« blib/lib/VM/EC2/ReservationSet.pm
↑ Summary
blib/lib/VM/EC2/ReservedInstance/Listing/InstanceCount.pm »
| 1 | package VM::EC2::ReservedInstance::Listing; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::ReservedInstance::Listing - Object describing an Amazon EC2 reserved instance listing | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | |||
| 11 | $ec2 = VM::EC2->new(...); | ||
| 12 | @listings = $ec2->describe_reserved_instances_listings(); | ||
| 13 | for my $l (@listings) { | ||
| 14 | print $l->reservedInstancesId,"\n"; | ||
| 15 | print $l->createDate,"\n"; | ||
| 16 | print $l->status,"\n"; | ||
| 17 | } | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | This object represents an Amazon EC2 reserved instance listing, as | ||
| 22 | returned by VM::EC2->describe_reserved_instances_listings(). | ||
| 23 | |||
| 24 | =head1 METHODS | ||
| 25 | |||
| 26 | These object methods are supported: | ||
| 27 | |||
| 28 | reservedInstancesListingId -- ID of this listing | ||
| 29 | |||
| 30 | reservedInstancesId -- The ID of the Reserved Instance | ||
| 31 | |||
| 32 | createDate -- The time the listing was created | ||
| 33 | |||
| 34 | updateDate -- The last modified timestamp of the listing | ||
| 35 | |||
| 36 | status -- The status of the Reserved Instance listing | ||
| 37 | Valid values: | ||
| 38 | active | pending | cancelled | closed | ||
| 39 | |||
| 40 | statusMessage -- The reason for the current status of the listing | ||
| 41 | The response can be blank. | ||
| 42 | |||
| 43 | instanceCounts -- Number of instances in this state | ||
| 44 | |||
| 45 | priceSchedules -- Price of the Reserved Instance listing | ||
| 46 | |||
| 47 | clientToken -- The idempotency token you provided when you | ||
| 48 | created the listing | ||
| 49 | |||
| 50 | =head1 STRING OVERLOADING | ||
| 51 | |||
| 52 | When used in a string context, this object will interpolate the | ||
| 53 | reservedInstancesListingId. | ||
| 54 | |||
| 55 | =head1 SEE ALSO | ||
| 56 | |||
| 57 | L<VM::EC2> | ||
| 58 | L<VM::EC2::Generic> | ||
| 59 | |||
| 60 | =head1 AUTHOR | ||
| 61 | |||
| 62 | Lance Kinley E<lt>lkinley@loyaltymethods.com<gt>. | ||
| 63 | |||
| 64 | Copyright (c) 2014 Loyalty Methods, Inc. | ||
| 65 | |||
| 66 | This package and its accompanying libraries is free software; you can | ||
| 67 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 68 | version 1, or at your option, any later version) or the Artistic | ||
| 69 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 70 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | use strict; | ||
| 75 | use base 'VM::EC2::Generic'; | ||
| 76 | use VM::EC2::ReservedInstance::Listing::InstanceCount; | ||
| 77 | use VM::EC2::ReservedInstance::Listing::PriceSchedule; | ||
| 78 | |||
| 79 | use overload | ||
| 80 | '""' => sub { | ||
| 81 | my $self = shift; | ||
| 82 | return $self->reservedInstancesListingId }, | ||
| 83 | fallback => 1; | ||
| 84 | |||
| 85 | sub valid_fields { | ||
| 86 | my $self = shift; | ||
| 87 | return qw(reservedInstancesListingId reservedInstancesId createDate | ||
| 88 | updateDate status statusMessage instanceCounts | ||
| 89 | priceSchedules clientToken); | ||
| 90 | } | ||
| 91 | |||
| 92 | sub instanceCounts { | ||
| 93 | my $self = shift; | ||
| 94 | my $ic = $self->SUPER::instanceCounts or return; | ||
| 95 | return map { VM::EC2::ReservedInstance::Listing::InstanceCount->new($_,$self->aws,$self->xmlns,$self->requestId) } | ||
| 96 | @{$ic->{item}}; | ||
| 97 | } | ||
| 98 | |||
| 99 | sub priceSchedules { | ||
| 100 | my $self = shift; | ||
| 101 | my $ps = $self->SUPER::priceSchedules or return; | ||
| 102 | return map { VM::EC2::ReservedInstance::Listing::PriceSchedule->new($_,$self->aws,$self->xmlns,$self->requestId) } | ||
| 103 | @{$ps->{item}}; | ||
| 104 | } | ||
| 105 | |||
| 106 | 1; |