« blib/lib/VM/EC2/ELB/Attributes.pm
↑ Summary
blib/lib/VM/EC2/ELB/Attributes/ConnectionDraining.pm »
| 1 | package VM::EC2::ELB::Attributes::AccessLog; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::ELB:Attributes::AccessLog - Object describing the AccessLog attributes | ||
| 6 | 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 $access_log = $lb->AccessLog; | ||
| 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 | EmitInterval -- The interval for publishing the access logs. You | ||
| 25 | can specify an interval of either 5 minutes or 60 | ||
| 26 | minutes. Default is 60 mins. | ||
| 27 | |||
| 28 | Enabled -- Specifies whether access log is enabled for the | ||
| 29 | load balancer. | ||
| 30 | |||
| 31 | S3BucketName -- The name of the Amazon S3 bucket where the access | ||
| 32 | logs are stored. | ||
| 33 | |||
| 34 | S3BucketPrefix -- The logical hierarchy you created for your Amazon | ||
| 35 | S3 bucket, for example my-bucket-prefix/prod. If | ||
| 36 | the prefix is not provided, the log is placed at | ||
| 37 | the root level of the bucket. | ||
| 38 | |||
| 39 | =head1 STRING OVERLOADING | ||
| 40 | |||
| 41 | When used in a string context, this object will interpolate the | ||
| 42 | instance state. | ||
| 43 | |||
| 44 | =head1 SEE ALSO | ||
| 45 | |||
| 46 | L<VM::EC2> | ||
| 47 | L<VM::EC2::Generic> | ||
| 48 | L<VM::EC2::ELB> | ||
| 49 | |||
| 50 | =head1 AUTHOR | ||
| 51 | |||
| 52 | Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>. | ||
| 53 | |||
| 54 | Copyright (c) 2014 Loyalty Methods, Inc. | ||
| 55 | |||
| 56 | This package and its accompanying libraries is free software; you can | ||
| 57 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 58 | version 1, or at your option, any later version) or the Artistic | ||
| 59 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 60 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | use strict; | ||
| 65 | use base 'VM::EC2::Generic'; | ||
| 66 | |||
| 67 | use overload | ||
| 68 | '""' => sub { | ||
| 69 | my $self = shift; | ||
| 70 | my $string = "Access Log:\n"; | ||
| 71 | if ($self->Enabled) { | ||
| 72 | $string .= ' Emit Interval=' . $self->EmitInterval; | ||
| 73 | $string .= "\n S3 Bucket=" . $self->S3BucketName; | ||
| 74 | $string .= "\n S3 Bucket Prefix=" . $self->S3BucketPrefix; | ||
| 75 | } else { | ||
| 76 | $string .= ' DISABLED'; | ||
| 77 | } | ||
| 78 | return $string}, | ||
| 79 | fallback => 1; | ||
| 80 | |||
| 81 | sub valid_fields { | ||
| 82 | my $self = shift; | ||
| 83 | return qw(EmitInterval Enabled S3BucketName S3BucketPrefix); | ||
| 84 | } | ||
| 85 | |||
| 86 | sub Enabled { | ||
| 87 | my $self = shift; | ||
| 88 | my $enabled = $self->SUPER::Enabled; | ||
| 89 | return $enabled eq 'true'; | ||
| 90 | } | ||
| 91 | |||
| 92 | 1; |