Class: Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb

Overview

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.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#attached_cluster_path, #attached_server_config_path, #location_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new AttachedClusters client object.

Examples:


# 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

Yields:

  • (config)

    Configure the AttachedClusters client.

Yield Parameters:



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 159

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/cloud/gkemulticloud/v1/attached_service_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@config.endpoint.split(".").first.include?("-"))
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @operations_client = Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @attached_clusters_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool,
    logger: @config.logger
  )

  @attached_clusters_stub.stub_logger&.info do |entry|
    entry.set_system_name
    entry.set_service
    entry.message = "Created client for #{entry.service}"
    entry.set_credentials_fields credentials
    entry.set "customEndpoint", @config.endpoint if @config.endpoint
    entry.set "defaultTimeout", @config.timeout if @config.timeout
    entry.set "quotaProject", @quota_project_id if @quota_project_id
  end
end

Instance Attribute Details

#operations_client::Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Operations (readonly)

Get the associated client for long-running operations.



222
223
224
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 222

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the AttachedClusters Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all AttachedClusters clients
::Google::Cloud::GkeMultiCloud::V1::AttachedClusters::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 64

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "GkeMultiCloud", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.create_attached_cluster.timeout = 60.0

    default_config.rpcs.update_attached_cluster.timeout = 60.0

    default_config.rpcs.import_attached_cluster.timeout = 60.0

    default_config.rpcs.get_attached_cluster.timeout = 60.0
    default_config.rpcs.get_attached_cluster.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.list_attached_clusters.timeout = 60.0
    default_config.rpcs.list_attached_clusters.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.delete_attached_cluster.timeout = 60.0

    default_config.rpcs.get_attached_server_config.timeout = 60.0
    default_config.rpcs.get_attached_server_config.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.generate_attached_cluster_install_manifest.timeout = 60.0
    default_config.rpcs.generate_attached_cluster_install_manifest.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.generate_attached_cluster_agent_token.timeout = 60.0
    default_config.rpcs.generate_attached_cluster_agent_token.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#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 configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:



129
130
131
132
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 129

def configure
  yield @config if block_given?
  @config
end

#create_attached_cluster(request, options = nil) ⇒ ::Gapic::Operation #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.

Examples:

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

Overloads:

  • #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.

  • #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).

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 314

def create_attached_cluster request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::CreateAttachedClusterRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_attached_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_attached_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_attached_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :create_attached_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_attached_cluster(request, options = nil) ⇒ ::Gapic::Operation #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.

Examples:

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

Overloads:

  • #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.

  • #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).

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 890

def delete_attached_cluster request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::DeleteAttachedClusterRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_attached_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_attached_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_attached_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :delete_attached_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#generate_attached_cluster_agent_token(request, options = nil) ⇒ ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterAgentTokenResponse #generate_attached_cluster_agent_token(attached_cluster: nil, subject_token: nil, subject_token_type: nil, version: nil, grant_type: nil, audience: nil, scope: nil, requested_token_type: nil, options: nil) ⇒ ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterAgentTokenResponse

Generates an access token for a cluster agent.

Examples:

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::GenerateAttachedClusterAgentTokenRequest.new

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

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

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 1203

def generate_attached_cluster_agent_token request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterAgentTokenRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.generate_attached_cluster_agent_token..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.attached_cluster
    header_params["attached_cluster"] = request.attached_cluster
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.generate_attached_cluster_agent_token.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.generate_attached_cluster_agent_token.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :generate_attached_cluster_agent_token, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#generate_attached_cluster_install_manifest(request, options = nil) ⇒ ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestResponse #generate_attached_cluster_install_manifest(parent: nil, attached_cluster_id: nil, platform_version: nil, proxy_config: nil) ⇒ ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestResponse

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

Examples:

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

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 1102

def generate_attached_cluster_install_manifest request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::GenerateAttachedClusterInstallManifestRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.generate_attached_cluster_install_manifest..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.generate_attached_cluster_install_manifest.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.generate_attached_cluster_install_manifest.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :generate_attached_cluster_install_manifest, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_attached_cluster(request, options = nil) ⇒ ::Google::Cloud::GkeMultiCloud::V1::AttachedCluster #get_attached_cluster(name: nil) ⇒ ::Google::Cloud::GkeMultiCloud::V1::AttachedCluster

Describes a specific AttachedCluster resource.

Examples:

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

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 653

def get_attached_cluster request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::GetAttachedClusterRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_attached_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_attached_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_attached_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :get_attached_cluster, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_attached_server_config(request, options = nil) ⇒ ::Google::Cloud::GkeMultiCloud::V1::AttachedServerConfig #get_attached_server_config(name: nil) ⇒ ::Google::Cloud::GkeMultiCloud::V1::AttachedServerConfig

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

Examples:

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

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 986

def get_attached_server_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::GetAttachedServerConfigRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_attached_server_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_attached_server_config.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_attached_server_config.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :get_attached_server_config, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#import_attached_cluster(request, options = nil) ⇒ ::Gapic::Operation #import_attached_cluster(parent: nil, validate_only: nil, fleet_membership: nil, platform_version: nil, distribution: nil, proxy_config: 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.

Examples:

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

Overloads:

  • #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.

  • #import_attached_cluster(parent: nil, validate_only: nil, fleet_membership: nil, platform_version: nil, distribution: nil, proxy_config: 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).

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 557

def import_attached_cluster request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::ImportAttachedClusterRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.import_attached_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.import_attached_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.import_attached_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :import_attached_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_attached_clusters(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::GkeMultiCloud::V1::AttachedCluster> #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.

Examples:

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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::GkeMultiCloud::V1::AttachedCluster.
  p item
end

Overloads:

  • #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.

  • #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).

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 761

def list_attached_clusters request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::ListAttachedClustersRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_attached_clusters..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_attached_clusters.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_attached_clusters.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :list_attached_clusters, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @attached_clusters_stub, :list_attached_clusters, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#loggerLogger

The logger used for request/response debug logging.



229
230
231
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 229

def logger
  @attached_clusters_stub.logger
end

#universe_domainString

The effective universe domain



139
140
141
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 139

def universe_domain
  @attached_clusters_stub.universe_domain
end

#update_attached_cluster(request, options = nil) ⇒ ::Gapic::Operation #update_attached_cluster(attached_cluster: nil, validate_only: nil, update_mask: nil) ⇒ ::Gapic::Operation

Updates an AttachedCluster.

Examples:

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

Overloads:

  • #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.

  • #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).

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/google/cloud/gke_multi_cloud/v1/attached_clusters/client.rb', line 431

def update_attached_cluster request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeMultiCloud::V1::UpdateAttachedClusterRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_attached_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::GkeMultiCloud::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.attached_cluster&.name
    header_params["attached_cluster.name"] = request.attached_cluster.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_attached_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_attached_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @attached_clusters_stub.call_rpc :update_attached_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end