1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/requests/compute/create_internet_gateway.rb
2015-01-02 09:42:20 -08:00

52 lines
1.7 KiB
Ruby

module Fog
module Compute
class AWS
class Real
require 'fog/aws/parsers/compute/create_internet_gateway'
# Creates an InternetGateway
#
# ==== Parameters
# (none)
#
# === Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'requestId'<~String> - Id of request
# * 'internetGateway'<~Array>:
# * 'attachmentSet'<~Array>: A list of VPCs attached to the Internet gateway
# * 'vpcId'<~String> - The ID of the VPC the Internet gateway is attached to.
# * 'state'<~String> - The current state of the attachment.
# * 'tagSet'<~Array>: Tags assigned to the resource.
# * 'key'<~String> - Tag's key
# * 'value'<~String> - Tag's value
#
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-InternetGatewayAttachmentType.html]
def create_internet_gateway()
request({
'Action' => 'CreateInternetGateway',
:parser => Fog::Parsers::Compute::AWS::CreateInternetGateway.new
})
end
end
class Mock
def create_internet_gateway()
gateway_id = Fog::AWS::Mock.internet_gateway_id
self.data[:internet_gateways][gateway_id] = {
'internetGatewayId' => gateway_id,
'attachmentSet' => {},
'tagSet' => {}
}
Excon::Response.new(
:status => 200,
:body => {
'requestId' => Fog::AWS::Mock.request_id,
'internetGatewaySet' => [self.data[:internet_gateways][gateway_id]]
}
)
end
end
end
end
end