Class: Google::Cloud::ResourceManager::Project::Updater

Inherits:
Google::Cloud::ResourceManager::Project show all
Defined in:
lib/google/cloud/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.

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
resource_manager = gcloud.resource_manager
project = resource_manager.project "tokyo-rain-123"
project.update do |p|
  p.name = "My Project"
  p.labels["env"] = "production"
end

Instance Method Summary collapse

Methods inherited from Google::Cloud::ResourceManager::Project

#active?, #created_at, #delete, #delete_in_progress?, #delete_requested?, #name, #policy, #policy=, #project_id, #project_number, #reload!, #state, #test_permissions, #undelete, #unspecified?, #update

Instance Method Details

#labelsObject

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?.

Label values must be between 0 and 63 characters long and must conform to the regular expression (a-z?)?.

No more than 256 labels can be associated with a given resource. (Hash)

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
resource_manager = gcloud.resource_manager
project = resource_manager.project "tokyo-rain-123"
project.update do |p|
  p.labels["env"] = "production"
end


91
92
93
# File 'lib/google/cloud/resource_manager/project/updater.rb', line 91

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?.

Label values must be between 0 and 63 characters long and must conform to the regular expression (a-z?)?.

No more than 256 labels can be associated with a given resource. (Hash)

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
resource_manager = gcloud.resource_manager
project = resource_manager.project "tokyo-rain-123"
project.update do |p|
  p.labels = { "env" => "production" }
end


119
120
121
# File 'lib/google/cloud/resource_manager/project/updater.rb', line 119

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.

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
resource_manager = gcloud.resource_manager
project = resource_manager.project "tokyo-rain-123"
project.update do |p|
  p.name = "My Project"
end


63
64
65
# File 'lib/google/cloud/resource_manager/project/updater.rb', line 63

def name= new_name
  gapi.name = new_name
end