Class: VagrantPlugins::Skytap::API::Vpn

Inherits:
Resource show all
Includes:
Connectable
Defined in:
lib/vagrant-skytap/api/vpn.rb

Instance Attribute Summary

Attributes inherited from Resource

#attrs, #env

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Connectable

#choice_for_setup, #connection_choice_class

Methods inherited from Resource

#delete, #initialize, #refresh, #reload, rest_name, short_name, #update, #url

Methods included from SpecifiedAttributes

#get_api_attribute, included

Constructor Details

This class inherits a constructor from VagrantPlugins::Skytap::API::Resource

Class Method Details

.all(env, options = {}) ⇒ Object



35
36
37
38
39
# File 'lib/vagrant-skytap/api/vpn.rb', line 35

def all(env, options = {})
  resp = env[:api_client].get('/vpns', options)
  vpn_attrs = JSON.load(resp.body)
  vpn_attrs.collect {|attrs| new(attrs, env)}
end

.fetch(env, url, options = {}) ⇒ Object



41
42
43
44
# File 'lib/vagrant-skytap/api/vpn.rb', line 41

def fetch(env, url, options = {})
  resp = env[:api_client].get(url, options)
  new(JSON.load(resp.body), env)
end

Instance Method Details

#nat_enabled?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/vagrant-skytap/api/vpn.rb', line 49

def nat_enabled?
  !!nat_local_subnet
end

#subnetObject



57
58
59
# File 'lib/vagrant-skytap/api/vpn.rb', line 57

def subnet
  Util::Subnet.new(local_subnet)
end

#subsumes?(network) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/vagrant-skytap/api/vpn.rb', line 53

def subsumes?(network)
  subnet.subsumes?(network.subnet)
end