Class: Gcloud::ResourceManager::Project::Updater
- Inherits:
-
Gcloud::ResourceManager::Project
- Object
- Gcloud::ResourceManager::Project
- Gcloud::ResourceManager::Project::Updater
- Defined in:
- lib/gcloud/resource_manager/project/updater.rb
Overview
# Project Updater
This object is used by Project#update when passed a block. These methods are used to update the project data in a single API call.
Instance Attribute Summary
Attributes inherited from Gcloud::ResourceManager::Project
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(project) ⇒ Updater
constructor
A new instance of Updater.
-
#labels ⇒ Object
The labels associated with this project.
-
#labels=(new_labels) ⇒ Object
Updates the labels associated with this project.
-
#name=(new_name) ⇒ Object
Updates the user-assigned name of the project.
Methods inherited from Gcloud::ResourceManager::Project
#active?, #created_at, #delete, #delete_in_progress?, #delete_requested?, from_gapi, #name, #policy, #policy=, #project_id, #project_number, #reload!, #state, #test_permissions, #undelete, #unspecified?, #update
Constructor Details
#initialize(project) ⇒ Updater
Returns a new instance of Updater.
42 43 44 |
# File 'lib/gcloud/resource_manager/project/updater.rb', line 42 def initialize project super project end |
Class Method Details
.from_project(project) ⇒ Object
123 124 125 126 127 128 129 130 131 |
# File 'lib/gcloud/resource_manager/project/updater.rb', line 123 def self.from_project project dupe_gapi = project.gapi.dup dupe_gapi = dupe_gapi.to_hash if dupe_gapi.respond_to? :to_hash if dupe_gapi["labels"].respond_to? :to_hash dupe_gapi["labels"] = dupe_gapi["labels"].to_hash end dupe_project = Project.from_gapi dupe_gapi, nil # no way to update Updater.new dupe_project end |
Instance Method Details
#labels ⇒ Object
The labels associated with this project.
Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9]*[a-z0-9])?
.
Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)?
.
No more than 256 labels can be associated with a given resource. (‘Hash`)
90 91 92 |
# File 'lib/gcloud/resource_manager/project/updater.rb', line 90 def labels gapi["labels"] end |
#labels=(new_labels) ⇒ Object
Updates the labels associated with this project.
Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9]*[a-z0-9])?
.
Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)?
.
No more than 256 labels can be associated with a given resource. (‘Hash`)
117 118 119 |
# File 'lib/gcloud/resource_manager/project/updater.rb', line 117 def labels= new_labels gapi["labels"] = new_labels end |
#name=(new_name) ⇒ Object
Updates the user-assigned name of the project. This field is optional and can remain unset.
Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point.
63 64 65 |
# File 'lib/gcloud/resource_manager/project/updater.rb', line 63 def name= new_name gapi["name"] = new_name end |