| 1 | package VM::EC2::ProductCode; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::ProductCode - Object describing an Amazon EC2 product code | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | |||
| 11 | $ec2 = VM::EC2->new(...); | ||
| 12 | $volume = $ec2->describe_volumes('vol-123456'); | ||
| 13 | for my $g ($volume->product_codes) { | ||
| 14 | my $id = $g->productCode; | ||
| 15 | my $type = $g->type; | ||
| 16 | } | ||
| 17 | |||
| 18 | =head1 DESCRIPTION | ||
| 19 | |||
| 20 | This object represents the code and type of a product code. | ||
| 21 | |||
| 22 | =head1 METHODS | ||
| 23 | |||
| 24 | These object methods are supported: | ||
| 25 | |||
| 26 | productCode -- the product code | ||
| 27 | code -- shorter version of the above | ||
| 28 | type -- the type of product code ('devpay','marketplace') | ||
| 29 | |||
| 30 | =head1 STRING OVERLOADING | ||
| 31 | |||
| 32 | When used in a string context, this object will interpolate the | ||
| 33 | productCode | ||
| 34 | |||
| 35 | =head1 SEE ALSO | ||
| 36 | |||
| 37 | L<VM::EC2> | ||
| 38 | L<VM::EC2::Object> | ||
| 39 | L<VM::EC2::Generic> | ||
| 40 | L<VM::EC2::Instance> | ||
| 41 | L<VM::EC2::Volume> | ||
| 42 | |||
| 43 | =head1 AUTHOR | ||
| 44 | |||
| 45 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 46 | |||
| 47 | Copyright (c) 2011 Ontario Institute for Cancer Research | ||
| 48 | |||
| 49 | This package and its accompanying libraries is free software; you can | ||
| 50 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 51 | version 1, or at your option, any later version) or the Artistic | ||
| 52 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 53 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 54 | |||
| 55 | =cut | ||
| 56 | |||
| 57 | use strict; | ||
| 58 | use base 'VM::EC2::Generic'; | ||
| 59 | |||
| 60 | sub valid_fields { | ||
| 61 | my $self = shift; | ||
| 62 | return $self->SUPER::valid_fields, | ||
| 63 | qw(productCode type); | ||
| 64 | } | ||
| 65 | |||
| 66 | sub code { shift->productCode } | ||
| 67 | sub short_name {shift->productCode} | ||
| 68 | |||
| 69 | 1; | ||
| 70 |