| 1 | package VM::EC2::AccountAttributes; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::AccountAttributes - Object describing an Amazon EC2 account attributes set | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | |||
| 11 | $ec2 = VM::EC2->new(...); | ||
| 12 | $attr = $ec2->describe_account_attributes('default-vpc'); | ||
| 13 | print $attr->name,' : ',join(',',$attr->values),"\n"; | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | This object represents values of a account attribute | ||
| 18 | |||
| 19 | =head1 METHODS | ||
| 20 | |||
| 21 | These object methods are supported: | ||
| 22 | AttributeName -- The attribute name | ||
| 23 | AttributeValueSet -- The attribute value set | ||
| 24 | name -- alias for AttributeName | ||
| 25 | values -- returns array of values returned in AttributeValueSet | ||
| 26 | |||
| 27 | =head1 STRING OVERLOADING | ||
| 28 | |||
| 29 | When used in a string context, this object will return a string containing | ||
| 30 | the name and values for the format name=value1,value2,etc | ||
| 31 | |||
| 32 | =head1 SEE ALSO | ||
| 33 | |||
| 34 | L<VM::EC2> | ||
| 35 | L<VM::EC2::Object> | ||
| 36 | L<VM::EC2::Generic> | ||
| 37 | |||
| 38 | =head1 AUTHOR | ||
| 39 | |||
| 40 | Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>. | ||
| 41 | |||
| 42 | Copyright (c) 2013 Loyalty Methods, Inc. | ||
| 43 | |||
| 44 | This package and its accompanying libraries is free software; you can | ||
| 45 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 46 | version 1, or at your option, any later version) or the Artistic | ||
| 47 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 48 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | use strict; | ||
| 53 | use base 'VM::EC2::Generic'; | ||
| 54 | |||
| 55 | sub primary_id { | ||
| 56 | my $self = shift; | ||
| 57 | return $self->name . '=' . join(',',$self->values) | ||
| 58 | } | ||
| 59 | |||
| 60 | sub valid_fields { | ||
| 61 | my $self = shift; | ||
| 62 | return $self->SUPER::valid_fields, | ||
| 63 | qw(attributeName attributeValueSet); | ||
| 64 | } | ||
| 65 | |||
| 66 | sub values { | ||
| 67 | my $self = shift; | ||
| 68 | my $set = $self->attributeValueSet; | ||
| 69 | my $values = $set->{item}; | ||
| 70 | return map { $_->{attributeValue} } @$values | ||
| 71 | } | ||
| 72 | |||
| 73 | sub name { shift->attributeName } | ||
| 74 | |||
| 75 | 1; | ||
| 76 |