Class: Fog::AWS::Compute::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.



9
10
11
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 9

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



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

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



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

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



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

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



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

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