Class: Cumulus::VPC::RouteConfig
- Inherits:
-
Object
- Object
- Cumulus::VPC::RouteConfig
- Defined in:
- lib/vpc/models/RouteConfig.rb
Overview
Public: An object representing configuration for a VPC route table route
Instance Attribute Summary collapse
-
#dest_cidr ⇒ Object
readonly
Returns the value of attribute dest_cidr.
-
#gateway_id ⇒ Object
readonly
Returns the value of attribute gateway_id.
-
#instance_id ⇒ Object
readonly
Returns the value of attribute instance_id.
-
#nat_gateway_id ⇒ Object
readonly
Returns the value of attribute nat_gateway_id.
-
#network_interface_id ⇒ Object
readonly
Returns the value of attribute network_interface_id.
-
#vpc_peering_connection_id ⇒ Object
readonly
Returns the value of attribute vpc_peering_connection_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) ⇒ RouteConfig
constructor
Public: Constructor.
- #populate!(aws) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(json = nil) ⇒ RouteConfig
Public: Constructor
json - a hash containing the JSON configuration for the route table route
22 23 24 25 26 27 28 29 30 |
# File 'lib/vpc/models/RouteConfig.rb', line 22 def initialize(json = nil) if !json.nil? @dest_cidr = json["dest-cidr"] @gateway_id = json["gateway-id"] @network_interface_id = json["network-interface-id"] @vpc_peering_connection_id = json["vpc-peering-connection-id"] @nat_gateway_id = json["nat-gateway-id"] end end |
Instance Attribute Details
#dest_cidr ⇒ Object (readonly)
Returns the value of attribute dest_cidr.
12 13 14 |
# File 'lib/vpc/models/RouteConfig.rb', line 12 def dest_cidr @dest_cidr end |
#gateway_id ⇒ Object (readonly)
Returns the value of attribute gateway_id.
13 14 15 |
# File 'lib/vpc/models/RouteConfig.rb', line 13 def gateway_id @gateway_id end |
#instance_id ⇒ Object (readonly)
Returns the value of attribute instance_id.
14 15 16 |
# File 'lib/vpc/models/RouteConfig.rb', line 14 def instance_id @instance_id end |
#nat_gateway_id ⇒ Object (readonly)
Returns the value of attribute nat_gateway_id.
17 18 19 |
# File 'lib/vpc/models/RouteConfig.rb', line 17 def nat_gateway_id @nat_gateway_id end |
#network_interface_id ⇒ Object (readonly)
Returns the value of attribute network_interface_id.
15 16 17 |
# File 'lib/vpc/models/RouteConfig.rb', line 15 def network_interface_id @network_interface_id end |
#vpc_peering_connection_id ⇒ Object (readonly)
Returns the value of attribute vpc_peering_connection_id.
16 17 18 |
# File 'lib/vpc/models/RouteConfig.rb', line 16 def vpc_peering_connection_id @vpc_peering_connection_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 RouteDiffs 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/vpc/models/RouteConfig.rb', line 58 def diff(aws) diffs = [] if @gateway_id != aws.gateway_id diffs << RouteDiff.new(RouteChange::GATEWAY, aws.gateway_id, @gateway_id) end if @network_interface_id != aws.network_interface_id diffs << RouteDiff.new(RouteChange::NETWORK, aws.network_interface_id, @network_interface_id) end if @vpc_peering_connection_id != aws.vpc_peering_connection_id diffs << RouteDiff.new(RouteChange::VPC_PEERING, aws.vpc_peering_connection_id, @vpc_peering_connection_id) end if @nat_gateway_id != aws.nat_gateway_id diffs << RouteDiff.new(RouteChange::NAT_GATEWAY, aws.nat_gateway_id, @nat_gateway_id) end diffs end |
#populate!(aws) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/vpc/models/RouteConfig.rb', line 42 def populate!(aws) @dest_cidr = aws.destination_cidr_block @gateway_id = aws.gateway_id @network_interface_id = aws.network_interface_id @vpc_peering_connection_id = aws.vpc_peering_connection_id @nat_gateway_id = aws.nat_gateway_id self end |
#to_hash ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/vpc/models/RouteConfig.rb', line 32 def to_hash { "dest-cidr" => @dest_cidr, "gateway-id" => @gateway_id, "network-interface-id" => @network_interface_id, "vpc-peering-connection-id" => @vpc_peering_connection_id, "nat-gateway-id" => @nat_gateway_id, }.reject { |k, v| v.nil? } end |