Class: Fog::Compute::AWS::InternetGateways

Inherits:
Fog::Collection show all
Defined in:
lib/fog/aws/models/compute/internet_gateways.rb

Instance Attribute Summary

Attributes inherited from Fog::Collection

#connection

Instance Method Summary collapse

Methods inherited from Fog::Collection

#clear, #create, #destroy, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

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

Methods included from Attributes::InstanceMethods

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

Constructor Details

#initialize(attributes) ⇒ InternetGateways

Creates a new internet gateway

AWS.internet_gateways.new

Returns

Returns the details of the new InternetGateway

>> AWS.internet_gateways.new

> <Fog::Compute::AWS::InternetGateway

id=nil, attachment_set=nil, tag_set=nil >



30
31
32
33
# File 'lib/fog/aws/models/compute/internet_gateways.rb', line 30

def initialize(attributes)
  self.filters ||= {}
  super
end

Instance Method Details

#all(filters = filters) ⇒ Object

Returns an array of all InternetGateways that have been created

AWS.internet_gateways.all

Returns

Returns an array of all InternetGateways

>> AWS.internet_gateways.all <Fog::Compute::AWS::InternetGateways filters={} [ <Fog::Compute::AWS::InternetGateway id=“igw-some-id”, attachment_set=“state”=>“available”, tag_set={} > ] >



56
57
58
59
60
61
62
63
64
# File 'lib/fog/aws/models/compute/internet_gateways.rb', line 56

def all(filters = filters)
  unless filters.is_a?(Hash)
    Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('internet-gateway-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'internet-gateway-id' => [*filters]}
  end
  self.filters = filters
  data = connection.describe_internet_gateways(filters).body
  load(data['internetGatewaySet'])
end

#get(internet_gateway_id) ⇒ Object

Used to retrieve an InternetGateway

You can run the following command to get the details: AWS.internet_gateways.get(“igw-12345678”)

Returns

>> AWS.internet_gateways.get(“igw-12345678”)

> <Fog::Compute::AWS::InternetGateway

id=“igw-12345678”, attachment_set=“state”=>“available”, tag_set={} >



81
82
83
84
85
# File 'lib/fog/aws/models/compute/internet_gateways.rb', line 81

def get(internet_gateway_id)
  if internet_gateway_id
    self.class.new(:connection => connection).all('internet-gateway-id' => internet_gateway_id).first
  end
end