« blib/lib/VM/EC2/ELB/PolicyAttributeType.pm
↑ Summary
blib/lib/VM/EC2/ELB/PolicyTypeDescription.pm »
| 1 | package VM::EC2::ELB::PolicyDescription; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::ELB::PolicyDescription - Load Balancer Policy | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | |||
| 11 | my $ec2 = VM::EC2->new(...); | ||
| 12 | my $lb = $ec2->describe_load_balancers(-load_balancer_name=>'my-lb'); | ||
| 13 | my @policy = $lb->describe_policies; | ||
| 14 | foreach (@policy) { | ||
| 15 | print $_->PolicyName," : ",$_->PolicyTypeName,"\n"; | ||
| 16 | } | ||
| 17 | |||
| 18 | =head1 DESCRIPTION | ||
| 19 | |||
| 20 | This object is used to describe the result of a DescribeLoadBalancerPolicies | ||
| 21 | ELB API call. | ||
| 22 | |||
| 23 | =head1 METHODS | ||
| 24 | |||
| 25 | The following object methods are supported: | ||
| 26 | |||
| 27 | PolicyName -- The policy name | ||
| 28 | PolicyTypeName -- A L<VM::EC2::ELB::PolicyTypeDescription> object | ||
| 29 | PolicyAttributeDescriptions -- A series of L<VM::EC2::ELB::PolicyAttribute> | ||
| 30 | objects | ||
| 31 | policy_attributes -- Alias for PolicyAttributeDescriptions | ||
| 32 | |||
| 33 | =head1 STRING OVERLOADING | ||
| 34 | |||
| 35 | In string context, the object returns the Policy Name. | ||
| 36 | |||
| 37 | =head1 SEE ALSO | ||
| 38 | |||
| 39 | L<VM::EC2> | ||
| 40 | L<VM::EC2::Generic> | ||
| 41 | L<VM::EC2::ELB> | ||
| 42 | L<VM::EC2::ELB::Policies> | ||
| 43 | L<VM::EC2::ELB::PolicyAttribute> | ||
| 44 | L<VM::EC2::ELB::PolicyTypeDescription> | ||
| 45 | |||
| 46 | =head1 AUTHOR | ||
| 47 | |||
| 48 | Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>. | ||
| 49 | |||
| 50 | Copyright (c) 2012 Loyalty Methods, Inc. | ||
| 51 | |||
| 52 | This package and its accompanying libraries is free software; you can | ||
| 53 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 54 | version 1, or at your option, any later version) or the Artistic | ||
| 55 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 56 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | use strict; | ||
| 61 | use base 'VM::EC2::Generic'; | ||
| 62 | use VM::EC2::ELB::PolicyAttribute; | ||
| 63 | |||
| 64 | use overload | ||
| 65 | '""' => sub { shift->PolicyName }, | ||
| 66 | fallback => 1; | ||
| 67 | |||
| 68 | sub valid_fields { | ||
| 69 | my $self = shift; | ||
| 70 | return qw(PolicyAttributeDescriptions PolicyName PolicyTypeName); | ||
| 71 | } | ||
| 72 | |||
| 73 | sub PolicyAttributeDescriptions { | ||
| 74 | my $self = shift; | ||
| 75 | my $attr_desc = $self->SUPER::PolicyAttributeDescriptions; | ||
| 76 | return map { VM::EC2::ELB::PolicyAttribute->new($_,$self->aws) } @{$attr_desc->{member}}; | ||
| 77 | } | ||
| 78 | |||
| 79 | sub PolicyTypeName { | ||
| 80 | my $self = shift; | ||
| 81 | my $ptn = $self->SUPER::PolicyTypeName; | ||
| 82 | return $self->aws->describe_load_balancer_policy_types($ptn); | ||
| 83 | } | ||
| 84 | |||
| 85 | sub policy_attributes { shift->PolicyAttributeDescriptions } | ||
| 86 | |||
| 87 | 1; |