diff --git a/service/types.go b/service/types.go index 41b2b49..bf7734b 100644 --- a/service/types.go +++ b/service/types.go @@ -2899,8 +2899,13 @@ func (v *Snapshot) Validate() error { } type SnapshotResource struct { - OSFamily *string `json:"os_family" name:"os_family"` - Platform *string `json:"platform" name:"platform"` + 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"` } func (v *SnapshotResource) Validate() error { diff --git a/service/volume.go b/service/volume.go index 905d858..ee53253 100644 --- a/service/volume.go +++ b/service/volume.go @@ -104,6 +104,82 @@ 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 {