Class: Chef::Provisioning::GoogleDriver::Client::Projects
- Inherits:
-
GoogleBase
- Object
- GoogleBase
- Chef::Provisioning::GoogleDriver::Client::Projects
- Defined in:
- lib/chef/provisioning/google_driver/client/projects.rb
Overview
Wraps a Projects service of the GCE API.
Constant Summary
Constants inherited from GoogleBase
GoogleBase::NOT_FOUND, GoogleBase::OK, GoogleBase::SLEEP_SECONDS, GoogleBase::TRIES
Instance Attribute Summary
Attributes inherited from GoogleBase
Instance Method Summary collapse
- #get ⇒ Object
-
#set_common_instance_metadata(metadata) ⇒ Object
Takes a metadata object retrieved via #get and updates the metadata on GCE using the projects.set_common_instance_metadata API call.
Methods inherited from GoogleBase
#compute, #default_parameters, #initialize, #is_not_found?, #make_request, #operation_response, #raise_if_error
Constructor Details
This class inherits a constructor from Chef::Provisioning::GoogleDriver::Client::GoogleBase
Instance Method Details
#get ⇒ Object
11 12 13 14 15 16 |
# File 'lib/chef/provisioning/google_driver/client/projects.rb', line 11 def get # The default arguments are already enough for this call. response = make_request(compute.projects.get) raise_if_error(response) Metadata.new(response) end |
#set_common_instance_metadata(metadata) ⇒ Object
Takes a metadata object retrieved via #get and updates the metadata on GCE using the projects.set_common_instance_metadata API call. This fails if the metadata on GCE has been updated since the passed metadata object has been retrieved via #get. Note that this omits the API call if the metadata object hasn’t changed locally since it was retrieved via #get.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/chef/provisioning/google_driver/client/projects.rb', line 24 def () return nil unless .changed? response = make_request( compute.projects., # Default paremeters are sufficient. {}, { items: .items, fingerprint: .fingerprint } ) operation_response(response) end |