2014-12-30 17:25:09 -05:00
require 'fog/core/collection'
require 'fog/aws/models/compute/internet_gateway'
module Fog
module Compute
2015-01-02 12:34:40 -05:00
class AWS
2014-12-30 17:25:09 -05:00
class InternetGateways < Fog :: Collection
attribute :filters
model Fog :: Compute :: AWS :: InternetGateway
# Creates a new internet gateway
#
2015-01-02 12:34:40 -05:00
# AWS.internet_gateways.new
2014-12-30 17:25:09 -05:00
#
# ==== Returns
#
# Returns the details of the new InternetGateway
#
2015-01-02 12:34:40 -05:00
#>> AWS.internet_gateways.new
2014-12-30 17:25:09 -05:00
#=> <Fog::Compute::AWS::InternetGateway
#id=nil,
#attachment_set=nil,
#tag_set=nil
#>
#
def initialize ( attributes )
self . filters || = { }
super
end
# Returns an array of all InternetGateways that have been created
#
2015-01-02 12:34:40 -05:00
# AWS.internet_gateways.all
2014-12-30 17:25:09 -05:00
#
# ==== Returns
#
# Returns an array of all InternetGateways
#
2015-01-02 12:34:40 -05:00
#>> AWS.internet_gateways.all
2014-12-30 17:25:09 -05:00
#<Fog::Compute::AWS::InternetGateways
#filters={}
#[
#<Fog::Compute::AWS::InternetGateway
#id="igw-some-id",
#attachment_set={"vpcId"=>"vpc-some-id", "state"=>"available"},
#tag_set={}
#>
#]
#>
#
def all ( filters_arg = filters )
unless filters_arg . is_a? ( Hash )
Fog :: Logger . warning ( " all with #{ filters_arg . class } param is deprecated, use all('internet-gateway-id' => []) instead [light_black]( #{ caller . first } )[/] " )
filters_arg = { 'internet-gateway-id' = > [ * filters_arg ] }
end
filters = filters_arg
data = service . describe_internet_gateways ( filters ) . body
load ( data [ 'internetGatewaySet' ] )
end
# Used to retrieve an InternetGateway
#
# You can run the following command to get the details:
2015-01-02 12:34:40 -05:00
# AWS.internet_gateways.get("igw-12345678")
2014-12-30 17:25:09 -05:00
#
# ==== Returns
#
2015-01-02 12:34:40 -05:00
#>> AWS.internet_gateways.get("igw-12345678")
2014-12-30 17:25:09 -05:00
#=> <Fog::Compute::AWS::InternetGateway
#id="igw-12345678",
#attachment_set={"vpcId"=>"vpc-12345678", "state"=>"available"},
#tag_set={}
#>
#
def get ( internet_gateway_id )
if internet_gateway_id
self . class . new ( :service = > service ) . all ( 'internet-gateway-id' = > internet_gateway_id ) . first
end
end
end
end
end
end