You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: AWS::EC2::VPNGatewayCollection

Inherits:
Collection
  • Object
show all
Includes:
Core::Collection::Simple, TaggedCollection
Defined in:
lib/aws/ec2/vpn_gateway_collection.rb

Instance Method Summary collapse

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Methods included from TaggedCollection

#tagged, #tagged_values, #with_tag

Methods included from FilteredCollection

#filter, #initialize

Instance Method Details

#[](vpn_gateway_id) ⇒ VPNGateway

Parameters:

  • vpn_gateway_id (String)

Returns:



57
58
59
# File 'lib/aws/ec2/vpn_gateway_collection.rb', line 57

def [] vpn_gateway_id
  VPNGateway.new(vpn_gateway_id, :config => config)
end

#create(options = {}) ⇒ VPNGateway

Creates a new virtual private gateway. A virtual private gateway is the VPC-side endpoint for your VPN connection. You can create a virtual private gateway before creating the VPC itself.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :vpn_type (String) — default: 'ipsec.1'

    The type of VPN connection this virtual private gateway supports.

  • :availability_zone (AvailabilityZone, String)

    The Availability Zone where you want the virtual private gateway. AWS can select a default zone for you. This can be an AvailabilityZone object or availability zone name string.

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/aws/ec2/vpn_gateway_collection.rb', line 38

def create options = {}

  client_opts = {}
  client_opts[:type] = options[:vpn_type] || 'ipsec.1'

  if az = options[:availability_zone]
    az = az.name if az.is_a?(AvailabilityZone)
    client_opts[:availability_zone] = az
  end

  resp = client.create_vpn_gateway(client_opts)

  VPNGateway.new_from(:create_vpn_gateway, resp.vpn_gateway,
    resp.vpn_gateway.vpn_gateway_id, :config => config)

end