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

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

REST client for the TagBindings service.

Allow users to create and manage TagBindings between TagValues and different Google 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::Rest::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 Google Cloud resource.

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
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call 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::Rest::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 it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
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
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call 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::Rest::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 it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#initialize

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

Create a new TagBindings REST 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::Rest::Client.new

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

#list_effective_tags

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

Return a list of effective tags for the given Google Cloud resource, as specified in parent.

Overloads
def list_effective_tags(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::EffectiveTag>
Pass arguments to list_effective_tags via a request object, either of type ListEffectiveTagsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::ListEffectiveTagsRequest, ::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_effective_tags(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::EffectiveTag>
Pass arguments to list_effective_tags 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 the effective tags. E.g. "//cloudresourcemanager.googleapis.com/projects/123"
  • page_size (::Integer) — Optional. The maximum number of effective tags to return in the response. The server allows a maximum of 300 effective tags to return in a single page. If unspecified, the server will use 100 as the default.
  • page_token (::String) — Optional. A pagination token returned from a previous call to ListEffectiveTags that indicates from where this listing should continue.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call 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::Rest::Client.new

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

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::ResourceManager::V3::EffectiveTag.
  p item
end

#list_tag_bindings

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

Lists the TagBindings for the given Google 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::Rest::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::Rest::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
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call 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::Rest::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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::ResourceManager::V3::TagBinding.
  p item
end

#operations_client

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

Get the associated client for long-running operations.