File: create_internet_gateway.rb

package info (click to toggle)
ruby-fog-aws 3.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,816 kB
  • sloc: ruby: 68,587; makefile: 6
file content (52 lines) | stat: -rw-r--r-- 1,777 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
module Fog
  module AWS
    class Compute
      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::AWS::Compute::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