1package VM::EC2::ELB::Listener; 2 3=head1 NAME 4 5VM::EC2::ELB:Listener - Elastic Load Balancer Listener 6 7=head1 SYNOPSIS 8 9 use VM::EC2; 10 11 my $ec2 = VM::EC2->new(...); 12 my $lb = $ec2->describe_load_balancers('my-lb'); 13 my @http_listeners = map { grep { $_->LoadBalancerPort eq '80' } $_->Listener } $lb->ListenerDescriptions; 14 15=head1 DESCRIPTION 16 17This object is used to describe a listener attached to an Elastic Load 18Balancer. 19 20=head1 METHODS 21 22The following object methods are supported: 23 24 Protocol -- The protocol of the load balancer listener 25 LoadBalancerPort -- The port the listener is listening on 26 InstanceProtocol -- The protocol the load balancer uses to communicate 27 with the instance 28 InstancePort -- The port on the instance the load balancer connects to 29 SSLCertificateId -- The ARN string of the server certificate 30 31=head1 STRING OVERLOADING 32 33When used in a string context, this object will return a string containing 34all the parameters of the listener in a pretty format. 35 36 37=head1 SEE ALSO 38 39L<VM::EC2> 40L<VM::EC2::Generic> 41L<VM::EC2::ELB> 42L<VM::EC2::ELB::ListenerDescription> 43 44=head1 AUTHOR 45 46Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>. 47 48Copyright (c) 2012 Loyalty Methods, Inc. 49 50This package and its accompanying libraries is free software; you can 51redistribute it and/or modify it under the terms of the GPL (either 52version 1, or at your option, any later version) or the Artistic 53License 2.0. Refer to LICENSE for the full license text. In addition, 54please see DISCLAIMER.txt for disclaimers of warranty. 55 56=cut 57 58use strict; 59use base 'VM::EC2::Generic'; 60 61sub valid_fields { 62 my $self = shift; 63 return qw(InstancePort InstanceProtocol LoadBalancerPort Protocol SSLCertificateId); 64} 65 66use overload 67 '""' => sub { 68 my $self = shift; 69 my $string = $self->Protocol . ':' . $self->LoadBalancerPort . ' --> ' . $self->InstanceProtocol . ':' . $self->InstancePort; 70 my $ssl_id = $self->SSLCertificateId; 71 $string .= ':' . $ssl_id if (defined $ssl_id); 72 return $string}, 73 fallback => 1; 74 75sub InstanceProtocol { 76 my $self = shift; 77 my $instance_protocol = $self->SUPER::InstanceProtocol; 78 return defined $instance_protocol ? $instance_protocol : $self->Protocol; 79} 80 811; 82