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

Inherits:
Resource show all
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 inherited from Resource

#initialize, #refresh, #reload, resource_name, #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



114
115
116
117
118
# File 'lib/vagrant-skytap/api/vpn.rb', line 114

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



120
121
122
123
# File 'lib/vagrant-skytap/api/vpn.rb', line 120

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

Instance Method Details

#choice_for_setup(vm) ⇒ Object



128
129
130
# File 'lib/vagrant-skytap/api/vpn.rb', line 128

def choice_for_setup(vm)
  VpnChoice.new(env, self, vm)
end

#nat_enabled?Boolean

Returns:

  • (Boolean)


132
133
134
# File 'lib/vagrant-skytap/api/vpn.rb', line 132

def nat_enabled?
  !!nat_local_subnet
end

#subnetObject



140
141
142
# File 'lib/vagrant-skytap/api/vpn.rb', line 140

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

#subsumes?(network) ⇒ Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/vagrant-skytap/api/vpn.rb', line 136

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