google-cloud-hypercompute_cluster-v1beta 0.a → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/hypercompute_cluster/v1beta/bindings_override.rb +75 -0
  6. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/client.rb +968 -0
  7. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/credentials.rb +47 -0
  8. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/operations.rb +841 -0
  9. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/paths.rb +217 -0
  10. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/rest/client.rb +898 -0
  11. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/rest/operations.rb +925 -0
  12. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/rest/service_stub.rb +388 -0
  13. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/rest.rb +54 -0
  14. data/lib/google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster.rb +56 -0
  15. data/lib/google/cloud/hypercompute_cluster/v1beta/rest.rb +38 -0
  16. data/lib/google/cloud/hypercompute_cluster/v1beta/version.rb +7 -2
  17. data/lib/google/cloud/hypercompute_cluster/v1beta.rb +45 -0
  18. data/lib/google/cloud/hypercomputecluster/v1beta/hypercompute_cluster_pb.rb +101 -0
  19. data/lib/google/cloud/hypercomputecluster/v1beta/hypercompute_cluster_services_pb.rb +53 -0
  20. data/lib/google/cloud/hypercomputecluster/v1beta/operation_metadata_pb.rb +47 -0
  21. data/lib/google-cloud-hypercompute_cluster-v1beta.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/client.rb +473 -0
  24. data/proto_docs/google/api/field_behavior.rb +85 -0
  25. data/proto_docs/google/api/field_info.rb +88 -0
  26. data/proto_docs/google/api/launch_stage.rb +71 -0
  27. data/proto_docs/google/api/resource.rb +227 -0
  28. data/proto_docs/google/cloud/hypercomputecluster/v1beta/hypercompute_cluster.rb +1007 -0
  29. data/proto_docs/google/cloud/hypercomputecluster/v1beta/operation_metadata.rb +55 -0
  30. data/proto_docs/google/longrunning/operations.rb +191 -0
  31. data/proto_docs/google/protobuf/any.rb +145 -0
  32. data/proto_docs/google/protobuf/duration.rb +98 -0
  33. data/proto_docs/google/protobuf/empty.rb +34 -0
  34. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  35. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  36. data/proto_docs/google/rpc/status.rb +48 -0
  37. metadata +84 -9
@@ -0,0 +1,898 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/hypercomputecluster/v1beta/hypercompute_cluster_pb"
21
+ require "google/cloud/hypercompute_cluster/v1beta/hypercompute_cluster/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module HypercomputeCluster
27
+ module V1beta
28
+ module HypercomputeCluster
29
+ module Rest
30
+ ##
31
+ # REST client for the HypercomputeCluster service.
32
+ #
33
+ # Service describing handlers for resources
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "hypercomputecluster.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :hypercompute_cluster_stub
46
+
47
+ ##
48
+ # Configure the HypercomputeCluster Client class.
49
+ #
50
+ # See {::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all HypercomputeCluster clients
56
+ # ::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "HypercomputeCluster", "V1beta"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.rpcs.list_clusters.timeout = 60.0
77
+ default_config.rpcs.list_clusters.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.get_cluster.timeout = 60.0
82
+ default_config.rpcs.get_cluster.retry_policy = {
83
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
84
+ }
85
+
86
+ default_config.rpcs.create_cluster.timeout = 3600.0
87
+
88
+ default_config.rpcs.update_cluster.timeout = 3600.0
89
+
90
+ default_config.rpcs.delete_cluster.timeout = 3600.0
91
+
92
+ default_config
93
+ end
94
+ yield @configure if block_given?
95
+ @configure
96
+ end
97
+
98
+ ##
99
+ # Configure the HypercomputeCluster Client instance.
100
+ #
101
+ # The configuration is set to the derived mode, meaning that values can be changed,
102
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
103
+ # should be made on {Client.configure}.
104
+ #
105
+ # See {::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client::Configuration}
106
+ # for a description of the configuration fields.
107
+ #
108
+ # @yield [config] Configure the Client client.
109
+ # @yieldparam config [Client::Configuration]
110
+ #
111
+ # @return [Client::Configuration]
112
+ #
113
+ def configure
114
+ yield @config if block_given?
115
+ @config
116
+ end
117
+
118
+ ##
119
+ # The effective universe domain
120
+ #
121
+ # @return [String]
122
+ #
123
+ def universe_domain
124
+ @hypercompute_cluster_stub.universe_domain
125
+ end
126
+
127
+ ##
128
+ # Create a new HypercomputeCluster REST client object.
129
+ #
130
+ # @example
131
+ #
132
+ # # Create a client using the default configuration
133
+ # client = ::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.new
134
+ #
135
+ # # Create a client using a custom configuration
136
+ # client = ::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.new do |config|
137
+ # config.timeout = 10.0
138
+ # end
139
+ #
140
+ # @yield [config] Configure the HypercomputeCluster client.
141
+ # @yieldparam config [Client::Configuration]
142
+ #
143
+ def initialize
144
+ # Create the configuration object
145
+ @config = Configuration.new Client.configure
146
+
147
+ # Yield the configuration if needed
148
+ yield @config if block_given?
149
+
150
+ # Create credentials
151
+ credentials = @config.credentials
152
+ # Use self-signed JWT if the endpoint is unchanged from default,
153
+ # but only if the default endpoint does not have a region prefix.
154
+ enable_self_signed_jwt = @config.endpoint.nil? ||
155
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
156
+ !@config.endpoint.split(".").first.include?("-"))
157
+ credentials ||= Credentials.default scope: @config.scope,
158
+ enable_self_signed_jwt: enable_self_signed_jwt
159
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
160
+ credentials = Credentials.new credentials, scope: @config.scope
161
+ end
162
+
163
+ @quota_project_id = @config.quota_project
164
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
165
+
166
+ @operations_client = ::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Operations.new do |config|
167
+ config.credentials = credentials
168
+ config.quota_project = @quota_project_id
169
+ config.endpoint = @config.endpoint
170
+ config.universe_domain = @config.universe_domain
171
+ end
172
+
173
+ @hypercompute_cluster_stub = ::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::ServiceStub.new(
174
+ endpoint: @config.endpoint,
175
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
176
+ universe_domain: @config.universe_domain,
177
+ credentials: credentials,
178
+ logger: @config.logger
179
+ )
180
+
181
+ @hypercompute_cluster_stub.logger(stub: true)&.info do |entry|
182
+ entry.set_system_name
183
+ entry.set_service
184
+ entry.message = "Created client for #{entry.service}"
185
+ entry.set_credentials_fields credentials
186
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
187
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
188
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
189
+ end
190
+
191
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
192
+ config.credentials = credentials
193
+ config.quota_project = @quota_project_id
194
+ config.endpoint = @hypercompute_cluster_stub.endpoint
195
+ config.universe_domain = @hypercompute_cluster_stub.universe_domain
196
+ config.bindings_override = @config.bindings_override
197
+ config.logger = @hypercompute_cluster_stub.logger if config.respond_to? :logger=
198
+ end
199
+ end
200
+
201
+ ##
202
+ # Get the associated client for long-running operations.
203
+ #
204
+ # @return [::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Operations]
205
+ #
206
+ attr_reader :operations_client
207
+
208
+ ##
209
+ # Get the associated client for mix-in of the Locations.
210
+ #
211
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
212
+ #
213
+ attr_reader :location_client
214
+
215
+ ##
216
+ # The logger used for request/response debug logging.
217
+ #
218
+ # @return [Logger]
219
+ #
220
+ def logger
221
+ @hypercompute_cluster_stub.logger
222
+ end
223
+
224
+ # Service calls
225
+
226
+ ##
227
+ # Lists Clusters in a given project and location.
228
+ #
229
+ # @overload list_clusters(request, options = nil)
230
+ # Pass arguments to `list_clusters` via a request object, either of type
231
+ # {::Google::Cloud::HypercomputeCluster::V1beta::ListClustersRequest} or an equivalent Hash.
232
+ #
233
+ # @param request [::Google::Cloud::HypercomputeCluster::V1beta::ListClustersRequest, ::Hash]
234
+ # A request object representing the call parameters. Required. To specify no
235
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
236
+ # @param options [::Gapic::CallOptions, ::Hash]
237
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
238
+ #
239
+ # @overload list_clusters(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
240
+ # Pass arguments to `list_clusters` via keyword arguments. Note that at
241
+ # least one keyword argument is required. To specify no parameters, or to keep all
242
+ # the default parameter values, pass an empty Hash as a request object (see above).
243
+ #
244
+ # @param parent [::String]
245
+ # Required. Parent location of the clusters to list, in the format
246
+ # `projects/{project}/locations/{location}`.
247
+ # @param page_size [::Integer]
248
+ # Optional. Maximum number of clusters to return. The service may return
249
+ # fewer than this value.
250
+ # @param page_token [::String]
251
+ # Optional. A page token received from a previous `ListClusters` call.
252
+ # Provide this to retrieve the subsequent page. When paginating, all other
253
+ # parameters provided to `ListClusters` must match the call that provided the
254
+ # page token.
255
+ # @param filter [::String]
256
+ # Optional. [Filter](https://google.aip.dev/160) to apply to the returned
257
+ # results.
258
+ # @param order_by [::String]
259
+ # Optional. How to order the resulting clusters. Must be one of the following
260
+ # strings:
261
+ #
262
+ # * `name`
263
+ # * `name desc`
264
+ # * `create_time`
265
+ # * `create_time desc`
266
+ #
267
+ # If not specified, clusters will be returned in an arbitrary order.
268
+ # @yield [result, operation] Access the result along with the TransportOperation object
269
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::HypercomputeCluster::V1beta::Cluster>]
270
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
271
+ #
272
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::HypercomputeCluster::V1beta::Cluster>]
273
+ #
274
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
275
+ #
276
+ # @example Basic example
277
+ # require "google/cloud/hypercompute_cluster/v1beta"
278
+ #
279
+ # # Create a client object. The client can be reused for multiple calls.
280
+ # client = Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.new
281
+ #
282
+ # # Create a request. To set request fields, pass in keyword arguments.
283
+ # request = Google::Cloud::HypercomputeCluster::V1beta::ListClustersRequest.new
284
+ #
285
+ # # Call the list_clusters method.
286
+ # result = client.list_clusters request
287
+ #
288
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
289
+ # # over elements, and API calls will be issued to fetch pages as needed.
290
+ # result.each do |item|
291
+ # # Each element is of type ::Google::Cloud::HypercomputeCluster::V1beta::Cluster.
292
+ # p item
293
+ # end
294
+ #
295
+ def list_clusters request, options = nil
296
+ raise ::ArgumentError, "request must be provided" if request.nil?
297
+
298
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::HypercomputeCluster::V1beta::ListClustersRequest
299
+
300
+ # Converts hash and nil to an options object
301
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
302
+
303
+ # Customize the options with defaults
304
+ call_metadata = @config.rpcs.list_clusters.metadata.to_h
305
+
306
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
307
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
308
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
309
+ gapic_version: ::Google::Cloud::HypercomputeCluster::V1beta::VERSION,
310
+ transports_version_send: [:rest]
311
+
312
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
313
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
314
+
315
+ options.apply_defaults timeout: @config.rpcs.list_clusters.timeout,
316
+ metadata: call_metadata,
317
+ retry_policy: @config.rpcs.list_clusters.retry_policy
318
+
319
+ options.apply_defaults timeout: @config.timeout,
320
+ metadata: @config.metadata,
321
+ retry_policy: @config.retry_policy
322
+
323
+ @hypercompute_cluster_stub.list_clusters request, options do |result, operation|
324
+ result = ::Gapic::Rest::PagedEnumerable.new @hypercompute_cluster_stub, :list_clusters, "clusters", request, result, options
325
+ yield result, operation if block_given?
326
+ throw :response, result
327
+ end
328
+ rescue ::Gapic::Rest::Error => e
329
+ raise ::Google::Cloud::Error.from_error(e)
330
+ end
331
+
332
+ ##
333
+ # Gets details of a single Cluster.
334
+ #
335
+ # @overload get_cluster(request, options = nil)
336
+ # Pass arguments to `get_cluster` via a request object, either of type
337
+ # {::Google::Cloud::HypercomputeCluster::V1beta::GetClusterRequest} or an equivalent Hash.
338
+ #
339
+ # @param request [::Google::Cloud::HypercomputeCluster::V1beta::GetClusterRequest, ::Hash]
340
+ # A request object representing the call parameters. Required. To specify no
341
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
342
+ # @param options [::Gapic::CallOptions, ::Hash]
343
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
344
+ #
345
+ # @overload get_cluster(name: nil)
346
+ # Pass arguments to `get_cluster` via keyword arguments. Note that at
347
+ # least one keyword argument is required. To specify no parameters, or to keep all
348
+ # the default parameter values, pass an empty Hash as a request object (see above).
349
+ #
350
+ # @param name [::String]
351
+ # Required. Name of the cluster to retrieve, in the format
352
+ # `projects/{project}/locations/{location}/clusters/{cluster}`.
353
+ # @yield [result, operation] Access the result along with the TransportOperation object
354
+ # @yieldparam result [::Google::Cloud::HypercomputeCluster::V1beta::Cluster]
355
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
356
+ #
357
+ # @return [::Google::Cloud::HypercomputeCluster::V1beta::Cluster]
358
+ #
359
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
360
+ #
361
+ # @example Basic example
362
+ # require "google/cloud/hypercompute_cluster/v1beta"
363
+ #
364
+ # # Create a client object. The client can be reused for multiple calls.
365
+ # client = Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.new
366
+ #
367
+ # # Create a request. To set request fields, pass in keyword arguments.
368
+ # request = Google::Cloud::HypercomputeCluster::V1beta::GetClusterRequest.new
369
+ #
370
+ # # Call the get_cluster method.
371
+ # result = client.get_cluster request
372
+ #
373
+ # # The returned object is of type Google::Cloud::HypercomputeCluster::V1beta::Cluster.
374
+ # p result
375
+ #
376
+ def get_cluster request, options = nil
377
+ raise ::ArgumentError, "request must be provided" if request.nil?
378
+
379
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::HypercomputeCluster::V1beta::GetClusterRequest
380
+
381
+ # Converts hash and nil to an options object
382
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
383
+
384
+ # Customize the options with defaults
385
+ call_metadata = @config.rpcs.get_cluster.metadata.to_h
386
+
387
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
388
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
389
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
390
+ gapic_version: ::Google::Cloud::HypercomputeCluster::V1beta::VERSION,
391
+ transports_version_send: [:rest]
392
+
393
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
394
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
395
+
396
+ options.apply_defaults timeout: @config.rpcs.get_cluster.timeout,
397
+ metadata: call_metadata,
398
+ retry_policy: @config.rpcs.get_cluster.retry_policy
399
+
400
+ options.apply_defaults timeout: @config.timeout,
401
+ metadata: @config.metadata,
402
+ retry_policy: @config.retry_policy
403
+
404
+ @hypercompute_cluster_stub.get_cluster request, options do |result, operation|
405
+ yield result, operation if block_given?
406
+ end
407
+ rescue ::Gapic::Rest::Error => e
408
+ raise ::Google::Cloud::Error.from_error(e)
409
+ end
410
+
411
+ ##
412
+ # Creates a new Cluster in a given project and location.
413
+ #
414
+ # @overload create_cluster(request, options = nil)
415
+ # Pass arguments to `create_cluster` via a request object, either of type
416
+ # {::Google::Cloud::HypercomputeCluster::V1beta::CreateClusterRequest} or an equivalent Hash.
417
+ #
418
+ # @param request [::Google::Cloud::HypercomputeCluster::V1beta::CreateClusterRequest, ::Hash]
419
+ # A request object representing the call parameters. Required. To specify no
420
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
421
+ # @param options [::Gapic::CallOptions, ::Hash]
422
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
423
+ #
424
+ # @overload create_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil)
425
+ # Pass arguments to `create_cluster` via keyword arguments. Note that at
426
+ # least one keyword argument is required. To specify no parameters, or to keep all
427
+ # the default parameter values, pass an empty Hash as a request object (see above).
428
+ #
429
+ # @param parent [::String]
430
+ # Required. Parent location in which the cluster should be created, in the
431
+ # format `projects/{project}/locations/{location}`.
432
+ # @param cluster_id [::String]
433
+ # Required. ID of the cluster to create. Must conform to
434
+ # [RFC-1034](https://datatracker.ietf.org/doc/html/rfc1034) (lower-case,
435
+ # alphanumeric, and at most 63 characters).
436
+ # @param cluster [::Google::Cloud::HypercomputeCluster::V1beta::Cluster, ::Hash]
437
+ # Required. Cluster to create.
438
+ # @param request_id [::String]
439
+ # Optional. A unique identifier for this request. A random UUID is
440
+ # recommended. This request is idempotent if and only if `request_id` is
441
+ # provided.
442
+ # @yield [result, operation] Access the result along with the TransportOperation object
443
+ # @yieldparam result [::Gapic::Operation]
444
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
445
+ #
446
+ # @return [::Gapic::Operation]
447
+ #
448
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
449
+ #
450
+ # @example Basic example
451
+ # require "google/cloud/hypercompute_cluster/v1beta"
452
+ #
453
+ # # Create a client object. The client can be reused for multiple calls.
454
+ # client = Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.new
455
+ #
456
+ # # Create a request. To set request fields, pass in keyword arguments.
457
+ # request = Google::Cloud::HypercomputeCluster::V1beta::CreateClusterRequest.new
458
+ #
459
+ # # Call the create_cluster method.
460
+ # result = client.create_cluster request
461
+ #
462
+ # # The returned object is of type Gapic::Operation. You can use it to
463
+ # # check the status of an operation, cancel it, or wait for results.
464
+ # # Here is how to wait for a response.
465
+ # result.wait_until_done! timeout: 60
466
+ # if result.response?
467
+ # p result.response
468
+ # else
469
+ # puts "No response received."
470
+ # end
471
+ #
472
+ def create_cluster request, options = nil
473
+ raise ::ArgumentError, "request must be provided" if request.nil?
474
+
475
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::HypercomputeCluster::V1beta::CreateClusterRequest
476
+
477
+ # Converts hash and nil to an options object
478
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
479
+
480
+ # Customize the options with defaults
481
+ call_metadata = @config.rpcs.create_cluster.metadata.to_h
482
+
483
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
484
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
485
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
486
+ gapic_version: ::Google::Cloud::HypercomputeCluster::V1beta::VERSION,
487
+ transports_version_send: [:rest]
488
+
489
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
490
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
491
+
492
+ options.apply_defaults timeout: @config.rpcs.create_cluster.timeout,
493
+ metadata: call_metadata,
494
+ retry_policy: @config.rpcs.create_cluster.retry_policy
495
+
496
+ options.apply_defaults timeout: @config.timeout,
497
+ metadata: @config.metadata,
498
+ retry_policy: @config.retry_policy
499
+
500
+ @hypercompute_cluster_stub.create_cluster request, options do |result, operation|
501
+ result = ::Gapic::Operation.new result, @operations_client, options: options
502
+ yield result, operation if block_given?
503
+ throw :response, result
504
+ end
505
+ rescue ::Gapic::Rest::Error => e
506
+ raise ::Google::Cloud::Error.from_error(e)
507
+ end
508
+
509
+ ##
510
+ # Updates the parameters of a single Cluster.
511
+ #
512
+ # @overload update_cluster(request, options = nil)
513
+ # Pass arguments to `update_cluster` via a request object, either of type
514
+ # {::Google::Cloud::HypercomputeCluster::V1beta::UpdateClusterRequest} or an equivalent Hash.
515
+ #
516
+ # @param request [::Google::Cloud::HypercomputeCluster::V1beta::UpdateClusterRequest, ::Hash]
517
+ # A request object representing the call parameters. Required. To specify no
518
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
519
+ # @param options [::Gapic::CallOptions, ::Hash]
520
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
521
+ #
522
+ # @overload update_cluster(cluster: nil, update_mask: nil, request_id: nil)
523
+ # Pass arguments to `update_cluster` via keyword arguments. Note that at
524
+ # least one keyword argument is required. To specify no parameters, or to keep all
525
+ # the default parameter values, pass an empty Hash as a request object (see above).
526
+ #
527
+ # @param cluster [::Google::Cloud::HypercomputeCluster::V1beta::Cluster, ::Hash]
528
+ # Required. Cluster to update.
529
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
530
+ # Optional. Mask specifying which fields in the cluster to update. All paths
531
+ # must be specified explicitly - wildcards are not supported. At least one
532
+ # path must be provided.
533
+ # @param request_id [::String]
534
+ # Optional. A unique identifier for this request. A random UUID is
535
+ # recommended. This request is idempotent if and only if `request_id` is
536
+ # provided.
537
+ # @yield [result, operation] Access the result along with the TransportOperation object
538
+ # @yieldparam result [::Gapic::Operation]
539
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
540
+ #
541
+ # @return [::Gapic::Operation]
542
+ #
543
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
544
+ #
545
+ # @example Basic example
546
+ # require "google/cloud/hypercompute_cluster/v1beta"
547
+ #
548
+ # # Create a client object. The client can be reused for multiple calls.
549
+ # client = Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.new
550
+ #
551
+ # # Create a request. To set request fields, pass in keyword arguments.
552
+ # request = Google::Cloud::HypercomputeCluster::V1beta::UpdateClusterRequest.new
553
+ #
554
+ # # Call the update_cluster method.
555
+ # result = client.update_cluster request
556
+ #
557
+ # # The returned object is of type Gapic::Operation. You can use it to
558
+ # # check the status of an operation, cancel it, or wait for results.
559
+ # # Here is how to wait for a response.
560
+ # result.wait_until_done! timeout: 60
561
+ # if result.response?
562
+ # p result.response
563
+ # else
564
+ # puts "No response received."
565
+ # end
566
+ #
567
+ def update_cluster request, options = nil
568
+ raise ::ArgumentError, "request must be provided" if request.nil?
569
+
570
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::HypercomputeCluster::V1beta::UpdateClusterRequest
571
+
572
+ # Converts hash and nil to an options object
573
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
574
+
575
+ # Customize the options with defaults
576
+ call_metadata = @config.rpcs.update_cluster.metadata.to_h
577
+
578
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
579
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
580
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
581
+ gapic_version: ::Google::Cloud::HypercomputeCluster::V1beta::VERSION,
582
+ transports_version_send: [:rest]
583
+
584
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
585
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
586
+
587
+ options.apply_defaults timeout: @config.rpcs.update_cluster.timeout,
588
+ metadata: call_metadata,
589
+ retry_policy: @config.rpcs.update_cluster.retry_policy
590
+
591
+ options.apply_defaults timeout: @config.timeout,
592
+ metadata: @config.metadata,
593
+ retry_policy: @config.retry_policy
594
+
595
+ @hypercompute_cluster_stub.update_cluster request, options do |result, operation|
596
+ result = ::Gapic::Operation.new result, @operations_client, options: options
597
+ yield result, operation if block_given?
598
+ throw :response, result
599
+ end
600
+ rescue ::Gapic::Rest::Error => e
601
+ raise ::Google::Cloud::Error.from_error(e)
602
+ end
603
+
604
+ ##
605
+ # Deletes a single Cluster.
606
+ #
607
+ # @overload delete_cluster(request, options = nil)
608
+ # Pass arguments to `delete_cluster` via a request object, either of type
609
+ # {::Google::Cloud::HypercomputeCluster::V1beta::DeleteClusterRequest} or an equivalent Hash.
610
+ #
611
+ # @param request [::Google::Cloud::HypercomputeCluster::V1beta::DeleteClusterRequest, ::Hash]
612
+ # A request object representing the call parameters. Required. To specify no
613
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
614
+ # @param options [::Gapic::CallOptions, ::Hash]
615
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
616
+ #
617
+ # @overload delete_cluster(name: nil, request_id: nil)
618
+ # Pass arguments to `delete_cluster` via keyword arguments. Note that at
619
+ # least one keyword argument is required. To specify no parameters, or to keep all
620
+ # the default parameter values, pass an empty Hash as a request object (see above).
621
+ #
622
+ # @param name [::String]
623
+ # Required. Name of the cluster to delete, in the format
624
+ # `projects/{project}/locations/{location}/clusters/{cluster}`.
625
+ # @param request_id [::String]
626
+ # Optional. A unique identifier for this request. A random UUID is
627
+ # recommended. This request is idempotent if and only if `request_id` is
628
+ # provided.
629
+ # @yield [result, operation] Access the result along with the TransportOperation object
630
+ # @yieldparam result [::Gapic::Operation]
631
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
632
+ #
633
+ # @return [::Gapic::Operation]
634
+ #
635
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
636
+ #
637
+ # @example Basic example
638
+ # require "google/cloud/hypercompute_cluster/v1beta"
639
+ #
640
+ # # Create a client object. The client can be reused for multiple calls.
641
+ # client = Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.new
642
+ #
643
+ # # Create a request. To set request fields, pass in keyword arguments.
644
+ # request = Google::Cloud::HypercomputeCluster::V1beta::DeleteClusterRequest.new
645
+ #
646
+ # # Call the delete_cluster method.
647
+ # result = client.delete_cluster request
648
+ #
649
+ # # The returned object is of type Gapic::Operation. You can use it to
650
+ # # check the status of an operation, cancel it, or wait for results.
651
+ # # Here is how to wait for a response.
652
+ # result.wait_until_done! timeout: 60
653
+ # if result.response?
654
+ # p result.response
655
+ # else
656
+ # puts "No response received."
657
+ # end
658
+ #
659
+ def delete_cluster request, options = nil
660
+ raise ::ArgumentError, "request must be provided" if request.nil?
661
+
662
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::HypercomputeCluster::V1beta::DeleteClusterRequest
663
+
664
+ # Converts hash and nil to an options object
665
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
666
+
667
+ # Customize the options with defaults
668
+ call_metadata = @config.rpcs.delete_cluster.metadata.to_h
669
+
670
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
671
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
672
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
673
+ gapic_version: ::Google::Cloud::HypercomputeCluster::V1beta::VERSION,
674
+ transports_version_send: [:rest]
675
+
676
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
677
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
678
+
679
+ options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout,
680
+ metadata: call_metadata,
681
+ retry_policy: @config.rpcs.delete_cluster.retry_policy
682
+
683
+ options.apply_defaults timeout: @config.timeout,
684
+ metadata: @config.metadata,
685
+ retry_policy: @config.retry_policy
686
+
687
+ @hypercompute_cluster_stub.delete_cluster request, options do |result, operation|
688
+ result = ::Gapic::Operation.new result, @operations_client, options: options
689
+ yield result, operation if block_given?
690
+ throw :response, result
691
+ end
692
+ rescue ::Gapic::Rest::Error => e
693
+ raise ::Google::Cloud::Error.from_error(e)
694
+ end
695
+
696
+ ##
697
+ # Configuration class for the HypercomputeCluster REST API.
698
+ #
699
+ # This class represents the configuration for HypercomputeCluster REST,
700
+ # providing control over timeouts, retry behavior, logging, transport
701
+ # parameters, and other low-level controls. Certain parameters can also be
702
+ # applied individually to specific RPCs. See
703
+ # {::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client::Configuration::Rpcs}
704
+ # for a list of RPCs that can be configured independently.
705
+ #
706
+ # Configuration can be applied globally to all clients, or to a single client
707
+ # on construction.
708
+ #
709
+ # @example
710
+ #
711
+ # # Modify the global config, setting the timeout for
712
+ # # list_clusters to 20 seconds,
713
+ # # and all remaining timeouts to 10 seconds.
714
+ # ::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.configure do |config|
715
+ # config.timeout = 10.0
716
+ # config.rpcs.list_clusters.timeout = 20.0
717
+ # end
718
+ #
719
+ # # Apply the above configuration only to a new client.
720
+ # client = ::Google::Cloud::HypercomputeCluster::V1beta::HypercomputeCluster::Rest::Client.new do |config|
721
+ # config.timeout = 10.0
722
+ # config.rpcs.list_clusters.timeout = 20.0
723
+ # end
724
+ #
725
+ # @!attribute [rw] endpoint
726
+ # A custom service endpoint, as a hostname or hostname:port. The default is
727
+ # nil, indicating to use the default endpoint in the current universe domain.
728
+ # @return [::String,nil]
729
+ # @!attribute [rw] credentials
730
+ # Credentials to send with calls. You may provide any of the following types:
731
+ # * (`String`) The path to a service account key file in JSON format
732
+ # * (`Hash`) A service account key as a Hash
733
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
734
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
735
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
736
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
737
+ # * (`nil`) indicating no credentials
738
+ #
739
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
740
+ # external source for authentication to Google Cloud, you must validate it before
741
+ # providing it to a Google API client library. Providing an unvalidated credential
742
+ # configuration to Google APIs can compromise the security of your systems and data.
743
+ # For more information, refer to [Validate credential configurations from external
744
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
745
+ # @return [::Object]
746
+ # @!attribute [rw] scope
747
+ # The OAuth scopes
748
+ # @return [::Array<::String>]
749
+ # @!attribute [rw] lib_name
750
+ # The library name as recorded in instrumentation and logging
751
+ # @return [::String]
752
+ # @!attribute [rw] lib_version
753
+ # The library version as recorded in instrumentation and logging
754
+ # @return [::String]
755
+ # @!attribute [rw] timeout
756
+ # The call timeout in seconds.
757
+ # @return [::Numeric]
758
+ # @!attribute [rw] metadata
759
+ # Additional headers to be sent with the call.
760
+ # @return [::Hash{::Symbol=>::String}]
761
+ # @!attribute [rw] retry_policy
762
+ # The retry policy. The value is a hash with the following keys:
763
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
764
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
765
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
766
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
767
+ # trigger a retry.
768
+ # @return [::Hash]
769
+ # @!attribute [rw] quota_project
770
+ # A separate project against which to charge quota.
771
+ # @return [::String]
772
+ # @!attribute [rw] universe_domain
773
+ # The universe domain within which to make requests. This determines the
774
+ # default endpoint URL. The default value of nil uses the environment
775
+ # universe (usually the default "googleapis.com" universe).
776
+ # @return [::String,nil]
777
+ # @!attribute [rw] logger
778
+ # A custom logger to use for request/response debug logging, or the value
779
+ # `:default` (the default) to construct a default logger, or `nil` to
780
+ # explicitly disable logging.
781
+ # @return [::Logger,:default,nil]
782
+ #
783
+ class Configuration
784
+ extend ::Gapic::Config
785
+
786
+ # @private
787
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
788
+ DEFAULT_ENDPOINT = "hypercomputecluster.googleapis.com"
789
+
790
+ config_attr :endpoint, nil, ::String, nil
791
+ config_attr :credentials, nil do |value|
792
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
793
+ allowed.any? { |klass| klass === value }
794
+ end
795
+ config_attr :scope, nil, ::String, ::Array, nil
796
+ config_attr :lib_name, nil, ::String, nil
797
+ config_attr :lib_version, nil, ::String, nil
798
+ config_attr :timeout, nil, ::Numeric, nil
799
+ config_attr :metadata, nil, ::Hash, nil
800
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
801
+ config_attr :quota_project, nil, ::String, nil
802
+ config_attr :universe_domain, nil, ::String, nil
803
+
804
+ # @private
805
+ # Overrides for http bindings for the RPCs of this service
806
+ # are only used when this service is used as mixin, and only
807
+ # by the host service.
808
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
809
+ config_attr :bindings_override, {}, ::Hash, nil
810
+ config_attr :logger, :default, ::Logger, nil, :default
811
+
812
+ # @private
813
+ def initialize parent_config = nil
814
+ @parent_config = parent_config unless parent_config.nil?
815
+
816
+ yield self if block_given?
817
+ end
818
+
819
+ ##
820
+ # Configurations for individual RPCs
821
+ # @return [Rpcs]
822
+ #
823
+ def rpcs
824
+ @rpcs ||= begin
825
+ parent_rpcs = nil
826
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
827
+ Rpcs.new parent_rpcs
828
+ end
829
+ end
830
+
831
+ ##
832
+ # Configuration RPC class for the HypercomputeCluster API.
833
+ #
834
+ # Includes fields providing the configuration for each RPC in this service.
835
+ # Each configuration object is of type `Gapic::Config::Method` and includes
836
+ # the following configuration fields:
837
+ #
838
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
839
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
840
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
841
+ # include the following keys:
842
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
843
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
844
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
845
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
846
+ # trigger a retry.
847
+ #
848
+ class Rpcs
849
+ ##
850
+ # RPC-specific configuration for `list_clusters`
851
+ # @return [::Gapic::Config::Method]
852
+ #
853
+ attr_reader :list_clusters
854
+ ##
855
+ # RPC-specific configuration for `get_cluster`
856
+ # @return [::Gapic::Config::Method]
857
+ #
858
+ attr_reader :get_cluster
859
+ ##
860
+ # RPC-specific configuration for `create_cluster`
861
+ # @return [::Gapic::Config::Method]
862
+ #
863
+ attr_reader :create_cluster
864
+ ##
865
+ # RPC-specific configuration for `update_cluster`
866
+ # @return [::Gapic::Config::Method]
867
+ #
868
+ attr_reader :update_cluster
869
+ ##
870
+ # RPC-specific configuration for `delete_cluster`
871
+ # @return [::Gapic::Config::Method]
872
+ #
873
+ attr_reader :delete_cluster
874
+
875
+ # @private
876
+ def initialize parent_rpcs = nil
877
+ list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters
878
+ @list_clusters = ::Gapic::Config::Method.new list_clusters_config
879
+ get_cluster_config = parent_rpcs.get_cluster if parent_rpcs.respond_to? :get_cluster
880
+ @get_cluster = ::Gapic::Config::Method.new get_cluster_config
881
+ create_cluster_config = parent_rpcs.create_cluster if parent_rpcs.respond_to? :create_cluster
882
+ @create_cluster = ::Gapic::Config::Method.new create_cluster_config
883
+ update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
884
+ @update_cluster = ::Gapic::Config::Method.new update_cluster_config
885
+ delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
886
+ @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
887
+
888
+ yield self if block_given?
889
+ end
890
+ end
891
+ end
892
+ end
893
+ end
894
+ end
895
+ end
896
+ end
897
+ end
898
+ end