Class: VagrantPlugins::Vrealize::SubmittedItemRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vrealize/vra_client.rb

Constant Summary collapse

OkStates =
%w{
  SUCCESSFUL
  IN_PROGRESS
  PENDING_PRE_APPROVAL
  PENDING_POST_APPROVAL
}

Instance Method Summary collapse

Constructor Details

#initialize(vra, request) ⇒ SubmittedItemRequest

Returns a new instance of SubmittedItemRequest.



97
98
99
100
# File 'lib/vagrant-vrealize/vra_client.rb', line 97

def initialize(vra, request)
  @vra = vra
  @request = request
end

Instance Method Details

#joinObject



109
110
111
112
113
114
115
# File 'lib/vagrant-vrealize/vra_client.rb', line 109

def join
  while !done?
    fail "Creating the machine failed: #{@request.status}" if failed?
    sleep 5
  end
  self
end

#machineObject



102
103
104
105
106
107
# File 'lib/vagrant-vrealize/vra_client.rb', line 102

def machine
  if done?
    # expecting only one VM, but should check and error out if there are more
    @request.resources.select { |a| a.vm? }.first
  end
end