Fix non existing fields in gp2 discovery.

This commit is contained in:
Jan Mußler 2020-12-09 15:44:15 +01:00
parent b2e390ce20
commit ad965a191b
1 changed files with 7 additions and 2 deletions

View File

@ -72,14 +72,19 @@ func (r *EBSVolumeResizer) DescribeVolumes(volumeIds []string) ([]VolumeProperti
return nil, err
}
fmt.Printf("%v", volumeOutput)
p := []VolumeProperties{}
if nil == volumeOutput.Volumes {
return p, nil
}
for _, v := range volumeOutput.Volumes {
if *v.VolumeType == "gp3" {
p = append(p, VolumeProperties{VolumeID: *v.VolumeId, Size: *v.Size, VolumeType: *v.VolumeType, Iops: *v.Iops, Throughput: *v.Throughput})
} else if *v.VolumeType == "gp2" {
p = append(p, VolumeProperties{VolumeID: *v.VolumeId, Size: *v.Size, VolumeType: *v.VolumeType})
} else {
return nil, fmt.Errorf("Discovered unexpected volume type %s %s", *v.VolumeId, *v.VolumeType)
}
}
return p, nil