google-cloud-metastore-v1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/metastore/v1"
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/metastore/v1/dataproc_metastore"
20
+ require "google/cloud/metastore/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Metastore
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/metastore/v1"
29
+ # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
38
+ require "google/cloud/metastore/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/metastore/v1/version"
24
+
25
+ require "google/cloud/metastore/v1/dataproc_metastore/credentials"
26
+ require "google/cloud/metastore/v1/dataproc_metastore/paths"
27
+ require "google/cloud/metastore/v1/dataproc_metastore/operations"
28
+ require "google/cloud/metastore/v1/dataproc_metastore/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Metastore
33
+ module V1
34
+ ##
35
+ # Configures and manages metastore services.
36
+ # Metastore services are fully managed, highly available, auto-scaled,
37
+ # auto-healing, OSS-native deployments of technical metadata management
38
+ # software. Each metastore service exposes a network endpoint through which
39
+ # metadata queries are served. Metadata queries can originate from a variety
40
+ # of sources, including Apache Hive, Apache Presto, and Apache Spark.
41
+ #
42
+ # The Dataproc Metastore API defines the following resource model:
43
+ #
44
+ # * The service works with a collection of Google Cloud projects, named:
45
+ # `/projects/*`
46
+ # * Each project has a collection of available locations, named: `/locations/*`
47
+ # (a location must refer to a Google Cloud `region`)
48
+ # * Each location has a collection of services, named: `/services/*`
49
+ # * Dataproc Metastore services are resources with names of the form:
50
+ #
51
+ # `/projects/{project_number}/locations/{location_id}/services/{service_id}`.
52
+ #
53
+ # To load this service and instantiate a client:
54
+ #
55
+ # require "google/cloud/metastore/v1/dataproc_metastore"
56
+ # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
57
+ #
58
+ module DataprocMetastore
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ helper_path = ::File.join __dir__, "dataproc_metastore", "helpers.rb"
66
+ require "google/cloud/metastore/v1/dataproc_metastore/helpers" if ::File.file? helper_path
@@ -0,0 +1,1275 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Metastore
25
+ module V1
26
+ module DataprocMetastore
27
+ ##
28
+ # Client for the DataprocMetastore service.
29
+ #
30
+ # Configures and manages metastore services.
31
+ # Metastore services are fully managed, highly available, auto-scaled,
32
+ # auto-healing, OSS-native deployments of technical metadata management
33
+ # software. Each metastore service exposes a network endpoint through which
34
+ # metadata queries are served. Metadata queries can originate from a variety
35
+ # of sources, including Apache Hive, Apache Presto, and Apache Spark.
36
+ #
37
+ # The Dataproc Metastore API defines the following resource model:
38
+ #
39
+ # * The service works with a collection of Google Cloud projects, named:
40
+ # `/projects/*`
41
+ # * Each project has a collection of available locations, named: `/locations/*`
42
+ # (a location must refer to a Google Cloud `region`)
43
+ # * Each location has a collection of services, named: `/services/*`
44
+ # * Dataproc Metastore services are resources with names of the form:
45
+ #
46
+ # `/projects/{project_number}/locations/{location_id}/services/{service_id}`.
47
+ #
48
+ class Client
49
+ include Paths
50
+
51
+ # @private
52
+ attr_reader :dataproc_metastore_stub
53
+
54
+ ##
55
+ # Configure the DataprocMetastore Client class.
56
+ #
57
+ # See {::Google::Cloud::Metastore::V1::DataprocMetastore::Client::Configuration}
58
+ # for a description of the configuration fields.
59
+ #
60
+ # ## Example
61
+ #
62
+ # To modify the configuration for all DataprocMetastore clients:
63
+ #
64
+ # ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.configure do |config|
65
+ # config.timeout = 10.0
66
+ # end
67
+ #
68
+ # @yield [config] Configure the Client client.
69
+ # @yieldparam config [Client::Configuration]
70
+ #
71
+ # @return [Client::Configuration]
72
+ #
73
+ def self.configure
74
+ @configure ||= begin
75
+ namespace = ["Google", "Cloud", "Metastore", "V1"]
76
+ parent_config = while namespace.any?
77
+ parent_name = namespace.join "::"
78
+ parent_const = const_get parent_name
79
+ break parent_const.configure if parent_const.respond_to? :configure
80
+ namespace.pop
81
+ end
82
+ default_config = Client::Configuration.new parent_config
83
+
84
+ default_config.timeout = 60.0
85
+ default_config.retry_policy = {
86
+ initial_delay: 1.0,
87
+ max_delay: 10.0,
88
+ multiplier: 1.3,
89
+ retry_codes: [14]
90
+ }
91
+
92
+ default_config.rpcs.create_service.timeout = 60.0
93
+
94
+ default_config.rpcs.update_service.timeout = 60.0
95
+
96
+ default_config.rpcs.delete_service.timeout = 60.0
97
+
98
+ default_config.rpcs.create_metadata_import.timeout = 60.0
99
+
100
+ default_config.rpcs.update_metadata_import.timeout = 60.0
101
+
102
+ default_config.rpcs.export_metadata.timeout = 60.0
103
+
104
+ default_config
105
+ end
106
+ yield @configure if block_given?
107
+ @configure
108
+ end
109
+
110
+ ##
111
+ # Configure the DataprocMetastore Client instance.
112
+ #
113
+ # The configuration is set to the derived mode, meaning that values can be changed,
114
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
115
+ # should be made on {Client.configure}.
116
+ #
117
+ # See {::Google::Cloud::Metastore::V1::DataprocMetastore::Client::Configuration}
118
+ # for a description of the configuration fields.
119
+ #
120
+ # @yield [config] Configure the Client client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ # @return [Client::Configuration]
124
+ #
125
+ def configure
126
+ yield @config if block_given?
127
+ @config
128
+ end
129
+
130
+ ##
131
+ # Create a new DataprocMetastore client object.
132
+ #
133
+ # ## Examples
134
+ #
135
+ # To create a new DataprocMetastore client with the default
136
+ # configuration:
137
+ #
138
+ # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
139
+ #
140
+ # To create a new DataprocMetastore client with a custom
141
+ # configuration:
142
+ #
143
+ # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new do |config|
144
+ # config.timeout = 10.0
145
+ # end
146
+ #
147
+ # @yield [config] Configure the DataprocMetastore client.
148
+ # @yieldparam config [Client::Configuration]
149
+ #
150
+ def initialize
151
+ # These require statements are intentionally placed here to initialize
152
+ # the gRPC module only when it's required.
153
+ # See https://github.com/googleapis/toolkit/issues/446
154
+ require "gapic/grpc"
155
+ require "google/cloud/metastore/v1/metastore_services_pb"
156
+
157
+ # Create the configuration object
158
+ @config = Configuration.new Client.configure
159
+
160
+ # Yield the configuration if needed
161
+ yield @config if block_given?
162
+
163
+ # Create credentials
164
+ credentials = @config.credentials
165
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
166
+ # but only if the default endpoint does not have a region prefix.
167
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
168
+ @config.endpoint == Client.configure.endpoint &&
169
+ !@config.endpoint.split(".").first.include?("-")
170
+ credentials ||= Credentials.default scope: @config.scope,
171
+ enable_self_signed_jwt: enable_self_signed_jwt
172
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
173
+ credentials = Credentials.new credentials, scope: @config.scope
174
+ end
175
+ @quota_project_id = @config.quota_project
176
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
177
+
178
+ @operations_client = Operations.new do |config|
179
+ config.credentials = credentials
180
+ config.endpoint = @config.endpoint
181
+ end
182
+
183
+ @dataproc_metastore_stub = ::Gapic::ServiceStub.new(
184
+ ::Google::Cloud::Metastore::V1::DataprocMetastore::Stub,
185
+ credentials: credentials,
186
+ endpoint: @config.endpoint,
187
+ channel_args: @config.channel_args,
188
+ interceptors: @config.interceptors
189
+ )
190
+ end
191
+
192
+ ##
193
+ # Get the associated client for long-running operations.
194
+ #
195
+ # @return [::Google::Cloud::Metastore::V1::DataprocMetastore::Operations]
196
+ #
197
+ attr_reader :operations_client
198
+
199
+ # Service calls
200
+
201
+ ##
202
+ # Lists services in a project and location.
203
+ #
204
+ # @overload list_services(request, options = nil)
205
+ # Pass arguments to `list_services` via a request object, either of type
206
+ # {::Google::Cloud::Metastore::V1::ListServicesRequest} or an equivalent Hash.
207
+ #
208
+ # @param request [::Google::Cloud::Metastore::V1::ListServicesRequest, ::Hash]
209
+ # A request object representing the call parameters. Required. To specify no
210
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
211
+ # @param options [::Gapic::CallOptions, ::Hash]
212
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
213
+ #
214
+ # @overload list_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
215
+ # Pass arguments to `list_services` via keyword arguments. Note that at
216
+ # least one keyword argument is required. To specify no parameters, or to keep all
217
+ # the default parameter values, pass an empty Hash as a request object (see above).
218
+ #
219
+ # @param parent [::String]
220
+ # Required. The relative resource name of the location of metastore services to
221
+ # list, in the following form:
222
+ #
223
+ # `projects/{project_number}/locations/{location_id}`.
224
+ # @param page_size [::Integer]
225
+ # Optional. The maximum number of services to return. The response may contain less
226
+ # than the maximum number. If unspecified, no more than 500 services are
227
+ # returned. The maximum value is 1000; values above 1000 are changed to 1000.
228
+ # @param page_token [::String]
229
+ # Optional. A page token, received from a previous {::Google::Cloud::Metastore::V1::DataprocMetastore::Client#list_services DataprocMetastore.ListServices}
230
+ # call. Provide this token to retrieve the subsequent page.
231
+ #
232
+ # To retrieve the first page, supply an empty page token.
233
+ #
234
+ # When paginating, other parameters provided to
235
+ # {::Google::Cloud::Metastore::V1::DataprocMetastore::Client#list_services DataprocMetastore.ListServices} must match the call that provided the
236
+ # page token.
237
+ # @param filter [::String]
238
+ # Optional. The filter to apply to list results.
239
+ # @param order_by [::String]
240
+ # Optional. Specify the ordering of results as described in [Sorting
241
+ # Order](https://cloud.google.com/apis/design/design_patterns#sorting_order).
242
+ # If not specified, the results will be sorted in the default order.
243
+ #
244
+ # @yield [response, operation] Access the result along with the RPC operation
245
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Metastore::V1::Service>]
246
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
247
+ #
248
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Metastore::V1::Service>]
249
+ #
250
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
251
+ #
252
+ def list_services request, options = nil
253
+ raise ::ArgumentError, "request must be provided" if request.nil?
254
+
255
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::ListServicesRequest
256
+
257
+ # Converts hash and nil to an options object
258
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
259
+
260
+ # Customize the options with defaults
261
+ metadata = @config.rpcs.list_services.metadata.to_h
262
+
263
+ # Set x-goog-api-client and x-goog-user-project headers
264
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
265
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
266
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
267
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
268
+
269
+ header_params = {
270
+ "parent" => request.parent
271
+ }
272
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
273
+ metadata[:"x-goog-request-params"] ||= request_params_header
274
+
275
+ options.apply_defaults timeout: @config.rpcs.list_services.timeout,
276
+ metadata: metadata,
277
+ retry_policy: @config.rpcs.list_services.retry_policy
278
+ options.apply_defaults metadata: @config.metadata,
279
+ retry_policy: @config.retry_policy
280
+
281
+ @dataproc_metastore_stub.call_rpc :list_services, request, options: options do |response, operation|
282
+ response = ::Gapic::PagedEnumerable.new @dataproc_metastore_stub, :list_services, request, response, operation, options
283
+ yield response, operation if block_given?
284
+ return response
285
+ end
286
+ rescue ::GRPC::BadStatus => e
287
+ raise ::Google::Cloud::Error.from_error(e)
288
+ end
289
+
290
+ ##
291
+ # Gets the details of a single service.
292
+ #
293
+ # @overload get_service(request, options = nil)
294
+ # Pass arguments to `get_service` via a request object, either of type
295
+ # {::Google::Cloud::Metastore::V1::GetServiceRequest} or an equivalent Hash.
296
+ #
297
+ # @param request [::Google::Cloud::Metastore::V1::GetServiceRequest, ::Hash]
298
+ # A request object representing the call parameters. Required. To specify no
299
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
300
+ # @param options [::Gapic::CallOptions, ::Hash]
301
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
302
+ #
303
+ # @overload get_service(name: nil)
304
+ # Pass arguments to `get_service` via keyword arguments. Note that at
305
+ # least one keyword argument is required. To specify no parameters, or to keep all
306
+ # the default parameter values, pass an empty Hash as a request object (see above).
307
+ #
308
+ # @param name [::String]
309
+ # Required. The relative resource name of the metastore service to retrieve, in the
310
+ # following form:
311
+ #
312
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}`.
313
+ #
314
+ # @yield [response, operation] Access the result along with the RPC operation
315
+ # @yieldparam response [::Google::Cloud::Metastore::V1::Service]
316
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
317
+ #
318
+ # @return [::Google::Cloud::Metastore::V1::Service]
319
+ #
320
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
321
+ #
322
+ def get_service request, options = nil
323
+ raise ::ArgumentError, "request must be provided" if request.nil?
324
+
325
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::GetServiceRequest
326
+
327
+ # Converts hash and nil to an options object
328
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
329
+
330
+ # Customize the options with defaults
331
+ metadata = @config.rpcs.get_service.metadata.to_h
332
+
333
+ # Set x-goog-api-client and x-goog-user-project headers
334
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
335
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
336
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
337
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
338
+
339
+ header_params = {
340
+ "name" => request.name
341
+ }
342
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
343
+ metadata[:"x-goog-request-params"] ||= request_params_header
344
+
345
+ options.apply_defaults timeout: @config.rpcs.get_service.timeout,
346
+ metadata: metadata,
347
+ retry_policy: @config.rpcs.get_service.retry_policy
348
+ options.apply_defaults metadata: @config.metadata,
349
+ retry_policy: @config.retry_policy
350
+
351
+ @dataproc_metastore_stub.call_rpc :get_service, request, options: options do |response, operation|
352
+ yield response, operation if block_given?
353
+ return response
354
+ end
355
+ rescue ::GRPC::BadStatus => e
356
+ raise ::Google::Cloud::Error.from_error(e)
357
+ end
358
+
359
+ ##
360
+ # Creates a metastore service in a project and location.
361
+ #
362
+ # @overload create_service(request, options = nil)
363
+ # Pass arguments to `create_service` via a request object, either of type
364
+ # {::Google::Cloud::Metastore::V1::CreateServiceRequest} or an equivalent Hash.
365
+ #
366
+ # @param request [::Google::Cloud::Metastore::V1::CreateServiceRequest, ::Hash]
367
+ # A request object representing the call parameters. Required. To specify no
368
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
369
+ # @param options [::Gapic::CallOptions, ::Hash]
370
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
371
+ #
372
+ # @overload create_service(parent: nil, service_id: nil, service: nil, request_id: nil)
373
+ # Pass arguments to `create_service` via keyword arguments. Note that at
374
+ # least one keyword argument is required. To specify no parameters, or to keep all
375
+ # the default parameter values, pass an empty Hash as a request object (see above).
376
+ #
377
+ # @param parent [::String]
378
+ # Required. The relative resource name of the location in which to create a metastore
379
+ # service, in the following form:
380
+ #
381
+ # `projects/{project_number}/locations/{location_id}`.
382
+ # @param service_id [::String]
383
+ # Required. The ID of the metastore service, which is used as the final
384
+ # component of the metastore service's name.
385
+ #
386
+ # This value must be between 2 and 63 characters long inclusive, begin with a
387
+ # letter, end with a letter or number, and consist of alpha-numeric
388
+ # ASCII characters or hyphens.
389
+ # @param service [::Google::Cloud::Metastore::V1::Service, ::Hash]
390
+ # Required. The Metastore service to create. The `name` field is
391
+ # ignored. The ID of the created metastore service must be provided in
392
+ # the request's `service_id` field.
393
+ # @param request_id [::String]
394
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
395
+ # request if it has completed. The server will ignore subsequent requests
396
+ # that provide a duplicate request ID for at least 60 minutes after the first
397
+ # request.
398
+ #
399
+ # For example, if an initial request times out, followed by another request
400
+ # with the same request ID, the server ignores the second request to prevent
401
+ # the creation of duplicate commitments.
402
+ #
403
+ # The request ID must be a valid
404
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
405
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
406
+ #
407
+ # @yield [response, operation] Access the result along with the RPC operation
408
+ # @yieldparam response [::Gapic::Operation]
409
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
410
+ #
411
+ # @return [::Gapic::Operation]
412
+ #
413
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
414
+ #
415
+ def create_service request, options = nil
416
+ raise ::ArgumentError, "request must be provided" if request.nil?
417
+
418
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::CreateServiceRequest
419
+
420
+ # Converts hash and nil to an options object
421
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
422
+
423
+ # Customize the options with defaults
424
+ metadata = @config.rpcs.create_service.metadata.to_h
425
+
426
+ # Set x-goog-api-client and x-goog-user-project headers
427
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
428
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
429
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
430
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ header_params = {
433
+ "parent" => request.parent
434
+ }
435
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
436
+ metadata[:"x-goog-request-params"] ||= request_params_header
437
+
438
+ options.apply_defaults timeout: @config.rpcs.create_service.timeout,
439
+ metadata: metadata,
440
+ retry_policy: @config.rpcs.create_service.retry_policy
441
+ options.apply_defaults metadata: @config.metadata,
442
+ retry_policy: @config.retry_policy
443
+
444
+ @dataproc_metastore_stub.call_rpc :create_service, request, options: options do |response, operation|
445
+ response = ::Gapic::Operation.new response, @operations_client, options: options
446
+ yield response, operation if block_given?
447
+ return response
448
+ end
449
+ rescue ::GRPC::BadStatus => e
450
+ raise ::Google::Cloud::Error.from_error(e)
451
+ end
452
+
453
+ ##
454
+ # Updates the parameters of a single service.
455
+ #
456
+ # @overload update_service(request, options = nil)
457
+ # Pass arguments to `update_service` via a request object, either of type
458
+ # {::Google::Cloud::Metastore::V1::UpdateServiceRequest} or an equivalent Hash.
459
+ #
460
+ # @param request [::Google::Cloud::Metastore::V1::UpdateServiceRequest, ::Hash]
461
+ # A request object representing the call parameters. Required. To specify no
462
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
463
+ # @param options [::Gapic::CallOptions, ::Hash]
464
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
465
+ #
466
+ # @overload update_service(update_mask: nil, service: nil, request_id: nil)
467
+ # Pass arguments to `update_service` via keyword arguments. Note that at
468
+ # least one keyword argument is required. To specify no parameters, or to keep all
469
+ # the default parameter values, pass an empty Hash as a request object (see above).
470
+ #
471
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
472
+ # Required. A field mask used to specify the fields to be overwritten in the
473
+ # metastore service resource by the update.
474
+ # Fields specified in the `update_mask` are relative to the resource (not
475
+ # to the full request). A field is overwritten if it is in the mask.
476
+ # @param service [::Google::Cloud::Metastore::V1::Service, ::Hash]
477
+ # Required. The metastore service to update. The server only merges fields
478
+ # in the service if they are specified in `update_mask`.
479
+ #
480
+ # The metastore service's `name` field is used to identify the metastore
481
+ # service to be updated.
482
+ # @param request_id [::String]
483
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
484
+ # request if it has completed. The server will ignore subsequent requests
485
+ # that provide a duplicate request ID for at least 60 minutes after the first
486
+ # request.
487
+ #
488
+ # For example, if an initial request times out, followed by another request
489
+ # with the same request ID, the server ignores the second request to prevent
490
+ # the creation of duplicate commitments.
491
+ #
492
+ # The request ID must be a valid
493
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
494
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
495
+ #
496
+ # @yield [response, operation] Access the result along with the RPC operation
497
+ # @yieldparam response [::Gapic::Operation]
498
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
499
+ #
500
+ # @return [::Gapic::Operation]
501
+ #
502
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
503
+ #
504
+ def update_service request, options = nil
505
+ raise ::ArgumentError, "request must be provided" if request.nil?
506
+
507
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::UpdateServiceRequest
508
+
509
+ # Converts hash and nil to an options object
510
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
511
+
512
+ # Customize the options with defaults
513
+ metadata = @config.rpcs.update_service.metadata.to_h
514
+
515
+ # Set x-goog-api-client and x-goog-user-project headers
516
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
517
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
518
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
519
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
520
+
521
+ header_params = {
522
+ "service.name" => request.service.name
523
+ }
524
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
525
+ metadata[:"x-goog-request-params"] ||= request_params_header
526
+
527
+ options.apply_defaults timeout: @config.rpcs.update_service.timeout,
528
+ metadata: metadata,
529
+ retry_policy: @config.rpcs.update_service.retry_policy
530
+ options.apply_defaults metadata: @config.metadata,
531
+ retry_policy: @config.retry_policy
532
+
533
+ @dataproc_metastore_stub.call_rpc :update_service, request, options: options do |response, operation|
534
+ response = ::Gapic::Operation.new response, @operations_client, options: options
535
+ yield response, operation if block_given?
536
+ return response
537
+ end
538
+ rescue ::GRPC::BadStatus => e
539
+ raise ::Google::Cloud::Error.from_error(e)
540
+ end
541
+
542
+ ##
543
+ # Deletes a single service.
544
+ #
545
+ # @overload delete_service(request, options = nil)
546
+ # Pass arguments to `delete_service` via a request object, either of type
547
+ # {::Google::Cloud::Metastore::V1::DeleteServiceRequest} or an equivalent Hash.
548
+ #
549
+ # @param request [::Google::Cloud::Metastore::V1::DeleteServiceRequest, ::Hash]
550
+ # A request object representing the call parameters. Required. To specify no
551
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
552
+ # @param options [::Gapic::CallOptions, ::Hash]
553
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
554
+ #
555
+ # @overload delete_service(name: nil, request_id: nil)
556
+ # Pass arguments to `delete_service` via keyword arguments. Note that at
557
+ # least one keyword argument is required. To specify no parameters, or to keep all
558
+ # the default parameter values, pass an empty Hash as a request object (see above).
559
+ #
560
+ # @param name [::String]
561
+ # Required. The relative resource name of the metastore service to delete, in the
562
+ # following form:
563
+ #
564
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}`.
565
+ # @param request_id [::String]
566
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
567
+ # request if it has completed. The server will ignore subsequent requests
568
+ # that provide a duplicate request ID for at least 60 minutes after the first
569
+ # request.
570
+ #
571
+ # For example, if an initial request times out, followed by another request
572
+ # with the same request ID, the server ignores the second request to prevent
573
+ # the creation of duplicate commitments.
574
+ #
575
+ # The request ID must be a valid
576
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
577
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
578
+ #
579
+ # @yield [response, operation] Access the result along with the RPC operation
580
+ # @yieldparam response [::Gapic::Operation]
581
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
582
+ #
583
+ # @return [::Gapic::Operation]
584
+ #
585
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
586
+ #
587
+ def delete_service request, options = nil
588
+ raise ::ArgumentError, "request must be provided" if request.nil?
589
+
590
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::DeleteServiceRequest
591
+
592
+ # Converts hash and nil to an options object
593
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
594
+
595
+ # Customize the options with defaults
596
+ metadata = @config.rpcs.delete_service.metadata.to_h
597
+
598
+ # Set x-goog-api-client and x-goog-user-project headers
599
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
600
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
601
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
602
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
603
+
604
+ header_params = {
605
+ "name" => request.name
606
+ }
607
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
608
+ metadata[:"x-goog-request-params"] ||= request_params_header
609
+
610
+ options.apply_defaults timeout: @config.rpcs.delete_service.timeout,
611
+ metadata: metadata,
612
+ retry_policy: @config.rpcs.delete_service.retry_policy
613
+ options.apply_defaults metadata: @config.metadata,
614
+ retry_policy: @config.retry_policy
615
+
616
+ @dataproc_metastore_stub.call_rpc :delete_service, request, options: options do |response, operation|
617
+ response = ::Gapic::Operation.new response, @operations_client, options: options
618
+ yield response, operation if block_given?
619
+ return response
620
+ end
621
+ rescue ::GRPC::BadStatus => e
622
+ raise ::Google::Cloud::Error.from_error(e)
623
+ end
624
+
625
+ ##
626
+ # Lists imports in a service.
627
+ #
628
+ # @overload list_metadata_imports(request, options = nil)
629
+ # Pass arguments to `list_metadata_imports` via a request object, either of type
630
+ # {::Google::Cloud::Metastore::V1::ListMetadataImportsRequest} or an equivalent Hash.
631
+ #
632
+ # @param request [::Google::Cloud::Metastore::V1::ListMetadataImportsRequest, ::Hash]
633
+ # A request object representing the call parameters. Required. To specify no
634
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
635
+ # @param options [::Gapic::CallOptions, ::Hash]
636
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
637
+ #
638
+ # @overload list_metadata_imports(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
639
+ # Pass arguments to `list_metadata_imports` via keyword arguments. Note that at
640
+ # least one keyword argument is required. To specify no parameters, or to keep all
641
+ # the default parameter values, pass an empty Hash as a request object (see above).
642
+ #
643
+ # @param parent [::String]
644
+ # Required. The relative resource name of the service whose metadata imports to
645
+ # list, in the following form:
646
+ #
647
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`.
648
+ # @param page_size [::Integer]
649
+ # Optional. The maximum number of imports to return. The response may contain less
650
+ # than the maximum number. If unspecified, no more than 500 imports are
651
+ # returned. The maximum value is 1000; values above 1000 are changed to 1000.
652
+ # @param page_token [::String]
653
+ # Optional. A page token, received from a previous {::Google::Cloud::Metastore::V1::DataprocMetastore::Client#list_services DataprocMetastore.ListServices}
654
+ # call. Provide this token to retrieve the subsequent page.
655
+ #
656
+ # To retrieve the first page, supply an empty page token.
657
+ #
658
+ # When paginating, other parameters provided to
659
+ # {::Google::Cloud::Metastore::V1::DataprocMetastore::Client#list_services DataprocMetastore.ListServices} must match the call that provided the
660
+ # page token.
661
+ # @param filter [::String]
662
+ # Optional. The filter to apply to list results.
663
+ # @param order_by [::String]
664
+ # Optional. Specify the ordering of results as described in [Sorting
665
+ # Order](https://cloud.google.com/apis/design/design_patterns#sorting_order).
666
+ # If not specified, the results will be sorted in the default order.
667
+ #
668
+ # @yield [response, operation] Access the result along with the RPC operation
669
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Metastore::V1::MetadataImport>]
670
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
671
+ #
672
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Metastore::V1::MetadataImport>]
673
+ #
674
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
675
+ #
676
+ def list_metadata_imports request, options = nil
677
+ raise ::ArgumentError, "request must be provided" if request.nil?
678
+
679
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::ListMetadataImportsRequest
680
+
681
+ # Converts hash and nil to an options object
682
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
683
+
684
+ # Customize the options with defaults
685
+ metadata = @config.rpcs.list_metadata_imports.metadata.to_h
686
+
687
+ # Set x-goog-api-client and x-goog-user-project headers
688
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
689
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
690
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
691
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
692
+
693
+ header_params = {
694
+ "parent" => request.parent
695
+ }
696
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
697
+ metadata[:"x-goog-request-params"] ||= request_params_header
698
+
699
+ options.apply_defaults timeout: @config.rpcs.list_metadata_imports.timeout,
700
+ metadata: metadata,
701
+ retry_policy: @config.rpcs.list_metadata_imports.retry_policy
702
+ options.apply_defaults metadata: @config.metadata,
703
+ retry_policy: @config.retry_policy
704
+
705
+ @dataproc_metastore_stub.call_rpc :list_metadata_imports, request, options: options do |response, operation|
706
+ response = ::Gapic::PagedEnumerable.new @dataproc_metastore_stub, :list_metadata_imports, request, response, operation, options
707
+ yield response, operation if block_given?
708
+ return response
709
+ end
710
+ rescue ::GRPC::BadStatus => e
711
+ raise ::Google::Cloud::Error.from_error(e)
712
+ end
713
+
714
+ ##
715
+ # Gets details of a single import.
716
+ #
717
+ # @overload get_metadata_import(request, options = nil)
718
+ # Pass arguments to `get_metadata_import` via a request object, either of type
719
+ # {::Google::Cloud::Metastore::V1::GetMetadataImportRequest} or an equivalent Hash.
720
+ #
721
+ # @param request [::Google::Cloud::Metastore::V1::GetMetadataImportRequest, ::Hash]
722
+ # A request object representing the call parameters. Required. To specify no
723
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
724
+ # @param options [::Gapic::CallOptions, ::Hash]
725
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
726
+ #
727
+ # @overload get_metadata_import(name: nil)
728
+ # Pass arguments to `get_metadata_import` via keyword arguments. Note that at
729
+ # least one keyword argument is required. To specify no parameters, or to keep all
730
+ # the default parameter values, pass an empty Hash as a request object (see above).
731
+ #
732
+ # @param name [::String]
733
+ # Required. The relative resource name of the metadata import to retrieve, in the
734
+ # following form:
735
+ #
736
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`.
737
+ #
738
+ # @yield [response, operation] Access the result along with the RPC operation
739
+ # @yieldparam response [::Google::Cloud::Metastore::V1::MetadataImport]
740
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
741
+ #
742
+ # @return [::Google::Cloud::Metastore::V1::MetadataImport]
743
+ #
744
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
745
+ #
746
+ def get_metadata_import request, options = nil
747
+ raise ::ArgumentError, "request must be provided" if request.nil?
748
+
749
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::GetMetadataImportRequest
750
+
751
+ # Converts hash and nil to an options object
752
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
753
+
754
+ # Customize the options with defaults
755
+ metadata = @config.rpcs.get_metadata_import.metadata.to_h
756
+
757
+ # Set x-goog-api-client and x-goog-user-project headers
758
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
759
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
760
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
761
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
762
+
763
+ header_params = {
764
+ "name" => request.name
765
+ }
766
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
767
+ metadata[:"x-goog-request-params"] ||= request_params_header
768
+
769
+ options.apply_defaults timeout: @config.rpcs.get_metadata_import.timeout,
770
+ metadata: metadata,
771
+ retry_policy: @config.rpcs.get_metadata_import.retry_policy
772
+ options.apply_defaults metadata: @config.metadata,
773
+ retry_policy: @config.retry_policy
774
+
775
+ @dataproc_metastore_stub.call_rpc :get_metadata_import, request, options: options do |response, operation|
776
+ yield response, operation if block_given?
777
+ return response
778
+ end
779
+ rescue ::GRPC::BadStatus => e
780
+ raise ::Google::Cloud::Error.from_error(e)
781
+ end
782
+
783
+ ##
784
+ # Creates a new MetadataImport in a given project and location.
785
+ #
786
+ # @overload create_metadata_import(request, options = nil)
787
+ # Pass arguments to `create_metadata_import` via a request object, either of type
788
+ # {::Google::Cloud::Metastore::V1::CreateMetadataImportRequest} or an equivalent Hash.
789
+ #
790
+ # @param request [::Google::Cloud::Metastore::V1::CreateMetadataImportRequest, ::Hash]
791
+ # A request object representing the call parameters. Required. To specify no
792
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
793
+ # @param options [::Gapic::CallOptions, ::Hash]
794
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
795
+ #
796
+ # @overload create_metadata_import(parent: nil, metadata_import_id: nil, metadata_import: nil, request_id: nil)
797
+ # Pass arguments to `create_metadata_import` via keyword arguments. Note that at
798
+ # least one keyword argument is required. To specify no parameters, or to keep all
799
+ # the default parameter values, pass an empty Hash as a request object (see above).
800
+ #
801
+ # @param parent [::String]
802
+ # Required. The relative resource name of the service in which to create a metastore
803
+ # import, in the following form:
804
+ #
805
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}`.
806
+ # @param metadata_import_id [::String]
807
+ # Required. The ID of the metadata import, which is used as the final component of the
808
+ # metadata import's name.
809
+ #
810
+ # This value must be between 1 and 64 characters long, begin with a letter,
811
+ # end with a letter or number, and consist of alpha-numeric ASCII characters
812
+ # or hyphens.
813
+ # @param metadata_import [::Google::Cloud::Metastore::V1::MetadataImport, ::Hash]
814
+ # Required. The metadata import to create. The `name` field is ignored. The ID of the
815
+ # created metadata import must be provided in the request's
816
+ # `metadata_import_id` field.
817
+ # @param request_id [::String]
818
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
819
+ # request if it has completed. The server will ignore subsequent requests
820
+ # that provide a duplicate request ID for at least 60 minutes after the first
821
+ # request.
822
+ #
823
+ # For example, if an initial request times out, followed by another request
824
+ # with the same request ID, the server ignores the second request to prevent
825
+ # the creation of duplicate commitments.
826
+ #
827
+ # The request ID must be a valid
828
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
829
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
830
+ #
831
+ # @yield [response, operation] Access the result along with the RPC operation
832
+ # @yieldparam response [::Gapic::Operation]
833
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
834
+ #
835
+ # @return [::Gapic::Operation]
836
+ #
837
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
838
+ #
839
+ def create_metadata_import request, options = nil
840
+ raise ::ArgumentError, "request must be provided" if request.nil?
841
+
842
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::CreateMetadataImportRequest
843
+
844
+ # Converts hash and nil to an options object
845
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
846
+
847
+ # Customize the options with defaults
848
+ metadata = @config.rpcs.create_metadata_import.metadata.to_h
849
+
850
+ # Set x-goog-api-client and x-goog-user-project headers
851
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
852
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
853
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
854
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
855
+
856
+ header_params = {
857
+ "parent" => request.parent
858
+ }
859
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
860
+ metadata[:"x-goog-request-params"] ||= request_params_header
861
+
862
+ options.apply_defaults timeout: @config.rpcs.create_metadata_import.timeout,
863
+ metadata: metadata,
864
+ retry_policy: @config.rpcs.create_metadata_import.retry_policy
865
+ options.apply_defaults metadata: @config.metadata,
866
+ retry_policy: @config.retry_policy
867
+
868
+ @dataproc_metastore_stub.call_rpc :create_metadata_import, request, options: options do |response, operation|
869
+ response = ::Gapic::Operation.new response, @operations_client, options: options
870
+ yield response, operation if block_given?
871
+ return response
872
+ end
873
+ rescue ::GRPC::BadStatus => e
874
+ raise ::Google::Cloud::Error.from_error(e)
875
+ end
876
+
877
+ ##
878
+ # Updates a single import.
879
+ # Only the description field of MetadataImport is supported to be updated.
880
+ #
881
+ # @overload update_metadata_import(request, options = nil)
882
+ # Pass arguments to `update_metadata_import` via a request object, either of type
883
+ # {::Google::Cloud::Metastore::V1::UpdateMetadataImportRequest} or an equivalent Hash.
884
+ #
885
+ # @param request [::Google::Cloud::Metastore::V1::UpdateMetadataImportRequest, ::Hash]
886
+ # A request object representing the call parameters. Required. To specify no
887
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
888
+ # @param options [::Gapic::CallOptions, ::Hash]
889
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
890
+ #
891
+ # @overload update_metadata_import(update_mask: nil, metadata_import: nil, request_id: nil)
892
+ # Pass arguments to `update_metadata_import` via keyword arguments. Note that at
893
+ # least one keyword argument is required. To specify no parameters, or to keep all
894
+ # the default parameter values, pass an empty Hash as a request object (see above).
895
+ #
896
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
897
+ # Required. A field mask used to specify the fields to be overwritten in the
898
+ # metadata import resource by the update.
899
+ # Fields specified in the `update_mask` are relative to the resource (not
900
+ # to the full request). A field is overwritten if it is in the mask.
901
+ # @param metadata_import [::Google::Cloud::Metastore::V1::MetadataImport, ::Hash]
902
+ # Required. The metadata import to update. The server only merges fields
903
+ # in the import if they are specified in `update_mask`.
904
+ #
905
+ # The metadata import's `name` field is used to identify the metastore
906
+ # import to be updated.
907
+ # @param request_id [::String]
908
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
909
+ # request if it has completed. The server will ignore subsequent requests
910
+ # that provide a duplicate request ID for at least 60 minutes after the first
911
+ # request.
912
+ #
913
+ # For example, if an initial request times out, followed by another request
914
+ # with the same request ID, the server ignores the second request to prevent
915
+ # the creation of duplicate commitments.
916
+ #
917
+ # The request ID must be a valid
918
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
919
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
920
+ #
921
+ # @yield [response, operation] Access the result along with the RPC operation
922
+ # @yieldparam response [::Gapic::Operation]
923
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
924
+ #
925
+ # @return [::Gapic::Operation]
926
+ #
927
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
928
+ #
929
+ def update_metadata_import request, options = nil
930
+ raise ::ArgumentError, "request must be provided" if request.nil?
931
+
932
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::UpdateMetadataImportRequest
933
+
934
+ # Converts hash and nil to an options object
935
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
936
+
937
+ # Customize the options with defaults
938
+ metadata = @config.rpcs.update_metadata_import.metadata.to_h
939
+
940
+ # Set x-goog-api-client and x-goog-user-project headers
941
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
942
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
943
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
944
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
945
+
946
+ header_params = {
947
+ "metadata_import.name" => request.metadata_import.name
948
+ }
949
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
950
+ metadata[:"x-goog-request-params"] ||= request_params_header
951
+
952
+ options.apply_defaults timeout: @config.rpcs.update_metadata_import.timeout,
953
+ metadata: metadata,
954
+ retry_policy: @config.rpcs.update_metadata_import.retry_policy
955
+ options.apply_defaults metadata: @config.metadata,
956
+ retry_policy: @config.retry_policy
957
+
958
+ @dataproc_metastore_stub.call_rpc :update_metadata_import, request, options: options do |response, operation|
959
+ response = ::Gapic::Operation.new response, @operations_client, options: options
960
+ yield response, operation if block_given?
961
+ return response
962
+ end
963
+ rescue ::GRPC::BadStatus => e
964
+ raise ::Google::Cloud::Error.from_error(e)
965
+ end
966
+
967
+ ##
968
+ # Exports metadata from a service.
969
+ #
970
+ # @overload export_metadata(request, options = nil)
971
+ # Pass arguments to `export_metadata` via a request object, either of type
972
+ # {::Google::Cloud::Metastore::V1::ExportMetadataRequest} or an equivalent Hash.
973
+ #
974
+ # @param request [::Google::Cloud::Metastore::V1::ExportMetadataRequest, ::Hash]
975
+ # A request object representing the call parameters. Required. To specify no
976
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
977
+ # @param options [::Gapic::CallOptions, ::Hash]
978
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
979
+ #
980
+ # @overload export_metadata(destination_gcs_folder: nil, service: nil, request_id: nil, database_dump_type: nil)
981
+ # Pass arguments to `export_metadata` via keyword arguments. Note that at
982
+ # least one keyword argument is required. To specify no parameters, or to keep all
983
+ # the default parameter values, pass an empty Hash as a request object (see above).
984
+ #
985
+ # @param destination_gcs_folder [::String]
986
+ # A Cloud Storage URI of a folder, in the format
987
+ # `gs://<bucket_name>/<path_inside_bucket>`. A sub-folder
988
+ # `<export_folder>` containing exported files will be created below it.
989
+ # @param service [::String]
990
+ # Required. The relative resource name of the metastore service to run export, in the
991
+ # following form:
992
+ #
993
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}`.
994
+ # @param request_id [::String]
995
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
996
+ # request if it has completed. The server will ignore subsequent requests
997
+ # that provide a duplicate request ID for at least 60 minutes after the first
998
+ # request.
999
+ #
1000
+ # For example, if an initial request times out, followed by another request
1001
+ # with the same request ID, the server ignores the second request to prevent
1002
+ # the creation of duplicate commitments.
1003
+ #
1004
+ # The request ID must be a valid
1005
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
1006
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
1007
+ # @param database_dump_type [::Google::Cloud::Metastore::V1::DatabaseDumpSpec::Type]
1008
+ # Optional. The type of the database dump. If unspecified, defaults to `MYSQL`.
1009
+ #
1010
+ # @yield [response, operation] Access the result along with the RPC operation
1011
+ # @yieldparam response [::Gapic::Operation]
1012
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1013
+ #
1014
+ # @return [::Gapic::Operation]
1015
+ #
1016
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1017
+ #
1018
+ def export_metadata request, options = nil
1019
+ raise ::ArgumentError, "request must be provided" if request.nil?
1020
+
1021
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::ExportMetadataRequest
1022
+
1023
+ # Converts hash and nil to an options object
1024
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1025
+
1026
+ # Customize the options with defaults
1027
+ metadata = @config.rpcs.export_metadata.metadata.to_h
1028
+
1029
+ # Set x-goog-api-client and x-goog-user-project headers
1030
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1031
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1032
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
1033
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1034
+
1035
+ header_params = {
1036
+ "service" => request.service
1037
+ }
1038
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1039
+ metadata[:"x-goog-request-params"] ||= request_params_header
1040
+
1041
+ options.apply_defaults timeout: @config.rpcs.export_metadata.timeout,
1042
+ metadata: metadata,
1043
+ retry_policy: @config.rpcs.export_metadata.retry_policy
1044
+ options.apply_defaults metadata: @config.metadata,
1045
+ retry_policy: @config.retry_policy
1046
+
1047
+ @dataproc_metastore_stub.call_rpc :export_metadata, request, options: options do |response, operation|
1048
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1049
+ yield response, operation if block_given?
1050
+ return response
1051
+ end
1052
+ rescue ::GRPC::BadStatus => e
1053
+ raise ::Google::Cloud::Error.from_error(e)
1054
+ end
1055
+
1056
+ ##
1057
+ # Configuration class for the DataprocMetastore API.
1058
+ #
1059
+ # This class represents the configuration for DataprocMetastore,
1060
+ # providing control over timeouts, retry behavior, logging, transport
1061
+ # parameters, and other low-level controls. Certain parameters can also be
1062
+ # applied individually to specific RPCs. See
1063
+ # {::Google::Cloud::Metastore::V1::DataprocMetastore::Client::Configuration::Rpcs}
1064
+ # for a list of RPCs that can be configured independently.
1065
+ #
1066
+ # Configuration can be applied globally to all clients, or to a single client
1067
+ # on construction.
1068
+ #
1069
+ # # Examples
1070
+ #
1071
+ # To modify the global config, setting the timeout for list_services
1072
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
1073
+ #
1074
+ # ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.configure do |config|
1075
+ # config.timeout = 10.0
1076
+ # config.rpcs.list_services.timeout = 20.0
1077
+ # end
1078
+ #
1079
+ # To apply the above configuration only to a new client:
1080
+ #
1081
+ # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new do |config|
1082
+ # config.timeout = 10.0
1083
+ # config.rpcs.list_services.timeout = 20.0
1084
+ # end
1085
+ #
1086
+ # @!attribute [rw] endpoint
1087
+ # The hostname or hostname:port of the service endpoint.
1088
+ # Defaults to `"metastore.googleapis.com"`.
1089
+ # @return [::String]
1090
+ # @!attribute [rw] credentials
1091
+ # Credentials to send with calls. You may provide any of the following types:
1092
+ # * (`String`) The path to a service account key file in JSON format
1093
+ # * (`Hash`) A service account key as a Hash
1094
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1095
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1096
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1097
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1098
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1099
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1100
+ # * (`nil`) indicating no credentials
1101
+ # @return [::Object]
1102
+ # @!attribute [rw] scope
1103
+ # The OAuth scopes
1104
+ # @return [::Array<::String>]
1105
+ # @!attribute [rw] lib_name
1106
+ # The library name as recorded in instrumentation and logging
1107
+ # @return [::String]
1108
+ # @!attribute [rw] lib_version
1109
+ # The library version as recorded in instrumentation and logging
1110
+ # @return [::String]
1111
+ # @!attribute [rw] channel_args
1112
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1113
+ # `GRPC::Core::Channel` object is provided as the credential.
1114
+ # @return [::Hash]
1115
+ # @!attribute [rw] interceptors
1116
+ # An array of interceptors that are run before calls are executed.
1117
+ # @return [::Array<::GRPC::ClientInterceptor>]
1118
+ # @!attribute [rw] timeout
1119
+ # The call timeout in seconds.
1120
+ # @return [::Numeric]
1121
+ # @!attribute [rw] metadata
1122
+ # Additional gRPC headers to be sent with the call.
1123
+ # @return [::Hash{::Symbol=>::String}]
1124
+ # @!attribute [rw] retry_policy
1125
+ # The retry policy. The value is a hash with the following keys:
1126
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1127
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1128
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1129
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1130
+ # trigger a retry.
1131
+ # @return [::Hash]
1132
+ # @!attribute [rw] quota_project
1133
+ # A separate project against which to charge quota.
1134
+ # @return [::String]
1135
+ #
1136
+ class Configuration
1137
+ extend ::Gapic::Config
1138
+
1139
+ config_attr :endpoint, "metastore.googleapis.com", ::String
1140
+ config_attr :credentials, nil do |value|
1141
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1142
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1143
+ allowed.any? { |klass| klass === value }
1144
+ end
1145
+ config_attr :scope, nil, ::String, ::Array, nil
1146
+ config_attr :lib_name, nil, ::String, nil
1147
+ config_attr :lib_version, nil, ::String, nil
1148
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1149
+ config_attr :interceptors, nil, ::Array, nil
1150
+ config_attr :timeout, nil, ::Numeric, nil
1151
+ config_attr :metadata, nil, ::Hash, nil
1152
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1153
+ config_attr :quota_project, nil, ::String, nil
1154
+
1155
+ # @private
1156
+ def initialize parent_config = nil
1157
+ @parent_config = parent_config unless parent_config.nil?
1158
+
1159
+ yield self if block_given?
1160
+ end
1161
+
1162
+ ##
1163
+ # Configurations for individual RPCs
1164
+ # @return [Rpcs]
1165
+ #
1166
+ def rpcs
1167
+ @rpcs ||= begin
1168
+ parent_rpcs = nil
1169
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1170
+ Rpcs.new parent_rpcs
1171
+ end
1172
+ end
1173
+
1174
+ ##
1175
+ # Configuration RPC class for the DataprocMetastore API.
1176
+ #
1177
+ # Includes fields providing the configuration for each RPC in this service.
1178
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1179
+ # the following configuration fields:
1180
+ #
1181
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1182
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1183
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1184
+ # include the following keys:
1185
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1186
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1187
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1188
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1189
+ # trigger a retry.
1190
+ #
1191
+ class Rpcs
1192
+ ##
1193
+ # RPC-specific configuration for `list_services`
1194
+ # @return [::Gapic::Config::Method]
1195
+ #
1196
+ attr_reader :list_services
1197
+ ##
1198
+ # RPC-specific configuration for `get_service`
1199
+ # @return [::Gapic::Config::Method]
1200
+ #
1201
+ attr_reader :get_service
1202
+ ##
1203
+ # RPC-specific configuration for `create_service`
1204
+ # @return [::Gapic::Config::Method]
1205
+ #
1206
+ attr_reader :create_service
1207
+ ##
1208
+ # RPC-specific configuration for `update_service`
1209
+ # @return [::Gapic::Config::Method]
1210
+ #
1211
+ attr_reader :update_service
1212
+ ##
1213
+ # RPC-specific configuration for `delete_service`
1214
+ # @return [::Gapic::Config::Method]
1215
+ #
1216
+ attr_reader :delete_service
1217
+ ##
1218
+ # RPC-specific configuration for `list_metadata_imports`
1219
+ # @return [::Gapic::Config::Method]
1220
+ #
1221
+ attr_reader :list_metadata_imports
1222
+ ##
1223
+ # RPC-specific configuration for `get_metadata_import`
1224
+ # @return [::Gapic::Config::Method]
1225
+ #
1226
+ attr_reader :get_metadata_import
1227
+ ##
1228
+ # RPC-specific configuration for `create_metadata_import`
1229
+ # @return [::Gapic::Config::Method]
1230
+ #
1231
+ attr_reader :create_metadata_import
1232
+ ##
1233
+ # RPC-specific configuration for `update_metadata_import`
1234
+ # @return [::Gapic::Config::Method]
1235
+ #
1236
+ attr_reader :update_metadata_import
1237
+ ##
1238
+ # RPC-specific configuration for `export_metadata`
1239
+ # @return [::Gapic::Config::Method]
1240
+ #
1241
+ attr_reader :export_metadata
1242
+
1243
+ # @private
1244
+ def initialize parent_rpcs = nil
1245
+ list_services_config = parent_rpcs.list_services if parent_rpcs.respond_to? :list_services
1246
+ @list_services = ::Gapic::Config::Method.new list_services_config
1247
+ get_service_config = parent_rpcs.get_service if parent_rpcs.respond_to? :get_service
1248
+ @get_service = ::Gapic::Config::Method.new get_service_config
1249
+ create_service_config = parent_rpcs.create_service if parent_rpcs.respond_to? :create_service
1250
+ @create_service = ::Gapic::Config::Method.new create_service_config
1251
+ update_service_config = parent_rpcs.update_service if parent_rpcs.respond_to? :update_service
1252
+ @update_service = ::Gapic::Config::Method.new update_service_config
1253
+ delete_service_config = parent_rpcs.delete_service if parent_rpcs.respond_to? :delete_service
1254
+ @delete_service = ::Gapic::Config::Method.new delete_service_config
1255
+ list_metadata_imports_config = parent_rpcs.list_metadata_imports if parent_rpcs.respond_to? :list_metadata_imports
1256
+ @list_metadata_imports = ::Gapic::Config::Method.new list_metadata_imports_config
1257
+ get_metadata_import_config = parent_rpcs.get_metadata_import if parent_rpcs.respond_to? :get_metadata_import
1258
+ @get_metadata_import = ::Gapic::Config::Method.new get_metadata_import_config
1259
+ create_metadata_import_config = parent_rpcs.create_metadata_import if parent_rpcs.respond_to? :create_metadata_import
1260
+ @create_metadata_import = ::Gapic::Config::Method.new create_metadata_import_config
1261
+ update_metadata_import_config = parent_rpcs.update_metadata_import if parent_rpcs.respond_to? :update_metadata_import
1262
+ @update_metadata_import = ::Gapic::Config::Method.new update_metadata_import_config
1263
+ export_metadata_config = parent_rpcs.export_metadata if parent_rpcs.respond_to? :export_metadata
1264
+ @export_metadata = ::Gapic::Config::Method.new export_metadata_config
1265
+
1266
+ yield self if block_given?
1267
+ end
1268
+ end
1269
+ end
1270
+ end
1271
+ end
1272
+ end
1273
+ end
1274
+ end
1275
+ end