Class: Shared::StateResource Abstract
- Defined in:
- lib/vas/shared/state_resource.rb
Overview
This class is abstract.
A resource that has state, i.e. it can be started and stopped and its state can be queried
Direct Known Subclasses
Instance, NodeInstance, TcServer::NodeRevision, TcServer::Revision
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(location, client) ⇒ StateResource
constructor
A new instance of StateResource.
-
#start ⇒ void
Starts the resource.
-
#state ⇒ String
Retrieves the state of the resource from the server.
-
#stop ⇒ void
Stops the resource.
Constructor Details
#initialize(location, client) ⇒ StateResource
Returns a new instance of StateResource.
24 25 26 27 |
# File 'lib/vas/shared/state_resource.rb', line 24 def initialize(location, client) super(location, client) @state_location = Util::LinkUtils.get_link_href(details, 'state') end |
Instance Method Details
#start ⇒ void
This method returns an undefined value.
Starts the resource
32 33 34 |
# File 'lib/vas/shared/state_resource.rb', line 32 def start client.post(@state_location, { :status => 'STARTED' }) end |
#state ⇒ String
Returns Retrieves the state of the resource from the server.
44 45 46 |
# File 'lib/vas/shared/state_resource.rb', line 44 def state client.get(@state_location)['status'] end |
#stop ⇒ void
This method returns an undefined value.
Stops the resource
39 40 41 |
# File 'lib/vas/shared/state_resource.rb', line 39 def stop client.post(@state_location, { :status => 'STOPPED' }) end |