« blib/lib/VM/EC2/ReservedInstance/Listing/InstanceCount.pm
↑ Summary
blib/lib/VM/EC2/ReservedInstance/Modification.pm »
| 1 | package VM::EC2::ReservedInstance::Listing::PriceSchedule; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::ReservedInstance::Listing::PriceSchedule - Object describing an Amazon EC2 reserved instance | ||
| 6 | listing price schedule | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | use VM::EC2; | ||
| 11 | |||
| 12 | $ec2 = VM::EC2->new(...); | ||
| 13 | @listings = $ec2->describe_reserved_instances_listings(); | ||
| 14 | for my $l (@listings) { | ||
| 15 | foreach ($l->priceSchedules) { | ||
| 16 | print $_,"\n"; | ||
| 17 | } | ||
| 18 | } | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | This object represents an Amazon EC2 reserved instance listing price schedule | ||
| 23 | (PriceScheduleSetItemType) | ||
| 24 | |||
| 25 | =head1 METHODS | ||
| 26 | |||
| 27 | These object methods are supported: | ||
| 28 | |||
| 29 | term -- The number of months remaining in the reservation | ||
| 30 | |||
| 31 | price -- The fixed price for the term | ||
| 32 | |||
| 33 | currencyCode -- The currency for transacting the Reserved Instance resale. | ||
| 34 | At this time, the only supported currency is USD | ||
| 35 | |||
| 36 | active -- The current price schedule, as determined by the term | ||
| 37 | remaining for the Reserved Instance in the listing | ||
| 38 | |||
| 39 | =head1 STRING OVERLOADING | ||
| 40 | |||
| 41 | When used in a string context, this object will interpolate the | ||
| 42 | reservedInstancesListingId. | ||
| 43 | |||
| 44 | =head1 SEE ALSO | ||
| 45 | |||
| 46 | L<VM::EC2> | ||
| 47 | L<VM::EC2::Generic> | ||
| 48 | |||
| 49 | =head1 AUTHOR | ||
| 50 | |||
| 51 | Lance Kinley E<lt>lkinley@loyaltymethods.com<gt>. | ||
| 52 | |||
| 53 | Copyright (c) 2014 Loyalty Methods, Inc. | ||
| 54 | |||
| 55 | This package and its accompanying libraries is free software; you can | ||
| 56 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 57 | version 1, or at your option, any later version) or the Artistic | ||
| 58 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 59 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | use strict; | ||
| 64 | use base 'VM::EC2::Generic'; | ||
| 65 | |||
| 66 | use overload | ||
| 67 | '""' => sub { | ||
| 68 | my $self = shift; | ||
| 69 | return $self->term . ' ' . $self->price . ' ' . $self->currencyCode . | ||
| 70 | $self->active eq 'true' ? 'active' : 'inactive' }, | ||
| 71 | fallback => 1; | ||
| 72 | |||
| 73 | sub valid_fields { | ||
| 74 | my $self = shift; | ||
| 75 | return qw(term price currencyCode active); | ||
| 76 | } | ||
| 77 | |||
| 78 | sub active { | ||
| 79 | my $self = shift; | ||
| 80 | my $active = $self->SUPER::active; | ||
| 81 | return $active eq 'true' | ||
| 82 | } | ||
| 83 | |||
| 84 | 1; |