google-cloud-metastore-v1beta 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,775 @@
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/v1beta/metastore_federation_pb"
21
+ require "google/cloud/metastore/v1beta/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 V1beta
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::V1beta::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::V1beta::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", "V1beta"]
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::V1beta::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::V1beta::DataprocMetastoreFederation::Rest::Client.new
116
+ #
117
+ # # Create a client using a custom configuration
118
+ # client = ::Google::Cloud::Metastore::V1beta::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::V1beta::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::V1beta::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::V1beta::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::V1beta::ListFederationsRequest} or an equivalent Hash.
199
+ #
200
+ # @param request [::Google::Cloud::Metastore::V1beta::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
213
+ # federations 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
217
+ # contain less than the maximum number. If unspecified, no more than 500
218
+ # services are returned. The maximum value is 1000; values above 1000 are
219
+ # changed to 1000.
220
+ # @param page_token [::String]
221
+ # Optional. A page token, received from a previous ListFederationServices
222
+ # call. Provide this token to retrieve the subsequent page.
223
+ #
224
+ # To retrieve the first page, supply an empty page token.
225
+ #
226
+ # When paginating, other parameters provided to
227
+ # ListFederationServices must match the call that provided the
228
+ # page token.
229
+ # @param filter [::String]
230
+ # Optional. The filter to apply to list results.
231
+ # @param order_by [::String]
232
+ # Optional. Specify the ordering of results as described in [Sorting
233
+ # Order](https://cloud.google.com/apis/design/design_patterns#sorting_order).
234
+ # If not specified, the results will be sorted in the default order.
235
+ # @yield [result, operation] Access the result along with the TransportOperation object
236
+ # @yieldparam result [::Google::Cloud::Metastore::V1beta::ListFederationsResponse]
237
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
238
+ #
239
+ # @return [::Google::Cloud::Metastore::V1beta::ListFederationsResponse]
240
+ #
241
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
242
+ def list_federations request, options = nil
243
+ raise ::ArgumentError, "request must be provided" if request.nil?
244
+
245
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::ListFederationsRequest
246
+
247
+ # Converts hash and nil to an options object
248
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
249
+
250
+ # Customize the options with defaults
251
+ call_metadata = @config.rpcs.list_federations.metadata.to_h
252
+
253
+ # Set x-goog-api-client and x-goog-user-project headers
254
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
255
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
256
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION,
257
+ transports_version_send: [:rest]
258
+
259
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
260
+
261
+ options.apply_defaults timeout: @config.rpcs.list_federations.timeout,
262
+ metadata: call_metadata,
263
+ retry_policy: @config.rpcs.list_federations.retry_policy
264
+
265
+ options.apply_defaults timeout: @config.timeout,
266
+ metadata: @config.metadata,
267
+ retry_policy: @config.retry_policy
268
+
269
+ @dataproc_metastore_federation_stub.list_federations request, options do |result, operation|
270
+ yield result, operation if block_given?
271
+ return result
272
+ end
273
+ rescue ::Gapic::Rest::Error => e
274
+ raise ::Google::Cloud::Error.from_error(e)
275
+ end
276
+
277
+ ##
278
+ # Gets the details of a single federation.
279
+ #
280
+ # @overload get_federation(request, options = nil)
281
+ # Pass arguments to `get_federation` via a request object, either of type
282
+ # {::Google::Cloud::Metastore::V1beta::GetFederationRequest} or an equivalent Hash.
283
+ #
284
+ # @param request [::Google::Cloud::Metastore::V1beta::GetFederationRequest, ::Hash]
285
+ # A request object representing the call parameters. Required. To specify no
286
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
287
+ # @param options [::Gapic::CallOptions, ::Hash]
288
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
289
+ #
290
+ # @overload get_federation(name: nil)
291
+ # Pass arguments to `get_federation` via keyword arguments. Note that at
292
+ # least one keyword argument is required. To specify no parameters, or to keep all
293
+ # the default parameter values, pass an empty Hash as a request object (see above).
294
+ #
295
+ # @param name [::String]
296
+ # Required. The relative resource name of the metastore federation to
297
+ # retrieve, in the following form:
298
+ #
299
+ # `projects/{project_number}/locations/{location_id}/federations/{federation_id}`.
300
+ # @yield [result, operation] Access the result along with the TransportOperation object
301
+ # @yieldparam result [::Google::Cloud::Metastore::V1beta::Federation]
302
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
303
+ #
304
+ # @return [::Google::Cloud::Metastore::V1beta::Federation]
305
+ #
306
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
307
+ def get_federation request, options = nil
308
+ raise ::ArgumentError, "request must be provided" if request.nil?
309
+
310
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::GetFederationRequest
311
+
312
+ # Converts hash and nil to an options object
313
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
314
+
315
+ # Customize the options with defaults
316
+ call_metadata = @config.rpcs.get_federation.metadata.to_h
317
+
318
+ # Set x-goog-api-client and x-goog-user-project headers
319
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
320
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
321
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION,
322
+ transports_version_send: [:rest]
323
+
324
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
325
+
326
+ options.apply_defaults timeout: @config.rpcs.get_federation.timeout,
327
+ metadata: call_metadata,
328
+ retry_policy: @config.rpcs.get_federation.retry_policy
329
+
330
+ options.apply_defaults timeout: @config.timeout,
331
+ metadata: @config.metadata,
332
+ retry_policy: @config.retry_policy
333
+
334
+ @dataproc_metastore_federation_stub.get_federation request, options do |result, operation|
335
+ yield result, operation if block_given?
336
+ return result
337
+ end
338
+ rescue ::Gapic::Rest::Error => e
339
+ raise ::Google::Cloud::Error.from_error(e)
340
+ end
341
+
342
+ ##
343
+ # Creates a metastore federation in a project and location.
344
+ #
345
+ # @overload create_federation(request, options = nil)
346
+ # Pass arguments to `create_federation` via a request object, either of type
347
+ # {::Google::Cloud::Metastore::V1beta::CreateFederationRequest} or an equivalent Hash.
348
+ #
349
+ # @param request [::Google::Cloud::Metastore::V1beta::CreateFederationRequest, ::Hash]
350
+ # A request object representing the call parameters. Required. To specify no
351
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
352
+ # @param options [::Gapic::CallOptions, ::Hash]
353
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
354
+ #
355
+ # @overload create_federation(parent: nil, federation_id: nil, federation: nil, request_id: nil)
356
+ # Pass arguments to `create_federation` via keyword arguments. Note that at
357
+ # least one keyword argument is required. To specify no parameters, or to keep all
358
+ # the default parameter values, pass an empty Hash as a request object (see above).
359
+ #
360
+ # @param parent [::String]
361
+ # Required. The relative resource name of the location in which to create a
362
+ # federation service, in the following form:
363
+ #
364
+ # `projects/{project_number}/locations/{location_id}`.
365
+ # @param federation_id [::String]
366
+ # Required. The ID of the metastore federation, which is used as the final
367
+ # component of the metastore federation's name.
368
+ #
369
+ # This value must be between 2 and 63 characters long inclusive, begin with a
370
+ # letter, end with a letter or number, and consist of alpha-numeric
371
+ # ASCII characters or hyphens.
372
+ # @param federation [::Google::Cloud::Metastore::V1beta::Federation, ::Hash]
373
+ # Required. The Metastore Federation to create. The `name` field is
374
+ # ignored. The ID of the created metastore federation must be
375
+ # provided in the request's `federation_id` field.
376
+ # @param request_id [::String]
377
+ # Optional. A request ID. Specify a unique request ID to allow the server to
378
+ # ignore the request if it has completed. The server will ignore subsequent
379
+ # requests that provide a duplicate request ID for at least 60 minutes after
380
+ # the first request.
381
+ #
382
+ # For example, if an initial request times out, followed by another request
383
+ # with the same request ID, the server ignores the second request to prevent
384
+ # the creation of duplicate commitments.
385
+ #
386
+ # The request ID must be a valid
387
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
388
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
389
+ # @yield [result, operation] Access the result along with the TransportOperation object
390
+ # @yieldparam result [::Gapic::Operation]
391
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
392
+ #
393
+ # @return [::Gapic::Operation]
394
+ #
395
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
396
+ def create_federation request, options = nil
397
+ raise ::ArgumentError, "request must be provided" if request.nil?
398
+
399
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::CreateFederationRequest
400
+
401
+ # Converts hash and nil to an options object
402
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
403
+
404
+ # Customize the options with defaults
405
+ call_metadata = @config.rpcs.create_federation.metadata.to_h
406
+
407
+ # Set x-goog-api-client and x-goog-user-project headers
408
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
409
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
410
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION,
411
+ transports_version_send: [:rest]
412
+
413
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
414
+
415
+ options.apply_defaults timeout: @config.rpcs.create_federation.timeout,
416
+ metadata: call_metadata,
417
+ retry_policy: @config.rpcs.create_federation.retry_policy
418
+
419
+ options.apply_defaults timeout: @config.timeout,
420
+ metadata: @config.metadata,
421
+ retry_policy: @config.retry_policy
422
+
423
+ @dataproc_metastore_federation_stub.create_federation request, options do |result, operation|
424
+ result = ::Gapic::Operation.new result, @operations_client, options: options
425
+ yield result, operation if block_given?
426
+ return result
427
+ end
428
+ rescue ::Gapic::Rest::Error => e
429
+ raise ::Google::Cloud::Error.from_error(e)
430
+ end
431
+
432
+ ##
433
+ # Updates the fields of a federation.
434
+ #
435
+ # @overload update_federation(request, options = nil)
436
+ # Pass arguments to `update_federation` via a request object, either of type
437
+ # {::Google::Cloud::Metastore::V1beta::UpdateFederationRequest} or an equivalent Hash.
438
+ #
439
+ # @param request [::Google::Cloud::Metastore::V1beta::UpdateFederationRequest, ::Hash]
440
+ # A request object representing the call parameters. Required. To specify no
441
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
442
+ # @param options [::Gapic::CallOptions, ::Hash]
443
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
444
+ #
445
+ # @overload update_federation(update_mask: nil, federation: nil, request_id: nil)
446
+ # Pass arguments to `update_federation` via keyword arguments. Note that at
447
+ # least one keyword argument is required. To specify no parameters, or to keep all
448
+ # the default parameter values, pass an empty Hash as a request object (see above).
449
+ #
450
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
451
+ # Required. A field mask used to specify the fields to be overwritten in the
452
+ # metastore federation resource by the update.
453
+ # Fields specified in the `update_mask` are relative to the resource (not
454
+ # to the full request). A field is overwritten if it is in the mask.
455
+ # @param federation [::Google::Cloud::Metastore::V1beta::Federation, ::Hash]
456
+ # Required. The metastore federation to update. The server only merges fields
457
+ # in the service if they are specified in `update_mask`.
458
+ #
459
+ # The metastore federation's `name` field is used to identify the
460
+ # metastore service to be updated.
461
+ # @param request_id [::String]
462
+ # Optional. A request ID. Specify a unique request ID to allow the server to
463
+ # ignore the request if it has completed. The server will ignore subsequent
464
+ # requests that provide a duplicate request ID for at least 60 minutes after
465
+ # the first request.
466
+ #
467
+ # For example, if an initial request times out, followed by another request
468
+ # with the same request ID, the server ignores the second request to prevent
469
+ # the creation of duplicate commitments.
470
+ #
471
+ # The request ID must be a valid
472
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
473
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
474
+ # @yield [result, operation] Access the result along with the TransportOperation object
475
+ # @yieldparam result [::Gapic::Operation]
476
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
477
+ #
478
+ # @return [::Gapic::Operation]
479
+ #
480
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
481
+ def update_federation request, options = nil
482
+ raise ::ArgumentError, "request must be provided" if request.nil?
483
+
484
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::UpdateFederationRequest
485
+
486
+ # Converts hash and nil to an options object
487
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
488
+
489
+ # Customize the options with defaults
490
+ call_metadata = @config.rpcs.update_federation.metadata.to_h
491
+
492
+ # Set x-goog-api-client and x-goog-user-project headers
493
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
494
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
495
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION,
496
+ transports_version_send: [:rest]
497
+
498
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
499
+
500
+ options.apply_defaults timeout: @config.rpcs.update_federation.timeout,
501
+ metadata: call_metadata,
502
+ retry_policy: @config.rpcs.update_federation.retry_policy
503
+
504
+ options.apply_defaults timeout: @config.timeout,
505
+ metadata: @config.metadata,
506
+ retry_policy: @config.retry_policy
507
+
508
+ @dataproc_metastore_federation_stub.update_federation request, options do |result, operation|
509
+ result = ::Gapic::Operation.new result, @operations_client, options: options
510
+ yield result, operation if block_given?
511
+ return result
512
+ end
513
+ rescue ::Gapic::Rest::Error => e
514
+ raise ::Google::Cloud::Error.from_error(e)
515
+ end
516
+
517
+ ##
518
+ # Deletes a single federation.
519
+ #
520
+ # @overload delete_federation(request, options = nil)
521
+ # Pass arguments to `delete_federation` via a request object, either of type
522
+ # {::Google::Cloud::Metastore::V1beta::DeleteFederationRequest} or an equivalent Hash.
523
+ #
524
+ # @param request [::Google::Cloud::Metastore::V1beta::DeleteFederationRequest, ::Hash]
525
+ # A request object representing the call parameters. Required. To specify no
526
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
527
+ # @param options [::Gapic::CallOptions, ::Hash]
528
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
529
+ #
530
+ # @overload delete_federation(name: nil, request_id: nil)
531
+ # Pass arguments to `delete_federation` via keyword arguments. Note that at
532
+ # least one keyword argument is required. To specify no parameters, or to keep all
533
+ # the default parameter values, pass an empty Hash as a request object (see above).
534
+ #
535
+ # @param name [::String]
536
+ # Required. The relative resource name of the metastore federation to delete,
537
+ # in the following form:
538
+ #
539
+ # `projects/{project_number}/locations/{location_id}/federations/{federation_id}`.
540
+ # @param request_id [::String]
541
+ # Optional. A request ID. Specify a unique request ID to allow the server to
542
+ # ignore the request if it has completed. The server will ignore subsequent
543
+ # requests that provide a duplicate request ID for at least 60 minutes after
544
+ # the first request.
545
+ #
546
+ # For example, if an initial request times out, followed by another request
547
+ # with the same request ID, the server ignores the second request to prevent
548
+ # the creation of duplicate commitments.
549
+ #
550
+ # The request ID must be a valid
551
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
552
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
553
+ # @yield [result, operation] Access the result along with the TransportOperation object
554
+ # @yieldparam result [::Gapic::Operation]
555
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
556
+ #
557
+ # @return [::Gapic::Operation]
558
+ #
559
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
560
+ def delete_federation request, options = nil
561
+ raise ::ArgumentError, "request must be provided" if request.nil?
562
+
563
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1beta::DeleteFederationRequest
564
+
565
+ # Converts hash and nil to an options object
566
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
567
+
568
+ # Customize the options with defaults
569
+ call_metadata = @config.rpcs.delete_federation.metadata.to_h
570
+
571
+ # Set x-goog-api-client and x-goog-user-project headers
572
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
573
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
574
+ gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION,
575
+ transports_version_send: [:rest]
576
+
577
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
578
+
579
+ options.apply_defaults timeout: @config.rpcs.delete_federation.timeout,
580
+ metadata: call_metadata,
581
+ retry_policy: @config.rpcs.delete_federation.retry_policy
582
+
583
+ options.apply_defaults timeout: @config.timeout,
584
+ metadata: @config.metadata,
585
+ retry_policy: @config.retry_policy
586
+
587
+ @dataproc_metastore_federation_stub.delete_federation request, options do |result, operation|
588
+ result = ::Gapic::Operation.new result, @operations_client, options: options
589
+ yield result, operation if block_given?
590
+ return result
591
+ end
592
+ rescue ::Gapic::Rest::Error => e
593
+ raise ::Google::Cloud::Error.from_error(e)
594
+ end
595
+
596
+ ##
597
+ # Configuration class for the DataprocMetastoreFederation REST API.
598
+ #
599
+ # This class represents the configuration for DataprocMetastoreFederation REST,
600
+ # providing control over timeouts, retry behavior, logging, transport
601
+ # parameters, and other low-level controls. Certain parameters can also be
602
+ # applied individually to specific RPCs. See
603
+ # {::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Rest::Client::Configuration::Rpcs}
604
+ # for a list of RPCs that can be configured independently.
605
+ #
606
+ # Configuration can be applied globally to all clients, or to a single client
607
+ # on construction.
608
+ #
609
+ # @example
610
+ #
611
+ # # Modify the global config, setting the timeout for
612
+ # # list_federations to 20 seconds,
613
+ # # and all remaining timeouts to 10 seconds.
614
+ # ::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Rest::Client.configure do |config|
615
+ # config.timeout = 10.0
616
+ # config.rpcs.list_federations.timeout = 20.0
617
+ # end
618
+ #
619
+ # # Apply the above configuration only to a new client.
620
+ # client = ::Google::Cloud::Metastore::V1beta::DataprocMetastoreFederation::Rest::Client.new do |config|
621
+ # config.timeout = 10.0
622
+ # config.rpcs.list_federations.timeout = 20.0
623
+ # end
624
+ #
625
+ # @!attribute [rw] endpoint
626
+ # The hostname or hostname:port of the service endpoint.
627
+ # Defaults to `"metastore.googleapis.com"`.
628
+ # @return [::String]
629
+ # @!attribute [rw] credentials
630
+ # Credentials to send with calls. You may provide any of the following types:
631
+ # * (`String`) The path to a service account key file in JSON format
632
+ # * (`Hash`) A service account key as a Hash
633
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
634
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
635
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
636
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
637
+ # * (`nil`) indicating no credentials
638
+ # @return [::Object]
639
+ # @!attribute [rw] scope
640
+ # The OAuth scopes
641
+ # @return [::Array<::String>]
642
+ # @!attribute [rw] lib_name
643
+ # The library name as recorded in instrumentation and logging
644
+ # @return [::String]
645
+ # @!attribute [rw] lib_version
646
+ # The library version as recorded in instrumentation and logging
647
+ # @return [::String]
648
+ # @!attribute [rw] timeout
649
+ # The call timeout in seconds.
650
+ # @return [::Numeric]
651
+ # @!attribute [rw] metadata
652
+ # Additional headers to be sent with the call.
653
+ # @return [::Hash{::Symbol=>::String}]
654
+ # @!attribute [rw] retry_policy
655
+ # The retry policy. The value is a hash with the following keys:
656
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
657
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
658
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
659
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
660
+ # trigger a retry.
661
+ # @return [::Hash]
662
+ # @!attribute [rw] quota_project
663
+ # A separate project against which to charge quota.
664
+ # @return [::String]
665
+ #
666
+ class Configuration
667
+ extend ::Gapic::Config
668
+
669
+ config_attr :endpoint, "metastore.googleapis.com", ::String
670
+ config_attr :credentials, nil do |value|
671
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
672
+ allowed.any? { |klass| klass === value }
673
+ end
674
+ config_attr :scope, nil, ::String, ::Array, nil
675
+ config_attr :lib_name, nil, ::String, nil
676
+ config_attr :lib_version, nil, ::String, nil
677
+ config_attr :timeout, nil, ::Numeric, nil
678
+ config_attr :metadata, nil, ::Hash, nil
679
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
680
+ config_attr :quota_project, nil, ::String, nil
681
+
682
+ # @private
683
+ # Overrides for http bindings for the RPCs of this service
684
+ # are only used when this service is used as mixin, and only
685
+ # by the host service.
686
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
687
+ config_attr :bindings_override, {}, ::Hash, nil
688
+
689
+ # @private
690
+ def initialize parent_config = nil
691
+ @parent_config = parent_config unless parent_config.nil?
692
+
693
+ yield self if block_given?
694
+ end
695
+
696
+ ##
697
+ # Configurations for individual RPCs
698
+ # @return [Rpcs]
699
+ #
700
+ def rpcs
701
+ @rpcs ||= begin
702
+ parent_rpcs = nil
703
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
704
+ Rpcs.new parent_rpcs
705
+ end
706
+ end
707
+
708
+ ##
709
+ # Configuration RPC class for the DataprocMetastoreFederation API.
710
+ #
711
+ # Includes fields providing the configuration for each RPC in this service.
712
+ # Each configuration object is of type `Gapic::Config::Method` and includes
713
+ # the following configuration fields:
714
+ #
715
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
716
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
717
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
718
+ # include the following keys:
719
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
720
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
721
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
722
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
723
+ # trigger a retry.
724
+ #
725
+ class Rpcs
726
+ ##
727
+ # RPC-specific configuration for `list_federations`
728
+ # @return [::Gapic::Config::Method]
729
+ #
730
+ attr_reader :list_federations
731
+ ##
732
+ # RPC-specific configuration for `get_federation`
733
+ # @return [::Gapic::Config::Method]
734
+ #
735
+ attr_reader :get_federation
736
+ ##
737
+ # RPC-specific configuration for `create_federation`
738
+ # @return [::Gapic::Config::Method]
739
+ #
740
+ attr_reader :create_federation
741
+ ##
742
+ # RPC-specific configuration for `update_federation`
743
+ # @return [::Gapic::Config::Method]
744
+ #
745
+ attr_reader :update_federation
746
+ ##
747
+ # RPC-specific configuration for `delete_federation`
748
+ # @return [::Gapic::Config::Method]
749
+ #
750
+ attr_reader :delete_federation
751
+
752
+ # @private
753
+ def initialize parent_rpcs = nil
754
+ list_federations_config = parent_rpcs.list_federations if parent_rpcs.respond_to? :list_federations
755
+ @list_federations = ::Gapic::Config::Method.new list_federations_config
756
+ get_federation_config = parent_rpcs.get_federation if parent_rpcs.respond_to? :get_federation
757
+ @get_federation = ::Gapic::Config::Method.new get_federation_config
758
+ create_federation_config = parent_rpcs.create_federation if parent_rpcs.respond_to? :create_federation
759
+ @create_federation = ::Gapic::Config::Method.new create_federation_config
760
+ update_federation_config = parent_rpcs.update_federation if parent_rpcs.respond_to? :update_federation
761
+ @update_federation = ::Gapic::Config::Method.new update_federation_config
762
+ delete_federation_config = parent_rpcs.delete_federation if parent_rpcs.respond_to? :delete_federation
763
+ @delete_federation = ::Gapic::Config::Method.new delete_federation_config
764
+
765
+ yield self if block_given?
766
+ end
767
+ end
768
+ end
769
+ end
770
+ end
771
+ end
772
+ end
773
+ end
774
+ end
775
+ end