ModifyInstanceAttribute.go 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models"
  20. )
  21. type ModifyInstanceAttributeRequest struct {
  22. core.JDCloudRequest
  23. /* 地域ID */
  24. RegionId string `json:"regionId"`
  25. /* 云主机ID */
  26. InstanceId string `json:"instanceId"`
  27. /* 名称,不为空且只允许中文、数字、大小写字母、英文下划线(_)、中划线(-)及点(.),不能以(.)作为首尾,长度为2~128个字符 (Optional) */
  28. Name *string `json:"name"`
  29. /* 描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Optional) */
  30. Description *string `json:"description"`
  31. /* 云主机hostname,若不指定hostname,则hostname默认使用云主机名称name,但是会以RFC 952和RFC 1123命名规范做一定转义
  32. Windows Server系统:长度为2-15个字符,允许大小写字母、数字或连字符(-)。不能以连字符(-)开头或结尾,不能连续使用连字符(-),也不能全部使用数字。不支持点号(.)。
  33. Linux系统:长度为2-64个字符,允许支持多个点号,点之间为一段,每段允许使用大小写字母、数字或连字符(-),但不能连续使用点号(.)或连字符(-),不能以点号(.)或连字符(-)开头或结尾。
  34. hostname修改后,重启云主机hostname生效
  35. (Optional) */
  36. Hostname *string `json:"hostname"`
  37. /* 用户自定义元数据信息,key-value 键值对总数量不超过40,其中更新和新增键值对总数量不超过20对,删除的键值对总数量不超过20对。不区分大小写。
  38. 如key已有认为是更新value;如key不存在认为是新增键值对;如key后面有连字符(-),比如key-,则删除此key。
  39. (Optional) */
  40. Metadata []vm.Metadata `json:"metadata"`
  41. /* 元数据信息,目前只支持传入一个key为"launch-script",表示首次启动脚本。value为base64格式。
  42. launch-script:linux系统支持bash和python,编码前须分别以 #!/bin/bash 和 #!/usr/bin/env python 作为内容首行;
  43. launch-script:windows系统支持bat和powershell,编码前须分别以 <cmd></cmd> 和 <powershell></powershell> 作为内容首、尾行。
  44. (Optional) */
  45. Userdata []vm.Userdata `json:"userdata"`
  46. }
  47. /*
  48. * param regionId: 地域ID (Required)
  49. * param instanceId: 云主机ID (Required)
  50. *
  51. * @Deprecated, not compatible when mandatory parameters changed
  52. */
  53. func NewModifyInstanceAttributeRequest(
  54. regionId string,
  55. instanceId string,
  56. ) *ModifyInstanceAttributeRequest {
  57. return &ModifyInstanceAttributeRequest{
  58. JDCloudRequest: core.JDCloudRequest{
  59. URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute",
  60. Method: "POST",
  61. Header: nil,
  62. Version: "v1",
  63. },
  64. RegionId: regionId,
  65. InstanceId: instanceId,
  66. }
  67. }
  68. /*
  69. * param regionId: 地域ID (Required)
  70. * param instanceId: 云主机ID (Required)
  71. * param name: 名称,不为空且只允许中文、数字、大小写字母、英文下划线(_)、中划线(-)及点(.),不能以(.)作为首尾,长度为2~128个字符 (Optional)
  72. * param description: 描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Optional)
  73. * param hostname: 云主机hostname,若不指定hostname,则hostname默认使用云主机名称name,但是会以RFC 952和RFC 1123命名规范做一定转义
  74. Windows Server系统:长度为2-15个字符,允许大小写字母、数字或连字符(-)。不能以连字符(-)开头或结尾,不能连续使用连字符(-),也不能全部使用数字。不支持点号(.)。
  75. Linux系统:长度为2-64个字符,允许支持多个点号,点之间为一段,每段允许使用大小写字母、数字或连字符(-),但不能连续使用点号(.)或连字符(-),不能以点号(.)或连字符(-)开头或结尾。
  76. hostname修改后,重启云主机hostname生效
  77. (Optional)
  78. * param metadata: 用户自定义元数据信息,key-value 键值对总数量不超过40,其中更新和新增键值对总数量不超过20对,删除的键值对总数量不超过20对。不区分大小写。
  79. 如key已有认为是更新value;如key不存在认为是新增键值对;如key后面有连字符(-),比如key-,则删除此key。
  80. (Optional)
  81. * param userdata: 元数据信息,目前只支持传入一个key为"launch-script",表示首次启动脚本。value为base64格式。
  82. launch-script:linux系统支持bash和python,编码前须分别以 #!/bin/bash 和 #!/usr/bin/env python 作为内容首行;
  83. launch-script:windows系统支持bat和powershell,编码前须分别以 <cmd></cmd> 和 <powershell></powershell> 作为内容首、尾行。
  84. (Optional)
  85. */
  86. func NewModifyInstanceAttributeRequestWithAllParams(
  87. regionId string,
  88. instanceId string,
  89. name *string,
  90. description *string,
  91. hostname *string,
  92. metadata []vm.Metadata,
  93. userdata []vm.Userdata,
  94. ) *ModifyInstanceAttributeRequest {
  95. return &ModifyInstanceAttributeRequest{
  96. JDCloudRequest: core.JDCloudRequest{
  97. URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute",
  98. Method: "POST",
  99. Header: nil,
  100. Version: "v1",
  101. },
  102. RegionId: regionId,
  103. InstanceId: instanceId,
  104. Name: name,
  105. Description: description,
  106. Hostname: hostname,
  107. Metadata: metadata,
  108. Userdata: userdata,
  109. }
  110. }
  111. /* This constructor has better compatible ability when API parameters changed */
  112. func NewModifyInstanceAttributeRequestWithoutParam() *ModifyInstanceAttributeRequest {
  113. return &ModifyInstanceAttributeRequest{
  114. JDCloudRequest: core.JDCloudRequest{
  115. URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute",
  116. Method: "POST",
  117. Header: nil,
  118. Version: "v1",
  119. },
  120. }
  121. }
  122. /* param regionId: 地域ID(Required) */
  123. func (r *ModifyInstanceAttributeRequest) SetRegionId(regionId string) {
  124. r.RegionId = regionId
  125. }
  126. /* param instanceId: 云主机ID(Required) */
  127. func (r *ModifyInstanceAttributeRequest) SetInstanceId(instanceId string) {
  128. r.InstanceId = instanceId
  129. }
  130. /* param name: 名称,不为空且只允许中文、数字、大小写字母、英文下划线(_)、中划线(-)及点(.),不能以(.)作为首尾,长度为2~128个字符(Optional) */
  131. func (r *ModifyInstanceAttributeRequest) SetName(name string) {
  132. r.Name = &name
  133. }
  134. /* param description: 描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。(Optional) */
  135. func (r *ModifyInstanceAttributeRequest) SetDescription(description string) {
  136. r.Description = &description
  137. }
  138. /* param hostname: 云主机hostname,若不指定hostname,则hostname默认使用云主机名称name,但是会以RFC 952和RFC 1123命名规范做一定转义
  139. Windows Server系统:长度为2-15个字符,允许大小写字母、数字或连字符(-)。不能以连字符(-)开头或结尾,不能连续使用连字符(-),也不能全部使用数字。不支持点号(.)。
  140. Linux系统:长度为2-64个字符,允许支持多个点号,点之间为一段,每段允许使用大小写字母、数字或连字符(-),但不能连续使用点号(.)或连字符(-),不能以点号(.)或连字符(-)开头或结尾。
  141. hostname修改后,重启云主机hostname生效
  142. (Optional) */
  143. func (r *ModifyInstanceAttributeRequest) SetHostname(hostname string) {
  144. r.Hostname = &hostname
  145. }
  146. /* param metadata: 用户自定义元数据信息,key-value 键值对总数量不超过40,其中更新和新增键值对总数量不超过20对,删除的键值对总数量不超过20对。不区分大小写。
  147. 如key已有认为是更新value;如key不存在认为是新增键值对;如key后面有连字符(-),比如key-,则删除此key。
  148. (Optional) */
  149. func (r *ModifyInstanceAttributeRequest) SetMetadata(metadata []vm.Metadata) {
  150. r.Metadata = metadata
  151. }
  152. /* param userdata: 元数据信息,目前只支持传入一个key为"launch-script",表示首次启动脚本。value为base64格式。
  153. launch-script:linux系统支持bash和python,编码前须分别以 #!/bin/bash 和 #!/usr/bin/env python 作为内容首行;
  154. launch-script:windows系统支持bat和powershell,编码前须分别以 <cmd></cmd> 和 <powershell></powershell> 作为内容首、尾行。
  155. (Optional) */
  156. func (r *ModifyInstanceAttributeRequest) SetUserdata(userdata []vm.Userdata) {
  157. r.Userdata = userdata
  158. }
  159. // GetRegionId returns path parameter 'regionId' if exist,
  160. // otherwise return empty string
  161. func (r ModifyInstanceAttributeRequest) GetRegionId() string {
  162. return r.RegionId
  163. }
  164. type ModifyInstanceAttributeResponse struct {
  165. RequestID string `json:"requestId"`
  166. Error core.ErrorResponse `json:"error"`
  167. Result ModifyInstanceAttributeResult `json:"result"`
  168. }
  169. type ModifyInstanceAttributeResult struct {
  170. }