Anthos Multi-Cloud V1 API - Class Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client (v0.4.0)

Reference documentation and code samples for the Anthos Multi-Cloud V1 API class Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.

Client for the AttachedClusters service.

The AttachedClusters API provides a single centrally managed service to register and manage Anthos attached clusters that run on customer's owned infrastructure.

Inherits

  • Object

Methods

.configure

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

Configure the AttachedClusters 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 AttachedClusters clients
::Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the AttachedClusters 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_attached_cluster

def create_attached_cluster(request, options = nil) -> ::Gapic::Operation
def create_attached_cluster(parent: nil, attached_cluster: nil, attached_cluster_id: nil, validate_only: nil) -> ::Gapic::Operation

Creates a new AttachedCluster resource on a given Google Cloud Platform project and region.

If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.

Overloads
def create_attached_cluster(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_attached_cluster via a request object, either of type CreateAttachedClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::GkeMultiCloud::V1::CreateAttachedClusterRequest, ::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_attached_cluster(parent: nil, attached_cluster: nil, attached_cluster_id: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to create_attached_cluster 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 parent location where this AttachedCluster resource will be created.

    Location names are formatted as projects/<project-id>/locations/<region>.

    See Resource Names for more details on Google Cloud resource names.

  • attached_cluster (::Google::Cloud::GkeMultiCloud::V1::AttachedCluster, ::Hash) — Required. The specification of the AttachedCluster to create.
  • attached_cluster_id (::String) — Required. A client provided ID the resource. Must be unique within the parent resource.

    The provided ID will be part of the AttachedCluster resource name formatted as projects/<project-id>/locations/<region>/attachedClusters/<cluster-id>.

    Valid characters are /[a-z][0-9]-/. Cannot be longer than 63 characters.

  • validate_only (::Boolean) — If set, only validate the request, but do not actually create the cluster.
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/gke_multi_cloud/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::GkeMultiCloud::V1::CreateAttachedClusterRequest.new

# Call the create_attached_cluster method.
result = client.create_attached_cluster 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_attached_cluster

def delete_attached_cluster(request, options = nil) -> ::Gapic::Operation
def delete_attached_cluster(name: nil, validate_only: nil, allow_missing: nil, ignore_errors: nil, etag: nil) -> ::Gapic::Operation

Deletes a specific AttachedCluster resource.

If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.

Overloads
def delete_attached_cluster(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_attached_cluster via a request object, either of type DeleteAttachedClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::GkeMultiCloud::V1::DeleteAttachedClusterRequest, ::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_attached_cluster(name: nil, validate_only: nil, allow_missing: nil, ignore_errors: nil, etag: nil) -> ::Gapic::Operation
Pass arguments to delete_attached_cluster 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
  • name (::String) — Required. The resource name the AttachedCluster to delete.

    AttachedCluster names are formatted as projects/<project-id>/locations/<region>/attachedClusters/<cluster-id>.

    See Resource Names for more details on Google Cloud Platform resource names.

  • validate_only (::Boolean) — If set, only validate the request, but do not actually delete the resource.
  • allow_missing (::Boolean) — If set to true, and the AttachedCluster resource is not found, the request will succeed but no action will be taken on the server and a completed Operation will be returned.

    Useful for idempotent deletion.

  • ignore_errors (::Boolean) — If set to true, the deletion of AttachedCluster resource will succeed even if errors occur during deleting in cluster resources. Using this parameter may result in orphaned resources in the cluster.
  • etag (::String) — The current etag of the AttachedCluster.

    Allows clients to perform deletions through optimistic concurrency control.

    If the provided etag does not match the current etag of the cluster, the request will fail and an ABORTED error will be returned.

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/gke_multi_cloud/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::GkeMultiCloud::V1::DeleteAttachedClusterRequest.new

# Call the delete_attached_cluster method.
result = client.delete_attached_cluster 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

#generate_attached_cluster_install_manifest

def generate_attached_cluster_install_manifest(request, options = nil) -> ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestResponse
def generate_attached_cluster_install_manifest(parent: nil, attached_cluster_id: nil, platform_version: nil) -> ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestResponse

Generates the install manifest to be installed on the target cluster.

Overloads
def generate_attached_cluster_install_manifest(request, options = nil) -> ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestResponse
Pass arguments to generate_attached_cluster_install_manifest via a request object, either of type GenerateAttachedClusterInstallManifestRequest or an equivalent Hash.
Parameters
def generate_attached_cluster_install_manifest(parent: nil, attached_cluster_id: nil, platform_version: nil) -> ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestResponse
Pass arguments to generate_attached_cluster_install_manifest 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 parent location where this AttachedCluster resource will be created.

    Location names are formatted as projects/<project-id>/locations/<region>.

    See Resource Names for more details on Google Cloud resource names.

  • attached_cluster_id (::String) — Required. A client provided ID of the resource. Must be unique within the parent resource.

    The provided ID will be part of the AttachedCluster resource name formatted as projects/<project-id>/locations/<region>/attachedClusters/<cluster-id>.

    Valid characters are /[a-z][0-9]-/. Cannot be longer than 63 characters.

    When generating an install manifest for importing an existing Membership resource, the attached_cluster_id field must be the Membership id.

    Membership names are formatted as projects/<project-id>/locations/<region>/memberships/<membership-id>.

  • platform_version (::String) — Required. The platform version for the cluster (e.g. 1.19.0-gke.1000).

    You can list all supported versions on a given Google Cloud region by calling GetAttachedServerConfig.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/gke_multi_cloud/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestRequest.new

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

# The returned object is of type Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestResponse.
p result

#get_attached_cluster

def get_attached_cluster(request, options = nil) -> ::Google::Cloud::GkeMultiCloud::V1::AttachedCluster
def get_attached_cluster(name: nil) -> ::Google::Cloud::GkeMultiCloud::V1::AttachedCluster

Describes a specific AttachedCluster resource.

Overloads
def get_attached_cluster(request, options = nil) -> ::Google::Cloud::GkeMultiCloud::V1::AttachedCluster
Pass arguments to get_attached_cluster via a request object, either of type GetAttachedClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::GkeMultiCloud::V1::GetAttachedClusterRequest, ::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 get_attached_cluster(name: nil) -> ::Google::Cloud::GkeMultiCloud::V1::AttachedCluster
Pass arguments to get_attached_cluster 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 AttachedCluster resource to describe.

    AttachedCluster names are formatted as projects/<project-id>/locations/<region>/attachedClusters/<cluster-id>.

    See Resource Names for more details on Google Cloud Platform resource names.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/gke_multi_cloud/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::GkeMultiCloud::V1::GetAttachedClusterRequest.new

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

# The returned object is of type Google::Cloud::GkeMultiCloud::V1::AttachedCluster.
p result

#get_attached_server_config

def get_attached_server_config(request, options = nil) -> ::Google::Cloud::GkeMultiCloud::V1::AttachedServerConfig
def get_attached_server_config(name: nil) -> ::Google::Cloud::GkeMultiCloud::V1::AttachedServerConfig

Returns information, such as supported Kubernetes versions, on a given Google Cloud location.

Overloads
def get_attached_server_config(request, options = nil) -> ::Google::Cloud::GkeMultiCloud::V1::AttachedServerConfig
Pass arguments to get_attached_server_config via a request object, either of type GetAttachedServerConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::GkeMultiCloud::V1::GetAttachedServerConfigRequest, ::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 get_attached_server_config(name: nil) -> ::Google::Cloud::GkeMultiCloud::V1::AttachedServerConfig
Pass arguments to get_attached_server_config 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 AttachedServerConfig resource to describe.

    AttachedServerConfig names are formatted as projects/<project-id>/locations/<region>/attachedServerConfig.

    See Resource Names for more details on Google Cloud resource names.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/gke_multi_cloud/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::GkeMultiCloud::V1::GetAttachedServerConfigRequest.new

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

# The returned object is of type Google::Cloud::GkeMultiCloud::V1::AttachedServerConfig.
p result

#import_attached_cluster

def import_attached_cluster(request, options = nil) -> ::Gapic::Operation
def import_attached_cluster(parent: nil, validate_only: nil, fleet_membership: nil, platform_version: nil, distribution: nil) -> ::Gapic::Operation

Imports creates a new AttachedCluster resource by importing an existing Fleet Membership resource.

Attached Clusters created before the introduction of the Anthos Multi-Cloud API can be imported through this method.

If successful, the response contains a newly created Operation resource that can be described to track the status of the operation.

Overloads
def import_attached_cluster(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_attached_cluster via a request object, either of type ImportAttachedClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::GkeMultiCloud::V1::ImportAttachedClusterRequest, ::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 import_attached_cluster(parent: nil, validate_only: nil, fleet_membership: nil, platform_version: nil, distribution: nil) -> ::Gapic::Operation
Pass arguments to import_attached_cluster 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 parent location where this AttachedCluster resource will be created.

    Location names are formatted as projects/<project-id>/locations/<region>.

    See Resource Names for more details on Google Cloud resource names.

  • validate_only (::Boolean) — If set, only validate the request, but do not actually import the cluster.
  • fleet_membership (::String) — Required. The name of the fleet membership resource to import.
  • platform_version (::String) — Required. The platform version for the cluster (e.g. 1.19.0-gke.1000).

    You can list all supported versions on a given Google Cloud region by calling GetAttachedServerConfig.

  • distribution (::String) — Required. The Kubernetes distribution of the underlying attached cluster.

    Supported values: ["eks", "aks"].

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/gke_multi_cloud/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::GkeMultiCloud::V1::ImportAttachedClusterRequest.new

# Call the import_attached_cluster method.
result = client.import_attached_cluster 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 AttachedClusters client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new do |config|
  config.timeout = 10.0
end

#list_attached_clusters

def list_attached_clusters(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::GkeMultiCloud::V1::AttachedCluster>
def list_attached_clusters(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::GkeMultiCloud::V1::AttachedCluster>

Lists all AttachedCluster resources on a given Google Cloud project and region.

Overloads
def list_attached_clusters(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::GkeMultiCloud::V1::AttachedCluster>
Pass arguments to list_attached_clusters via a request object, either of type ListAttachedClustersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::GkeMultiCloud::V1::ListAttachedClustersRequest, ::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_attached_clusters(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::GkeMultiCloud::V1::AttachedCluster>
Pass arguments to list_attached_clusters 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 parent location which owns this collection of AttachedCluster resources.

    Location names are formatted as projects/<project-id>/locations/<region>.

    See Resource Names for more details on Google Cloud Platform resource names.

  • page_size (::Integer) — The maximum number of items to return.

    If not specified, a default value of 50 will be used by the service. Regardless of the pageSize value, the response can include a partial list and a caller should only rely on response's nextPageToken to determine if there are more instances left to be queried.

  • page_token (::String) — The nextPageToken value returned from a previous attachedClusters.list request, if any.
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/gke_multi_cloud/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::GkeMultiCloud::V1::ListAttachedClustersRequest.new

# Call the list_attached_clusters method.
result = client.list_attached_clusters 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::GkeMultiCloud::V1::AttachedCluster.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Operations

Get the associated client for long-running operations.

#update_attached_cluster

def update_attached_cluster(request, options = nil) -> ::Gapic::Operation
def update_attached_cluster(attached_cluster: nil, validate_only: nil, update_mask: nil) -> ::Gapic::Operation

Updates an AttachedCluster.

Overloads
def update_attached_cluster(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_attached_cluster via a request object, either of type UpdateAttachedClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::GkeMultiCloud::V1::UpdateAttachedClusterRequest, ::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 update_attached_cluster(attached_cluster: nil, validate_only: nil, update_mask: nil) -> ::Gapic::Operation
Pass arguments to update_attached_cluster 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
  • attached_cluster (::Google::Cloud::GkeMultiCloud::V1::AttachedCluster, ::Hash) — Required. The AttachedCluster resource to update.
  • validate_only (::Boolean) — If set, only validate the request, but do not actually update the cluster.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) —

    Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field can only include these fields from AttachedCluster:

    • description.
    • annotations.
    • platform_version.
    • authorization.admin_users.
    • logging_config.component_config.enable_components.
    • monitoring_config.managed_prometheus_config.enabled.
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/gke_multi_cloud/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::GkeMultiCloud::V1::UpdateAttachedClusterRequest.new

# Call the update_attached_cluster method.
result = client.update_attached_cluster 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