Class: Cumulus::ELB::ListenerConfig
- Inherits:
-
Object
- Object
- Cumulus::ELB::ListenerConfig
- Defined in:
- lib/elb/models/ListenerConfig.rb
Overview
Public: An object representing configuration for a listener
Instance Attribute Summary collapse
-
#instance_port ⇒ Object
readonly
Returns the value of attribute instance_port.
-
#instance_protocol ⇒ Object
readonly
Returns the value of attribute instance_protocol.
-
#load_balancer_port ⇒ Object
readonly
Returns the value of attribute load_balancer_port.
-
#load_balancer_protocol ⇒ Object
readonly
Returns the value of attribute load_balancer_protocol.
-
#policies ⇒ Object
readonly
Returns the value of attribute policies.
-
#ssl_certificate_id ⇒ Object
readonly
Returns the value of attribute ssl_certificate_id.
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) ⇒ ListenerConfig
constructor
Public: Constructor.
- #populate!(aws) ⇒ Object
- #to_aws ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(json = nil) ⇒ ListenerConfig
Public: Constructor
json - a hash containing the JSON configuration for the listener
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/elb/models/ListenerConfig.rb', line 19 def initialize(json = nil) if !json.nil? @load_balancer_protocol = json["load-balancer-protocol"] @load_balancer_port = json["load-balancer-port"] @instance_protocol = json["instance-protocol"] @instance_port = json["instance-port"] @ssl_certificate_id = json["ssl-certificate-id"] @policies = json["policies"] || [] end end |
Instance Attribute Details
#instance_port ⇒ Object (readonly)
Returns the value of attribute instance_port.
12 13 14 |
# File 'lib/elb/models/ListenerConfig.rb', line 12 def instance_port @instance_port end |
#instance_protocol ⇒ Object (readonly)
Returns the value of attribute instance_protocol.
11 12 13 |
# File 'lib/elb/models/ListenerConfig.rb', line 11 def instance_protocol @instance_protocol end |
#load_balancer_port ⇒ Object (readonly)
Returns the value of attribute load_balancer_port.
10 11 12 |
# File 'lib/elb/models/ListenerConfig.rb', line 10 def load_balancer_port @load_balancer_port end |
#load_balancer_protocol ⇒ Object (readonly)
Returns the value of attribute load_balancer_protocol.
9 10 11 |
# File 'lib/elb/models/ListenerConfig.rb', line 9 def load_balancer_protocol @load_balancer_protocol end |
#policies ⇒ Object (readonly)
Returns the value of attribute policies.
14 15 16 |
# File 'lib/elb/models/ListenerConfig.rb', line 14 def policies @policies end |
#ssl_certificate_id ⇒ Object (readonly)
Returns the value of attribute ssl_certificate_id.
13 14 15 |
# File 'lib/elb/models/ListenerConfig.rb', line 13 def ssl_certificate_id @ssl_certificate_id 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 ListenerDiffs that were found
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/elb/models/ListenerConfig.rb', line 66 def diff(aws) diffs = [] if @load_balancer_protocol != aws.listener.protocol diffs << ListenerDiff.new(ListenerChange::LB_PROTOCOL, aws.listener.protocol, @load_balancer_protocol) end if @load_balancer_port != aws.listener.load_balancer_port diffs << ListenerDiff.new(ListenerChange::LB_PORT, aws.listener.load_balancer_port, @load_balancer_port) end if @instance_protocol != aws.listener.instance_protocol diffs << ListenerDiff.new(ListenerChange::INST_PROTOCOL, aws.listener.instance_protocol, @instance_protocol) end if @instance_port != aws.listener.instance_port diffs << ListenerDiff.new(ListenerChange::INST_PORT, aws.listener.instance_port, @instance_port) end if @ssl_certificate_id != aws.listener.ssl_certificate_id diffs << ListenerDiff.new(ListenerChange::SSL, aws.listener.ssl_certificate_id, @ssl_certificate_id) end if @policies.sort != aws.policy_names.sort diffs << ListenerDiff.policies(aws.policy_names, @policies) end diffs end |
#populate!(aws) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/elb/models/ListenerConfig.rb', line 51 def populate!(aws) @load_balancer_protocol = aws.listener.protocol @load_balancer_port = aws.listener.load_balancer_port @instance_protocol = aws.listener.instance_protocol @instance_port = aws.listener.instance_port @ssl_certificate_id = aws.listener.ssl_certificate_id @policies = aws.policy_names end |
#to_aws ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/elb/models/ListenerConfig.rb', line 41 def to_aws { protocol: @load_balancer_protocol, load_balancer_port: @load_balancer_port, instance_protocol: @instance_protocol, instance_port: @instance_port, ssl_certificate_id: @ssl_certificate_id, }.reject { |k, v| v.nil? } end |
#to_hash ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/elb/models/ListenerConfig.rb', line 30 def to_hash { "load-balancer-protocol" => @load_balancer_protocol, "load-balancer-port" => @load_balancer_port, "instance-protocol" => @instance_protocol, "instance-port" => @instance_port, "ssl-certificate-id" => @ssl_certificate_id, "policies" => @policies, }.reject { |k, v| v.nil? } end |