Class: ZAWS::External::AWSCLI::Generators::Result::EC2::RouteTables
- Inherits:
-
Object
- Object
- ZAWS::External::AWSCLI::Generators::Result::EC2::RouteTables
- Defined in:
- lib/zaws/external/awscli/generators/result/ec2/route_tables.rb
Instance Method Summary collapse
- #add(route_tables) ⇒ Object
- #associate_subnets(route_table_number, subnets) ⇒ Object
- #get_json ⇒ Object
- #get_json_single_route_table(index) ⇒ Object
- #get_route_tables_array ⇒ Object
-
#initialize ⇒ RouteTables
constructor
A new instance of RouteTables.
- #propagate_to_virtual_gateway(route_table_number, gateway) ⇒ Object
- #resize_route_tables_array(index) ⇒ Object
- #route_table_id(route_table_number, id) ⇒ Object
- #routes(route_table_number, routes) ⇒ Object
- #vpc_id(route_table_number, vpc_id) ⇒ Object
Constructor Details
#initialize ⇒ RouteTables
Returns a new instance of RouteTables.
8 9 10 11 12 13 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 8 def initialize @route_tables= {} @route_tables["RouteTables"]= [] @route_tables["Associations"]= [] self end |
Instance Method Details
#add(route_tables) ⇒ Object
36 37 38 39 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 36 def add(route_tables) @route_tables["RouteTables"].concat(route_tables.get_route_tables_array) self end |
#associate_subnets(route_table_number, subnets) ⇒ Object
47 48 49 50 51 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 47 def associate_subnets(route_table_number, subnets) resize_route_tables_array(route_table_number) @route_tables["RouteTables"][route_table_number]["Associations"].concat(subnets.get_subnets_array) self end |
#get_json ⇒ Object
59 60 61 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 59 def get_json @route_tables.to_json end |
#get_json_single_route_table(index) ⇒ Object
63 64 65 66 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 63 def get_json_single_route_table(index) single={"RouteTable" => @route_tables["RouteTables"][index]} single.to_json end |
#get_route_tables_array ⇒ Object
68 69 70 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 68 def get_route_tables_array @route_tables["RouteTables"] end |
#propagate_to_virtual_gateway(route_table_number, gateway) ⇒ Object
53 54 55 56 57 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 53 def propagate_to_virtual_gateway(route_table_number, gateway) resize_route_tables_array(route_table_number) @route_tables["RouteTables"][route_table_number]["PropagatingVgws"] << gateway.get_hash self end |
#resize_route_tables_array(index) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 27 def resize_route_tables_array(index) while index > @route_tables["RouteTables"].length-1 @route_tables["RouteTables"].push({}) end @route_tables["RouteTables"][index]["Associations"] ||= [] @route_tables["RouteTables"][index]["PropagatingVgws"] ||= [] @route_tables["RouteTables"][index]["Routes"] ||= [] end |
#route_table_id(route_table_number, id) ⇒ Object
21 22 23 24 25 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 21 def route_table_id(route_table_number, id) resize_route_tables_array(route_table_number) @route_tables["RouteTables"][route_table_number]["RouteTableId"]=id self end |
#routes(route_table_number, routes) ⇒ Object
41 42 43 44 45 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 41 def routes(route_table_number, routes) resize_route_tables_array(route_table_number) @route_tables["RouteTables"][route_table_number]["Routes"].concat(routes.get_route_array) self end |
#vpc_id(route_table_number, vpc_id) ⇒ Object
15 16 17 18 19 |
# File 'lib/zaws/external/awscli/generators/result/ec2/route_tables.rb', line 15 def vpc_id(route_table_number, vpc_id) resize_route_tables_array(route_table_number) @route_tables["RouteTables"][route_table_number]["VpcId"]=vpc_id self end |