Class: VagrantPlugins::Skytap::API::Tunnel
- Defined in:
- lib/vagrant-skytap/api/tunnel.rb
Instance Attribute Summary collapse
-
#source_network ⇒ Object
readonly
Returns the value of attribute source_network.
-
#target_network ⇒ Object
readonly
Returns the value of attribute target_network.
Attributes inherited from Resource
Class Method Summary collapse
-
.create!(env, network, other_network) ⇒ API::Tunnel
Creates a tunnel between two networks in different environments.
Instance Method Summary collapse
-
#busy? ⇒ Boolean
Indicates whether the tunnel is busy.
-
#initialize(attrs, env) ⇒ Tunnel
constructor
A new instance of Tunnel.
Methods inherited from Resource
#delete, #refresh, #reload, rest_name, short_name, #update, #url
Methods included from SpecifiedAttributes
Constructor Details
#initialize(attrs, env) ⇒ Tunnel
Returns a new instance of Tunnel.
54 55 56 57 58 |
# File 'lib/vagrant-skytap/api/tunnel.rb', line 54 def initialize(attrs, env) super @source_network = Network.new(get_api_attribute('source_network'), env[:environment], env) @target_network = Network.new(get_api_attribute('target_network'), env[:environment], env) end |
Instance Attribute Details
#source_network ⇒ Object (readonly)
Returns the value of attribute source_network.
34 35 36 |
# File 'lib/vagrant-skytap/api/tunnel.rb', line 34 def source_network @source_network end |
#target_network ⇒ Object (readonly)
Returns the value of attribute target_network.
34 35 36 |
# File 'lib/vagrant-skytap/api/tunnel.rb', line 34 def target_network @target_network end |
Class Method Details
.create!(env, network, other_network) ⇒ API::Tunnel
Creates a tunnel between two networks in different environments. The API response includes information about both networks, but omits their tunnel collections, so no attempt is made to update the network objects automatically.
47 48 49 50 51 |
# File 'lib/vagrant-skytap/api/tunnel.rb', line 47 def create!(env, network, other_network) params = {source_network_id: network.id, target_network_id: other_network.id} resp = env[:api_client].post("/tunnels", JSON.dump(params)) new(JSON.load(resp.body), env) end |
Instance Method Details
#busy? ⇒ Boolean
Indicates whether the tunnel is busy.
63 64 65 |
# File 'lib/vagrant-skytap/api/tunnel.rb', line 63 def busy? status == "busy" end |