class CFM::Vpc
Constants
- TYPE
Attributes
config[R]
Public Class Methods
new()
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 17 def initialize @config = Configuration.new @cfm = @config.create_client set_vpc_id end
Public Instance Methods
create()
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 23 def create unless collect_stack_name.include?(@config.stack_name) resp = @cfm.create_stack({ stack_name: @config.stack_name, template_body: @config.template, parameters: @config.parameters, tags: [ { key: 'Name', value: @config.stack_tag_value, }, ], }) @cfm.wait_until(:stack_create_complete, {stack_name: @config.stack_name}) @config.stack_id = resp.stack_id end end
destroy()
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 41 def destroy if collect_stack_name.include?(@config.stack_name) resp = @cfm.delete_stack({ stack_name: @config.stack_name, }) @cfm.wait_until(:stack_delete_complete, {stack_name: @config.stack_name}) @config.stack_id = resp.to_s @config.vpc_id = nil end end
get_subnet_infos()
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 60 def get_subnet_infos end
get_vpc_id()
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 52 def get_vpc_id if @config.vpc_id.nil? select_vpc_id else @config.vpc_id end end
Protected Instance Methods
get_template_full_path(template_file)
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 64 def get_template_full_path(template_file) Dir.pwd + @config.template_path + template_file end
Private Instance Methods
collect_stack_name()
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 69 def collect_stack_name stack_names = [] @cfm.describe_stacks.stacks.each do |stack| stack_names << stack.stack_name end stack_names end
select_vpc_id()
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 77 def select_vpc_id @cfm.describe_stack_resource({stack_name: @config.stack_name, logical_resource_id: 'VPC'}).stack_resource_detail.physical_resource_id end
set_vpc_id()
click to toggle source
# File lib/etude_for_aws/cfm/vpc/vpc.rb, line 81 def set_vpc_id if collect_stack_name.include?(@config.stack_name) @config.vpc_id = get_vpc_id end end