class AWS::EC2::InternetGateway

def attach vpc

Returns:
  • (nil) -

Parameters:
  • vpc (VPC, String) -- A {VPC} object or a vpc id string.
def attach vpc
  client_opts = {}
  client_opts[:internet_gateway_id] = internet_gateway_id
  client_opts[:vpc_id] = vpc_id_option(vpc)
  client.attach_internet_gateway(client_opts)
  nil
end

def attachments

Returns:
  • (Array) -
def attachments
  attachment_set.map {|details| Attachment.new(self, details) }
end

def delete

Returns:
  • (nil) -
def delete
  client_opts = {}
  client_opts[:internet_gateway_id] = internet_gateway_id
  client.delete_internet_gateway(client_opts)
  nil
end

def detach vpc

Returns:
  • (nil) -

Parameters:
  • vpc (VPC, String) -- A {VPC} object or a vpc id string.
def detach vpc
  client_opts = {}
  client_opts[:internet_gateway_id] = internet_gateway_id
  client_opts[:vpc_id] = vpc_id_option(vpc)
  client.detach_internet_gateway(client_opts)
  nil
end

def exists?

Returns:
  • (Boolean) - Returns true if the gateway exists.
def exists?
  begin
    get_resource
    true
  rescue Errors::InvalidInternetGatewayID::NotFound
    false
  end
end

def initialize internet_gateway_id, options = {}

def initialize internet_gateway_id, options = {}
  @internet_gateway_id = internet_gateway_id
  super
end

def vpc

Returns:
  • (VPC, nil) - Returns the currently attached VPC, or nil
def vpc
  if attachment = attachments.first
    attachment.vpc
  end
end

def vpc= vpc

Parameters:
  • vpc (VPC, String) -- A {VPC} object or a vpc id string.
def vpc= vpc
  if attachment = attachments.first
    attachment.delete
  end
  attach(vpc) if vpc
end

def vpc_id_option vpc

def vpc_id_option vpc
  vpc.is_a?(VPC) ? vpc.vpc_id : vpc
end