Resource Manager V3 API - Class Google::Cloud::ResourceManager::V3::TagBindings::Client (v0.3.0)

Reference documentation and code samples for the Resource Manager V3 API class Google::Cloud::ResourceManager::V3::TagBindings::Client.

Client for the TagBindings service.

Allow users to create and manage TagBindings between TagValues and different cloud resources throughout the GCP resource hierarchy.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the TagBindings Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all TagBindings clients
::Google::Cloud::ResourceManager::V3::TagBindings::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the TagBindings Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_tag_binding

def create_tag_binding(request, options = nil) -> ::Gapic::Operation
def create_tag_binding(tag_binding: nil, validate_only: nil) -> ::Gapic::Operation

Creates a TagBinding between a TagValue and a cloud resource (currently project, folder, or organization).

Overloads
def create_tag_binding(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_tag_binding via a request object, either of type CreateTagBindingRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::CreateTagBindingRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_tag_binding(tag_binding: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to create_tag_binding via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • tag_binding (::Google::Cloud::ResourceManager::V3::TagBinding, ::Hash) — Required. The TagBinding to be created.
  • validate_only (::Boolean) — Optional. Set to true to perform the validations necessary for creating the resource, but not actually perform the action.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/resource_manager/v3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ResourceManager::V3::TagBindings::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ResourceManager::V3::CreateTagBindingRequest.new

# Call the create_tag_binding method.
result = client.create_tag_binding request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#delete_tag_binding

def delete_tag_binding(request, options = nil) -> ::Gapic::Operation
def delete_tag_binding(name: nil) -> ::Gapic::Operation

Deletes a TagBinding.

Overloads
def delete_tag_binding(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_tag_binding via a request object, either of type DeleteTagBindingRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::DeleteTagBindingRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_tag_binding(name: nil) -> ::Gapic::Operation
Pass arguments to delete_tag_binding via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the TagBinding. This is a String of the form: tagBindings/{id} (e.g. tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456).
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/resource_manager/v3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ResourceManager::V3::TagBindings::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ResourceManager::V3::DeleteTagBindingRequest.new

# Call the delete_tag_binding method.
result = client.delete_tag_binding request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#initialize

def initialize() { |config| ... } -> Client

Create a new TagBindings client object.

Yields
  • (config) — Configure the TagBindings client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::ResourceManager::V3::TagBindings::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::ResourceManager::V3::TagBindings::Client.new do |config|
  config.timeout = 10.0
end

#list_tag_bindings

def list_tag_bindings(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagBinding>
def list_tag_bindings(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagBinding>

Lists the TagBindings for the given cloud resource, as specified with parent.

NOTE: The parent field is expected to be a full resource name: https://cloud.google.com/apis/design/resource_names#full_resource_name

Overloads
def list_tag_bindings(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagBinding>
Pass arguments to list_tag_bindings via a request object, either of type ListTagBindingsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::ListTagBindingsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_tag_bindings(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagBinding>
Pass arguments to list_tag_bindings via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The full resource name of a resource for which you want to list existing TagBindings. E.g. "//cloudresourcemanager.googleapis.com/projects/123"
  • page_size (::Integer) — Optional. The maximum number of TagBindings to return in the response. The server allows a maximum of 300 TagBindings to return. If unspecified, the server will use 100 as the default.
  • page_token (::String) — Optional. A pagination token returned from a previous call to ListTagBindings that indicates where this listing should continue from.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/resource_manager/v3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ResourceManager::V3::TagBindings::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ResourceManager::V3::ListTagBindingsRequest.new

# Call the list_tag_bindings method.
result = client.list_tag_bindings request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::ResourceManager::V3::TagBinding.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::ResourceManager::V3::TagBindings::Operations

Get the associated client for long-running operations.