Class: PublishedServiceChoice

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-skytap/api/published_service.rb

Overview

TODO:NLA Move this to another class, properly namespaced.

Defined Under Namespace

Classes: CreateAndUseServiceExecution, ServiceExecution, UseServiceExecution

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, iface, service = nil) ⇒ PublishedServiceChoice

Returns a new instance of PublishedServiceChoice.



11
12
13
14
15
16
# File 'lib/vagrant-skytap/api/published_service.rb', line 11

def initialize(env, iface, service=nil)
  @env = env
  @iface = iface
  @service = service
  @execution = ServiceExecution.make(env, iface, service)
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



5
6
7
# File 'lib/vagrant-skytap/api/published_service.rb', line 5

def env
  @env
end

#executionObject (readonly)

Returns the value of attribute execution.



5
6
7
# File 'lib/vagrant-skytap/api/published_service.rb', line 5

def execution
  @execution
end

#ifaceObject (readonly)

Returns the value of attribute iface.



5
6
7
# File 'lib/vagrant-skytap/api/published_service.rb', line 5

def iface
  @iface
end

#serviceObject (readonly)

Returns the value of attribute service.



5
6
7
# File 'lib/vagrant-skytap/api/published_service.rb', line 5

def service
  @service
end

Class Method Details

.uncreated_choice(env, iface) ⇒ Object



7
8
9
# File 'lib/vagrant-skytap/api/published_service.rb', line 7

def self.uncreated_choice(env, iface)
  new(env, iface, nil)
end

Instance Method Details

#chooseObject



22
23
24
25
26
# File 'lib/vagrant-skytap/api/published_service.rb', line 22

def choose
  execution.execute
  @service = execution.service
  [service.external_ip, service.external_port]
end

#to_sObject



18
19
20
# File 'lib/vagrant-skytap/api/published_service.rb', line 18

def to_s
  execution.message
end

#valid?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/vagrant-skytap/api/published_service.rb', line 28

def valid?
  service.nil? || service.internal_port == 22 #TODO:NLA Use constant
end