support-clone-volume-and-upgrade-describe-volume

This commit is contained in:
huyujie 2019-07-09 23:32:28 +08:00
parent c8f8d40dd4
commit 9935dabdb4
2 changed files with 83 additions and 2 deletions

View File

@ -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 {

View File

@ -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 {