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