class AWS::EC2::VPNGateway
Attributes
id[R]
@return [String]
vpn_gateway_id[R]
@return [String]
Public Class Methods
new(vpn_gateway_id, options = {})
click to toggle source
Calls superclass method
AWS::Core::Resource.new
# File lib/aws/ec2/vpn_gateway.rb, line 23 def initialize vpn_gateway_id, options = {} @vpn_gateway_id = vpn_gateway_id super end
Public Instance Methods
attach(vpc)
click to toggle source
Attaches this vpn gateway to the given VPC. @param [VPC,String] vpc A {VPC} object or a vpc id string. @return [Attachment]
# File lib/aws/ec2/vpn_gateway.rb, line 67 def attach vpc client_opts = {} client_opts[:vpn_gateway_id] = vpn_gateway_id client_opts[:vpc_id] = vpc_id(vpc) resp = client.attach_vpn_gateway(client_opts) Attachment.new(self, resp.attachment) end
attachments()
click to toggle source
@return [Array<VPNGateway::Attachment>]
# File lib/aws/ec2/vpn_gateway.rb, line 52 def attachments attachment_set.map {|details| Attachment.new(self, details) } end
delete()
click to toggle source
Deletes this vpn gateway. @return [nil]
# File lib/aws/ec2/vpn_gateway.rb, line 99 def delete client_opts = {} client_opts[:vpn_gateway_id] = vpn_gateway_id client.delete_vpn_gateway(client_opts) nil end
detach(vpc)
click to toggle source
Detaches this vpn gateway from the given VPC. @param [VPC,String] vpc A {VPC} object or a vpc id string. @return [nil]
# File lib/aws/ec2/vpn_gateway.rb, line 82 def detach vpc client_opts = {} client_opts[:vpn_gateway_id] = vpn_gateway_id client_opts[:vpc_id] = vpc_id(vpc) client.detach_vpn_gateway(client_opts) nil end
exists?()
click to toggle source
@return [Boolean] Returns true if the gateway exists.
# File lib/aws/ec2/vpn_gateway.rb, line 107 def exists? begin client.describe_vpn_gateways(:vpn_gateway_ids => [id]) true rescue Errors::InvalidVPNGatewayID::NotFound false end end
vpc()
click to toggle source
@return [VPC,nil] Returns the currently attached VPC, or nil
if this gateway has not been attached.
# File lib/aws/ec2/vpn_gateway.rb, line 58 def vpc if attachment = attachments.first attachment.vpc end end
vpn_connections()
click to toggle source
@return [VPNConnectionCollection] Returns a collection
of VPC connections for this gateway.
# File lib/aws/ec2/vpn_gateway.rb, line 92 def vpn_connections connections = VPNConnectionCollection.new(:config => config) connections.filter('vpn-gateway-id', id) end
Protected Instance Methods
vpc_id(vpc)
click to toggle source
# File lib/aws/ec2/vpn_gateway.rb, line 117 def vpc_id vpc vpc.is_a?(VPC) ? vpc.vpc_id : vpc end