Module: DeltacloudVM::Client::Methods::InstanceState

Included in:
Connection
Defined in:
lib/deltacloud_vm/client/methods/instance_state.rb

Instance Method Summary collapse

Instance Method Details

#instance_state(name) ⇒ Object



35
36
37
# File 'lib/deltacloud_vm/client/methods/instance_state.rb', line 35

def instance_state(name)
  instance_states.find { |s| s.name.to_s.eql?(name.to_s) }
end

#instance_statesObject

Representation of the current driver state machine



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/deltacloud_vm/client/methods/instance_state.rb', line 22

def instance_states
  r = connection.get(api_uri("instance_states"))
  r.body.to_xml.root.xpath('state').map do |se|
    state = model(:instance_state).new_state(se['name'])
    se.xpath('transition').each do |te|
      state.transitions << model(:instance_state).new_transition(
        te['to'], te['action']
      )
    end
    state
  end
end