Class: Cumulus::ELB::AccessLogConfig
- Inherits:
-
Object
- Object
- Cumulus::ELB::AccessLogConfig
- Defined in:
- lib/elb/models/AccessLogConfig.rb
Overview
Public: An object representing configuration for a load balancer
Instance Attribute Summary collapse
-
#bucket_prefix ⇒ Object
readonly
Returns the value of attribute bucket_prefix.
-
#emit_interval ⇒ Object
readonly
Returns the value of attribute emit_interval.
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#s3_bucket ⇒ Object
readonly
Returns the value of attribute s3_bucket.
Instance Method Summary collapse
-
#diff(aws) ⇒ Object
Public: Produce an array of differences between this local configuration and the configuration in AWS.
-
#initialize(json = nil) ⇒ AccessLogConfig
constructor
Public: Constructor.
- #populate!(aws) ⇒ Object
- #to_aws ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(json = nil) ⇒ AccessLogConfig
Public: Constructor
json - a hash containing the JSON configuration for the load balancer
15 16 17 18 19 20 21 22 |
# File 'lib/elb/models/AccessLogConfig.rb', line 15 def initialize(json = nil) @enabled = !json.nil? if !json.nil? @s3_bucket = json["s3-bucket"] @emit_interval = json["emit-interval"] @bucket_prefix = json["bucket-prefix"] end end |
Instance Attribute Details
#bucket_prefix ⇒ Object (readonly)
Returns the value of attribute bucket_prefix.
10 11 12 |
# File 'lib/elb/models/AccessLogConfig.rb', line 10 def bucket_prefix @bucket_prefix end |
#emit_interval ⇒ Object (readonly)
Returns the value of attribute emit_interval.
9 10 11 |
# File 'lib/elb/models/AccessLogConfig.rb', line 9 def emit_interval @emit_interval end |
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
7 8 9 |
# File 'lib/elb/models/AccessLogConfig.rb', line 7 def enabled @enabled end |
#s3_bucket ⇒ Object (readonly)
Returns the value of attribute s3_bucket.
8 9 10 |
# File 'lib/elb/models/AccessLogConfig.rb', line 8 def s3_bucket @s3_bucket end |
Instance Method Details
#diff(aws) ⇒ Object
Public: Produce an array of differences between this local configuration and the configuration in AWS
aws - the AWS resource
Returns an array of the HealthCheckDiffs that were found
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/elb/models/AccessLogConfig.rb', line 58 def diff(aws) diffs = [] if @enabled != aws.enabled diffs << AccessLogDiff.new(AccessLogChange::ENABLED, aws.enabled, @enabled) end if @s3_bucket != aws.s3_bucket_name diffs << AccessLogDiff.new(AccessLogChange::BUCKET, aws.s3_bucket_name, @s3_bucket) end if @emit_interval != aws.emit_interval diffs << AccessLogDiff.new(AccessLogChange::EMIT, aws.emit_interval, @emit_interval) end if @bucket_prefix != aws.s3_bucket_prefix diffs << AccessLogDiff.new(AccessLogChange::PREFIX, aws.s3_bucket_prefix, @bucket_prefix) end diffs.flatten end |
#populate!(aws) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/elb/models/AccessLogConfig.rb', line 45 def populate!(aws) @enabled = aws.enabled @s3_bucket = aws.s3_bucket_name @emit_interval = aws.emit_interval @bucket_prefix = aws.s3_bucket_prefix end |
#to_aws ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/elb/models/AccessLogConfig.rb', line 36 def to_aws { enabled: @enabled, s3_bucket_name: @s3_bucket, emit_interval: @emit_interval, s3_bucket_prefix: @bucket_prefix, }.reject { |k, v| v.nil? } end |
#to_hash ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/elb/models/AccessLogConfig.rb', line 24 def to_hash if @enabled { "s3-bucket" => @s3_bucket, "emit-interval" => @emit_interval, "bucket-prefix" => @bucket_prefix, }.reject { |k, v| v.nil? } else false end end |