class AWS::EC2::InternetGateway::Attachment

Represents the attachment between an internet gateway and a VPC.

Creating Attachments

To create an attachment, just assign an internet gateway to a VPC or visa versa.

# attaches a gateway to a vpc
internet_gateway.vpc = vpc

# this can also be done in reverse
vpc.internet_gateway = internet_gateway

Enumerating Attachments

You can enumerate the attachments for an {InternetGateway} like so:

internet_gateway.attachments.each do |attachment|
   puts "#{attachment.internet_gateway.id} => #{attachment.vpc.id}"
end

Deleting Attachments

You can delete an attachment from the Attachment object:

internet_gateway.attachments.each(&:delete)

You can also delete an attachment by assigning a nil value:

# removes the current attachment to the vpc is one exists
internet_gateway.vpc = nil

Attributes

internet_gateway[R]

@return [InternetGateway]

state[R]

@return [Symbol]

vpc[R]

@return [VPC]

Public Class Methods

new(internet_gateway, details) click to toggle source

@private

# File lib/aws/ec2/internet_gateway/attachment.rb, line 53
def initialize internet_gateway, details
  @internet_gateway = internet_gateway
  @vpc = VPC.new(details.vpc_id, :config => internet_gateway.config)
  @state = details.state.to_sym
end

Public Instance Methods

delete() click to toggle source

Deletes this attachment. @return (see AWS::EC2::InternetGateway#detach)

# File lib/aws/ec2/internet_gateway/attachment.rb, line 70
def delete
  internet_gateway.detach(vpc)
end
Also aliased as: detach
detach() click to toggle source
Alias for: delete