google-cloud-resource_manager - Class Google::Cloud::ResourceManager::Project::Updater (v0.36.2)

Reference documentation and code samples for the google-cloud-resource_manager class Google::Cloud::ResourceManager::Project::Updater.

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.

Example

require "google/cloud/resource_manager"

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

Methods

#labels

def labels()

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)

Example
require "google/cloud/resource_manager"

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

#labels=

def labels=(new_labels)

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)

Example
require "google/cloud/resource_manager"

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

#name=

def name=(new_name)

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.

Example
require "google/cloud/resource_manager"

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

#parent=

def parent=(new_parent)

Updates the reference to a parent with a new Resource.

Supported parent types include "organization" and "folder". Once set, the parent can be updated but cannot be cleared.

The end user must have the resourcemanager.projects.create permission on the parent.

(See Resource and Manager#resource.)

Parameter
  • new_parent (Resource) — A new parent Resource.
Raises
  • (ArgumentError)
Example
require "google/cloud/resource_manager"

resource_manager = Google::Cloud::ResourceManager.new
project = resource_manager.project "tokyo-rain-123"
folder = resource_manager.resource "folder", "1234"
project.parent = folder