Sha256: 6660e04a65b8556f702966085863438de9fec75ecf7e19fa1474726352d6c2d9
Contents?: true
Size: 1.29 KB
Versions: 15
Compression:
Stored size: 1.29 KB
Contents
require 'vagrant-skytap/api/resource' require_relative 'busyable' module VagrantPlugins module Skytap module API class VpnAttachment < Resource include Busyable attr_reader :network reads :connected, :network, :vpn def self.create(network, vpn, env) path = "#{base_url(network.id, network.environment.id)}?id=#{vpn.id}" resp = env[:api_client].post(path) body = JSON.load(resp.body) new(body, network, env) end def self.base_url(network_id, environment_id) "/configurations/#{environment_id}/networks/#{network_id}/vpns" end def initialize(attrs, network, env) super @network = network end def url environment_id = network['configuration_id'] network_id = network['id'] vpn_id = vpn['id'] "#{self.class.base_url(network_id, environment_id)}/#{vpn_id}" end def nat_enabled? vpn['nat_enabled'] end def connected? !!connected end def connect! update_with_retry(connected: true) raise Errors::VpnConnectionFailed unless connected? end def vpn_name vpn['name'] end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems