Class: VPC::Configuration

Inherits:
Object
  • Object
show all
Includes:
ConfigurationHelper
Defined in:
lib/etude_for_aws/vpc/configuration.rb

Direct Known Subclasses

ConfigurationStub

Constant Summary

Constants included from ConfigurationHelper

ConfigurationHelper::YAML_FILE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConfigurationHelper

#get_yaml_destination_cidr_block, #get_yaml_ec2_config, #get_yaml_ec2_instances, #get_yaml_internet_gateway, get_yaml_region, #get_yaml_stack_name, #get_yaml_stack_tag_value, #get_yaml_subnet_cidr_block, #get_yaml_subnet_cidr_block_private, #get_yaml_subnet_cidr_block_public, #get_yaml_template_file, #get_yaml_template_path, #get_yaml_vpc_cidr_block, #get_yaml_vpc_route_tables, #get_yaml_vpc_subnets, #get_yaml_vpc_tags, #get_yaml_vpn_info, #get_yaml_zas, load_yaml_file

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/etude_for_aws/vpc/configuration.rb', line 18

def initialize
  vpc_tags = get_yaml_vpc_tags
  @vpc_name = vpc_tags['NAME']['VALUE']
  @vpc_group_name = vpc_tags['GROUP']['VALUE']
  @vpc_cidr_block = get_yaml_vpc_cidr_block

  vpc_subnets = get_yaml_vpc_subnets
  @subnet_names = []
  vpc_subnets['PUBLIC'].each do |v|
    @subnet_names << v['CONFIG']['SUBNET_TAGS'].first['NAME']['VALUE']
  end
  vpc_subnets['PRIVATE'].each do |v|
    @subnet_names << v['CONFIG']['SUBNET_TAGS'].first['NAME']['VALUE']
  end
  @public_subnets = vpc_subnets['PUBLIC']
  @private_subnets = vpc_subnets['PRIVATE']

  vpc_route_tables = get_yaml_vpc_route_tables
  @route_table_names = []
  vpc_route_tables['PUBLIC'].each do |v|
    @route_table_names << v['CONFIG']['ROUTE_TABLE_TAGS'].first['NAME']['VALUE']
  end
  vpc_route_tables['PRIVATE'].each do |v|
    @route_table_names << v['CONFIG']['ROUTE_TABLE_TAGS'].first['NAME']['VALUE']
  end
  @public_route_tables = vpc_route_tables['PUBLIC']
  @private_route_tables = vpc_route_tables['PRIVATE']

  @internet_gateway = get_yaml_internet_gateway

  @vpc_name_tag = {key: vpc_tags['NAME']['KEY'], value: @vpc_name}
  @vpc_group_tag = {key: vpc_tags['GROUP']['KEY'], value: @vpc_group_name}

  @vpn_info = get_yaml_vpn_info
end

Instance Attribute Details

#internet_gatewayObject (readonly)

Returns the value of attribute internet_gateway.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def internet_gateway
  @internet_gateway
end

#private_route_tablesObject (readonly)

Returns the value of attribute private_route_tables.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def private_route_tables
  @private_route_tables
end

#private_subnetsObject (readonly)

Returns the value of attribute private_subnets.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def private_subnets
  @private_subnets
end

#public_route_tablesObject (readonly)

Returns the value of attribute public_route_tables.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def public_route_tables
  @public_route_tables
end

#public_subnetsObject (readonly)

Returns the value of attribute public_subnets.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def public_subnets
  @public_subnets
end

#route_table_namesObject (readonly)

Returns the value of attribute route_table_names.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def route_table_names
  @route_table_names
end

#subnet_namesObject (readonly)

Returns the value of attribute subnet_names.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def subnet_names
  @subnet_names
end

#vpc_cidr_blockObject (readonly)

Returns the value of attribute vpc_cidr_block.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def vpc_cidr_block
  @vpc_cidr_block
end

#vpc_group_tagObject (readonly)

Returns the value of attribute vpc_group_tag.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def vpc_group_tag
  @vpc_group_tag
end

#vpc_nameObject (readonly)

Returns the value of attribute vpc_name.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def vpc_name
  @vpc_name
end

#vpc_name_tagObject (readonly)

Returns the value of attribute vpc_name_tag.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def vpc_name_tag
  @vpc_name_tag
end

#vpn_infoObject (readonly)

Returns the value of attribute vpn_info.



5
6
7
# File 'lib/etude_for_aws/vpc/configuration.rb', line 5

def vpn_info
  @vpn_info
end

Instance Method Details

#get_internet_gateway_nameObject



54
55
56
# File 'lib/etude_for_aws/vpc/configuration.rb', line 54

def get_internet_gateway_name
  internet_gateway['IG_TAGS']['NAME']['VALUE']
end

#get_vpn_connectionsObject



66
67
68
# File 'lib/etude_for_aws/vpc/configuration.rb', line 66

def get_vpn_connections
  vpn_info['VPN_CONNECTIONS']
end

#get_vpn_customer_gatewaysObject



58
59
60
# File 'lib/etude_for_aws/vpc/configuration.rb', line 58

def get_vpn_customer_gateways
  vpn_info['CUSTOMER_GATEWAYS']
end

#get_vpn_gatewayObject



62
63
64
# File 'lib/etude_for_aws/vpc/configuration.rb', line 62

def get_vpn_gateway
  vpn_info['VPN_GATEWAY']
end