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

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ InternetGateway

Returns a new instance of InternetGateway.



13
14
15
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 13

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



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

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



54
55
56
57
58
59
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 54

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



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

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



70
71
72
73
74
75
76
77
# File 'lib/fog/aws/models/compute/internet_gateway.rb', line 70

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