Class: DrawCloud::RouteTableEntry
- Defined in:
- lib/draw_cloud/route_table_entry.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#to ⇒ Object
Returns the value of attribute to.
-
#via ⇒ Object
Returns the value of attribute via.
Attributes inherited from Base
#as_groups, #as_launch_configurations, #deletion_policy, #depends_on, #ec2_instances, #elastic_ips, #gateways, #iam_access_keys, #iam_policies, #iam_users, #mappings, #metadata, #network_acls, #network_interfaces, #outputs, #parameters, #parent, #rdses, #resources, #route_tables, #security_groups, #sns_topics, #subnets, #vpcs, #wait_handles
Instance Method Summary collapse
-
#initialize(name, to, via, options = {}) ⇒ RouteTableEntry
constructor
A new instance of RouteTableEntry.
- #load_into_config(config) ⇒ Object
- #resource_name ⇒ Object
- #to_h ⇒ Object
Methods inherited from Base
#[], #accessor, #add_standard_properties, #create_as_group, #create_as_launch_configuration, #create_ec2_instance, #create_ec2_instance_template, #create_elastic_ip, #create_iam_access_key, #create_iam_policy, #create_iam_user, #create_mapping, #create_network_acl, #create_network_interface, #create_output, #create_parameter, #create_rds, #create_route_table, #create_security_group, #create_service, #create_sns_topic, #create_subnet, #create_vpc, #create_wait_handle, #ref
Methods included from Locations
Methods included from Utilities
#desplice, #fnbase64, #fngetatt, #fnjoin, #hash_to_tag_array, #region, #resource_style, #splice, #stack_name
Constructor Details
#initialize(name, to, via, options = {}) ⇒ RouteTableEntry
Returns a new instance of RouteTableEntry.
22 23 24 25 26 27 |
# File 'lib/draw_cloud/route_table_entry.rb', line 22 def initialize(name, to, via, ={}) @name = name @to = to @via = via super() end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/draw_cloud/route_table_entry.rb', line 21 def name @name end |
#to ⇒ Object
Returns the value of attribute to.
21 22 23 |
# File 'lib/draw_cloud/route_table_entry.rb', line 21 def to @to end |
#via ⇒ Object
Returns the value of attribute via.
21 22 23 |
# File 'lib/draw_cloud/route_table_entry.rb', line 21 def via @via end |
Instance Method Details
#load_into_config(config) ⇒ Object
29 30 31 32 33 |
# File 'lib/draw_cloud/route_table_entry.rb', line 29 def load_into_config(config) # FIXME: emit error if no table attached config.cf_add_resource resource_name, self super(config) end |
#resource_name ⇒ Object
35 36 37 |
# File 'lib/draw_cloud/route_table_entry.rb', line 35 def resource_name route_table.resource_name + "To" + resource_style(name) end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/draw_cloud/route_table_entry.rb', line 39 def to_h h = { "Type" => "AWS::EC2::Route", "Properties" => { "RouteTableId" => DrawCloud.ref(route_table), "DestinationCidrBlock" => to, } } if via.nil? throw ArgumentError, "Route #{resource_name} requires :via" elsif via.internet_gateway h["Properties"]["GatewayId"] = DrawCloud.ref(via.internet_gateway) # TODO: ["NetworkInterfaceId"] elsif via.ec2_instance h["Properties"]["InstanceId"] = DrawCloud.ref(via.ec2_instance) end add_standard_properties(h) end |