« blib/lib/VM/EC2/ELB/Attributes/AccessLog.pm
↑ Summary
blib/lib/VM/EC2/ELB/Attributes/ConnectionSettings.pm »
| 1 | package VM::EC2::ELB::Attributes::ConnectionDraining; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::ELB:Attributes::ConnectionDraining - Object describing the | ||
| 6 | ConnectionDraining attribute of an Elastic Load Balancer. | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | use VM::EC2; | ||
| 11 | |||
| 12 | my $ec2 = VM::EC2->new(...); | ||
| 13 | my $lb = $ec2->describe_load_balancer_attributes('my-lb'); | ||
| 14 | my $conn_drain = $lb->ConnectionDraining; | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | This object is returned as part of the DescribeLoadBalancerAttributes API call. | ||
| 19 | |||
| 20 | =head1 METHODS | ||
| 21 | |||
| 22 | The following object methods are supported: | ||
| 23 | |||
| 24 | Enabled -- Specifies whether connection draining is enabled | ||
| 25 | for the load balancer. | ||
| 26 | |||
| 27 | Timeout -- Specifies the maximum time (in seconds) to keep | ||
| 28 | the existing connections open before deregistering | ||
| 29 | the instances. | ||
| 30 | |||
| 31 | =head1 STRING OVERLOADING | ||
| 32 | |||
| 33 | When used in a string context, this object will interpolate the | ||
| 34 | instance state. | ||
| 35 | |||
| 36 | =head1 SEE ALSO | ||
| 37 | |||
| 38 | L<VM::EC2> | ||
| 39 | L<VM::EC2::Generic> | ||
| 40 | L<VM::EC2::ELB> | ||
| 41 | |||
| 42 | =head1 AUTHOR | ||
| 43 | |||
| 44 | Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>. | ||
| 45 | |||
| 46 | Copyright (c) 2014 Loyalty Methods, Inc. | ||
| 47 | |||
| 48 | This package and its accompanying libraries is free software; you can | ||
| 49 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 50 | version 1, or at your option, any later version) or the Artistic | ||
| 51 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 52 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | use strict; | ||
| 57 | use base 'VM::EC2::Generic'; | ||
| 58 | |||
| 59 | use overload | ||
| 60 | '""' => sub { | ||
| 61 | my $self = shift; | ||
| 62 | my $string = "Connection Draining:\n"; | ||
| 63 | if ($self->Enabled) { | ||
| 64 | $string .= " ENABLED"; | ||
| 65 | } else { | ||
| 66 | $string .= " DISABLED"; | ||
| 67 | } | ||
| 68 | return $string}, | ||
| 69 | fallback => 1; | ||
| 70 | |||
| 71 | sub valid_fields { | ||
| 72 | my $self = shift; | ||
| 73 | return qw(Enabled Timeout); | ||
| 74 | } | ||
| 75 | |||
| 76 | sub Enabled { | ||
| 77 | my $self = shift; | ||
| 78 | my $enabled = $self->SUPER::Enabled; | ||
| 79 | return $enabled eq 'true'; | ||
| 80 | } | ||
| 81 | |||
| 82 | 1; |