diff --git a/service/cluster.go b/service/cluster.go index 071b966..d55e918 100644 --- a/service/cluster.go +++ b/service/cluster.go @@ -982,12 +982,12 @@ func (s *ClusterService) ResizeCluster(i *ResizeClusterInput) (*ResizeClusterOut } type ResizeClusterInput struct { - Cluster *string `json:"cluster" name:"cluster" location:"params"` // Required - CPU *int `json:"cpu" name:"cpu" location:"params"` - Gpu *int `json:"gpu" name:"gpu" location:"params"` - Memory *int `json:"memory" name:"memory" location:"params"` - NodeRole *string `json:"node_role" name:"node_role" location:"params"` - StorageSize *int `json:"storage_size" name:"storage_size" location:"params"` + Cluster *string `json:"cluster" name:"cluster" location:"params"` // Required + CPU *int `json:"cpu" name:"cpu" location:"params"` + Gpu *int `json:"gpu" name:"gpu" location:"params"` + Memory *int `json:"memory" name:"memory" location:"params"` + NodeRole []*string `json:"node_role" name:"node_role" location:"params"` + StorageSize *int `json:"storage_size" name:"storage_size" location:"params"` } func (v *ResizeClusterInput) Validate() error { diff --git a/service/image.go b/service/image.go index b50e111..f184168 100644 --- a/service/image.go +++ b/service/image.go @@ -100,6 +100,7 @@ type CaptureInstanceOutput struct { // Documentation URL: https://docs.qingcloud.com/api/image/delete_images.html func (s *ImageService) DeleteImages(i *DeleteImagesInput) (*DeleteImagesOutput, error) { + time.RFC822 if i == nil { i = &DeleteImagesInput{} } diff --git a/service/instance.go b/service/instance.go index 2b30ca5..8dd4ecd 100644 --- a/service/instance.go +++ b/service/instance.go @@ -90,7 +90,7 @@ func (v *CeaseInstancesInput) Validate() error { } type CeaseInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` JobID *string `json:"job_id" name:"job_id" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` @@ -123,6 +123,8 @@ func (s *InstanceService) DescribeInstanceTypes(i *DescribeInstanceTypesInput) ( } type DescribeInstanceTypesInput struct { + Baremetal *int `json:"baremetal" name:"baremetal" location:"params"` + // 指定查询的云服务器类型 InstanceTypes []*string `json:"instance_types" name:"instance_types" location:"params"` } @@ -132,7 +134,7 @@ func (v *DescribeInstanceTypesInput) Validate() error { } type DescribeInstanceTypesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` InstanceTypeSet []*InstanceType `json:"instance_type_set" name:"instance_type_set" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` @@ -181,6 +183,78 @@ type DescribeInstancesInput struct { Tags []*string `json:"tags" name:"tags" location:"params"` // Verbose's available values: 0, 1 Verbose *int `json:"verbose" name:"verbose" location:"params"` + + // alarm status of the instance + AlarmStatus *string `json:"alarm_status" name:"alarm_status" location:"params"` + // filter by border + Border *string `json:"border" name:"border" location:"params"` + ConsoleID *string `json:"console_id" name:"console_id" location:"params"` + // pitrix or self. + Controller *string `json:"controller" name:"controller" location:"params"` + CreateTime *string `json:"create_time" name:"create_time" location:"params"` + DedicatedHostGroupID *string `json:"dedicated_host_group_id" name:"dedicated_host_group_id" location:"params"` + DedicatedHostID *string `json:"dedicated_host_id" name:"dedicated_host_id" location:"params"` + // directory_id + DirectoryID *string `json:"directory_id" name:"directory_id" location:"params"` + // for filter reserved resource + ExcludeReserved *string `json:"exclude_reserved" name:"exclude_reserved" location:"params"` + ExcludeUser *string `json:"exclude_user" name:"exclude_user" location:"params"` + // for filter directory resources + ExcludedDir *string `json:"excluded_dir" name:"excluded_dir" location:"params"` + // query instances by excluded_plg_id + ExcludedPlgID *string `json:"excluded_plg_id" name:"excluded_plg_id" location:"params"` + // filter by fence + Fence *string `json:"fence" name:"fence" location:"params"` + // The graphics protocol + GraphicsProtocol *string `json:"graphics_protocol" name:"graphics_protocol" location:"params"` + // the host machine of instances. + HostMachine *string `json:"host_machine" name:"host_machine" location:"params"` + // filter by hypervisor. + Hypervisor *string `json:"hypervisor" name:"hypervisor" location:"params"` + // filter by instance group + InstanceGroup *string `json:"instance_group" name:"instance_group" location:"params"` + // the name of the instance. Support partial match. + InstanceName *string `json:"instance_name" name:"instance_name" location:"params"` + IsElastic *string `json:"is_elastic" name:"is_elastic" location:"params"` + // memory_current + MemoryCurrent *string `json:"memory_current" name:"memory_current" location:"params"` + // output mount detail(1 + MountDetail *string `json:"mount_detail" name:"mount_detail" location:"params"` + // query instances by mounted image + MountImageID *string `json:"mount_image_id" name:"mount_image_id" location:"params"` + // 0: include resources whose transition_status is not empty + NotTransition *string `json:"not_transition" name:"not_transition" default:"0" location:"params"` + // os_disk_size + OSDiskSize *string `json:"os_disk_size" name:"os_disk_size" location:"params"` + // the place group of instances + PlaceGroupID *string `json:"place_group_id" name:"place_group_id" location:"params"` + // Support windows + Platform *string `json:"platform" name:"platform" location:"params"` + // filter by replica policy. + Repl *string `json:"repl" name:"repl" location:"params"` + // for reverse sorting. 1: reverse + Reverse *string `json:"reverse" name:"reverse" location:"params"` + // if role==partner then it is for partner to get the instances of her/his Apps + Role *string `json:"role" name:"role" location:"params"` + RootUserID *string `json:"root_user_id" name:"root_user_id" location:"params"` + // sort key + SortKey *string `json:"sort_key" name:"sort_key" location:"params"` + // sriov_nic_type + SriovNICType *string `json:"sriov_nic_type" name:"sriov_nic_type" location:"params"` + // query instances support cdrom(1 + SupportCdrom *string `json:"support_cdrom" name:"support_cdrom" location:"params"` + // filter by tags + TransitionStatus *string `json:"transition_status" name:"transition_status" location:"params"` + // vcpus_current + VCPUsCurrent *string `json:"vcpus_current" name:"vcpus_current" location:"params"` + VdcNodeID *string `json:"vdc_node_id" name:"vdc_node_id" location:"params"` + // filter by vxnet. + VxNet *string `json:"vxnet" name:"vxnet" location:"params"` + // filter by vxnet type. + VxNetType *string `json:"vxnet_type" name:"vxnet_type" location:"params"` + WithoutContract *string `json:"without_contract" name:"without_contract" location:"params"` + // zone id + Zone *string `json:"zone" name:"zone" location:"params"` } func (v *DescribeInstancesInput) Validate() error { @@ -229,7 +303,7 @@ func (v *DescribeInstancesInput) Validate() error { } type DescribeInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` InstanceSet []*Instance `json:"instance_set" name:"instance_set" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` @@ -266,6 +340,7 @@ type ModifyInstanceAttributesInput struct { Description *string `json:"description" name:"description" location:"params"` Instance *string `json:"instance" name:"instance" location:"params"` // Required InstanceName *string `json:"instance_name" name:"instance_name" location:"params"` + NICMqueue *string `json:"nic_mqueue" name:"nic_mqueue" location:"params"` } func (v *ModifyInstanceAttributesInput) Validate() error { @@ -281,7 +356,7 @@ func (v *ModifyInstanceAttributesInput) Validate() error { } type ModifyInstanceAttributesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` } @@ -320,6 +395,18 @@ type ResetInstancesInput struct { LoginPasswd *string `json:"login_passwd" name:"login_passwd" location:"params"` // NeedNewSID's available values: 0, 1 NeedNewSID *int `json:"need_newsid" name:"need_newsid" default:"0" location:"params"` + + // force. + Force *string `json:"force" name:"force" default:"0" location:"params"` + // image_id. + ImageID *string `json:"image_id" name:"image_id" location:"params"` + // os_disk_size. + OSDiskSize *string `json:"os_disk_size" name:"os_disk_size" location:"params"` + Type *string `json:"type" name:"type" location:"params"` + UserData *string `json:"user_data" name:"user_data" location:"params"` + Value *string `json:"value" name:"value" location:"params"` + VmDefinition *string `json:"vm_definition" name:"vm_definition" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` } func (v *ResetInstancesInput) Validate() error { @@ -382,7 +469,7 @@ func (v *ResetInstancesInput) Validate() error { } type ResetInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` JobID *string `json:"job_id" name:"job_id" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` @@ -425,6 +512,17 @@ type ResizeInstancesInput struct { // Memory's available values: 1024, 2048, 4096, 6144, 8192, 12288, 16384, 24576, 32768 Memory *int `json:"memory" name:"memory" location:"params"` OSDiskSize *int `json:"os_disk_size" name:"os_disk_size" location:"params"` + + // the boot device + BootDev *string `json:"boot_dev" name:"boot_dev" location:"params"` + // the CPU topology + CPUTopology *string `json:"cpu_topology" name:"cpu_topology" location:"params"` + MemoryCurrent *string `json:"memory_current" name:"memory_current" location:"params"` + MemoryMax *string `json:"memory_max" name:"memory_max" location:"params"` + VCPUsCurrent *string `json:"vcpus_current" name:"vcpus_current" location:"params"` + VCPUsMax *string `json:"vcpus_max" name:"vcpus_max" location:"params"` + VmDefinition *string `json:"vm_definition" name:"vm_definition" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` } func (v *ResizeInstancesInput) Validate() error { @@ -480,7 +578,7 @@ func (v *ResizeInstancesInput) Validate() error { } type ResizeInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` JobID *string `json:"job_id" name:"job_id" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` @@ -529,7 +627,7 @@ func (v *RestartInstancesInput) Validate() error { } type RestartInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` JobID *string `json:"job_id" name:"job_id" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` @@ -595,10 +693,91 @@ type RunInstancesInput struct { UserdataFile *string `json:"userdata_file" name:"userdata_file" default:"/etc/rc.local" location:"params"` UserdataPath *string `json:"userdata_path" name:"userdata_path" default:"/etc/qingcloud/userdata" location:"params"` // UserdataType's available values: plain, exec, tar - UserdataType *string `json:"userdata_type" name:"userdata_type" location:"params"` - UserdataValue *string `json:"userdata_value" name:"userdata_value" location:"params"` - Volumes []*string `json:"volumes" name:"volumes" location:"params"` - VxNets []*string `json:"vxnets" name:"vxnets" location:"params"` + UserdataType *string `json:"userdata_type" name:"userdata_type" location:"params"` + UserdataValue *string `json:"userdata_value" name:"userdata_value" location:"params"` + Volumes []*string `json:"volumes" name:"volumes" location:"params"` + VxNets []*string `json:"vxnets" name:"vxnets" location:"params"` + OsDiskEncryption *int `json:"os_disk_encryption" name:"os_disk_encryption" location:"params"` + NicMqueue *int `json:"nic_mqueue" name:"nic_mqueue" location:"params"` + Platform *string `json:"platform" name:"platform" location:"params"` + FResetpwd *int `json:"f_resetpwd" name:"f_resetpwd" location:"params"` + ProcessorType *string `json:"processor_type" name:"processor_type" location:"params"` + DefaultUser *string `json:"default_user" name:"default_user" location:"params"` + DefaultPasswd *string `json:"default_passwd" name:"default_passwd" location:"params"` + Hypervisor *string `json:"hypervisor" name:"hypervisor" location:"params"` + GpuClass *string `json:"gpu_class" name:"gpu_class" location:"params"` + PlaceGroupID *string `json:"place_group_id" name:"place_group_id" location:"params"` + + AutoRenew *string `json:"auto_renew" name:"auto_renew" location:"params"` + AutoVolumes *string `json:"auto_volumes" name:"auto_volumes" location:"params"` + Backups *string `json:"backups" name:"backups" location:"params"` + ChargeMode *string `json:"charge_mode" name:"charge_mode" location:"params"` + CipherAlg *string `json:"cipher_alg" name:"cipher_alg" location:"params"` + ContractDescription *string `json:"contract_description" name:"contract_description" location:"params"` + ContractEntries *string `json:"contract_entries" name:"contract_entries" location:"params"` + ContractID *string `json:"contract_id" name:"contract_id" location:"params"` + CouponID *string `json:"coupon_id" name:"coupon_id" location:"params"` + CPUTopology *int `json:"cpu_topology" name:"cpu_topology" location:"params"` + DedicatedHostGroupID *string `json:"dedicated_host_group_id" name:"dedicated_host_group_id" location:"params"` + DedicatedHostID *string `json:"dedicated_host_id" name:"dedicated_host_id" location:"params"` + DirectoryID *string `json:"directory_id" name:"directory_id" location:"params"` + // dry_run + DryRun *string `json:"dry_run" name:"dry_run" default:"0" location:"params"` + // eip_bandwidth. + EIPBandwidth *string `json:"eip_bandwidth" name:"eip_bandwidth" location:"params"` + // eip_bandwidth. + EIPBillingMode *string `json:"eip_billing_mode" name:"eip_billing_mode" location:"params"` + // eip_group. + EIPGroup *string `json:"eip_group" name:"eip_group" location:"params"` + // eips. + EIPIDs *string `json:"eip_ids" name:"eip_ids" location:"params"` + // eip billing + EIPIgnoreContract *string `json:"eip_ignore_contract" name:"eip_ignore_contract" location:"params"` + EIPVirgin *string `json:"eip_virgin" name:"eip_virgin" location:"params"` + Entries *string `json:"entries" name:"entries" location:"params"` + ExpirationTime *string `json:"expiration_time" name:"expiration_time" location:"params"` + // type of the physical GPU where the vGPU will be allocated + GpuType *string `json:"gpu_type" name:"gpu_type" location:"params"` + InResourceGroupIDs *string `json:"in_resource_group_ids" name:"in_resource_group_ids" location:"params"` + // instance_ext_type + InstanceExtType *string `json:"instance_ext_type" name:"instance_ext_type" location:"params"` + // instance_ext_type + InstanceGroup *string `json:"instance_group" name:"instance_group" location:"params"` + // login_keypair + LoginKeyPairList *string `json:"login_keypair_list" name:"login_keypair_list" location:"params"` + MemoryCurrent *string `json:"memory_current" name:"memory_current" location:"params"` + MemoryMax *string `json:"memory_max" name:"memory_max" location:"params"` + Months *string `json:"months" name:"months" location:"params"` + NextChargeMode *string `json:"next_charge_mode" name:"next_charge_mode" location:"params"` + ProjectID *string `json:"project_id" name:"project_id" location:"params"` + PromotionID *string `json:"promotion_id" name:"promotion_id" location:"params"` + ReservedContract *string `json:"reserved_contract" name:"reserved_contract" location:"params"` + // Whether to stop on error + StopOnError *string `json:"stop_on_error" name:"stop_on_error" location:"params"` + Tags *string `json:"tags" name:"tags" location:"params"` + // the user who will own this instance + TargetUser *string `json:"target_user" name:"target_user" location:"params"` + Type *string `json:"type" name:"type" location:"params"` + UserData *string `json:"user_data" name:"user_data" location:"params"` + Value *string `json:"value" name:"value" location:"params"` + VCPUsCurrent *string `json:"vcpus_current" name:"vcpus_current" location:"params"` + VCPUsMax *string `json:"vcpus_max" name:"vcpus_max" location:"params"` + VdcNodeID *string `json:"vdc_node_id" name:"vdc_node_id" location:"params"` + VmDefinition *string `json:"vm_definition" name:"vm_definition" location:"params"` + VolumeContractEntries *string `json:"volume_contract_entries" name:"volume_contract_entries" location:"params"` + // volume_encryption. + VolumeEncryption *string `json:"volume_encryption" name:"volume_encryption" location:"params"` + // volume_filesystem_type. + VolumeFilesystemType *string `json:"volume_filesystem_type" name:"volume_filesystem_type" location:"params"` + // volume_mount_point. + VolumeMountPoint *string `json:"volume_mount_point" name:"volume_mount_point" location:"params"` + VolumeRepl *string `json:"volume_repl" name:"volume_repl" location:"params"` + // volume_size. + VolumeSize *string `json:"volume_size" name:"volume_size" location:"params"` + // volume_type. + VolumeType *string `json:"volume_type" name:"volume_type" location:"params"` + // zone id to run instance to + Zone *string `json:"zone" name:"zone" location:"params"` RepCount *int `json:"rep_count" name:"rep_count" location:"params"` } @@ -824,7 +1003,7 @@ func (v *RunInstancesInput) Validate() error { } type RunInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` Instances []*string `json:"instances" name:"instances" location:"elements"` JobID *string `json:"job_id" name:"job_id" location:"elements"` @@ -859,6 +1038,7 @@ func (s *InstanceService) StartInstances(i *StartInstancesInput) (*StartInstance type StartInstancesInput struct { Instances []*string `json:"instances" name:"instances" location:"params"` // Required + Volumes *string `json:"volumes" name:"volumes" location:"params"` } func (v *StartInstancesInput) Validate() error { @@ -874,7 +1054,7 @@ func (v *StartInstancesInput) Validate() error { } type StartInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` JobID *string `json:"job_id" name:"job_id" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` @@ -946,7 +1126,7 @@ func (v *StopInstancesInput) Validate() error { } type StopInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` JobID *string `json:"job_id" name:"job_id" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` @@ -995,7 +1175,522 @@ func (v *TerminateInstancesInput) Validate() error { } type TerminateInstancesOutput struct { - Message *string `json:"message" name:"message"` + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// Documentation URL: https://docs.qingcloud.com/api/instance/clone_instances.html +func (s *InstanceService) CloneInstances(i *CloneInstancesInput) (*CloneInstancesOutput, error) { + if i == nil { + i = &CloneInstancesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "CloneInstances", + RequestMethod: "GET", + } + + x := &CloneInstancesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type CloneInstancesInput struct { + Instances []*string `json:"instances" name:"instances" location:"params"` + VxNets []*string `json:"vxnets" name:"vxnets" location:"params"` +} + +func (v *CloneInstancesInput) Validate() error { + + return nil +} + +type CloneInstancesOutput struct { + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + InstancesSet map[string]InstanceDetails `json:"instance_set" name:"instance_set" location:"elements"` + Instances []*string `json:"instances" name:"instances" location:"elements"` +} + +type InstanceDetails struct { + InstanceMap map[string]string `json:"instance_map"` + VolumesMap map[string]string `json:"volumes_map"` +} + +// CreateBrokers: CreateBrokers + +func (s *InstanceService) CreateBrokers(i *CreateBrokersInput) (*CreateBrokersOutput, error) { + if i == nil { + i = &CreateBrokersInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "CreateBrokers", + RequestMethod: "GET", + } + + x := &CreateBrokersOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type CreateBrokersInput struct { + Instances []*string `json:"instances" name:"instances" location:"params"` +} + +func (v *CreateBrokersInput) Validate() error { + + return nil +} + +type CreateBrokersOutput struct { + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Brokers []Broker `json:"brokers"` +} +type Broker struct { + InstanceID string `json:"instance_id"` + BrokerPort int `json:"broker_port"` + BrokerHost string `json:"broker_host"` +} + +// DeleteBrokers: DeleteBrokers + +func (s *InstanceService) DeleteBrokers(i *DeleteBrokersInput) (*DeleteBrokersOutput, error) { + if i == nil { + i = &DeleteBrokersInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DeleteBrokers", + RequestMethod: "GET", + } + + x := &DeleteBrokersOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DeleteBrokersInput struct { + Instances []*string `json:"instances" name:"instances" location:"params"` +} + +func (v *DeleteBrokersInput) Validate() error { + + return nil +} + +type DeleteBrokersOutput struct { + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Brokers []Broker `json:"brokers" name:"brokers" location:"elements"` +} + +// ApplyInstanceGroup: ApplyInstanceGroup +func (s *InstanceService) ApplyInstanceGroup(i *ApplyInstanceGroupInput) (*ApplyInstanceGroupOutput, error) { + if i == nil { + i = &ApplyInstanceGroupInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "ApplyInstanceGroup", + RequestMethod: "GET", + } + + x := &ApplyInstanceGroupOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type ApplyInstanceGroupInput struct { + InstanceGroup *string `json:"instance_group" name:"instance_group" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` +} + +func (v *ApplyInstanceGroupInput) Validate() error { + + return nil +} + +type ApplyInstanceGroupOutput struct { + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// CreateInstanceGroups: CreateInstanceGroups + +func (s *InstanceService) CreateInstanceGroups(i *CreateInstanceGroupsInput) (*CreateInstanceGroupsOutput, error) { + if i == nil { + i = &CreateInstanceGroupsInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "CreateInstanceGroups", + RequestMethod: "GET", + } + + x := &CreateInstanceGroupsOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type CreateInstanceGroupsInput struct { + + // The number of instance group to create. + Count *int `json:"count" name:"count" default:"1" location:"params"` + // The description of the instance group + Description *string `json:"description" name:"description" location:"params"` + // the short name of instance_group you want to create. + InstanceGroupName *string `json:"instance_group_name" name:"instance_group_name" location:"params"` + ProjectID *string `json:"project_id" name:"project_id" location:"params"` + // The instance group relation. Supported relations are `repel` or `attract` + Relation *string `json:"relation" name:"relation" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` +} + +func (v *CreateInstanceGroupsInput) Validate() error { + + return nil +} + +type CreateInstanceGroupsOutput struct { + InstanceGroups []string `json:"instance_groups" name:"instance_groups" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// DeleteInstanceGroups: DeleteInstanceGroups + +func (s *InstanceService) DeleteInstanceGroups(i *DeleteInstanceGroupsInput) (*DeleteInstanceGroupsOutput, error) { + if i == nil { + i = &DeleteInstanceGroupsInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DeleteInstanceGroups", + RequestMethod: "GET", + } + + x := &DeleteInstanceGroupsOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DeleteInstanceGroupsInput struct { + + // the IDs of instance groups you want to delete. + InstanceGroups []*string `json:"instance_groups" name:"instance_groups" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` +} + +func (v *DeleteInstanceGroupsInput) Validate() error { + + return nil +} + +type DeleteInstanceGroupsOutput struct { + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + InstanceGroups []string `json:"instance_groups" name:"instance_groups" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// DescribeInstanceGroups: DescribeInstanceGroups + +func (s *InstanceService) DescribeInstanceGroups(i *DescribeInstanceGroupsInput) (*DescribeInstanceGroupsOutput, error) { + if i == nil { + i = &DescribeInstanceGroupsInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DescribeInstanceGroups", + RequestMethod: "GET", + } + + x := &DescribeInstanceGroupsOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DescribeInstanceGroupsInput struct { + ConsoleID *string `json:"console_id" name:"console_id" location:"params"` + // the name of the instance group. Support partial match. + InstanceGroupName *string `json:"instance_group_name" name:"instance_group_name" location:"params"` + // the comma separated IDs of instance_groups you want to list. + InstanceGroups []*string `json:"instance_groups" name:"instance_groups" location:"params"` + // specify the number of the returning results. + Limit *int `json:"limit" name:"limit" default:"20" location:"params"` + // the starting offset of the returning results. + Offset *int `json:"offset" name:"offset" location:"params"` + // the owner id of instance_groups + Owner []*string `json:"owner" name:"owner" location:"params"` + // project id + ProjectID *string `json:"project_id" name:"project_id" location:"params"` + // filter by instance_group relation + Relation []*string `json:"relation" name:"relation" location:"params"` + // for reverse sorting. 1: reverse + Reverse *int `json:"reverse" name:"reverse" location:"params"` + RootUserID *string `json:"root_user_id" name:"root_user_id" location:"params"` + SearchWord *string `json:"search_word" name:"search_word" location:"params"` + // sort key + SortKey *string `json:"sort_key" name:"sort_key" location:"params"` + // filter by tags + Tags []*string `json:"tags" name:"tags" location:"params"` + // the number to specify the verbose level + Verbose *int `json:"verbose" name:"verbose" default:"0" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` +} + +func (v *DescribeInstanceGroupsInput) Validate() error { + + return nil +} + +type DescribeInstanceGroupsOutput struct { + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + InstanceGroups []*InstanceGroup `json:"instance_group_set" name:"instance_group_set" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} +type InstanceGroup struct { + InstanceGroupName *string `json:"instance_group_name"` + Description *string `json:"description"` + Tags []*string `json:"tags"` + Controller *string `json:"controller"` + ConsoleID *string `json:"console_id"` + RootUserID *string `json:"root_user_id"` + CreateTime *string `json:"create_time"` + Relation *string `json:"relation"` + Owner *string `json:"owner"` + InstanceGroupID *string `json:"instance_group_id"` +} + +// ModifyInstanceGroupAttributes: ModifyInstanceGroupAttributes + +func (s *InstanceService) ModifyInstanceGroupAttributes(i *ModifyInstanceGroupAttributesInput) (*ModifyInstanceGroupAttributesOutput, error) { + if i == nil { + i = &ModifyInstanceGroupAttributesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "ModifyInstanceGroupAttributes", + RequestMethod: "GET", + } + + x := &ModifyInstanceGroupAttributesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type ModifyInstanceGroupAttributesInput struct { + + // The detailed description of the resource + Description *string `json:"description" name:"description" location:"params"` + InstanceGroup *string `json:"instance_group" name:"instance_group" location:"params"` + // specify the new instance_group name. + InstanceGroupName *string `json:"instance_group_name" name:"instance_group_name" location:"params"` + // The instance group relation. Supported relations are `repel` or `attract` + Relation *string `json:"relation" name:"relation" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` +} + +func (v *ModifyInstanceGroupAttributesInput) Validate() error { + + return nil +} + +type ModifyInstanceGroupAttributesOutput struct { + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// JoinInstanceGroup: JoinInstanceGroup + +func (s *InstanceService) JoinInstanceGroup(i *JoinInstanceGroupInput) (*JoinInstanceGroupOutput, error) { + if i == nil { + i = &JoinInstanceGroupInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "JoinInstanceGroup", + RequestMethod: "GET", + } + + x := &JoinInstanceGroupOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type JoinInstanceGroupInput struct { + + // the id of instance_group the instances will join. + InstanceGroup *string `json:"instance_group" name:"instance_group" location:"params"` + // the IDs of instances that will join a instance_group. + Instances []*string `json:"instances" name:"instances" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` +} + +func (v *JoinInstanceGroupInput) Validate() error { + + return nil +} + +type JoinInstanceGroupOutput struct { + Message *string `json:"message" name:"message" location:"elements"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// LeaveInstanceGroup: LeaveInstanceGroup + +func (s *InstanceService) LeaveInstanceGroup(i *LeaveInstanceGroupInput) (*LeaveInstanceGroupOutput, error) { + if i == nil { + i = &LeaveInstanceGroupInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "LeaveInstanceGroup", + RequestMethod: "GET", + } + + x := &LeaveInstanceGroupOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type LeaveInstanceGroupInput struct { + + // the id of the instance_group the instances will leave. + InstanceGroup *string `json:"instance_group" name:"instance_group" location:"params"` + // the IDs of instances that will leave a instance_group. + Instances []*string `json:"instances" name:"instances" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` +} + +func (v *LeaveInstanceGroupInput) Validate() error { + + return nil +} + +type LeaveInstanceGroupOutput struct { + Message *string `json:"message" name:"message" location:"elements"` Action *string `json:"action" name:"action" location:"elements"` JobID *string `json:"job_id" name:"job_id" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` diff --git a/service/nic.go b/service/nic.go index 573d071..0d11fe9 100644 --- a/service/nic.go +++ b/service/nic.go @@ -358,6 +358,11 @@ type ModifyNicAttributesInput struct { NICName *string `json:"nic_name" name:"nic_name" location:"params"` PrivateIP *string `json:"private_ip" name:"private_ip" location:"params"` VxNet *string `json:"vxnet" name:"vxnet" location:"params"` + + // enable/disable vxnet aspoof 1/0 + EnableAspoof *int `json:"enable_aspoof" name:"enable_aspoof" location:"params"` + // specify the ipv6 address + Ipv6Address *string `json:"ipv6_address" name:"ipv6_address" location:"params"` } func (v *ModifyNicAttributesInput) Validate() error { diff --git a/service/snapshot.go b/service/snapshot.go index 268dc0f..47373a7 100644 --- a/service/snapshot.go +++ b/service/snapshot.go @@ -217,7 +217,7 @@ func (v *CreateSnapshotsInput) Validate() error { type CreateSnapshotsOutput struct { Message *string `json:"message" name:"message"` Action *string `json:"action" name:"action" location:"elements"` - JobID *string `json:"job_id" name:"job_id" location:"elements"` + JobID *[]string `json:"job_id" name:"job_id" location:"elements"` RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` Snapshots []*string `json:"snapshots" name:"snapshots" location:"elements"` } diff --git a/service/types.go b/service/types.go index 038ec19..6d35018 100644 --- a/service/types.go +++ b/service/types.go @@ -3354,3 +3354,58 @@ func (v *VIP) Validate() error { // TODO return nil } + +type BorderVxnet struct { + VxnetID *string `json:"vxnet_id"` + DynIPStart *string `json:"dyn_ip_start"` + DynIPv6End *string `json:"dyn_ipv6_end"` + ConsoleID *string `json:"console_id"` + CreateTime *time.Time `json:"create_time"` + Owner *string `json:"owner"` + DhcpServerIP *string `json:"dhcp_server_ip"` + Features *int `json:"features"` + ManagerIP *string `json:"manager_ip"` + BorderID *string `json:"border_id"` + IPv6Network *string `json:"ipv6_network"` + VxnetName *string `json:"vxnet_name"` + BorderPrivateIP *string `json:"border_private_ip"` + DhcpServerIPv6 *string `json:"dhcp_server_ipv6"` + RouterID *string `json:"router_id"` + IPNetwork *string `json:"ip_network"` + DynIPEnd *string `json:"dyn_ip_end"` + TransitionStatus *string `json:"transition_status"` + Controller *string `json:"controller"` + DomainServers *string `json:"domain_servers"` + BorderZoneID *string `json:"border_zone_id"` + DynIPv6Start *string `json:"dyn_ipv6_start"` + ManagerIPv6 *string `json:"manager_ipv6"` + VpcRouterID *string `json:"vpc_router_id"` + VxnetZoneID *string `json:"vxnet_zone_id"` + RootUserID *string `json:"root_user_id"` + Mode *int `json:"mode"` +} + +func (v *BorderVxnet) Validate() error { + // TODO + return nil +} + +type VpcBorder struct { + RouterID *string `json:"router_id"` + Status *string `json:"status"` + BorderName *string `json:"border_name"` + ZoneID *string `json:"zone_id"` + Tags []*string `json:"tags"` + VpcBorderID *string `json:"vpc_border_id"` + BorderType *int `json:"border_type"` + CreateTime *string `json:"create_time"` + Owner *string `json:"owner"` + StatusTime *string `json:"status_time"` + ResourceProjectInfo []*string `json:"resource_project_info"` + Description *string `json:"description"` +} + +func (v *VpcBorder) Validate() error { + // TODO + return nil +} diff --git a/service/volume.go b/service/volume.go index fdb68c3..6d52285 100644 --- a/service/volume.go +++ b/service/volume.go @@ -17,13 +17,13 @@ package service import ( - "fmt" - "time" + "fmt" + "time" - "github.com/yunify/qingcloud-sdk-go/config" - "github.com/yunify/qingcloud-sdk-go/request" - "github.com/yunify/qingcloud-sdk-go/request/data" - "github.com/yunify/qingcloud-sdk-go/request/errors" + "github.com/yunify/qingcloud-sdk-go/config" + "github.com/yunify/qingcloud-sdk-go/request" + "github.com/yunify/qingcloud-sdk-go/request/data" + "github.com/yunify/qingcloud-sdk-go/request/errors" ) var _ fmt.State @@ -32,529 +32,600 @@ var _ time.Time var _volumeTypeValidValues = []string{"0", "1", "2", "3", "4", "5", "6", "7", "10", "20", "100", "200"} type VolumeService struct { - Config *config.Config - Properties *VolumeServiceProperties + Config *config.Config + Properties *VolumeServiceProperties } type VolumeServiceProperties struct { - // QingCloud Zone ID - Zone *string `json:"zone" name:"zone"` // Required + // QingCloud Zone ID + Zone *string `json:"zone" name:"zone"` // Required } func (s *QingCloudService) Volume(zone string) (*VolumeService, error) { - properties := &VolumeServiceProperties{ - Zone: &zone, - } + properties := &VolumeServiceProperties{ + Zone: &zone, + } - return &VolumeService{Config: s.Config, Properties: properties}, nil + return &VolumeService{Config: s.Config, Properties: properties}, nil } // Documentation URL: https://docs.qingcloud.com/api/volume/attach_volumes.html func (s *VolumeService) AttachVolumes(i *AttachVolumesInput) (*AttachVolumesOutput, error) { - if i == nil { - i = &AttachVolumesInput{} - } - o := &data.Operation{ - Config: s.Config, - Properties: s.Properties, - APIName: "AttachVolumes", - RequestMethod: "GET", - } - - x := &AttachVolumesOutput{} - r, err := request.New(o, i, x) - if err != nil { - return nil, err - } - - err = r.Send() - if err != nil { - return nil, err - } - - return x, err + if i == nil { + i = &AttachVolumesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "AttachVolumes", + RequestMethod: "GET", + } + + x := &AttachVolumesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err } type AttachVolumesInput struct { - Instance *string `json:"instance" name:"instance" location:"params"` // Required - Volumes []*string `json:"volumes" name:"volumes" location:"params"` // Required + Instance *string `json:"instance" name:"instance" location:"params"` // Required + Volumes []*string `json:"volumes" name:"volumes" location:"params"` // Required } func (v *AttachVolumesInput) Validate() error { - if v.Instance == nil { - return errors.ParameterRequiredError{ - ParameterName: "Instance", - ParentName: "AttachVolumesInput", - } - } + if v.Instance == nil { + return errors.ParameterRequiredError{ + ParameterName: "Instance", + ParentName: "AttachVolumesInput", + } + } - if len(v.Volumes) == 0 { - return errors.ParameterRequiredError{ - ParameterName: "Volumes", - ParentName: "AttachVolumesInput", - } - } + if len(v.Volumes) == 0 { + return errors.ParameterRequiredError{ + ParameterName: "Volumes", + ParentName: "AttachVolumesInput", + } + } - return nil + return nil } type AttachVolumesOutput struct { - Message *string `json:"message" name:"message"` - Action *string `json:"action" name:"action" location:"elements"` - JobID *string `json:"job_id" name:"job_id" location:"elements"` - RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` } // Documentation URL: https://docs.qingcloud.com func (s *VolumeService) CloneVolumes(i *CloneVolumesInput) (*CloneVolumesOutput, error) { - if i == nil { - i = &CloneVolumesInput{} - } - o := &data.Operation{ - Config: s.Config, - Properties: s.Properties, - APIName: "CloneVolumes", - RequestMethod: "GET", - } - - x := &CloneVolumesOutput{} - r, err := request.New(o, i, x) - if err != nil { - return nil, err - } - - err = r.Send() - if err != nil { - return nil, err - } - - return x, err + if i == nil { + i = &CloneVolumesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "CloneVolumes", + RequestMethod: "GET", + } + + x := &CloneVolumesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err } type CloneVolumesInput struct { - Count *int `json:"count" name:"count" default:"1" location:"params"` - SubZones *string `json:"sub_zones" name:"sub_zones" location:"params"` - Volume *string `json:"volume" name:"volume" location:"params"` // Required - VolumeName *string `json:"volume_name" name:"volume_name" location:"params"` - VolumeType *int `json:"volume_type" name:"volume_type" default:"0" location:"params"` - Zone *string `json:"zone" name:"zone" location:"params"` + Count *int `json:"count" name:"count" default:"1" location:"params"` + SubZones *string `json:"sub_zones" name:"sub_zones" location:"params"` + Volume *string `json:"volume" name:"volume" location:"params"` // Required + VolumeName *string `json:"volume_name" name:"volume_name" location:"params"` + VolumeType *int `json:"volume_type" name:"volume_type" default:"0" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` } func (v *CloneVolumesInput) Validate() error { - if v.Volume == nil { - return errors.ParameterRequiredError{ - ParameterName: "Volume", - ParentName: "CloneVolumesInput", - } - } - - if v.VolumeType != nil { - volumeTypeIsValid := false - volumeTypeParameterValue := fmt.Sprint(*v.VolumeType) - for _, value := range _volumeTypeValidValues { - if value == volumeTypeParameterValue { - volumeTypeIsValid = true - } - } - - if !volumeTypeIsValid { - return errors.ParameterValueNotAllowedError{ - ParameterName: "VolumeType", - ParameterValue: volumeTypeParameterValue, - AllowedValues: _volumeTypeValidValues, - } - } - } - - return nil + if v.Volume == nil { + return errors.ParameterRequiredError{ + ParameterName: "Volume", + ParentName: "CloneVolumesInput", + } + } + + if v.VolumeType != nil { + volumeTypeIsValid := false + volumeTypeParameterValue := fmt.Sprint(*v.VolumeType) + for _, value := range _volumeTypeValidValues { + if value == volumeTypeParameterValue { + volumeTypeIsValid = true + } + } + + if !volumeTypeIsValid { + return errors.ParameterValueNotAllowedError{ + ParameterName: "VolumeType", + ParameterValue: volumeTypeParameterValue, + AllowedValues: _volumeTypeValidValues, + } + } + } + + return nil } type CloneVolumesOutput struct { - Message *string `json:"message" name:"message"` - Action *string `json:"action" name:"action" location:"elements"` - JobID *string `json:"job_id" name:"job_id" location:"elements"` - RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` - Volumes []*string `json:"volumes" name:"volumes" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Volumes []*string `json:"volumes" name:"volumes" location:"elements"` } // Documentation URL: https://docs.qingcloud.com/api/volume/create_volumes.html func (s *VolumeService) CreateVolumes(i *CreateVolumesInput) (*CreateVolumesOutput, error) { - if i == nil { - i = &CreateVolumesInput{} - } - o := &data.Operation{ - Config: s.Config, - Properties: s.Properties, - APIName: "CreateVolumes", - RequestMethod: "GET", - } - - x := &CreateVolumesOutput{} - r, err := request.New(o, i, x) - if err != nil { - return nil, err - } - - err = r.Send() - if err != nil { - return nil, err - } - - return x, err + if i == nil { + i = &CreateVolumesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "CreateVolumes", + RequestMethod: "GET", + } + + x := &CreateVolumesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err } type CreateVolumesInput struct { - Count *int `json:"count" name:"count" default:"1" location:"params"` - Repl *string `json:"repl" name:"repl" location:"params"` - Size *int `json:"size" name:"size" location:"params"` // Required - VolumeName *string `json:"volume_name" name:"volume_name" location:"params"` - VolumeType *int `json:"volume_type" name:"volume_type" default:"0" location:"params"` - Zone *string `json:"zone" name:"zone" location:"params"` - // For VolumeType=5/6/7 to set replica count - ReplicaCount *int `json:"replica_count" name:"replica_count" location:"params"` + Count *int `json:"count" name:"count" default:"1" location:"params"` + Repl *string `json:"repl" name:"repl" location:"params"` + Size *int `json:"size" name:"size" location:"params"` // Required + VolumeName *string `json:"volume_name" name:"volume_name" location:"params"` + VolumeType *int `json:"volume_type" name:"volume_type" default:"0" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` + // For VolumeType=5/6/7 to set replica count + ReplicaCount *int `json:"replica_count" name:"replica_count" location:"params"` + + AutoRenew *string `json:"auto_renew" name:"auto_renew" location:"params"` + Backups *string `json:"backups" name:"backups" location:"params"` + CacheMode *string `json:"cache_mode" name:"cache_mode" location:"params"` + ChargeMode *string `json:"charge_mode" name:"charge_mode" location:"params"` + CipherAlg *string `json:"cipher_alg" name:"cipher_alg" location:"params"` + CmkID *string `json:"cmk_id" name:"cmk_id" location:"params"` + ContainerConfID *string `json:"container_conf_id" name:"container_conf_id" location:"params"` + ContractDescription *string `json:"contract_description" name:"contract_description" location:"params"` + ContractEntries *string `json:"contract_entries" name:"contract_entries" location:"params"` + ContractID *string `json:"contract_id" name:"contract_id" location:"params"` + CouponID *string `json:"coupon_id" name:"coupon_id" location:"params"` + Datastore *string `json:"datastore" name:"datastore" location:"params"` + DryRun *string `json:"dry_run" name:"dry_run" default:"0" location:"params"` + // enable volume encryption + Encryption *string `json:"encryption" name:"encryption" location:"params"` + Entries *string `json:"entries" name:"entries" location:"params"` + // the specified hyper node id the volume will be place into + HyperNodeID *string `json:"hyper_node_id" name:"hyper_node_id" location:"params"` + InResourceGroupIDs *string `json:"in_resource_group_ids" name:"in_resource_group_ids" location:"params"` + Instance *string `json:"instance" name:"instance" location:"params"` + Label *string `json:"label" name:"label" location:"params"` + MaxBs *string `json:"max_bs" name:"max_bs" location:"params"` + Months *string `json:"months" name:"months" location:"params"` + MutexGroupID *string `json:"mutex_group_id" name:"mutex_group_id" location:"params"` + NextChargeMode *string `json:"next_charge_mode" name:"next_charge_mode" location:"params"` + // the specified group id the volume will be place into + PlaceGroupID *string `json:"place_group_id" name:"place_group_id" location:"params"` + Policy *string `json:"policy" name:"policy" location:"params"` + // index of HBA port + Port *string `json:"port" name:"port" default:"0" location:"params"` + ProjectID *string `json:"project_id" name:"project_id" location:"params"` + PromotionID *string `json:"promotion_id" name:"promotion_id" location:"params"` + ResourceQos *string `json:"resource_qos" name:"resource_qos" location:"params"` + Rg *string `json:"rg" name:"rg" location:"params"` + // The volume size will round up to the minimum size if its samller than the minimum size + RoundUp *string `json:"round_up" name:"round_up" default:"0" location:"params"` + // the user who will own this volume + TargetUser *string `json:"target_user" name:"target_user" location:"params"` + ThickProv *string `json:"thick_prov" name:"thick_prov" location:"params"` + VdcNodeID *string `json:"vdc_node_id" name:"vdc_node_id" location:"params"` + // SAN wwpn + Wwpn *string `json:"wwpn" name:"wwpn" location:"params"` } func (v *CreateVolumesInput) Validate() error { - if v.Size == nil { - return errors.ParameterRequiredError{ - ParameterName: "Size", - ParentName: "CreateVolumesInput", - } - } - - if v.VolumeType != nil { - volumeTypeIsValid := false - volumeTypeParameterValue := fmt.Sprint(*v.VolumeType) - for _, value := range _volumeTypeValidValues { - if value == volumeTypeParameterValue { - volumeTypeIsValid = true - } - } - - if !volumeTypeIsValid { - return errors.ParameterValueNotAllowedError{ - ParameterName: "VolumeType", - ParameterValue: volumeTypeParameterValue, - AllowedValues: _volumeTypeValidValues, - } - } - } - - return nil + if v.Size == nil { + return errors.ParameterRequiredError{ + ParameterName: "Size", + ParentName: "CreateVolumesInput", + } + } + + if v.VolumeType != nil { + volumeTypeIsValid := false + volumeTypeParameterValue := fmt.Sprint(*v.VolumeType) + for _, value := range _volumeTypeValidValues { + if value == volumeTypeParameterValue { + volumeTypeIsValid = true + } + } + + if !volumeTypeIsValid { + return errors.ParameterValueNotAllowedError{ + ParameterName: "VolumeType", + ParameterValue: volumeTypeParameterValue, + AllowedValues: _volumeTypeValidValues, + } + } + } + + return nil } type CreateVolumesOutput struct { - Message *string `json:"message" name:"message"` - Action *string `json:"action" name:"action" location:"elements"` - JobID *string `json:"job_id" name:"job_id" location:"elements"` - RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` - Volumes []*string `json:"volumes" name:"volumes" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Volumes []*string `json:"volumes" name:"volumes" location:"elements"` } // Documentation URL: https://docs.qingcloud.com/api/volume/delete_volumes.html func (s *VolumeService) DeleteVolumes(i *DeleteVolumesInput) (*DeleteVolumesOutput, error) { - if i == nil { - i = &DeleteVolumesInput{} - } - o := &data.Operation{ - Config: s.Config, - Properties: s.Properties, - APIName: "DeleteVolumes", - RequestMethod: "GET", - } - - x := &DeleteVolumesOutput{} - r, err := request.New(o, i, x) - if err != nil { - return nil, err - } - - err = r.Send() - if err != nil { - return nil, err - } - - return x, err + if i == nil { + i = &DeleteVolumesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DeleteVolumes", + RequestMethod: "GET", + } + + x := &DeleteVolumesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err } type DeleteVolumesInput struct { - Volumes []*string `json:"volumes" name:"volumes" location:"params"` // Required + Volumes []*string `json:"volumes" name:"volumes" location:"params"` // Required + + DirectCease *string `json:"direct_cease" name:"direct_cease" location:"params"` + ProjectID *string `json:"project_id" name:"project_id" location:"params"` + Unlease *string `json:"unlease" name:"unlease" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` } func (v *DeleteVolumesInput) Validate() error { - if len(v.Volumes) == 0 { - return errors.ParameterRequiredError{ - ParameterName: "Volumes", - ParentName: "DeleteVolumesInput", - } - } + if len(v.Volumes) == 0 { + return errors.ParameterRequiredError{ + ParameterName: "Volumes", + ParentName: "DeleteVolumesInput", + } + } - return nil + return nil } type DeleteVolumesOutput struct { - Message *string `json:"message" name:"message"` - Action *string `json:"action" name:"action" location:"elements"` - JobID *string `json:"job_id" name:"job_id" location:"elements"` - RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` } // Documentation URL: https://docs.qingcloud.com/api/volume/describe_volumes.html func (s *VolumeService) DescribeVolumes(i *DescribeVolumesInput) (*DescribeVolumesOutput, error) { - if i == nil { - i = &DescribeVolumesInput{} - } - o := &data.Operation{ - Config: s.Config, - Properties: s.Properties, - APIName: "DescribeVolumes", - RequestMethod: "GET", - } - - x := &DescribeVolumesOutput{} - r, err := request.New(o, i, x) - if err != nil { - return nil, err - } - - err = r.Send() - if err != nil { - return nil, err - } - - return x, err + if i == nil { + i = &DescribeVolumesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DescribeVolumes", + RequestMethod: "GET", + } + + x := &DescribeVolumesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err } type DescribeVolumesInput struct { - Limit *int `json:"limit" name:"limit" default:"20" location:"params"` - Offset *int `json:"offset" name:"offset" default:"0" location:"params"` - Owner *string `json:"owner" name:"owner" location:"params"` - ProjectID *string `json:"project_id" name:"project_id" location:"params"` - SearchWord *string `json:"search_word" name:"search_word" location:"params"` - Status []*string `json:"status" name:"status" location:"params"` - Tags []*string `json:"tags" name:"tags" location:"params"` - // Verbose's available values: 0, 1 - Verbose *int `json:"verbose" name:"verbose" default:"0" location:"params"` - VolumeType *int `json:"volume_type" name:"volume_type" location:"params"` - Volumes []*string `json:"volumes" name:"volumes" location:"params"` - Zone *string `json:"zone" name:"zone" location:"params"` + Limit *int `json:"limit" name:"limit" default:"20" location:"params"` + Offset *int `json:"offset" name:"offset" default:"0" location:"params"` + Owner *string `json:"owner" name:"owner" location:"params"` + ProjectID *string `json:"project_id" name:"project_id" location:"params"` + SearchWord *string `json:"search_word" name:"search_word" location:"params"` + Status []*string `json:"status" name:"status" location:"params"` + Tags []*string `json:"tags" name:"tags" location:"params"` + // Verbose's available values: 0, 1 + Verbose *int `json:"verbose" name:"verbose" default:"0" location:"params"` + VolumeType *int `json:"volume_type" name:"volume_type" location:"params"` + Volumes []*string `json:"volumes" name:"volumes" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` + + ConsoleID *string `json:"console_id" name:"console_id" location:"params"` + // controller + Controller *string `json:"controller" name:"controller" location:"params"` + ExcludeReserved *string `json:"exclude_reserved" name:"exclude_reserved" location:"params"` + // the host_machine of volumes + HostMachine *string `json:"host_machine" name:"host_machine" location:"params"` + IsElastic *string `json:"is_elastic" name:"is_elastic" location:"params"` + // the place group of instances + PlaceGroupID *string `json:"place_group_id" name:"place_group_id" location:"params"` + // filter by replica policy. + Repl *string `json:"repl" name:"repl" location:"params"` + // for reverse sorting. 1: reverse + Reverse *string `json:"reverse" name:"reverse" location:"params"` + RootUserID *string `json:"root_user_id" name:"root_user_id" location:"params"` + // sort key + SortKey *string `json:"sort_key" name:"sort_key" location:"params"` + TransitionStatus *string `json:"transition_status" name:"transition_status" location:"params"` + VdcNodeID *string `json:"vdc_node_id" name:"vdc_node_id" location:"params"` + // the name of the volume. Support partial match. + VolumeName *string `json:"volume_name" name:"volume_name" location:"params"` } func (v *DescribeVolumesInput) Validate() error { - if v.Verbose != nil { - verboseValidValues := []string{"0", "1"} - verboseParameterValue := fmt.Sprint(*v.Verbose) - - verboseIsValid := false - for _, value := range verboseValidValues { - if value == verboseParameterValue { - verboseIsValid = true - } - } - - if !verboseIsValid { - return errors.ParameterValueNotAllowedError{ - ParameterName: "Verbose", - ParameterValue: verboseParameterValue, - AllowedValues: verboseValidValues, - } - } - } - - if v.VolumeType != nil { - volumeTypeIsValid := false - volumeTypeParameterValue := fmt.Sprint(*v.VolumeType) - for _, value := range _volumeTypeValidValues { - if value == volumeTypeParameterValue { - volumeTypeIsValid = true - } - } - - if !volumeTypeIsValid { - return errors.ParameterValueNotAllowedError{ - ParameterName: "VolumeType", - ParameterValue: volumeTypeParameterValue, - AllowedValues: _volumeTypeValidValues, - } - } - } - - return nil + if v.Verbose != nil { + verboseValidValues := []string{"0", "1"} + verboseParameterValue := fmt.Sprint(*v.Verbose) + + verboseIsValid := false + for _, value := range verboseValidValues { + if value == verboseParameterValue { + verboseIsValid = true + } + } + + if !verboseIsValid { + return errors.ParameterValueNotAllowedError{ + ParameterName: "Verbose", + ParameterValue: verboseParameterValue, + AllowedValues: verboseValidValues, + } + } + } + + if v.VolumeType != nil { + volumeTypeIsValid := false + volumeTypeParameterValue := fmt.Sprint(*v.VolumeType) + for _, value := range _volumeTypeValidValues { + if value == volumeTypeParameterValue { + volumeTypeIsValid = true + } + } + + if !volumeTypeIsValid { + return errors.ParameterValueNotAllowedError{ + ParameterName: "VolumeType", + ParameterValue: volumeTypeParameterValue, + AllowedValues: _volumeTypeValidValues, + } + } + } + + return nil } type DescribeVolumesOutput struct { - Message *string `json:"message" name:"message"` - Action *string `json:"action" name:"action" location:"elements"` - RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` - TotalCount *int `json:"total_count" name:"total_count" location:"elements"` - VolumeSet []*Volume `json:"volume_set" name:"volume_set" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + TotalCount *int `json:"total_count" name:"total_count" location:"elements"` + VolumeSet []*Volume `json:"volume_set" name:"volume_set" location:"elements"` } // Documentation URL: https://docs.qingcloud.com/api/volume/detach_volumes.html func (s *VolumeService) DetachVolumes(i *DetachVolumesInput) (*DetachVolumesOutput, error) { - if i == nil { - i = &DetachVolumesInput{} - } - o := &data.Operation{ - Config: s.Config, - Properties: s.Properties, - APIName: "DetachVolumes", - RequestMethod: "GET", - } - - x := &DetachVolumesOutput{} - r, err := request.New(o, i, x) - if err != nil { - return nil, err - } - - err = r.Send() - if err != nil { - return nil, err - } - - return x, err + if i == nil { + i = &DetachVolumesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DetachVolumes", + RequestMethod: "GET", + } + + x := &DetachVolumesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err } type DetachVolumesInput struct { - Instance *string `json:"instance" name:"instance" location:"params"` // Required - Volumes []*string `json:"volumes" name:"volumes" location:"params"` // Required + Instance *string `json:"instance" name:"instance" location:"params"` // Required + Volumes []*string `json:"volumes" name:"volumes" location:"params"` // Required } func (v *DetachVolumesInput) Validate() error { - if v.Instance == nil { - return errors.ParameterRequiredError{ - ParameterName: "Instance", - ParentName: "DetachVolumesInput", - } - } + if v.Instance == nil { + return errors.ParameterRequiredError{ + ParameterName: "Instance", + ParentName: "DetachVolumesInput", + } + } - if len(v.Volumes) == 0 { - return errors.ParameterRequiredError{ - ParameterName: "Volumes", - ParentName: "DetachVolumesInput", - } - } + if len(v.Volumes) == 0 { + return errors.ParameterRequiredError{ + ParameterName: "Volumes", + ParentName: "DetachVolumesInput", + } + } - return nil + return nil } type DetachVolumesOutput struct { - Message *string `json:"message" name:"message"` - Action *string `json:"action" name:"action" location:"elements"` - JobID *string `json:"job_id" name:"job_id" location:"elements"` - RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` } // Documentation URL: https://docs.qingcloud.com/api/volume/modify_volume_attributes.html func (s *VolumeService) ModifyVolumeAttributes(i *ModifyVolumeAttributesInput) (*ModifyVolumeAttributesOutput, error) { - if i == nil { - i = &ModifyVolumeAttributesInput{} - } - o := &data.Operation{ - Config: s.Config, - Properties: s.Properties, - APIName: "ModifyVolumeAttributes", - RequestMethod: "GET", - } - - x := &ModifyVolumeAttributesOutput{} - r, err := request.New(o, i, x) - if err != nil { - return nil, err - } - - err = r.Send() - if err != nil { - return nil, err - } - - return x, err + if i == nil { + i = &ModifyVolumeAttributesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "ModifyVolumeAttributes", + RequestMethod: "GET", + } + + x := &ModifyVolumeAttributesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err } type ModifyVolumeAttributesInput struct { - Description *string `json:"description" name:"description" location:"params"` - Volume *string `json:"volume" name:"volume" location:"params"` // Required - VolumeName *string `json:"volume_name" name:"volume_name" location:"params"` + Description *string `json:"description" name:"description" location:"params"` + Volume *string `json:"volume" name:"volume" location:"params"` // Required + VolumeName *string `json:"volume_name" name:"volume_name" location:"params"` + // 云服务器 ID + Instance *string `json:"instance" name:"instance" location:"params"` } func (v *ModifyVolumeAttributesInput) Validate() error { - if v.Volume == nil { - return errors.ParameterRequiredError{ - ParameterName: "Volume", - ParentName: "ModifyVolumeAttributesInput", - } - } + if v.Volume == nil { + return errors.ParameterRequiredError{ + ParameterName: "Volume", + ParentName: "ModifyVolumeAttributesInput", + } + } - return nil + return nil } type ModifyVolumeAttributesOutput struct { - Message *string `json:"message" name:"message"` - Action *string `json:"action" name:"action" location:"elements"` - RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` } // Documentation URL: https://docs.qingcloud.com/api/volume/resize_volumes.html func (s *VolumeService) ResizeVolumes(i *ResizeVolumesInput) (*ResizeVolumesOutput, error) { - if i == nil { - i = &ResizeVolumesInput{} - } - o := &data.Operation{ - Config: s.Config, - Properties: s.Properties, - APIName: "ResizeVolumes", - RequestMethod: "GET", - } - - x := &ResizeVolumesOutput{} - r, err := request.New(o, i, x) - if err != nil { - return nil, err - } - - err = r.Send() - if err != nil { - return nil, err - } - - return x, err + if i == nil { + i = &ResizeVolumesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "ResizeVolumes", + RequestMethod: "GET", + } + + x := &ResizeVolumesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err } type ResizeVolumesInput struct { - Size *int `json:"size" name:"size" location:"params"` // Required - Volumes []*string `json:"volumes" name:"volumes" location:"params"` // Required + Size *int `json:"size" name:"size" location:"params"` // Required + Volumes []*string `json:"volumes" name:"volumes" location:"params"` // Required } func (v *ResizeVolumesInput) Validate() error { - if v.Size == nil { - return errors.ParameterRequiredError{ - ParameterName: "Size", - ParentName: "ResizeVolumesInput", - } - } + if v.Size == nil { + return errors.ParameterRequiredError{ + ParameterName: "Size", + ParentName: "ResizeVolumesInput", + } + } - if len(v.Volumes) == 0 { - return errors.ParameterRequiredError{ - ParameterName: "Volumes", - ParentName: "ResizeVolumesInput", - } - } + if len(v.Volumes) == 0 { + return errors.ParameterRequiredError{ + ParameterName: "Volumes", + ParentName: "ResizeVolumesInput", + } + } - return nil + return nil } type ResizeVolumesOutput struct { - Message *string `json:"message" name:"message"` - Action *string `json:"action" name:"action" location:"elements"` - JobID *string `json:"job_id" name:"job_id" location:"elements"` - RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + JobID *string `json:"job_id" name:"job_id" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` } diff --git a/service/vpc_border.go b/service/vpc_border.go new file mode 100644 index 0000000..399e112 --- /dev/null +++ b/service/vpc_border.go @@ -0,0 +1,679 @@ +// +------------------------------------------------------------------------- +// | Copyright (C) 2016 Yunify, Inc. +// +------------------------------------------------------------------------- +// | Licensed under the Apache License, Version 2.0 (the "License"); +// | you may not use this work except in compliance with the License. +// | You may obtain a copy of the License in the LICENSE file, or 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. +// +------------------------------------------------------------------------- + +package service + +import ( + "fmt" + "time" + + "github.com/yunify/qingcloud-sdk-go/config" + "github.com/yunify/qingcloud-sdk-go/request" + "github.com/yunify/qingcloud-sdk-go/request/data" +) + +var _ fmt.State +var _ time.Time + +type VpcBorderService struct { + Config *config.Config + Properties *VpcBorderServiceProperties +} + +type VpcBorderServiceProperties struct { + // QingCloud Zone ID + Zone *string `json:"zone" name:"zone"` // Required +} + +func (s *QingCloudService) VpcBorder(zone string) (*VpcBorderService, error) { + properties := &VpcBorderServiceProperties{ + Zone: &zone, + } + + return &VpcBorderService{Config: s.Config, Properties: properties}, nil +} + +// AddBorderStatics: AddBorderStatics + +func (s *VpcBorderService) AddBorderStatics(i *AddBorderStaticsInput) (*AddBorderStaticsOutput, error) { + if i == nil { + i = &AddBorderStaticsInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "AddBorderStatics", + RequestMethod: "GET", + } + + x := &AddBorderStaticsOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type AddBorderStaticsInput struct { + + // the ID of intranet router whose statics you want to add. + Border *string `json:"border" name:"border" location:"params"` + // a json string of rules list. e.g.[{static_type:0 + Statics []*string `json:"statics" name:"statics" location:"params"` +} + +func (v *AddBorderStaticsInput) Validate() error { + + return nil +} + +type AddBorderStaticsOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// AssociateBorder: AssociateBorder + +func (s *VpcBorderService) AssociateBorder(i *AssociateBorderInput) (*AssociateBorderOutput, error) { + if i == nil { + i = &AssociateBorderInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "AssociateBorder", + RequestMethod: "GET", + } + + x := &AssociateBorderOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type AssociateBorderInput struct { + + // the intranet router you want to associate. + Border *string `json:"border" name:"border" location:"params"` + // the id of the vpc router. + Router *string `json:"router" name:"router" location:"params"` +} + +func (v *AssociateBorderInput) Validate() error { + + return nil +} + +type AssociateBorderOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + RouterID *string `json:"router_id" name:"router_id" location:"elements"` + BorderID *string `json:"border_id" name:"border_id" location:"elements"` +} + +// ConfigBorder: ConfigBorder + +func (s *VpcBorderService) ConfigBorder(i *ConfigBorderInput) (*ConfigBorderOutput, error) { + if i == nil { + i = &ConfigBorderInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "ConfigBorder", + RequestMethod: "GET", + } + + x := &ConfigBorderOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type ConfigBorderInput struct { + + // the ID of border you want to configure. + Border *string `json:"border" name:"border" location:"params"` + // configuration data in json format + Data *string `json:"data" name:"data" location:"params"` + // operation such as CreateSubIf + Operation *string `json:"operation" name:"operation" location:"params"` +} + +func (v *ConfigBorderInput) Validate() error { + + return nil +} + +type ConfigBorderOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + BorderID *string `json:"border_id" name:"border_id" location:"elements"` +} + +// CreateVpcBorders: CreateVpcBorders + +func (s *VpcBorderService) CreateVpcBorders(i *CreateVpcBordersInput) (*CreateVpcBordersOutput, error) { + if i == nil { + i = &CreateVpcBordersInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "CreateVpcBorders", + RequestMethod: "GET", + } + + x := &CreateVpcBordersOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type CreateVpcBordersInput struct { + BorderName *string `json:"border_name" name:"border_name" location:"params"` + BorderType *string `json:"border_type" name:"border_type" location:"params"` + Description *string `json:"description" name:"description" location:"params"` +} + +func (v *CreateVpcBordersInput) Validate() error { + + return nil +} + +type CreateVpcBordersOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + VpcBorders []*string `json:"vpc_borders" name:"vpc_borders" location:"elements"` +} + +// DeleteBorderStatics: DeleteBorderStatics + +func (s *VpcBorderService) DeleteBorderStatics(i *DeleteBorderStaticsInput) (*DeleteBorderStaticsOutput, error) { + if i == nil { + i = &DeleteBorderStaticsInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DeleteBorderStatics", + RequestMethod: "GET", + } + + x := &DeleteBorderStaticsOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DeleteBorderStaticsInput struct { + + // the comma separated IDs of border statics you want to delete. + BorderStatics []*string `json:"border_statics" name:"border_statics" location:"params"` +} + +func (v *DeleteBorderStaticsInput) Validate() error { + + return nil +} + +type DeleteBorderStaticsOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// DeleteVpcBorders: DeleteVpcBorders + +func (s *VpcBorderService) DeleteVpcBorders(i *DeleteVpcBordersInput) (*DeleteVpcBordersOutput, error) { + if i == nil { + i = &DeleteVpcBordersInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DeleteVpcBorders", + RequestMethod: "GET", + } + + x := &DeleteVpcBordersOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DeleteVpcBordersInput struct { + VpcBorders []*string `json:"vpc_borders" name:"vpc_borders" location:"params"` +} + +func (v *DeleteVpcBordersInput) Validate() error { + + return nil +} + +type DeleteVpcBordersOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// DescribeBorderStatics: DescribeBorderStatics + +func (s *VpcBorderService) DescribeBorderStatics(i *DescribeBorderStaticsInput) (*DescribeBorderStaticsOutput, error) { + if i == nil { + i = &DescribeBorderStaticsInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DescribeBorderStatics", + RequestMethod: "GET", + } + + x := &DescribeBorderStaticsOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DescribeBorderStaticsInput struct { + + // filter by border. + Border *string `json:"border" name:"border" location:"params"` + // the comma separated IDs of border_statics you want to list. + BorderStatics []*string `json:"border_statics" name:"border_statics" location:"params"` + // specify the number of the returning results. + Limit *int `json:"limit" name:"limit" location:"params"` + // the starting offset of the returning results. + Offset *int `json:"offset" name:"offset" location:"params"` + // filter by owner + Owner *string `json:"owner" name:"owner" location:"params"` + // a list of static type. 0: route. + StaticType []*string `json:"static_type" name:"static_type" location:"params"` + // the number to specify the verbose level + Verbose *int `json:"verbose" name:"verbose" location:"params"` +} + +func (v *DescribeBorderStaticsInput) Validate() error { + + return nil +} + +type DescribeBorderStaticsOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` +} + +// DescribeBorderVxNets: DescribeBorderVxnets + +func (s *VpcBorderService) DescribeBorderVxNets(i *DescribeBorderVxNetsInput) (*DescribeBorderVxNetsOutput, error) { + if i == nil { + i = &DescribeBorderVxNetsInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DescribeBorderVxnets", + RequestMethod: "GET", + } + + x := &DescribeBorderVxNetsOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DescribeBorderVxNetsInput struct { + Border *string `json:"border" name:"border" location:"params"` + // specify the number of the returning results. + Limit *int `json:"limit" name:"limit" location:"params"` + // the starting offset of the returning results. + Offset *int `json:"offset" name:"offset" location:"params"` + // filter by owner. + Owner *string `json:"owner" name:"owner" location:"params"` + VxNet *string `json:"vxnet" name:"vxnet" location:"params"` +} + +func (v *DescribeBorderVxNetsInput) Validate() error { + + return nil +} + +type DescribeBorderVxNetsOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + BorderVxnet []*BorderVxnet `json:"border_vxnet_set" name:"border_vxnet_set" location:"elements"` +} + +// DescribeVpcBorders: DescribeVpcBorders + +func (s *VpcBorderService) DescribeVpcBorders(i *DescribeVpcBordersInput) (*DescribeVpcBordersOutput, error) { + if i == nil { + i = &DescribeVpcBordersInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DescribeVpcBorders", + RequestMethod: "GET", + } + + x := &DescribeVpcBordersOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DescribeVpcBordersInput struct { + BorderName *string `json:"border_name" name:"border_name" location:"params"` + BorderType *string `json:"border_type" name:"border_type" location:"params"` + L3vni *int `json:"l3vni" name:"l3vni" location:"params"` + Limit *int `json:"limit" name:"limit" location:"params"` + Offset *int `json:"offset" name:"offset" location:"params"` + Owner *string `json:"owner" name:"owner" location:"params"` + RouterID *string `json:"router_id" name:"router_id" location:"params"` + SearchWord *string `json:"search_word" name:"search_word" location:"params"` + Status []*string `json:"status" name:"status" location:"params"` + Verbose *int `json:"verbose" name:"verbose" location:"params"` + VpcBorders []*string `json:"vpc_borders" name:"vpc_borders" location:"params"` +} + +func (v *DescribeVpcBordersInput) Validate() error { + + return nil +} + +type DescribeVpcBordersOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + TotalCount *int `json:"total_count" name:"total_count" location:"elements"` + VpcBorderSet []*VpcBorder `json:"vpc_border_set" name:"vpc_border_set" location:"elements"` +} + +// DissociateBorder: DissociateBorder + +func (s *VpcBorderService) DissociateBorder(i *DissociateBorderInput) (*DissociateBorderOutput, error) { + if i == nil { + i = &DissociateBorderInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "DissociateBorder", + RequestMethod: "GET", + } + + x := &DissociateBorderOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type DissociateBorderInput struct { + + // the intranet router you want to dissociate. + Border *string `json:"border" name:"border" location:"params"` + // the id of the vpc router. + Router *string `json:"router" name:"router" location:"params"` +} + +func (v *DissociateBorderInput) Validate() error { + + return nil +} + +type DissociateBorderOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + RouterID *string `json:"router_id" name:"router_id" location:"elements"` + BorderID *string `json:"border_id" name:"border_id" location:"elements"` +} + +// JoinBorder: JoinBorder + +func (s *VpcBorderService) JoinBorder(i *JoinBorderInput) (*JoinBorderOutput, error) { + if i == nil { + i = &JoinBorderInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "JoinBorder", + RequestMethod: "GET", + } + + x := &JoinBorderOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type JoinBorderInput struct { + + // the intranet router you want to join. + Border *string `json:"border" name:"border" location:"params"` + // specify the border private ip for each vxnet + BorderPrivateIPs []*string `json:"border_private_ips" name:"border_private_ips" location:"params"` + // the ids of the vxnets that will join the intranet router. + VxNets []*string `json:"vxnets" name:"vxnets" location:"params"` +} + +func (v *JoinBorderInput) Validate() error { + + return nil +} + +type JoinBorderOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + BorderID *string `json:"border_id" name:"border_id" location:"elements"` + VxNetID *string `json:"vxnet_id" name:"vxnet_id" location:"elements"` +} + +// LeaveBorder: LeaveBorder + +func (s *VpcBorderService) LeaveBorder(i *LeaveBorderInput) (*LeaveBorderOutput, error) { + if i == nil { + i = &LeaveBorderInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "LeaveBorder", + RequestMethod: "GET", + } + + x := &LeaveBorderOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type LeaveBorderInput struct { + + // the intranet router you want to leave. + Border *string `json:"border" name:"border" location:"params"` + // force leave + Force *int `json:"force" name:"force" default:"0" location:"params"` + // the comm separated IDs of the vxnets that will leave the intranet router. + VxNets []*string `json:"vxnets" name:"vxnets" location:"params"` + Zone *string `json:"zone" name:"zone" location:"params"` +} + +func (v *LeaveBorderInput) Validate() error { + + return nil +} + +type LeaveBorderOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + BorderID *string `json:"border_id" name:"border_id" location:"elements"` + Vxnets []*string `json:"vxnets" name:"vxnets" location:"elements"` +} + +// ModifyBorderAttributes: ModifyBorderAttributes + +func (s *VpcBorderService) ModifyBorderAttributes(i *ModifyBorderAttributesInput) (*ModifyBorderAttributesOutput, error) { + if i == nil { + i = &ModifyBorderAttributesInput{} + } + o := &data.Operation{ + Config: s.Config, + Properties: s.Properties, + APIName: "ModifyBorderAttributes", + RequestMethod: "GET", + } + + x := &ModifyBorderAttributesOutput{} + r, err := request.New(o, i, x) + if err != nil { + return nil, err + } + + err = r.Send() + if err != nil { + return nil, err + } + + return x, err +} + +type ModifyBorderAttributesInput struct { + + // the intranet router you want to modify. + Border *string `json:"border" name:"border" location:"params"` + // the new border_name. + BorderName *string `json:"border_name" name:"border_name" location:"params"` + // the new description. + Description *string `json:"description" name:"description" location:"params"` +} + +func (v *ModifyBorderAttributesInput) Validate() error { + + return nil +} + +type ModifyBorderAttributesOutput struct { + Message *string `json:"message" name:"message"` + Action *string `json:"action" name:"action" location:"elements"` + RetCode *int `json:"ret_code" name:"ret_code" location:"elements"` + GlobalJobID *string `json:"global_job_id" name:"global_job_id" location:"elements"` +} diff --git a/template/manifest.json b/template/manifest.json index 9d2f86f..37622dc 100644 --- a/template/manifest.json +++ b/template/manifest.json @@ -4,5 +4,35 @@ "style": "snake_case", "extension": ".go" } + }, + "template_files": { + "shared": { + "file_path": "shared.tmpl", + "output_file_naming": { + "prefix": "", + "suffix": "" + } + }, + "service": { + "file_path": "service.tmpl", + "output_file_naming": { + "prefix": "", + "suffix": "" + } + }, + "sub_service": { + "file_path": "sub_service.tmpl", + "output_file_naming": { + "prefix": "", + "suffix": "" + } + }, + "types": { + "file_path": "types.tmpl", + "output_file_naming": { + "prefix": "", + "suffix": "" + } + } } } diff --git a/template/service.tmpl b/template/service.tmpl index 36ceb1c..25fc7c1 100644 --- a/template/service.tmpl +++ b/template/service.tmpl @@ -33,11 +33,16 @@ type {{$service.Name | camelCase}}Service struct { } type {{$service.Name | camelCase}}ServiceProperties struct { + // QingCloud Zone ID + Zone *string `json:"zone" name:"zone"` // Required + {{template "RenderProperties" passThrough $service.Properties ""}} } func Init(c *config.Config) (*{{$service.Name | camelCase}}Service, error) { - properties := &{{$service.Name | camelCase}}ServiceProperties{} + properties := &InstanceServiceProperties{ + Zone: &{{$service.Name | camelCase}}, + } logger.SetLevel(c.LogLevel) return &{{$service.Name | camelCase}}Service{Config: c, Properties: properties}, nil }