Class: Fog::Compute::AWS::InternetGateway

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/compute/internet_gateway.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InternetGateway

Returns a new instance of InternetGateway.



11
12
13
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 11

def initialize(attributes={})
  super
end

Instance Method Details

#attach(vpc_id) ⇒ Object

Attaches an existing internet gateway

internet_gateway.attach(igw-id, vpc-id)

Returns

True or false depending on the result



23
24
25
26
27
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 23

def attach(vpc_id)
  requires :id
  service.attach_internet_gateway(id, vpc_id)
  reload
end

#destroyObject

Removes an existing internet gateway

internet_gateway.destroy

Returns

True or false depending on the result



51
52
53
54
55
56
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 51

def destroy
  requires :id

  service.delete_internet_gateway(id)
  true
end

#detach(vpc_id) ⇒ Object

Detaches an existing internet gateway

internet_gateway.detach(igw-id, vpc-id)

Returns

True or false depending on the result



37
38
39
40
41
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 37

def detach(vpc_id)
  requires :id
  service.detach_internet_gateway(id, vpc_id)
  reload
end

#saveObject

Create an internet gateway

>> g = AWS.internet_gateways.new()
>> g.save

Returns:

requestId and a internetGateway object



67
68
69
70
71
72
73
74
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 67

def save
  data = service.create_internet_gateway.body['internetGatewaySet'].first
  new_attributes = data.reject {|key,value| key == 'requestId'}
  merge_attributes(new_attributes)
  true

  true
end