Class: Google::Compute::Api::Instance
- Inherits:
-
Object
- Object
- Google::Compute::Api::Instance
- Defined in:
- lib/google/compute/api/gcompute_instance.rb
Overview
A helper class to provide access to (some) Google Compute Engine API.
Instance Method Summary collapse
-
#initialize(name, zone, project, cred) ⇒ Instance
constructor
A new instance of Instance.
-
#reset ⇒ Object
TODO(nelsonjr): Make this function wait for the operation to complete.
Constructor Details
#initialize(name, zone, project, cred) ⇒ Instance
Returns a new instance of Instance.
21 22 23 24 25 26 |
# File 'lib/google/compute/api/gcompute_instance.rb', line 21 def initialize(name, zone, project, cred) @name = name @zone = zone @project = project @cred = cred end |
Instance Method Details
#reset ⇒ Object
TODO(nelsonjr): Make this function wait for the operation to complete
29 30 31 32 33 34 35 36 |
# File 'lib/google/compute/api/gcompute_instance.rb', line 29 def reset reset_request = ::Google::Compute::Network::Post.new( gcompute_instance_reset, @cred, 'application/json', {}.to_json ) response = JSON.parse(reset_request.send.body) raise Puppet::Error, response['error']['errors'][0]['message'] \ if response['error'] end |