Support project feature
This commit is contained in:
parent
9b4f4db808
commit
afe3815417
|
@ -841,6 +841,7 @@ type DescribeCachesInput struct {
|
|||
Caches []*string `json:"caches" name:"caches" location:"params"`
|
||||
Limit *int `json:"limit" name:"limit" default:"20" location:"params"`
|
||||
Offset *int `json:"offset" name:"offset" default:"0" 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"`
|
||||
|
|
|
@ -368,6 +368,7 @@ type DescribeEIPsInput 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"`
|
||||
|
|
|
@ -233,6 +233,7 @@ type DescribeImagesInput struct {
|
|||
Owner *string `json:"owner" name:"owner" location:"params"`
|
||||
// ProcessorType's available values: 64bit, 32bit
|
||||
ProcessorType *string `json:"processor_type" name:"processor_type" location:"params"`
|
||||
ProjectID *string `json:"project_id" name:"project_id" location:"params"`
|
||||
// Provider's available values: system, self
|
||||
Provider *string `json:"provider" name:"provider" location:"params"`
|
||||
SearchWord *string `json:"search_word" name:"search_word" location:"params"`
|
||||
|
|
|
@ -175,6 +175,7 @@ type DescribeInstancesInput 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"`
|
||||
|
|
|
@ -277,6 +277,7 @@ type DescribeKeyPairsInput 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"`
|
||||
Tags []*string `json:"tags" name:"tags" location:"params"`
|
||||
Verbose *int `json:"verbose" name:"verbose" default:"0" location:"params"`
|
||||
|
|
|
@ -354,6 +354,7 @@ type CreateLoadBalancerInput struct {
|
|||
LoadBalancerType *int `json:"loadbalancer_type" name:"loadbalancer_type" default:"0" location:"params"`
|
||||
NodeCount *int `json:"node_count" name:"node_count" location:"params"`
|
||||
PrivateIP *string `json:"private_ip" name:"private_ip" location:"params"`
|
||||
ProjectID *string `json:"project_id" name:"project_id" location:"params"`
|
||||
SecurityGroup *string `json:"security_group" name:"security_group" location:"params"`
|
||||
VxNet *string `json:"vxnet" name:"vxnet" location:"params"`
|
||||
}
|
||||
|
|
|
@ -486,6 +486,7 @@ type DescribeMongosInput struct {
|
|||
MongoName *string `json:"mongo_name" name:"mongo_name" location:"params"`
|
||||
Mongos []*string `json:"mongos" name:"mongos" location:"params"`
|
||||
Offset *int `json:"offset" name:"offset" default:"0" location:"params"`
|
||||
ProjectID *string `json:"project_id" name:"project_id" location:"params"`
|
||||
Status []*string `json:"status" name:"status" location:"params"`
|
||||
Tags []*string `json:"tags" name:"tags" location:"params"`
|
||||
Verbose *int `json:"verbose" name:"verbose" location:"params"`
|
||||
|
|
|
@ -237,6 +237,7 @@ type DescribeNicsInput struct {
|
|||
Nics []*string `json:"nics" name:"nics" 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"`
|
||||
// Status's available values: available, in-use
|
||||
Status *string `json:"status" name:"status" location:"params"`
|
||||
VxNetType []*int `json:"vxnet_type" name:"vxnet_type" location:"params"`
|
||||
|
|
|
@ -0,0 +1,262 @@
|
|||
// +-------------------------------------------------------------------------
|
||||
// | 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"
|
||||
"github.com/yunify/qingcloud-sdk-go/request/errors"
|
||||
)
|
||||
|
||||
var _ fmt.State
|
||||
var _ time.Time
|
||||
|
||||
type ProjectService struct {
|
||||
Config *config.Config
|
||||
Properties *ProjectServiceProperties
|
||||
}
|
||||
|
||||
type ProjectServiceProperties struct {
|
||||
// QingCloud Zone ID
|
||||
Zone *string `json:"zone" name:"zone"` // Required
|
||||
}
|
||||
|
||||
func (s *QingCloudService) Project(zone string) (*ProjectService, error) {
|
||||
properties := &ProjectServiceProperties{
|
||||
Zone: &zone,
|
||||
}
|
||||
|
||||
return &ProjectService{Config: s.Config, Properties: properties}, nil
|
||||
}
|
||||
|
||||
func (s *ProjectService) AddProjectResourceItems(i *AddProjectResourceItemsInput) (*AddProjectResourceItemsOutput, error) {
|
||||
if i == nil {
|
||||
i = &AddProjectResourceItemsInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "AddProjectResourceItems",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &AddProjectResourceItemsOutput{}
|
||||
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 AddProjectResourceItemsInput struct {
|
||||
ProjectID *string `json:"project_id" name:"project_id" location:"params"` // Required
|
||||
Resources []*string `json:"resources" name:"resources" location:"params"` // Required
|
||||
}
|
||||
|
||||
func (v *AddProjectResourceItemsInput) Validate() error {
|
||||
|
||||
if v.ProjectID == nil {
|
||||
return errors.ParameterRequiredError{
|
||||
ParameterName: "ProjectID",
|
||||
ParentName: "AddProjectResourceItemsInput",
|
||||
}
|
||||
}
|
||||
|
||||
if len(v.Resources) == 0 {
|
||||
return errors.ParameterRequiredError{
|
||||
ParameterName: "Resources",
|
||||
ParentName: "AddProjectResourceItemsInput",
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type AddProjectResourceItemsOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
ProjectID *string `json:"project_id" name:"project_id" location:"elements"`
|
||||
ResourceIDs []*string `json:"resource_ids" name:"resource_ids" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
ZoneID *string `json:"zone_id" name:"zone_id" location:"elements"`
|
||||
}
|
||||
|
||||
func (s *ProjectService) DeleteProjectResourceItems(i *DeleteProjectResourceItemsInput) (*DeleteProjectResourceItemsOutput, error) {
|
||||
if i == nil {
|
||||
i = &DeleteProjectResourceItemsInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "DeleteProjectResourceItems",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &DeleteProjectResourceItemsOutput{}
|
||||
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 DeleteProjectResourceItemsInput struct {
|
||||
ProjectID []*string `json:"project_id" name:"project_id" location:"params"` // Required
|
||||
Resources []*string `json:"resources" name:"resources" location:"params"` // Required
|
||||
}
|
||||
|
||||
func (v *DeleteProjectResourceItemsInput) Validate() error {
|
||||
|
||||
if len(v.ProjectID) == 0 {
|
||||
return errors.ParameterRequiredError{
|
||||
ParameterName: "ProjectID",
|
||||
ParentName: "DeleteProjectResourceItemsInput",
|
||||
}
|
||||
}
|
||||
|
||||
if len(v.Resources) == 0 {
|
||||
return errors.ParameterRequiredError{
|
||||
ParameterName: "Resources",
|
||||
ParentName: "DeleteProjectResourceItemsInput",
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteProjectResourceItemsOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
ProjectID []*string `json:"project_id" name:"project_id" location:"elements"`
|
||||
ResourceIDs []*string `json:"resource_ids" name:"resource_ids" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
ZoneID *string `json:"zone_id" name:"zone_id" location:"elements"`
|
||||
}
|
||||
|
||||
func (s *ProjectService) DescribeProjectResourceItems(i *DescribeProjectResourceItemsInput) (*DescribeProjectResourceItemsOutput, error) {
|
||||
if i == nil {
|
||||
i = &DescribeProjectResourceItemsInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "DescribeProjectResourceItems",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &DescribeProjectResourceItemsOutput{}
|
||||
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 DescribeProjectResourceItemsInput struct {
|
||||
InGlobal *int `json:"in_global" name:"in_global" 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"`
|
||||
ProjectIDs []*string `json:"project_ids" name:"project_ids" location:"params"`
|
||||
Reserve *int `json:"reserve" name:"reserve" location:"params"`
|
||||
ResourceTypes []*string `json:"resource_types" name:"resource_types" location:"params"`
|
||||
Resources []*string `json:"resources" name:"resources" location:"params"`
|
||||
SortKey *string `json:"sort_key" name:"sort_key" location:"params"`
|
||||
Verbose *int `json:"verbose" name:"verbose" location:"params"`
|
||||
}
|
||||
|
||||
func (v *DescribeProjectResourceItemsInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type DescribeProjectResourceItemsOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
ProjectResourceItemSet []*ProjectResourceItem `json:"project_resource_item_set" name:"project_resource_item_set" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
TotalCount *int `json:"total_count" name:"total_count" location:"elements"`
|
||||
}
|
||||
|
||||
func (s *ProjectService) DescribeProjects(i *DescribeProjectsInput) (*DescribeProjectsOutput, error) {
|
||||
if i == nil {
|
||||
i = &DescribeProjectsInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "DescribeProjects",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &DescribeProjectsOutput{}
|
||||
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 DescribeProjectsInput 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"`
|
||||
ProjectIDs []*string `json:"project_ids" name:"project_ids" location:"params"`
|
||||
Shared *string `json:"shared" name:"shared" default:"False" location:"params"`
|
||||
Status []*string `json:"status" name:"status" location:"params"`
|
||||
}
|
||||
|
||||
func (v *DescribeProjectsInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type DescribeProjectsOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
ProjectSet []*Project `json:"project_set" name:"project_set" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
TotalCount *int `json:"total_count" name:"total_count" location:"elements"`
|
||||
}
|
|
@ -710,6 +710,7 @@ func (s *RDBService) DescribeRDBs(i *DescribeRDBsInput) (*DescribeRDBsOutput, er
|
|||
type DescribeRDBsInput struct {
|
||||
Limit *int `json:"limit" name:"limit" location:"params"`
|
||||
Offset *int `json:"offset" name:"offset" location:"params"`
|
||||
ProjectID *string `json:"project_id" name:"project_id" location:"params"`
|
||||
RDBEngine *string `json:"rdb_engine" name:"rdb_engine" location:"params"`
|
||||
RDBName *string `json:"rdb_name" name:"rdb_name" location:"params"`
|
||||
RDBs []*string `json:"rdbs" name:"rdbs" location:"params"`
|
||||
|
|
|
@ -638,6 +638,7 @@ type DescribeRoutersInput struct {
|
|||
Limit *int `json:"limit" name:"limit" location:"params"`
|
||||
Offset *int `json:"offset" name:"offset" location:"params"`
|
||||
Owner *string `json:"owner" name:"owner" location:"params"`
|
||||
ProjectID *string `json:"project_id" name:"project_id" location:"params"`
|
||||
Routers []*string `json:"routers" name:"routers" location:"params"`
|
||||
SearchWord *string `json:"search_word" name:"search_word" location:"params"`
|
||||
Status []*string `json:"status" name:"status" location:"params"`
|
||||
|
|
|
@ -564,6 +564,7 @@ type DescribeSecurityGroupIPSetsInput 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"`
|
||||
SecurityGroupIPSetName *string `json:"security_group_ipset_name" name:"security_group_ipset_name" location:"params"`
|
||||
SecurityGroupIPSets []*string `json:"security_group_ipsets" name:"security_group_ipsets" location:"params"`
|
||||
Tags []*string `json:"tags" name:"tags" location:"params"`
|
||||
|
@ -702,6 +703,7 @@ func (s *SecurityGroupService) DescribeSecurityGroupSnapshots(i *DescribeSecurit
|
|||
type DescribeSecurityGroupSnapshotsInput struct {
|
||||
Limit *int `json:"limit" name:"limit" default:"20" location:"params"`
|
||||
Offset *int `json:"offset" name:"offset" default:"0" location:"params"`
|
||||
ProjectID *string `json:"project_id" name:"project_id" location:"params"`
|
||||
Reverse *int `json:"reverse" name:"reverse" default:"1" location:"params"`
|
||||
SecurityGroup *string `json:"security_group" name:"security_group" location:"params"` // Required
|
||||
SecurityGroupSnapshots []*string `json:"security_group_snapshots" name:"security_group_snapshots" location:"params"`
|
||||
|
@ -757,6 +759,7 @@ type DescribeSecurityGroupsInput 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"`
|
||||
SecurityGroups []*string `json:"security_groups" name:"security_groups" location:"params"`
|
||||
Tags []*string `json:"tags" name:"tags" location:"params"`
|
||||
|
|
|
@ -352,6 +352,7 @@ type DescribeSnapshotsInput 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"`
|
||||
ResourceID *string `json:"resource_id" name:"resource_id" location:"params"`
|
||||
SearchWord *string `json:"search_word" name:"search_word" location:"params"`
|
||||
SnapshotTime *string `json:"snapshot_time" name:"snapshot_time" location:"params"`
|
||||
|
|
|
@ -1848,6 +1848,44 @@ func (v *NICVxNet) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type Project struct {
|
||||
ConsoleID *string `json:"console_id" name:"console_id"`
|
||||
CreateTime *string `json:"create_time" name:"create_time"`
|
||||
Description *string `json:"description" name:"description"`
|
||||
Enabled *int `json:"enabled" name:"enabled"`
|
||||
Meta *string `json:"meta" name:"meta"`
|
||||
Owner *string `json:"owner" name:"owner"`
|
||||
OwnerName *string `json:"owner_name" name:"owner_name"`
|
||||
ProjectID *string `json:"project_id" name:"project_id"`
|
||||
ProjectName *string `json:"project_name" name:"project_name"`
|
||||
ResourceGroupID *string `json:"resource_group_id" name:"resource_group_id"`
|
||||
RootUserID *string `json:"root_user_id" name:"root_user_id"`
|
||||
Status *string `json:"status" name:"status"`
|
||||
}
|
||||
|
||||
func (v *Project) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type ProjectResourceItem struct {
|
||||
CreateTime *string `json:"create_time" name:"create_time"`
|
||||
Meta *string `json:"meta" name:"meta"`
|
||||
Owner *string `json:"owner" name:"owner"`
|
||||
ProjectID *string `json:"project_id" name:"project_id"`
|
||||
ProjectName *string `json:"project_name" name:"project_name"`
|
||||
ResourceGroupID *string `json:"resource_group_id" name:"resource_group_id"`
|
||||
ResourceID *string `json:"resource_id" name:"resource_id"`
|
||||
ResourceType *string `json:"resource_type" name:"resource_type"`
|
||||
RootUserID *string `json:"root_user_id" name:"root_user_id"`
|
||||
ZoneID *string `json:"zone_id" name:"zone_id"`
|
||||
}
|
||||
|
||||
func (v *ProjectResourceItem) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type QuotaLeft struct {
|
||||
Left *int `json:"left" name:"left"`
|
||||
ResourceType *string `json:"resource_type" name:"resource_type"`
|
||||
|
@ -2899,13 +2937,8 @@ func (v *Snapshot) Validate() error {
|
|||
}
|
||||
|
||||
type SnapshotResource struct {
|
||||
Architecture *string `json:"architecture" name:"architecture"`
|
||||
Filesystem *string `json:"filesystem" name:"filesystem"`
|
||||
MountOptions *string `json:"mount_options" name:"mount_options"`
|
||||
MountPoint *string `json:"mount_point" name:"mount_point"`
|
||||
Size *int `json:"size" name:"size"`
|
||||
VolumeID *string `json:"volume_id" name:"volume_id"`
|
||||
VolumeType *int `json:"volume_type" name:"volume_type"`
|
||||
OSFamily *string `json:"os_family" name:"os_family"`
|
||||
Platform *string `json:"platform" name:"platform"`
|
||||
}
|
||||
|
||||
func (v *SnapshotResource) Validate() error {
|
||||
|
|
|
@ -104,82 +104,6 @@ type AttachVolumesOutput struct {
|
|||
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
|
||||
}
|
||||
|
||||
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's available values: 0, 1, 2, 3, 4, 5, 10, 100, 200
|
||||
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 {
|
||||
volumeTypeValidValues := []string{"0", "1", "2", "3", "4", "5", "10", "100", "200"}
|
||||
volumeTypeParameterValue := fmt.Sprint(*v.VolumeType)
|
||||
|
||||
volumeTypeIsValid := false
|
||||
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"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/volume/create_volumes.html
|
||||
func (s *VolumeService) CreateVolumes(i *CreateVolumesInput) (*CreateVolumesOutput, error) {
|
||||
if i == nil {
|
||||
|
@ -334,6 +258,7 @@ 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"`
|
||||
|
|
|
@ -254,6 +254,7 @@ type DescribeVxNetsInput 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"`
|
||||
Tags []*string `json:"tags" name:"tags" location:"params"`
|
||||
// Verbose's available values: 0, 1
|
||||
|
|
Loading…
Reference in New Issue