Class: VPC::VpnConnection
- Inherits:
-
Object
- Object
- VPC::VpnConnection
- Defined in:
- lib/etude_for_aws/vpc/vpn_connection.rb
Instance Attribute Summary collapse
-
#vpn_connection_id ⇒ Object
readonly
Returns the value of attribute vpn_connection_id.
Instance Method Summary collapse
- #creat(customer_gateway_id, vpn_gateway_id, vpn_connection_info) ⇒ Object
- #delete ⇒ Object
-
#initialize(config, gateway, vpn_connection_id = nil) ⇒ VpnConnection
constructor
A new instance of VpnConnection.
Constructor Details
#initialize(config, gateway, vpn_connection_id = nil) ⇒ VpnConnection
Returns a new instance of VpnConnection.
5 6 7 8 9 |
# File 'lib/etude_for_aws/vpc/vpn_connection.rb', line 5 def initialize(config,gateway,vpn_connection_id=nil) @config = config @gateway = gateway @vpn_connection_id = vpn_connection_id end |
Instance Attribute Details
#vpn_connection_id ⇒ Object (readonly)
Returns the value of attribute vpn_connection_id.
3 4 5 |
# File 'lib/etude_for_aws/vpc/vpn_connection.rb', line 3 def vpn_connection_id @vpn_connection_id end |
Instance Method Details
#creat(customer_gateway_id, vpn_gateway_id, vpn_connection_info) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/etude_for_aws/vpc/vpn_connection.rb', line 11 def creat(customer_gateway_id, vpn_gateway_id, vpn_connection_info) type = vpn_connection_info['TYPE'] static_routes_only = vpn_connection_info['OPTIONS']['STATIC_ROUTES_ONLY'] @vpn_connection = @gateway.create_vpn_connection(type, customer_gateway_id, vpn_gateway_id, static_routes_only) @vpn_connection_id = @vpn_connection[0].vpn_connection_id resources = [@vpn_connection_id] = vpn_connection_info['TAGS'] tag = {key: ['NAME']['KEY'], value: ['NAME']['VALUE']} = [tag, @config.vpc_group_tag] @gateway.(resources, ) end |
#delete ⇒ Object
23 24 25 |
# File 'lib/etude_for_aws/vpc/vpn_connection.rb', line 23 def delete @gateway.delete_vpn_connection(@vpn_connection_id) end |