only pass set variable to modify input
This commit is contained in:
parent
e35e217064
commit
19b56cf7a1
|
|
@ -155,31 +155,32 @@ func (r *EBSVolumeResizer) ResizeVolume(volumeID string, newSize int64) error {
|
||||||
|
|
||||||
// ModifyVolume Modify EBS volume
|
// ModifyVolume Modify EBS volume
|
||||||
func (r *EBSVolumeResizer) ModifyVolume(volumeID string, newType *string, newSize *int64, iops *int64, throughput *int64) error {
|
func (r *EBSVolumeResizer) ModifyVolume(volumeID string, newType *string, newSize *int64, iops *int64, throughput *int64) error {
|
||||||
/* first check if the volume is already of a requested size */
|
|
||||||
var sizeInt32 *int32
|
var sizeInt32 *int32
|
||||||
var iopsInt32 *int32
|
var iopsInt32 *int32
|
||||||
var throughputInt32 *int32
|
var throughputInt32 *int32
|
||||||
|
|
||||||
|
input := ec2.ModifyVolumeInput{
|
||||||
|
VolumeId: &volumeID,
|
||||||
|
}
|
||||||
if newSize != nil {
|
if newSize != nil {
|
||||||
s := int32(*newSize)
|
s := int32(*newSize)
|
||||||
sizeInt32 = &s
|
sizeInt32 = &s
|
||||||
|
input.Size = sizeInt32
|
||||||
}
|
}
|
||||||
if iops != nil {
|
if iops != nil {
|
||||||
i := int32(*iops)
|
i := int32(*iops)
|
||||||
iopsInt32 = &i
|
iopsInt32 = &i
|
||||||
|
input.Iops = iopsInt32
|
||||||
}
|
}
|
||||||
if throughput != nil {
|
if throughput != nil {
|
||||||
t := int32(*throughput)
|
t := int32(*throughput)
|
||||||
throughputInt32 = &t
|
throughputInt32 = &t
|
||||||
}
|
input.Throughput = throughputInt32
|
||||||
input := ec2.ModifyVolumeInput{
|
|
||||||
Size: sizeInt32,
|
|
||||||
VolumeId: &volumeID,
|
|
||||||
Iops: iopsInt32,
|
|
||||||
Throughput: throughputInt32,
|
|
||||||
}
|
}
|
||||||
if newType != nil {
|
if newType != nil {
|
||||||
input.VolumeType = types.VolumeType(*newType)
|
input.VolumeType = types.VolumeType(*newType)
|
||||||
}
|
}
|
||||||
|
|
||||||
output, err := r.connection.ModifyVolume(context.TODO(), &input)
|
output, err := r.connection.ModifyVolume(context.TODO(), &input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not modify persistent volume: %v", err)
|
return fmt.Errorf("could not modify persistent volume: %v", err)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue