Skip to content

Commit

Permalink
Merge pull request jadeallenx#12 from stevecaldwell77/master
Browse files Browse the repository at this point in the history
Provisioned IOPS for EBS Volumes
  • Loading branch information
jadeallenx committed Aug 15, 2012
2 parents c2af3a9 + ee70fe7 commit 89e434a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
25 changes: 23 additions & 2 deletions lib/Net/Amazon/EC2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ environment.
=head1 VERSION
This is Net::Amazon::EC2 version 0.19
EC2 Query API version: '2011-01-01'
EC2 Query API version: '2012-07-20'
=head1 SYNOPSIS
Expand Down Expand Up @@ -161,7 +161,7 @@ has 'AWSAccessKeyId' => ( is => 'ro', isa => 'Str', required => 1 );
has 'SecretAccessKey' => ( is => 'ro', isa => 'Str', required => 1 );
has 'debug' => ( is => 'ro', isa => 'Str', required => 0, default => 0 );
has 'signature_version' => ( is => 'ro', isa => 'Int', required => 1, default => 1 );
has 'version' => ( is => 'ro', isa => 'Str', required => 1, default => '2011-01-01' );
has 'version' => ( is => 'ro', isa => 'Str', required => 1, default => '2012-07-20' );
has 'region' => ( is => 'ro', isa => 'Str', required => 1, default => 'us-east-1' );
has 'ssl' => ( is => 'ro', isa => 'Bool', required => 1, default => 0 );
has 'return_errors' => ( is => 'ro', isa => 'Bool', default => 0 );
Expand Down Expand Up @@ -969,6 +969,16 @@ The optional snapshot id to create the volume from.
The availability zone to create the volume in.
=item VolumeType (optional)
The volume type: 'standard' or 'io1'. Defaults to 'standard'.
=item Iops (optional)
The number of I/O operations per second (IOPS) that the volume
supports. Required when the volume type is io1; not used with
standard volumes.
=back
Returns a Net::Amazon::EC2::Volume object containing the resulting volume
Expand All @@ -982,6 +992,8 @@ sub create_volume {
Size => { type => SCALAR },
SnapshotId => { type => SCALAR, optional => 1 },
AvailabilityZone => { type => SCALAR },
VolumeType => { type => SCALAR, optional => 1 },
Iops => { type => SCALAR, optional => 1 },
});

my $xml = $self->_sign(Action => 'CreateVolume', %args);
Expand All @@ -1003,6 +1015,8 @@ sub create_volume {
create_time => $xml->{createTime},
snapshot_id => $xml->{snapshotId},
size => $xml->{size},
volume_type => $xml->{volumeType},
iops => $xml->{iops},
);

return $volume;
Expand Down Expand Up @@ -2583,6 +2597,8 @@ sub describe_volumes {
create_time => $volume_set->{createTime},
snapshot_id => $volume_set->{snapshotId},
size => $volume_set->{size},
volume_type => $volume_set->{volumeType},
iops => $volume_set->{iops},
tag_set => $tags,
attachments => $attachments,
);
Expand Down Expand Up @@ -3674,6 +3690,10 @@ Specifies the subnet ID within which to launch the instance(s) for Amazon Virtua
Specifies the idempotent instance id.
=item EbsOptimized (optional)
Whether the instance is optimized for EBS I/O.
=back
Returns a Net::Amazon::EC2::ReservationInfo object
Expand Down Expand Up @@ -3706,6 +3726,7 @@ sub run_instances {
DisableApiTermination => { type => SCALAR, optional => 1 },
InstanceInitiatedShutdownBehavior => { type => SCALAR, optional => 1 },
ClientToken => { type => SCALAR, optional => 1 },
EbsOptimized => { type => SCALAR, optional => 1 },
});

# If we have a array ref of instances lets split them out into their SecurityGroup.n format
Expand Down
13 changes: 12 additions & 1 deletion lib/Net/Amazon/EC2/Volume.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ The volume's status.
The time the volume was created.
=item volume_type (optional)
The volume type.
=item iops (optional)
The number of I/O operations per second (IOPS) that the volume
supports (only applies to volumes with a volume_type of io1).
=item attachments (optional)
An array ref of Net:Amazon::EC2::Attachment objects.
Expand All @@ -51,6 +60,8 @@ has 'snapshot_id' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 );
has 'zone' => ( is => 'ro', isa => 'Str', required => 1 );
has 'status' => ( is => 'ro', isa => 'Str', required => 1 );
has 'create_time' => ( is => 'ro', isa => 'Str', required => 1 );
has 'volume_type' => ( is => 'ro', isa => 'Str', default => 'standard');
has 'iops' => ( is => 'ro', isa => 'Maybe[Int]');
has 'attachments' => ( is => 'ro', isa => 'Maybe[ArrayRef[Net::Amazon::EC2::Attachment]]', required => 0 );
has 'tag_set' => ( is => 'ro', isa => 'Maybe[ArrayRef[Net::Amazon::EC2::TagSet]]', required => 0 );

Expand All @@ -68,4 +79,4 @@ under the same terms as Perl itself.
=cut

no Moose;
1;
1;
7 changes: 5 additions & 2 deletions t/02_live.t
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ my $run_result = $ec2->run_instances(
ImageId => "ami-26b6534f", # ec2-public-images/developer-image.manifest.xml
KeyName => "test_keys",
SecurityGroup => "test_group",
InstanceType => 'm1.small'
InstanceType => 'm1.small',
EbsOptimized => 0,
);
isa_ok($run_result, 'Net::Amazon::EC2::ReservationInfo');
ok($run_result->group_set->[0]->group_name eq "test_group", "Checking for running instance");
Expand All @@ -102,7 +103,9 @@ my $running_instances = $ec2->describe_instances();
my $seen_test_instance = 0;
foreach my $instance (@{$running_instances}) {
my $instance_set = $instance->instances_set->[0];
if ($instance_set->key_name eq "test_keys" and $instance_set->image_id eq "ami-26b6534f") {
my $key_name = $instance_set->key_name || '';
my $image_id = $instance_set->image_id || '';
if ($key_name eq 'test_keys' and $image_id eq 'ami-26b6534f') {
$seen_test_instance = 1;
}
}
Expand Down

0 comments on commit 89e434a

Please sign in to comment.