class VPC::VpnGateway

Attributes

vpn_gateway_id[R]

Public Class Methods

new(config,gateway,vpn_gateway_id=nil) click to toggle source
# File lib/etude_for_aws/vpc/vpn_gateway.rb, line 5
def initialize(config,gateway,vpn_gateway_id=nil)
  @config = config
  @gateway = gateway
  @vpn_gateway_id = vpn_gateway_id
end

Public Instance Methods

attach(vpc_id) click to toggle source
# File lib/etude_for_aws/vpc/vpn_gateway.rb, line 23
def attach(vpc_id)
  @gateway.attach_vpn_gateway(@vpn_gateway_id,vpc_id)
end
create(vpn_gateway_info) click to toggle source
# File lib/etude_for_aws/vpc/vpn_gateway.rb, line 11
def create(vpn_gateway_info)
  type = vpn_gateway_info['TYPE']

  virtual_gateway = @gateway.create_vpn_gateway(type)
  @vpn_gateway_id = virtual_gateway[0].vpn_gateway_id
  resources = [vpn_gateway_id]
  vpn_gateway_tags = vpn_gateway_info['TAGS']
  tag = {key: vpn_gateway_tags['NAME']['KEY'], value: vpn_gateway_tags['NAME']['VALUE']}
  tags = [tag, @config.vpc_group_tag]
  @gateway.create_tags(resources, tags)
end
delete() click to toggle source
# File lib/etude_for_aws/vpc/vpn_gateway.rb, line 31
def delete
  @gateway.delete_vpn_gateway(@vpn_gateway_id)
end
detach(vpc_id) click to toggle source
# File lib/etude_for_aws/vpc/vpn_gateway.rb, line 27
def detach(vpc_id)
  @gateway.detach_vpn_gateway(@vpn_gateway_id,vpc_id)
end