Subject: | feature request (release VPC Elastic IP) |
Date: | Mon, 16 Mar 2015 11:21:27 +0200 |
To: | bug-Net-Amazon-EC2 [...] rt.cpan.org |
From: | Igor Tsigankov <tsiganenok [...] gmail.com> |
Hi,
The release_address method isn't working for vpc addresses.
Amazon requirement to release ip allocated in vpc is to pass allocation id
instead of PublicIp:
Amazon EC2 Errors [Request 99774cf3-9e75-4396-845a-a65770e3b017]:
[InvalidParameterValue] You must specify an allocation id when releasing a
VPC elastic IP address
and it can't be used together with ip:
Amazon EC2 Errors [Request e61529b6-6d63-42bd-82d5-35eae4a08394]:
[InvalidParameterCombination] You may specify public IP or allocation id,
but not both in the same call
The simplest way to fix is (IMHO) adding another function, following your
convention should look something like this:
sub release_vpc_address {
my $self = shift;
my %args = validate( @_, {
AllocationId => { type => SCALAR },
});
my $xml = $self->_sign(Action => 'ReleaseAddress', %args);
if ( grep { defined && length } $xml->{Errors} ) {
return $self->_parse_errors($xml);
}
else {
if ($xml->{return} eq 'true') {
return 1;
}
else {
return undef;
}
}
}
or updating current function as follows:
sub release_address {
my $self = shift;
my %args = validate( @_, {
PublicIp => { type => SCALAR, optional => 1
},
AllocationId => { type => SCALAR, optional => 1 },
});
my $xml = $self->_sign(Action => 'ReleaseAddress', %args);
if ( grep { defined && length } $xml->{Errors} ) {
return $self->_parse_errors($xml);
}
else {
if ($xml->{return} eq 'true') {
return 1;
}
else {
return undef;
}
}
}
both checked and found working.
Module version used is 0.29.
B.R.