google-cloud-metastore-v1 0.5.0 → 0.6.0

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