google-cloud-metastore-v1beta 0.2.0 → 0.3.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.
@@ -0,0 +1,900 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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/metastore/v1beta/metastore_federation_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Metastore
25
+ module V1beta
26
+ module DataprocMetastoreFederation
27
+ ##
28
+ # Client for the DataprocMetastoreFederation service.
29
+ #
30
+ # Configures and manages metastore federation services.
31
+ # Dataproc Metastore Federation Service allows federating a collection of
32
+ # backend metastores like BigQuery, Dataplex Lakes, and other Dataproc
33
+ # Metastores. The Federation Service exposes a gRPC URL through which metadata
34
+ # from the backend metastores are served at query time.
35
+ #
36
+ # The Dataproc Metastore Federation API defines the following resource model:
37
+ # * The service works with a collection of Google Cloud projects.
38
+ # * Each project has a collection of available locations.
39
+ # * Each location has a collection of federations.
40
+ # * Dataproc Metastore Federations are resources with names of the
41
+ # form:
42
+ # `projects/{project_number}/locations/{location_id}/federations/{federation_id}`.
43
+ #
44
+ class Client
45
+ include Paths
46
+
47
+ # @private
48
+ attr_reader :dataproc_metastore_federation_stub
49
+
50
+ ##
51
+ # Configure the DataprocMetastoreFederation Client class.
52
+ #
53
+ # See {::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client::Configuration}
54
+ # for a description of the configuration fields.
55
+ #
56
+ # @example
57
+ #
58
+ # # Modify the configuration for all DataprocMetastoreFederation clients
59
+ # ::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.configure do |config|
60
+ # config.timeout = 10.0
61
+ # end
62
+ #
63
+ # @yield [config] Configure the Client client.
64
+ # @yieldparam config [Client::Configuration]
65
+ #
66
+ # @return [Client::Configuration]
67
+ #
68
+ def self.configure
69
+ @configure ||= begin
70
+ namespace = ["Google", "Cloud", "Metastore", "V1beta"]
71
+ parent_config = while namespace.any?
72
+ parent_name = namespace.join "::"
73
+ parent_const = const_get parent_name
74
+ break parent_const.configure if parent_const.respond_to? :configure
75
+ namespace.pop
76
+ end
77
+ default_config = Client::Configuration.new parent_config
78
+
79
+ default_config
80
+ end
81
+ yield @configure if block_given?
82
+ @configure
83
+ end
84
+
85
+ ##
86
+ # Configure the DataprocMetastoreFederation Client instance.
87
+ #
88
+ # The configuration is set to the derived mode, meaning that values can be changed,
89
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
90
+ # should be made on {Client.configure}.
91
+ #
92
+ # See {::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client::Configuration}
93
+ # for a description of the configuration fields.
94
+ #
95
+ # @yield [config] Configure the Client client.
96
+ # @yieldparam config [Client::Configuration]
97
+ #
98
+ # @return [Client::Configuration]
99
+ #
100
+ def configure
101
+ yield @config if block_given?
102
+ @config
103
+ end
104
+
105
+ ##
106
+ # Create a new DataprocMetastoreFederation client object.
107
+ #
108
+ # @example
109
+ #
110
+ # # Create a client using the default configuration
111
+ # client = ::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.new
112
+ #
113
+ # # Create a client using a custom configuration
114
+ # client = ::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.new do |config|
115
+ # config.timeout = 10.0
116
+ # end
117
+ #
118
+ # @yield [config] Configure the DataprocMetastoreFederation client.
119
+ # @yieldparam config [Client::Configuration]
120
+ #
121
+ def initialize
122
+ # These require statements are intentionally placed here to initialize
123
+ # the gRPC module only when it's required.
124
+ # See https://github.com/googleapis/toolkit/issues/446
125
+ require "gapic/grpc"
126
+ require "google/cloud/metastore/v1beta/metastore_federation_services_pb"
127
+
128
+ # Create the configuration object
129
+ @config = Configuration.new Client.configure
130
+
131
+ # Yield the configuration if needed
132
+ yield @config if block_given?
133
+
134
+ # Create credentials
135
+ credentials = @config.credentials
136
+ # Use self-signed JWT if the endpoint is unchanged from default,
137
+ # but only if the default endpoint does not have a region prefix.
138
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
139
+ !@config.endpoint.split(".").first.include?("-")
140
+ credentials ||= Credentials.default scope: @config.scope,
141
+ enable_self_signed_jwt: enable_self_signed_jwt
142
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
143
+ credentials = Credentials.new credentials, scope: @config.scope
144
+ end
145
+ @quota_project_id = @config.quota_project
146
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
147
+
148
+ @operations_client = Operations.new do |config|
149
+ config.credentials = credentials
150
+ config.quota_project = @quota_project_id
151
+ config.endpoint = @config.endpoint
152
+ end
153
+
154
+ @dataproc_metastore_federation_stub = ::Gapic::ServiceStub.new(
155
+ ::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Stub,
156
+ credentials: credentials,
157
+ endpoint: @config.endpoint,
158
+ channel_args: @config.channel_args,
159
+ interceptors: @config.interceptors
160
+ )
161
+ end
162
+
163
+ ##
164
+ # Get the associated client for long-running operations.
165
+ #
166
+ # @return [::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Operations]
167
+ #
168
+ attr_reader :operations_client
169
+
170
+ # Service calls
171
+
172
+ ##
173
+ # Lists federations in a project and location.
174
+ #
175
+ # @overload list_federations(request, options = nil)
176
+ # Pass arguments to `list_federations` via a request object, either of type
177
+ # {::Google::Cloud::Metastore::V1beta::ListFederationsRequest} or an equivalent Hash.
178
+ #
179
+ # @param request [::Google::Cloud::Metastore::V1beta::ListFederationsRequest, ::Hash]
180
+ # A request object representing the call parameters. Required. To specify no
181
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
182
+ # @param options [::Gapic::CallOptions, ::Hash]
183
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
184
+ #
185
+ # @overload list_federations(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
186
+ # Pass arguments to `list_federations` via keyword arguments. Note that at
187
+ # least one keyword argument is required. To specify no parameters, or to keep all
188
+ # the default parameter values, pass an empty Hash as a request object (see above).
189
+ #
190
+ # @param parent [::String]
191
+ # Required. The relative resource name of the location of metastore federations
192
+ # to list, in the following form:
193
+ # `projects/{project_number}/locations/{location_id}`.
194
+ # @param page_size [::Integer]
195
+ # Optional. The maximum number of federations to return. The response may contain less
196
+ # than the maximum number. If unspecified, no more than 500 services are
197
+ # returned. The maximum value is 1000; values above 1000 are changed to 1000.
198
+ # @param page_token [::String]
199
+ # Optional. A page token, received from a previous ListFederationServices
200
+ # call. Provide this token to retrieve the subsequent page.
201
+ #
202
+ # To retrieve the first page, supply an empty page token.
203
+ #
204
+ # When paginating, other parameters provided to
205
+ # ListFederationServices must match the call that provided the
206
+ # page token.
207
+ # @param filter [::String]
208
+ # Optional. The filter to apply to list results.
209
+ # @param order_by [::String]
210
+ # Optional. Specify the ordering of results as described in [Sorting
211
+ # Order](https://cloud.google.com/apis/design/design_patterns#sorting_order).
212
+ # If not specified, the results will be sorted in the default order.
213
+ #
214
+ # @yield [response, operation] Access the result along with the RPC operation
215
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Metastore::V1beta::Federation>]
216
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
217
+ #
218
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Metastore::V1beta::Federation>]
219
+ #
220
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
221
+ #
222
+ # @example Basic example
223
+ # require "google/cloud/metastore/v1beta"
224
+ #
225
+ # # Create a client object. The client can be reused for multiple calls.
226
+ # client = Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.new
227
+ #
228
+ # # Create a request. To set request fields, pass in keyword arguments.
229
+ # request = Google::Cloud::Metastore::V1beta::ListFederationsRequest.new
230
+ #
231
+ # # Call the list_federations method.
232
+ # result = client.list_federations request
233
+ #
234
+ # # The returned object is of type Gapic::PagedEnumerable. You can
235
+ # # iterate over all elements by calling #each, and the enumerable
236
+ # # will lazily make API calls to fetch subsequent pages. Other
237
+ # # methods are also available for managing paging directly.
238
+ # result.each do |response|
239
+ # # Each element is of type ::Google::Cloud::Metastore::V1beta::Federation.
240
+ # p response
241
+ # end
242
+ #
243
+ def list_federations request, options = nil
244
+ raise ::ArgumentError, "request must be provided" if request.nil?
245
+
246
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::ListFederationsRequest
247
+
248
+ # Converts hash and nil to an options object
249
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
250
+
251
+ # Customize the options with defaults
252
+ metadata = @config.rpcs.list_federations.metadata.to_h
253
+
254
+ # Set x-goog-api-client and x-goog-user-project headers
255
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
256
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
257
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
258
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
259
+
260
+ header_params = {}
261
+ if request.parent
262
+ header_params["parent"] = request.parent
263
+ end
264
+
265
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
266
+ metadata[:"x-goog-request-params"] ||= request_params_header
267
+
268
+ options.apply_defaults timeout: @config.rpcs.list_federations.timeout,
269
+ metadata: metadata,
270
+ retry_policy: @config.rpcs.list_federations.retry_policy
271
+
272
+ options.apply_defaults timeout: @config.timeout,
273
+ metadata: @config.metadata,
274
+ retry_policy: @config.retry_policy
275
+
276
+ @dataproc_metastore_federation_stub.call_rpc :list_federations, request, options: options do |response, operation|
277
+ response = ::Gapic::PagedEnumerable.new @dataproc_metastore_federation_stub, :list_federations, request, response, operation, options
278
+ yield response, operation if block_given?
279
+ return response
280
+ end
281
+ rescue ::GRPC::BadStatus => e
282
+ raise ::Google::Cloud::Error.from_error(e)
283
+ end
284
+
285
+ ##
286
+ # Gets the details of a single federation.
287
+ #
288
+ # @overload get_federation(request, options = nil)
289
+ # Pass arguments to `get_federation` via a request object, either of type
290
+ # {::Google::Cloud::Metastore::V1beta::GetFederationRequest} or an equivalent Hash.
291
+ #
292
+ # @param request [::Google::Cloud::Metastore::V1beta::GetFederationRequest, ::Hash]
293
+ # A request object representing the call parameters. Required. To specify no
294
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
295
+ # @param options [::Gapic::CallOptions, ::Hash]
296
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
297
+ #
298
+ # @overload get_federation(name: nil)
299
+ # Pass arguments to `get_federation` via keyword arguments. Note that at
300
+ # least one keyword argument is required. To specify no parameters, or to keep all
301
+ # the default parameter values, pass an empty Hash as a request object (see above).
302
+ #
303
+ # @param name [::String]
304
+ # Required. The relative resource name of the metastore federation to retrieve,
305
+ # in the following form:
306
+ #
307
+ # `projects/{project_number}/locations/{location_id}/federations/{federation_id}`.
308
+ #
309
+ # @yield [response, operation] Access the result along with the RPC operation
310
+ # @yieldparam response [::Google::Cloud::Metastore::V1beta::Federation]
311
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
312
+ #
313
+ # @return [::Google::Cloud::Metastore::V1beta::Federation]
314
+ #
315
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
316
+ #
317
+ # @example Basic example
318
+ # require "google/cloud/metastore/v1beta"
319
+ #
320
+ # # Create a client object. The client can be reused for multiple calls.
321
+ # client = Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.new
322
+ #
323
+ # # Create a request. To set request fields, pass in keyword arguments.
324
+ # request = Google::Cloud::Metastore::V1beta::GetFederationRequest.new
325
+ #
326
+ # # Call the get_federation method.
327
+ # result = client.get_federation request
328
+ #
329
+ # # The returned object is of type Google::Cloud::Metastore::V1beta::Federation.
330
+ # p result
331
+ #
332
+ def get_federation request, options = nil
333
+ raise ::ArgumentError, "request must be provided" if request.nil?
334
+
335
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::GetFederationRequest
336
+
337
+ # Converts hash and nil to an options object
338
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
339
+
340
+ # Customize the options with defaults
341
+ metadata = @config.rpcs.get_federation.metadata.to_h
342
+
343
+ # Set x-goog-api-client and x-goog-user-project headers
344
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
345
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
346
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
347
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
348
+
349
+ header_params = {}
350
+ if request.name
351
+ header_params["name"] = request.name
352
+ end
353
+
354
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
355
+ metadata[:"x-goog-request-params"] ||= request_params_header
356
+
357
+ options.apply_defaults timeout: @config.rpcs.get_federation.timeout,
358
+ metadata: metadata,
359
+ retry_policy: @config.rpcs.get_federation.retry_policy
360
+
361
+ options.apply_defaults timeout: @config.timeout,
362
+ metadata: @config.metadata,
363
+ retry_policy: @config.retry_policy
364
+
365
+ @dataproc_metastore_federation_stub.call_rpc :get_federation, request, options: options do |response, operation|
366
+ yield response, operation if block_given?
367
+ return response
368
+ end
369
+ rescue ::GRPC::BadStatus => e
370
+ raise ::Google::Cloud::Error.from_error(e)
371
+ end
372
+
373
+ ##
374
+ # Creates a metastore federation in a project and location.
375
+ #
376
+ # @overload create_federation(request, options = nil)
377
+ # Pass arguments to `create_federation` via a request object, either of type
378
+ # {::Google::Cloud::Metastore::V1beta::CreateFederationRequest} or an equivalent Hash.
379
+ #
380
+ # @param request [::Google::Cloud::Metastore::V1beta::CreateFederationRequest, ::Hash]
381
+ # A request object representing the call parameters. Required. To specify no
382
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
383
+ # @param options [::Gapic::CallOptions, ::Hash]
384
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
385
+ #
386
+ # @overload create_federation(parent: nil, federation_id: nil, federation: nil, request_id: nil)
387
+ # Pass arguments to `create_federation` via keyword arguments. Note that at
388
+ # least one keyword argument is required. To specify no parameters, or to keep all
389
+ # the default parameter values, pass an empty Hash as a request object (see above).
390
+ #
391
+ # @param parent [::String]
392
+ # Required. The relative resource name of the location in which to create a federation
393
+ # service, in the following form:
394
+ #
395
+ # `projects/{project_number}/locations/{location_id}`.
396
+ # @param federation_id [::String]
397
+ # Required. The ID of the metastore federation, which is used as the final
398
+ # component of the metastore federation's name.
399
+ #
400
+ # This value must be between 2 and 63 characters long inclusive, begin with a
401
+ # letter, end with a letter or number, and consist of alpha-numeric
402
+ # ASCII characters or hyphens.
403
+ # @param federation [::Google::Cloud::Metastore::V1beta::Federation, ::Hash]
404
+ # Required. The Metastore Federation to create. The `name` field is
405
+ # ignored. The ID of the created metastore federation must be
406
+ # provided in the request's `federation_id` field.
407
+ # @param request_id [::String]
408
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
409
+ # request if it has completed. The server will ignore subsequent requests
410
+ # that provide a duplicate request ID for at least 60 minutes after the first
411
+ # request.
412
+ #
413
+ # For example, if an initial request times out, followed by another request
414
+ # with the same request ID, the server ignores the second request to prevent
415
+ # the creation of duplicate commitments.
416
+ #
417
+ # The request ID must be a valid
418
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
419
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
420
+ #
421
+ # @yield [response, operation] Access the result along with the RPC operation
422
+ # @yieldparam response [::Gapic::Operation]
423
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
424
+ #
425
+ # @return [::Gapic::Operation]
426
+ #
427
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
428
+ #
429
+ # @example Basic example
430
+ # require "google/cloud/metastore/v1beta"
431
+ #
432
+ # # Create a client object. The client can be reused for multiple calls.
433
+ # client = Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.new
434
+ #
435
+ # # Create a request. To set request fields, pass in keyword arguments.
436
+ # request = Google::Cloud::Metastore::V1beta::CreateFederationRequest.new
437
+ #
438
+ # # Call the create_federation method.
439
+ # result = client.create_federation request
440
+ #
441
+ # # The returned object is of type Gapic::Operation. You can use this
442
+ # # object to check the status of an operation, cancel it, or wait
443
+ # # for results. Here is how to block until completion:
444
+ # result.wait_until_done! timeout: 60
445
+ # if result.response?
446
+ # p result.response
447
+ # else
448
+ # puts "Error!"
449
+ # end
450
+ #
451
+ def create_federation request, options = nil
452
+ raise ::ArgumentError, "request must be provided" if request.nil?
453
+
454
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::CreateFederationRequest
455
+
456
+ # Converts hash and nil to an options object
457
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
458
+
459
+ # Customize the options with defaults
460
+ metadata = @config.rpcs.create_federation.metadata.to_h
461
+
462
+ # Set x-goog-api-client and x-goog-user-project headers
463
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
464
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
465
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
466
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
467
+
468
+ header_params = {}
469
+ if request.parent
470
+ header_params["parent"] = request.parent
471
+ end
472
+
473
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
474
+ metadata[:"x-goog-request-params"] ||= request_params_header
475
+
476
+ options.apply_defaults timeout: @config.rpcs.create_federation.timeout,
477
+ metadata: metadata,
478
+ retry_policy: @config.rpcs.create_federation.retry_policy
479
+
480
+ options.apply_defaults timeout: @config.timeout,
481
+ metadata: @config.metadata,
482
+ retry_policy: @config.retry_policy
483
+
484
+ @dataproc_metastore_federation_stub.call_rpc :create_federation, request, options: options do |response, operation|
485
+ response = ::Gapic::Operation.new response, @operations_client, options: options
486
+ yield response, operation if block_given?
487
+ return response
488
+ end
489
+ rescue ::GRPC::BadStatus => e
490
+ raise ::Google::Cloud::Error.from_error(e)
491
+ end
492
+
493
+ ##
494
+ # Updates the fields of a federation.
495
+ #
496
+ # @overload update_federation(request, options = nil)
497
+ # Pass arguments to `update_federation` via a request object, either of type
498
+ # {::Google::Cloud::Metastore::V1beta::UpdateFederationRequest} or an equivalent Hash.
499
+ #
500
+ # @param request [::Google::Cloud::Metastore::V1beta::UpdateFederationRequest, ::Hash]
501
+ # A request object representing the call parameters. Required. To specify no
502
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
503
+ # @param options [::Gapic::CallOptions, ::Hash]
504
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
505
+ #
506
+ # @overload update_federation(update_mask: nil, federation: nil, request_id: nil)
507
+ # Pass arguments to `update_federation` via keyword arguments. Note that at
508
+ # least one keyword argument is required. To specify no parameters, or to keep all
509
+ # the default parameter values, pass an empty Hash as a request object (see above).
510
+ #
511
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
512
+ # Required. A field mask used to specify the fields to be overwritten in the
513
+ # metastore federation resource by the update.
514
+ # Fields specified in the `update_mask` are relative to the resource (not
515
+ # to the full request). A field is overwritten if it is in the mask.
516
+ # @param federation [::Google::Cloud::Metastore::V1beta::Federation, ::Hash]
517
+ # Required. The metastore federation to update. The server only merges fields
518
+ # in the service if they are specified in `update_mask`.
519
+ #
520
+ # The metastore federation's `name` field is used to identify the
521
+ # metastore service to be updated.
522
+ # @param request_id [::String]
523
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
524
+ # request if it has completed. The server will ignore subsequent requests
525
+ # that provide a duplicate request ID for at least 60 minutes after the first
526
+ # request.
527
+ #
528
+ # For example, if an initial request times out, followed by another request
529
+ # with the same request ID, the server ignores the second request to prevent
530
+ # the creation of duplicate commitments.
531
+ #
532
+ # The request ID must be a valid
533
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
534
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
535
+ #
536
+ # @yield [response, operation] Access the result along with the RPC operation
537
+ # @yieldparam response [::Gapic::Operation]
538
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
539
+ #
540
+ # @return [::Gapic::Operation]
541
+ #
542
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
543
+ #
544
+ # @example Basic example
545
+ # require "google/cloud/metastore/v1beta"
546
+ #
547
+ # # Create a client object. The client can be reused for multiple calls.
548
+ # client = Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.new
549
+ #
550
+ # # Create a request. To set request fields, pass in keyword arguments.
551
+ # request = Google::Cloud::Metastore::V1beta::UpdateFederationRequest.new
552
+ #
553
+ # # Call the update_federation method.
554
+ # result = client.update_federation request
555
+ #
556
+ # # The returned object is of type Gapic::Operation. You can use this
557
+ # # object to check the status of an operation, cancel it, or wait
558
+ # # for results. Here is how to block until completion:
559
+ # result.wait_until_done! timeout: 60
560
+ # if result.response?
561
+ # p result.response
562
+ # else
563
+ # puts "Error!"
564
+ # end
565
+ #
566
+ def update_federation request, options = nil
567
+ raise ::ArgumentError, "request must be provided" if request.nil?
568
+
569
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::UpdateFederationRequest
570
+
571
+ # Converts hash and nil to an options object
572
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
573
+
574
+ # Customize the options with defaults
575
+ metadata = @config.rpcs.update_federation.metadata.to_h
576
+
577
+ # Set x-goog-api-client and x-goog-user-project headers
578
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
579
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
580
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
581
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
582
+
583
+ header_params = {}
584
+ if request.federation&.name
585
+ header_params["federation.name"] = request.federation.name
586
+ end
587
+
588
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
589
+ metadata[:"x-goog-request-params"] ||= request_params_header
590
+
591
+ options.apply_defaults timeout: @config.rpcs.update_federation.timeout,
592
+ metadata: metadata,
593
+ retry_policy: @config.rpcs.update_federation.retry_policy
594
+
595
+ options.apply_defaults timeout: @config.timeout,
596
+ metadata: @config.metadata,
597
+ retry_policy: @config.retry_policy
598
+
599
+ @dataproc_metastore_federation_stub.call_rpc :update_federation, request, options: options do |response, operation|
600
+ response = ::Gapic::Operation.new response, @operations_client, options: options
601
+ yield response, operation if block_given?
602
+ return response
603
+ end
604
+ rescue ::GRPC::BadStatus => e
605
+ raise ::Google::Cloud::Error.from_error(e)
606
+ end
607
+
608
+ ##
609
+ # Deletes a single federation.
610
+ #
611
+ # @overload delete_federation(request, options = nil)
612
+ # Pass arguments to `delete_federation` via a request object, either of type
613
+ # {::Google::Cloud::Metastore::V1beta::DeleteFederationRequest} or an equivalent Hash.
614
+ #
615
+ # @param request [::Google::Cloud::Metastore::V1beta::DeleteFederationRequest, ::Hash]
616
+ # A request object representing the call parameters. Required. To specify no
617
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
618
+ # @param options [::Gapic::CallOptions, ::Hash]
619
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
620
+ #
621
+ # @overload delete_federation(name: nil, request_id: nil)
622
+ # Pass arguments to `delete_federation` via keyword arguments. Note that at
623
+ # least one keyword argument is required. To specify no parameters, or to keep all
624
+ # the default parameter values, pass an empty Hash as a request object (see above).
625
+ #
626
+ # @param name [::String]
627
+ # Required. The relative resource name of the metastore federation to delete,
628
+ # in the following form:
629
+ #
630
+ # `projects/{project_number}/locations/{location_id}/federations/{federation_id}`.
631
+ # @param request_id [::String]
632
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
633
+ # request if it has completed. The server will ignore subsequent requests
634
+ # that provide a duplicate request ID for at least 60 minutes after the first
635
+ # request.
636
+ #
637
+ # For example, if an initial request times out, followed by another request
638
+ # with the same request ID, the server ignores the second request to prevent
639
+ # the creation of duplicate commitments.
640
+ #
641
+ # The request ID must be a valid
642
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
643
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
644
+ #
645
+ # @yield [response, operation] Access the result along with the RPC operation
646
+ # @yieldparam response [::Gapic::Operation]
647
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
648
+ #
649
+ # @return [::Gapic::Operation]
650
+ #
651
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
652
+ #
653
+ # @example Basic example
654
+ # require "google/cloud/metastore/v1beta"
655
+ #
656
+ # # Create a client object. The client can be reused for multiple calls.
657
+ # client = Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.new
658
+ #
659
+ # # Create a request. To set request fields, pass in keyword arguments.
660
+ # request = Google::Cloud::Metastore::V1beta::DeleteFederationRequest.new
661
+ #
662
+ # # Call the delete_federation method.
663
+ # result = client.delete_federation request
664
+ #
665
+ # # The returned object is of type Gapic::Operation. You can use this
666
+ # # object to check the status of an operation, cancel it, or wait
667
+ # # for results. Here is how to block until completion:
668
+ # result.wait_until_done! timeout: 60
669
+ # if result.response?
670
+ # p result.response
671
+ # else
672
+ # puts "Error!"
673
+ # end
674
+ #
675
+ def delete_federation request, options = nil
676
+ raise ::ArgumentError, "request must be provided" if request.nil?
677
+
678
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::DeleteFederationRequest
679
+
680
+ # Converts hash and nil to an options object
681
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
682
+
683
+ # Customize the options with defaults
684
+ metadata = @config.rpcs.delete_federation.metadata.to_h
685
+
686
+ # Set x-goog-api-client and x-goog-user-project headers
687
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
688
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
689
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
690
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
691
+
692
+ header_params = {}
693
+ if request.name
694
+ header_params["name"] = request.name
695
+ end
696
+
697
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
698
+ metadata[:"x-goog-request-params"] ||= request_params_header
699
+
700
+ options.apply_defaults timeout: @config.rpcs.delete_federation.timeout,
701
+ metadata: metadata,
702
+ retry_policy: @config.rpcs.delete_federation.retry_policy
703
+
704
+ options.apply_defaults timeout: @config.timeout,
705
+ metadata: @config.metadata,
706
+ retry_policy: @config.retry_policy
707
+
708
+ @dataproc_metastore_federation_stub.call_rpc :delete_federation, request, options: options do |response, operation|
709
+ response = ::Gapic::Operation.new response, @operations_client, options: options
710
+ yield response, operation if block_given?
711
+ return response
712
+ end
713
+ rescue ::GRPC::BadStatus => e
714
+ raise ::Google::Cloud::Error.from_error(e)
715
+ end
716
+
717
+ ##
718
+ # Configuration class for the DataprocMetastoreFederation API.
719
+ #
720
+ # This class represents the configuration for DataprocMetastoreFederation,
721
+ # providing control over timeouts, retry behavior, logging, transport
722
+ # parameters, and other low-level controls. Certain parameters can also be
723
+ # applied individually to specific RPCs. See
724
+ # {::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client::Configuration::Rpcs}
725
+ # for a list of RPCs that can be configured independently.
726
+ #
727
+ # Configuration can be applied globally to all clients, or to a single client
728
+ # on construction.
729
+ #
730
+ # @example
731
+ #
732
+ # # Modify the global config, setting the timeout for
733
+ # # list_federations to 20 seconds,
734
+ # # and all remaining timeouts to 10 seconds.
735
+ # ::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.configure do |config|
736
+ # config.timeout = 10.0
737
+ # config.rpcs.list_federations.timeout = 20.0
738
+ # end
739
+ #
740
+ # # Apply the above configuration only to a new client.
741
+ # client = ::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Client.new do |config|
742
+ # config.timeout = 10.0
743
+ # config.rpcs.list_federations.timeout = 20.0
744
+ # end
745
+ #
746
+ # @!attribute [rw] endpoint
747
+ # The hostname or hostname:port of the service endpoint.
748
+ # Defaults to `"metastore.googleapis.com"`.
749
+ # @return [::String]
750
+ # @!attribute [rw] credentials
751
+ # Credentials to send with calls. You may provide any of the following types:
752
+ # * (`String`) The path to a service account key file in JSON format
753
+ # * (`Hash`) A service account key as a Hash
754
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
755
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
756
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
757
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
758
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
759
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
760
+ # * (`nil`) indicating no credentials
761
+ # @return [::Object]
762
+ # @!attribute [rw] scope
763
+ # The OAuth scopes
764
+ # @return [::Array<::String>]
765
+ # @!attribute [rw] lib_name
766
+ # The library name as recorded in instrumentation and logging
767
+ # @return [::String]
768
+ # @!attribute [rw] lib_version
769
+ # The library version as recorded in instrumentation and logging
770
+ # @return [::String]
771
+ # @!attribute [rw] channel_args
772
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
773
+ # `GRPC::Core::Channel` object is provided as the credential.
774
+ # @return [::Hash]
775
+ # @!attribute [rw] interceptors
776
+ # An array of interceptors that are run before calls are executed.
777
+ # @return [::Array<::GRPC::ClientInterceptor>]
778
+ # @!attribute [rw] timeout
779
+ # The call timeout in seconds.
780
+ # @return [::Numeric]
781
+ # @!attribute [rw] metadata
782
+ # Additional gRPC headers to be sent with the call.
783
+ # @return [::Hash{::Symbol=>::String}]
784
+ # @!attribute [rw] retry_policy
785
+ # The retry policy. The value is a hash with the following keys:
786
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
787
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
788
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
789
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
790
+ # trigger a retry.
791
+ # @return [::Hash]
792
+ # @!attribute [rw] quota_project
793
+ # A separate project against which to charge quota.
794
+ # @return [::String]
795
+ #
796
+ class Configuration
797
+ extend ::Gapic::Config
798
+
799
+ config_attr :endpoint, "metastore.googleapis.com", ::String
800
+ config_attr :credentials, nil do |value|
801
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
802
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
803
+ allowed.any? { |klass| klass === value }
804
+ end
805
+ config_attr :scope, nil, ::String, ::Array, nil
806
+ config_attr :lib_name, nil, ::String, nil
807
+ config_attr :lib_version, nil, ::String, nil
808
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
809
+ config_attr :interceptors, nil, ::Array, nil
810
+ config_attr :timeout, nil, ::Numeric, nil
811
+ config_attr :metadata, nil, ::Hash, nil
812
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
813
+ config_attr :quota_project, nil, ::String, nil
814
+
815
+ # @private
816
+ def initialize parent_config = nil
817
+ @parent_config = parent_config unless parent_config.nil?
818
+
819
+ yield self if block_given?
820
+ end
821
+
822
+ ##
823
+ # Configurations for individual RPCs
824
+ # @return [Rpcs]
825
+ #
826
+ def rpcs
827
+ @rpcs ||= begin
828
+ parent_rpcs = nil
829
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
830
+ Rpcs.new parent_rpcs
831
+ end
832
+ end
833
+
834
+ ##
835
+ # Configuration RPC class for the DataprocMetastoreFederation API.
836
+ #
837
+ # Includes fields providing the configuration for each RPC in this service.
838
+ # Each configuration object is of type `Gapic::Config::Method` and includes
839
+ # the following configuration fields:
840
+ #
841
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
842
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
843
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
844
+ # include the following keys:
845
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
846
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
847
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
848
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
849
+ # trigger a retry.
850
+ #
851
+ class Rpcs
852
+ ##
853
+ # RPC-specific configuration for `list_federations`
854
+ # @return [::Gapic::Config::Method]
855
+ #
856
+ attr_reader :list_federations
857
+ ##
858
+ # RPC-specific configuration for `get_federation`
859
+ # @return [::Gapic::Config::Method]
860
+ #
861
+ attr_reader :get_federation
862
+ ##
863
+ # RPC-specific configuration for `create_federation`
864
+ # @return [::Gapic::Config::Method]
865
+ #
866
+ attr_reader :create_federation
867
+ ##
868
+ # RPC-specific configuration for `update_federation`
869
+ # @return [::Gapic::Config::Method]
870
+ #
871
+ attr_reader :update_federation
872
+ ##
873
+ # RPC-specific configuration for `delete_federation`
874
+ # @return [::Gapic::Config::Method]
875
+ #
876
+ attr_reader :delete_federation
877
+
878
+ # @private
879
+ def initialize parent_rpcs = nil
880
+ list_federations_config = parent_rpcs.list_federations if parent_rpcs.respond_to? :list_federations
881
+ @list_federations = ::Gapic::Config::Method.new list_federations_config
882
+ get_federation_config = parent_rpcs.get_federation if parent_rpcs.respond_to? :get_federation
883
+ @get_federation = ::Gapic::Config::Method.new get_federation_config
884
+ create_federation_config = parent_rpcs.create_federation if parent_rpcs.respond_to? :create_federation
885
+ @create_federation = ::Gapic::Config::Method.new create_federation_config
886
+ update_federation_config = parent_rpcs.update_federation if parent_rpcs.respond_to? :update_federation
887
+ @update_federation = ::Gapic::Config::Method.new update_federation_config
888
+ delete_federation_config = parent_rpcs.delete_federation if parent_rpcs.respond_to? :delete_federation
889
+ @delete_federation = ::Gapic::Config::Method.new delete_federation_config
890
+
891
+ yield self if block_given?
892
+ end
893
+ end
894
+ end
895
+ end
896
+ end
897
+ end
898
+ end
899
+ end
900
+ end