AttachKeypair.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // Copyright 2018 JDCLOUD.COM
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. // NOTE: This class is auto generated by the jdcloud code generator program.
  16. package apis
  17. import (
  18. "github.com/jdcloud-api/jdcloud-sdk-go/core"
  19. )
  20. type AttachKeypairRequest struct {
  21. core.JDCloudRequest
  22. /* 地域ID */
  23. RegionId string `json:"regionId"`
  24. /* 密钥名称 */
  25. KeyName string `json:"keyName"`
  26. /* 虚机Id */
  27. InstanceIds []string `json:"instanceIds"`
  28. /* 密码授权,绑定密钥后,根据此参数决定是否使用密码登录,"yes"为使用,"no"为不使用
  29. */
  30. PassWordAuth string `json:"passWordAuth"`
  31. }
  32. /*
  33. * param regionId: 地域ID (Required)
  34. * param keyName: 密钥名称 (Required)
  35. * param instanceIds: 虚机Id (Required)
  36. * param passWordAuth: 密码授权,绑定密钥后,根据此参数决定是否使用密码登录,"yes"为使用,"no"为不使用
  37. (Required)
  38. *
  39. * @Deprecated, not compatible when mandatory parameters changed
  40. */
  41. func NewAttachKeypairRequest(
  42. regionId string,
  43. keyName string,
  44. instanceIds []string,
  45. passWordAuth string,
  46. ) *AttachKeypairRequest {
  47. return &AttachKeypairRequest{
  48. JDCloudRequest: core.JDCloudRequest{
  49. URL: "/regions/{regionId}/keypairs/{keyName}:attach",
  50. Method: "POST",
  51. Header: nil,
  52. Version: "v1",
  53. },
  54. RegionId: regionId,
  55. KeyName: keyName,
  56. InstanceIds: instanceIds,
  57. PassWordAuth: passWordAuth,
  58. }
  59. }
  60. /*
  61. * param regionId: 地域ID (Required)
  62. * param keyName: 密钥名称 (Required)
  63. * param instanceIds: 虚机Id (Required)
  64. * param passWordAuth: 密码授权,绑定密钥后,根据此参数决定是否使用密码登录,"yes"为使用,"no"为不使用
  65. (Required)
  66. */
  67. func NewAttachKeypairRequestWithAllParams(
  68. regionId string,
  69. keyName string,
  70. instanceIds []string,
  71. passWordAuth string,
  72. ) *AttachKeypairRequest {
  73. return &AttachKeypairRequest{
  74. JDCloudRequest: core.JDCloudRequest{
  75. URL: "/regions/{regionId}/keypairs/{keyName}:attach",
  76. Method: "POST",
  77. Header: nil,
  78. Version: "v1",
  79. },
  80. RegionId: regionId,
  81. KeyName: keyName,
  82. InstanceIds: instanceIds,
  83. PassWordAuth: passWordAuth,
  84. }
  85. }
  86. /* This constructor has better compatible ability when API parameters changed */
  87. func NewAttachKeypairRequestWithoutParam() *AttachKeypairRequest {
  88. return &AttachKeypairRequest{
  89. JDCloudRequest: core.JDCloudRequest{
  90. URL: "/regions/{regionId}/keypairs/{keyName}:attach",
  91. Method: "POST",
  92. Header: nil,
  93. Version: "v1",
  94. },
  95. }
  96. }
  97. /* param regionId: 地域ID(Required) */
  98. func (r *AttachKeypairRequest) SetRegionId(regionId string) {
  99. r.RegionId = regionId
  100. }
  101. /* param keyName: 密钥名称(Required) */
  102. func (r *AttachKeypairRequest) SetKeyName(keyName string) {
  103. r.KeyName = keyName
  104. }
  105. /* param instanceIds: 虚机Id(Required) */
  106. func (r *AttachKeypairRequest) SetInstanceIds(instanceIds []string) {
  107. r.InstanceIds = instanceIds
  108. }
  109. /* param passWordAuth: 密码授权,绑定密钥后,根据此参数决定是否使用密码登录,"yes"为使用,"no"为不使用
  110. (Required) */
  111. func (r *AttachKeypairRequest) SetPassWordAuth(passWordAuth string) {
  112. r.PassWordAuth = passWordAuth
  113. }
  114. // GetRegionId returns path parameter 'regionId' if exist,
  115. // otherwise return empty string
  116. func (r AttachKeypairRequest) GetRegionId() string {
  117. return r.RegionId
  118. }
  119. type AttachKeypairResponse struct {
  120. RequestID string `json:"requestId"`
  121. Error core.ErrorResponse `json:"error"`
  122. Result AttachKeypairResult `json:"result"`
  123. }
  124. type AttachKeypairResult struct {
  125. SuccessInstanceId []string `json:"successInstanceId"`
  126. FailInstanceId []string `json:"failInstanceId"`
  127. }