| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- // Copyright 2018 JDCLOUD.COM
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- //
- // NOTE: This class is auto generated by the jdcloud code generator program.
- package apis
- import (
- "github.com/jdcloud-api/jdcloud-sdk-go/core"
- vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models"
- )
- type ModifyInstanceAttributeRequest struct {
- core.JDCloudRequest
- /* 地域ID */
- RegionId string `json:"regionId"`
- /* 云主机ID */
- InstanceId string `json:"instanceId"`
- /* 名称,不为空且只允许中文、数字、大小写字母、英文下划线(_)、中划线(-)及点(.),不能以(.)作为首尾,长度为2~128个字符 (Optional) */
- Name *string `json:"name"`
- /* 描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Optional) */
- Description *string `json:"description"`
- /* 云主机hostname,若不指定hostname,则hostname默认使用云主机名称name,但是会以RFC 952和RFC 1123命名规范做一定转义
- Windows Server系统:长度为2-15个字符,允许大小写字母、数字或连字符(-)。不能以连字符(-)开头或结尾,不能连续使用连字符(-),也不能全部使用数字。不支持点号(.)。
- Linux系统:长度为2-64个字符,允许支持多个点号,点之间为一段,每段允许使用大小写字母、数字或连字符(-),但不能连续使用点号(.)或连字符(-),不能以点号(.)或连字符(-)开头或结尾。
- hostname修改后,重启云主机hostname生效
- (Optional) */
- Hostname *string `json:"hostname"`
- /* 用户自定义元数据信息,key-value 键值对总数量不超过40,其中更新和新增键值对总数量不超过20对,删除的键值对总数量不超过20对。不区分大小写。
- 如key已有认为是更新value;如key不存在认为是新增键值对;如key后面有连字符(-),比如key-,则删除此key。
- (Optional) */
- Metadata []vm.Metadata `json:"metadata"`
- /* 元数据信息,目前只支持传入一个key为"launch-script",表示首次启动脚本。value为base64格式。
- launch-script:linux系统支持bash和python,编码前须分别以 #!/bin/bash 和 #!/usr/bin/env python 作为内容首行;
- launch-script:windows系统支持bat和powershell,编码前须分别以 <cmd></cmd> 和 <powershell></powershell> 作为内容首、尾行。
- (Optional) */
- Userdata []vm.Userdata `json:"userdata"`
- }
- /*
- * param regionId: 地域ID (Required)
- * param instanceId: 云主机ID (Required)
- *
- * @Deprecated, not compatible when mandatory parameters changed
- */
- func NewModifyInstanceAttributeRequest(
- regionId string,
- instanceId string,
- ) *ModifyInstanceAttributeRequest {
- return &ModifyInstanceAttributeRequest{
- JDCloudRequest: core.JDCloudRequest{
- URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute",
- Method: "POST",
- Header: nil,
- Version: "v1",
- },
- RegionId: regionId,
- InstanceId: instanceId,
- }
- }
- /*
- * param regionId: 地域ID (Required)
- * param instanceId: 云主机ID (Required)
- * param name: 名称,不为空且只允许中文、数字、大小写字母、英文下划线(_)、中划线(-)及点(.),不能以(.)作为首尾,长度为2~128个字符 (Optional)
- * param description: 描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Optional)
- * param hostname: 云主机hostname,若不指定hostname,则hostname默认使用云主机名称name,但是会以RFC 952和RFC 1123命名规范做一定转义
- Windows Server系统:长度为2-15个字符,允许大小写字母、数字或连字符(-)。不能以连字符(-)开头或结尾,不能连续使用连字符(-),也不能全部使用数字。不支持点号(.)。
- Linux系统:长度为2-64个字符,允许支持多个点号,点之间为一段,每段允许使用大小写字母、数字或连字符(-),但不能连续使用点号(.)或连字符(-),不能以点号(.)或连字符(-)开头或结尾。
- hostname修改后,重启云主机hostname生效
- (Optional)
- * param metadata: 用户自定义元数据信息,key-value 键值对总数量不超过40,其中更新和新增键值对总数量不超过20对,删除的键值对总数量不超过20对。不区分大小写。
- 如key已有认为是更新value;如key不存在认为是新增键值对;如key后面有连字符(-),比如key-,则删除此key。
- (Optional)
- * param userdata: 元数据信息,目前只支持传入一个key为"launch-script",表示首次启动脚本。value为base64格式。
- launch-script:linux系统支持bash和python,编码前须分别以 #!/bin/bash 和 #!/usr/bin/env python 作为内容首行;
- launch-script:windows系统支持bat和powershell,编码前须分别以 <cmd></cmd> 和 <powershell></powershell> 作为内容首、尾行。
- (Optional)
- */
- func NewModifyInstanceAttributeRequestWithAllParams(
- regionId string,
- instanceId string,
- name *string,
- description *string,
- hostname *string,
- metadata []vm.Metadata,
- userdata []vm.Userdata,
- ) *ModifyInstanceAttributeRequest {
- return &ModifyInstanceAttributeRequest{
- JDCloudRequest: core.JDCloudRequest{
- URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute",
- Method: "POST",
- Header: nil,
- Version: "v1",
- },
- RegionId: regionId,
- InstanceId: instanceId,
- Name: name,
- Description: description,
- Hostname: hostname,
- Metadata: metadata,
- Userdata: userdata,
- }
- }
- /* This constructor has better compatible ability when API parameters changed */
- func NewModifyInstanceAttributeRequestWithoutParam() *ModifyInstanceAttributeRequest {
- return &ModifyInstanceAttributeRequest{
- JDCloudRequest: core.JDCloudRequest{
- URL: "/regions/{regionId}/instances/{instanceId}:modifyInstanceAttribute",
- Method: "POST",
- Header: nil,
- Version: "v1",
- },
- }
- }
- /* param regionId: 地域ID(Required) */
- func (r *ModifyInstanceAttributeRequest) SetRegionId(regionId string) {
- r.RegionId = regionId
- }
- /* param instanceId: 云主机ID(Required) */
- func (r *ModifyInstanceAttributeRequest) SetInstanceId(instanceId string) {
- r.InstanceId = instanceId
- }
- /* param name: 名称,不为空且只允许中文、数字、大小写字母、英文下划线(_)、中划线(-)及点(.),不能以(.)作为首尾,长度为2~128个字符(Optional) */
- func (r *ModifyInstanceAttributeRequest) SetName(name string) {
- r.Name = &name
- }
- /* param description: 描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。(Optional) */
- func (r *ModifyInstanceAttributeRequest) SetDescription(description string) {
- r.Description = &description
- }
- /* param hostname: 云主机hostname,若不指定hostname,则hostname默认使用云主机名称name,但是会以RFC 952和RFC 1123命名规范做一定转义
- Windows Server系统:长度为2-15个字符,允许大小写字母、数字或连字符(-)。不能以连字符(-)开头或结尾,不能连续使用连字符(-),也不能全部使用数字。不支持点号(.)。
- Linux系统:长度为2-64个字符,允许支持多个点号,点之间为一段,每段允许使用大小写字母、数字或连字符(-),但不能连续使用点号(.)或连字符(-),不能以点号(.)或连字符(-)开头或结尾。
- hostname修改后,重启云主机hostname生效
- (Optional) */
- func (r *ModifyInstanceAttributeRequest) SetHostname(hostname string) {
- r.Hostname = &hostname
- }
- /* param metadata: 用户自定义元数据信息,key-value 键值对总数量不超过40,其中更新和新增键值对总数量不超过20对,删除的键值对总数量不超过20对。不区分大小写。
- 如key已有认为是更新value;如key不存在认为是新增键值对;如key后面有连字符(-),比如key-,则删除此key。
- (Optional) */
- func (r *ModifyInstanceAttributeRequest) SetMetadata(metadata []vm.Metadata) {
- r.Metadata = metadata
- }
- /* param userdata: 元数据信息,目前只支持传入一个key为"launch-script",表示首次启动脚本。value为base64格式。
- launch-script:linux系统支持bash和python,编码前须分别以 #!/bin/bash 和 #!/usr/bin/env python 作为内容首行;
- launch-script:windows系统支持bat和powershell,编码前须分别以 <cmd></cmd> 和 <powershell></powershell> 作为内容首、尾行。
- (Optional) */
- func (r *ModifyInstanceAttributeRequest) SetUserdata(userdata []vm.Userdata) {
- r.Userdata = userdata
- }
- // GetRegionId returns path parameter 'regionId' if exist,
- // otherwise return empty string
- func (r ModifyInstanceAttributeRequest) GetRegionId() string {
- return r.RegionId
- }
- type ModifyInstanceAttributeResponse struct {
- RequestID string `json:"requestId"`
- Error core.ErrorResponse `json:"error"`
- Result ModifyInstanceAttributeResult `json:"result"`
- }
- type ModifyInstanceAttributeResult struct {
- }
|