Class: AWS::EC2::VPNGateway
- Inherits:
-
Resource
- Object
- Core::Resource
- Resource
- AWS::EC2::VPNGateway
- Includes:
- TaggedItem
- Defined in:
- lib/aws/ec2/vpn_gateway.rb,
lib/aws/ec2/vpn_gateway/attachment.rb
Defined Under Namespace
Classes: Attachment
Instance Attribute Summary collapse
- #vpn_gateway_id ⇒ String (also: #id) readonly
Attributes included from Core::Model
Instance Method Summary collapse
-
#attach(vpc) ⇒ Attachment
Attaches this vpn gateway to the given VPC.
- #attachments ⇒ Array<VPNGateway::Attachment>
-
#delete ⇒ nil
Deletes this vpn gateway.
-
#detach(vpc) ⇒ nil
Detaches this vpn gateway from the given VPC.
-
#exists? ⇒ Boolean
Returns true if the gateway exists.
-
#initialize(vpn_gateway_id, options = {}) ⇒ VPNGateway
constructor
A new instance of VPNGateway.
-
#vpc ⇒ VPC?
Returns the currently attached VPC, or nil if this gateway has not been attached.
-
#vpn_connections ⇒ VPNConnectionCollection
Returns a collection of VPC connections for this gateway.
Methods included from TaggedItem
#add_tag, #cached_tags, #clear_tags, #tagging_resource_type, #tags
Methods inherited from Core::Resource
attribute_providers, attribute_providers_for, attributes, #attributes_from_response, define_attribute_type, #eql?, #inspect, new_from
Methods included from Core::Cacheable
Methods included from Core::Model
#client, #config_prefix, #inspect
Constructor Details
#initialize(vpn_gateway_id, options = {}) ⇒ VPNGateway
Returns a new instance of VPNGateway.
23 24 25 26 |
# File 'lib/aws/ec2/vpn_gateway.rb', line 23 def initialize vpn_gateway_id, = {} @vpn_gateway_id = vpn_gateway_id super end |
Instance Attribute Details
#vpn_gateway_id ⇒ String (readonly) Also known as: id
29 30 31 |
# File 'lib/aws/ec2/vpn_gateway.rb', line 29 def vpn_gateway_id @vpn_gateway_id end |
Instance Method Details
#attach(vpc) ⇒ Attachment
Attaches this vpn gateway to the given VPC.
67 68 69 70 71 72 73 74 75 76 77 |
# 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.) end |
#attachments ⇒ Array<VPNGateway::Attachment>
52 53 54 |
# File 'lib/aws/ec2/vpn_gateway.rb', line 52 def .map {|details| Attachment.new(self, details) } end |
#delete ⇒ nil
Deletes this vpn gateway.
99 100 101 102 103 104 |
# 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) ⇒ nil
Detaches this vpn gateway from the given VPC.
82 83 84 85 86 87 88 |
# 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? ⇒ Boolean
Returns true if the gateway exists.
107 108 109 110 111 112 113 114 |
# 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 ⇒ VPC?
Returns the currently attached VPC, or nil if this gateway has not been attached.
58 59 60 61 62 |
# File 'lib/aws/ec2/vpn_gateway.rb', line 58 def vpc if = .first .vpc end end |
#vpn_connections ⇒ VPNConnectionCollection
Returns a collection of VPC connections for this gateway.
92 93 94 95 |
# File 'lib/aws/ec2/vpn_gateway.rb', line 92 def vpn_connections connections = VPNConnectionCollection.new(:config => config) connections.filter('vpn-gateway-id', id) end |