Class: AWS::EC2::InternetGateway::Attachment
- Inherits:
-
Object
- Object
- AWS::EC2::InternetGateway::Attachment
- Defined in:
- lib/aws/ec2/internet_gateway/attachment.rb
Overview
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 AWS::EC2::InternetGateway like so:
internet_gateway..each do ||
puts "#{.internet_gateway.id} => #{.vpc.id}"
end
Deleting Attachments
You can delete an attachment from the Attachment object:
internet_gateway..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
Instance Attribute Summary collapse
- #internet_gateway ⇒ InternetGateway readonly
- #state ⇒ Symbol readonly
- #vpc ⇒ VPC readonly
Instance Method Summary collapse
-
#delete ⇒ nil
(also: #detach)
Deletes this attachment.
-
#initialize(internet_gateway, details) ⇒ Attachment
constructor
A new instance of Attachment.
Constructor Details
#initialize(internet_gateway, details) ⇒ Attachment
Returns a new instance of Attachment.
53 54 55 56 57 |
# 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 |
Instance Attribute Details
#internet_gateway ⇒ InternetGateway (readonly)
60 61 62 |
# File 'lib/aws/ec2/internet_gateway/attachment.rb', line 60 def internet_gateway @internet_gateway end |
#state ⇒ Symbol (readonly)
66 67 68 |
# File 'lib/aws/ec2/internet_gateway/attachment.rb', line 66 def state @state end |
#vpc ⇒ VPC (readonly)
63 64 65 |
# File 'lib/aws/ec2/internet_gateway/attachment.rb', line 63 def vpc @vpc end |
Instance Method Details
#delete ⇒ nil Also known as: detach
Deletes this attachment.
70 71 72 |
# File 'lib/aws/ec2/internet_gateway/attachment.rb', line 70 def delete internet_gateway.detach(vpc) end |