google-cloud-dataplex-v1 0.1.0 → 0.2.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,798 @@
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/dataplex/v1/content_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dataplex
25
+ module V1
26
+ module ContentService
27
+ ##
28
+ # Client for the ContentService service.
29
+ #
30
+ # ContentService manages Notebook and SQL Scripts for Dataplex.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :content_service_stub
37
+
38
+ ##
39
+ # Configure the ContentService Client class.
40
+ #
41
+ # See {::Google::Cloud::Dataplex::V1::ContentService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all ContentService clients
47
+ # ::Google::Cloud::Dataplex::V1::ContentService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "Dataplex", "V1"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config
68
+ end
69
+ yield @configure if block_given?
70
+ @configure
71
+ end
72
+
73
+ ##
74
+ # Configure the ContentService Client instance.
75
+ #
76
+ # The configuration is set to the derived mode, meaning that values can be changed,
77
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
78
+ # should be made on {Client.configure}.
79
+ #
80
+ # See {::Google::Cloud::Dataplex::V1::ContentService::Client::Configuration}
81
+ # for a description of the configuration fields.
82
+ #
83
+ # @yield [config] Configure the Client client.
84
+ # @yieldparam config [Client::Configuration]
85
+ #
86
+ # @return [Client::Configuration]
87
+ #
88
+ def configure
89
+ yield @config if block_given?
90
+ @config
91
+ end
92
+
93
+ ##
94
+ # Create a new ContentService client object.
95
+ #
96
+ # @example
97
+ #
98
+ # # Create a client using the default configuration
99
+ # client = ::Google::Cloud::Dataplex::V1::ContentService::Client.new
100
+ #
101
+ # # Create a client using a custom configuration
102
+ # client = ::Google::Cloud::Dataplex::V1::ContentService::Client.new do |config|
103
+ # config.timeout = 10.0
104
+ # end
105
+ #
106
+ # @yield [config] Configure the ContentService client.
107
+ # @yieldparam config [Client::Configuration]
108
+ #
109
+ def initialize
110
+ # These require statements are intentionally placed here to initialize
111
+ # the gRPC module only when it's required.
112
+ # See https://github.com/googleapis/toolkit/issues/446
113
+ require "gapic/grpc"
114
+ require "google/cloud/dataplex/v1/content_services_pb"
115
+
116
+ # Create the configuration object
117
+ @config = Configuration.new Client.configure
118
+
119
+ # Yield the configuration if needed
120
+ yield @config if block_given?
121
+
122
+ # Create credentials
123
+ credentials = @config.credentials
124
+ # Use self-signed JWT if the endpoint is unchanged from default,
125
+ # but only if the default endpoint does not have a region prefix.
126
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
127
+ !@config.endpoint.split(".").first.include?("-")
128
+ credentials ||= Credentials.default scope: @config.scope,
129
+ enable_self_signed_jwt: enable_self_signed_jwt
130
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
131
+ credentials = Credentials.new credentials, scope: @config.scope
132
+ end
133
+ @quota_project_id = @config.quota_project
134
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
135
+
136
+ @content_service_stub = ::Gapic::ServiceStub.new(
137
+ ::Google::Cloud::Dataplex::V1::ContentService::Stub,
138
+ credentials: credentials,
139
+ endpoint: @config.endpoint,
140
+ channel_args: @config.channel_args,
141
+ interceptors: @config.interceptors
142
+ )
143
+ end
144
+
145
+ # Service calls
146
+
147
+ ##
148
+ # Create a content.
149
+ #
150
+ # @overload create_content(request, options = nil)
151
+ # Pass arguments to `create_content` via a request object, either of type
152
+ # {::Google::Cloud::Dataplex::V1::CreateContentRequest} or an equivalent Hash.
153
+ #
154
+ # @param request [::Google::Cloud::Dataplex::V1::CreateContentRequest, ::Hash]
155
+ # A request object representing the call parameters. Required. To specify no
156
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
157
+ # @param options [::Gapic::CallOptions, ::Hash]
158
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
159
+ #
160
+ # @overload create_content(parent: nil, content: nil, validate_only: nil)
161
+ # Pass arguments to `create_content` via keyword arguments. Note that at
162
+ # least one keyword argument is required. To specify no parameters, or to keep all
163
+ # the default parameter values, pass an empty Hash as a request object (see above).
164
+ #
165
+ # @param parent [::String]
166
+ # Required. The resource name of the parent lake:
167
+ # projects/\\{project_id}/locations/\\{location_id}/lakes/\\{lake_id}
168
+ # @param content [::Google::Cloud::Dataplex::V1::Content, ::Hash]
169
+ # Required. Content resource.
170
+ # @param validate_only [::Boolean]
171
+ # Optional. Only validate the request, but do not perform mutations.
172
+ # The default is false.
173
+ #
174
+ # @yield [response, operation] Access the result along with the RPC operation
175
+ # @yieldparam response [::Google::Cloud::Dataplex::V1::Content]
176
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
177
+ #
178
+ # @return [::Google::Cloud::Dataplex::V1::Content]
179
+ #
180
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
181
+ #
182
+ # @example Basic example
183
+ # require "google/cloud/dataplex/v1"
184
+ #
185
+ # # Create a client object. The client can be reused for multiple calls.
186
+ # client = Google::Cloud::Dataplex::V1::ContentService::Client.new
187
+ #
188
+ # # Create a request. To set request fields, pass in keyword arguments.
189
+ # request = Google::Cloud::Dataplex::V1::CreateContentRequest.new
190
+ #
191
+ # # Call the create_content method.
192
+ # result = client.create_content request
193
+ #
194
+ # # The returned object is of type Google::Cloud::Dataplex::V1::Content.
195
+ # p result
196
+ #
197
+ def create_content request, options = nil
198
+ raise ::ArgumentError, "request must be provided" if request.nil?
199
+
200
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataplex::V1::CreateContentRequest
201
+
202
+ # Converts hash and nil to an options object
203
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
204
+
205
+ # Customize the options with defaults
206
+ metadata = @config.rpcs.create_content.metadata.to_h
207
+
208
+ # Set x-goog-api-client and x-goog-user-project headers
209
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
210
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
211
+ gapic_version: ::Google::Cloud::Dataplex::V1::VERSION
212
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
213
+
214
+ header_params = {}
215
+ if request.parent
216
+ header_params["parent"] = request.parent
217
+ end
218
+
219
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
220
+ metadata[:"x-goog-request-params"] ||= request_params_header
221
+
222
+ options.apply_defaults timeout: @config.rpcs.create_content.timeout,
223
+ metadata: metadata,
224
+ retry_policy: @config.rpcs.create_content.retry_policy
225
+
226
+ options.apply_defaults timeout: @config.timeout,
227
+ metadata: @config.metadata,
228
+ retry_policy: @config.retry_policy
229
+
230
+ @content_service_stub.call_rpc :create_content, request, options: options do |response, operation|
231
+ yield response, operation if block_given?
232
+ return response
233
+ end
234
+ rescue ::GRPC::BadStatus => e
235
+ raise ::Google::Cloud::Error.from_error(e)
236
+ end
237
+
238
+ ##
239
+ # Update a content. Only supports full resource update.
240
+ #
241
+ # @overload update_content(request, options = nil)
242
+ # Pass arguments to `update_content` via a request object, either of type
243
+ # {::Google::Cloud::Dataplex::V1::UpdateContentRequest} or an equivalent Hash.
244
+ #
245
+ # @param request [::Google::Cloud::Dataplex::V1::UpdateContentRequest, ::Hash]
246
+ # A request object representing the call parameters. Required. To specify no
247
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
248
+ # @param options [::Gapic::CallOptions, ::Hash]
249
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
250
+ #
251
+ # @overload update_content(update_mask: nil, content: nil, validate_only: nil)
252
+ # Pass arguments to `update_content` via keyword arguments. Note that at
253
+ # least one keyword argument is required. To specify no parameters, or to keep all
254
+ # the default parameter values, pass an empty Hash as a request object (see above).
255
+ #
256
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
257
+ # Required. Mask of fields to update.
258
+ # @param content [::Google::Cloud::Dataplex::V1::Content, ::Hash]
259
+ # Required. Update description.
260
+ # Only fields specified in `update_mask` are updated.
261
+ # @param validate_only [::Boolean]
262
+ # Optional. Only validate the request, but do not perform mutations.
263
+ # The default is false.
264
+ #
265
+ # @yield [response, operation] Access the result along with the RPC operation
266
+ # @yieldparam response [::Google::Cloud::Dataplex::V1::Content]
267
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
268
+ #
269
+ # @return [::Google::Cloud::Dataplex::V1::Content]
270
+ #
271
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
272
+ #
273
+ # @example Basic example
274
+ # require "google/cloud/dataplex/v1"
275
+ #
276
+ # # Create a client object. The client can be reused for multiple calls.
277
+ # client = Google::Cloud::Dataplex::V1::ContentService::Client.new
278
+ #
279
+ # # Create a request. To set request fields, pass in keyword arguments.
280
+ # request = Google::Cloud::Dataplex::V1::UpdateContentRequest.new
281
+ #
282
+ # # Call the update_content method.
283
+ # result = client.update_content request
284
+ #
285
+ # # The returned object is of type Google::Cloud::Dataplex::V1::Content.
286
+ # p result
287
+ #
288
+ def update_content request, options = nil
289
+ raise ::ArgumentError, "request must be provided" if request.nil?
290
+
291
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataplex::V1::UpdateContentRequest
292
+
293
+ # Converts hash and nil to an options object
294
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
295
+
296
+ # Customize the options with defaults
297
+ metadata = @config.rpcs.update_content.metadata.to_h
298
+
299
+ # Set x-goog-api-client and x-goog-user-project headers
300
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
301
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
302
+ gapic_version: ::Google::Cloud::Dataplex::V1::VERSION
303
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
304
+
305
+ header_params = {}
306
+ if request.content&.name
307
+ header_params["content.name"] = request.content.name
308
+ end
309
+
310
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
311
+ metadata[:"x-goog-request-params"] ||= request_params_header
312
+
313
+ options.apply_defaults timeout: @config.rpcs.update_content.timeout,
314
+ metadata: metadata,
315
+ retry_policy: @config.rpcs.update_content.retry_policy
316
+
317
+ options.apply_defaults timeout: @config.timeout,
318
+ metadata: @config.metadata,
319
+ retry_policy: @config.retry_policy
320
+
321
+ @content_service_stub.call_rpc :update_content, request, options: options do |response, operation|
322
+ yield response, operation if block_given?
323
+ return response
324
+ end
325
+ rescue ::GRPC::BadStatus => e
326
+ raise ::Google::Cloud::Error.from_error(e)
327
+ end
328
+
329
+ ##
330
+ # Delete a content.
331
+ #
332
+ # @overload delete_content(request, options = nil)
333
+ # Pass arguments to `delete_content` via a request object, either of type
334
+ # {::Google::Cloud::Dataplex::V1::DeleteContentRequest} or an equivalent Hash.
335
+ #
336
+ # @param request [::Google::Cloud::Dataplex::V1::DeleteContentRequest, ::Hash]
337
+ # A request object representing the call parameters. Required. To specify no
338
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
339
+ # @param options [::Gapic::CallOptions, ::Hash]
340
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
341
+ #
342
+ # @overload delete_content(name: nil)
343
+ # Pass arguments to `delete_content` via keyword arguments. Note that at
344
+ # least one keyword argument is required. To specify no parameters, or to keep all
345
+ # the default parameter values, pass an empty Hash as a request object (see above).
346
+ #
347
+ # @param name [::String]
348
+ # Required. The resource name of the content:
349
+ # projects/\\{project_id}/locations/\\{location_id}/lakes/\\{lake_id}/content/\\{content_id}
350
+ #
351
+ # @yield [response, operation] Access the result along with the RPC operation
352
+ # @yieldparam response [::Google::Protobuf::Empty]
353
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
354
+ #
355
+ # @return [::Google::Protobuf::Empty]
356
+ #
357
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
358
+ #
359
+ # @example Basic example
360
+ # require "google/cloud/dataplex/v1"
361
+ #
362
+ # # Create a client object. The client can be reused for multiple calls.
363
+ # client = Google::Cloud::Dataplex::V1::ContentService::Client.new
364
+ #
365
+ # # Create a request. To set request fields, pass in keyword arguments.
366
+ # request = Google::Cloud::Dataplex::V1::DeleteContentRequest.new
367
+ #
368
+ # # Call the delete_content method.
369
+ # result = client.delete_content request
370
+ #
371
+ # # The returned object is of type Google::Protobuf::Empty.
372
+ # p result
373
+ #
374
+ def delete_content request, options = nil
375
+ raise ::ArgumentError, "request must be provided" if request.nil?
376
+
377
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataplex::V1::DeleteContentRequest
378
+
379
+ # Converts hash and nil to an options object
380
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
381
+
382
+ # Customize the options with defaults
383
+ metadata = @config.rpcs.delete_content.metadata.to_h
384
+
385
+ # Set x-goog-api-client and x-goog-user-project headers
386
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
387
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
388
+ gapic_version: ::Google::Cloud::Dataplex::V1::VERSION
389
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
390
+
391
+ header_params = {}
392
+ if request.name
393
+ header_params["name"] = request.name
394
+ end
395
+
396
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
397
+ metadata[:"x-goog-request-params"] ||= request_params_header
398
+
399
+ options.apply_defaults timeout: @config.rpcs.delete_content.timeout,
400
+ metadata: metadata,
401
+ retry_policy: @config.rpcs.delete_content.retry_policy
402
+
403
+ options.apply_defaults timeout: @config.timeout,
404
+ metadata: @config.metadata,
405
+ retry_policy: @config.retry_policy
406
+
407
+ @content_service_stub.call_rpc :delete_content, request, options: options do |response, operation|
408
+ yield response, operation if block_given?
409
+ return response
410
+ end
411
+ rescue ::GRPC::BadStatus => e
412
+ raise ::Google::Cloud::Error.from_error(e)
413
+ end
414
+
415
+ ##
416
+ # Get a content resource.
417
+ #
418
+ # @overload get_content(request, options = nil)
419
+ # Pass arguments to `get_content` via a request object, either of type
420
+ # {::Google::Cloud::Dataplex::V1::GetContentRequest} or an equivalent Hash.
421
+ #
422
+ # @param request [::Google::Cloud::Dataplex::V1::GetContentRequest, ::Hash]
423
+ # A request object representing the call parameters. Required. To specify no
424
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
425
+ # @param options [::Gapic::CallOptions, ::Hash]
426
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
427
+ #
428
+ # @overload get_content(name: nil, view: nil)
429
+ # Pass arguments to `get_content` via keyword arguments. Note that at
430
+ # least one keyword argument is required. To specify no parameters, or to keep all
431
+ # the default parameter values, pass an empty Hash as a request object (see above).
432
+ #
433
+ # @param name [::String]
434
+ # Required. The resource name of the content:
435
+ # projects/\\{project_id}/locations/\\{location_id}/lakes/\\{lake_id}/content/\\{content_id}
436
+ # @param view [::Google::Cloud::Dataplex::V1::GetContentRequest::ContentView]
437
+ # Optional. Specify content view to make a partial request.
438
+ #
439
+ # @yield [response, operation] Access the result along with the RPC operation
440
+ # @yieldparam response [::Google::Cloud::Dataplex::V1::Content]
441
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
442
+ #
443
+ # @return [::Google::Cloud::Dataplex::V1::Content]
444
+ #
445
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
446
+ #
447
+ # @example Basic example
448
+ # require "google/cloud/dataplex/v1"
449
+ #
450
+ # # Create a client object. The client can be reused for multiple calls.
451
+ # client = Google::Cloud::Dataplex::V1::ContentService::Client.new
452
+ #
453
+ # # Create a request. To set request fields, pass in keyword arguments.
454
+ # request = Google::Cloud::Dataplex::V1::GetContentRequest.new
455
+ #
456
+ # # Call the get_content method.
457
+ # result = client.get_content request
458
+ #
459
+ # # The returned object is of type Google::Cloud::Dataplex::V1::Content.
460
+ # p result
461
+ #
462
+ def get_content request, options = nil
463
+ raise ::ArgumentError, "request must be provided" if request.nil?
464
+
465
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataplex::V1::GetContentRequest
466
+
467
+ # Converts hash and nil to an options object
468
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
469
+
470
+ # Customize the options with defaults
471
+ metadata = @config.rpcs.get_content.metadata.to_h
472
+
473
+ # Set x-goog-api-client and x-goog-user-project headers
474
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
476
+ gapic_version: ::Google::Cloud::Dataplex::V1::VERSION
477
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
478
+
479
+ header_params = {}
480
+ if request.name
481
+ header_params["name"] = request.name
482
+ end
483
+
484
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
485
+ metadata[:"x-goog-request-params"] ||= request_params_header
486
+
487
+ options.apply_defaults timeout: @config.rpcs.get_content.timeout,
488
+ metadata: metadata,
489
+ retry_policy: @config.rpcs.get_content.retry_policy
490
+
491
+ options.apply_defaults timeout: @config.timeout,
492
+ metadata: @config.metadata,
493
+ retry_policy: @config.retry_policy
494
+
495
+ @content_service_stub.call_rpc :get_content, request, options: options do |response, operation|
496
+ yield response, operation if block_given?
497
+ return response
498
+ end
499
+ rescue ::GRPC::BadStatus => e
500
+ raise ::Google::Cloud::Error.from_error(e)
501
+ end
502
+
503
+ ##
504
+ # List content.
505
+ #
506
+ # @overload list_content(request, options = nil)
507
+ # Pass arguments to `list_content` via a request object, either of type
508
+ # {::Google::Cloud::Dataplex::V1::ListContentRequest} or an equivalent Hash.
509
+ #
510
+ # @param request [::Google::Cloud::Dataplex::V1::ListContentRequest, ::Hash]
511
+ # A request object representing the call parameters. Required. To specify no
512
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
513
+ # @param options [::Gapic::CallOptions, ::Hash]
514
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
515
+ #
516
+ # @overload list_content(parent: nil, page_size: nil, page_token: nil, filter: nil)
517
+ # Pass arguments to `list_content` via keyword arguments. Note that at
518
+ # least one keyword argument is required. To specify no parameters, or to keep all
519
+ # the default parameter values, pass an empty Hash as a request object (see above).
520
+ #
521
+ # @param parent [::String]
522
+ # Required. The resource name of the parent lake:
523
+ # projects/\\{project_id}/locations/\\{location_id}/lakes/\\{lake_id}
524
+ # @param page_size [::Integer]
525
+ # Optional. Maximum number of content to return. The service may return fewer than
526
+ # this value. If unspecified, at most 10 content will be returned. The
527
+ # maximum value is 1000; values above 1000 will be coerced to 1000.
528
+ # @param page_token [::String]
529
+ # Optional. Page token received from a previous `ListContent` call. Provide this
530
+ # to retrieve the subsequent page. When paginating, all other parameters
531
+ # provided to `ListContent` must match the call that provided the page
532
+ # token.
533
+ # @param filter [::String]
534
+ # Optional. Filter request. Filters are case-sensitive.
535
+ # The following formats are supported:
536
+ #
537
+ # labels.key1 = "value1"
538
+ # labels:key1
539
+ # type = "NOTEBOOK"
540
+ # type = "SQL_SCRIPT"
541
+ #
542
+ # These restrictions can be coinjoined with AND, OR and NOT conjunctions.
543
+ #
544
+ # @yield [response, operation] Access the result along with the RPC operation
545
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dataplex::V1::Content>]
546
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
547
+ #
548
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dataplex::V1::Content>]
549
+ #
550
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
551
+ #
552
+ # @example Basic example
553
+ # require "google/cloud/dataplex/v1"
554
+ #
555
+ # # Create a client object. The client can be reused for multiple calls.
556
+ # client = Google::Cloud::Dataplex::V1::ContentService::Client.new
557
+ #
558
+ # # Create a request. To set request fields, pass in keyword arguments.
559
+ # request = Google::Cloud::Dataplex::V1::ListContentRequest.new
560
+ #
561
+ # # Call the list_content method.
562
+ # result = client.list_content request
563
+ #
564
+ # # The returned object is of type Gapic::PagedEnumerable. You can
565
+ # # iterate over all elements by calling #each, and the enumerable
566
+ # # will lazily make API calls to fetch subsequent pages. Other
567
+ # # methods are also available for managing paging directly.
568
+ # result.each do |response|
569
+ # # Each element is of type ::Google::Cloud::Dataplex::V1::Content.
570
+ # p response
571
+ # end
572
+ #
573
+ def list_content request, options = nil
574
+ raise ::ArgumentError, "request must be provided" if request.nil?
575
+
576
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataplex::V1::ListContentRequest
577
+
578
+ # Converts hash and nil to an options object
579
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
580
+
581
+ # Customize the options with defaults
582
+ metadata = @config.rpcs.list_content.metadata.to_h
583
+
584
+ # Set x-goog-api-client and x-goog-user-project headers
585
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
586
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
587
+ gapic_version: ::Google::Cloud::Dataplex::V1::VERSION
588
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
589
+
590
+ header_params = {}
591
+ if request.parent
592
+ header_params["parent"] = request.parent
593
+ end
594
+
595
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
596
+ metadata[:"x-goog-request-params"] ||= request_params_header
597
+
598
+ options.apply_defaults timeout: @config.rpcs.list_content.timeout,
599
+ metadata: metadata,
600
+ retry_policy: @config.rpcs.list_content.retry_policy
601
+
602
+ options.apply_defaults timeout: @config.timeout,
603
+ metadata: @config.metadata,
604
+ retry_policy: @config.retry_policy
605
+
606
+ @content_service_stub.call_rpc :list_content, request, options: options do |response, operation|
607
+ response = ::Gapic::PagedEnumerable.new @content_service_stub, :list_content, request, response, operation, options
608
+ yield response, operation if block_given?
609
+ return response
610
+ end
611
+ rescue ::GRPC::BadStatus => e
612
+ raise ::Google::Cloud::Error.from_error(e)
613
+ end
614
+
615
+ ##
616
+ # Configuration class for the ContentService API.
617
+ #
618
+ # This class represents the configuration for ContentService,
619
+ # providing control over timeouts, retry behavior, logging, transport
620
+ # parameters, and other low-level controls. Certain parameters can also be
621
+ # applied individually to specific RPCs. See
622
+ # {::Google::Cloud::Dataplex::V1::ContentService::Client::Configuration::Rpcs}
623
+ # for a list of RPCs that can be configured independently.
624
+ #
625
+ # Configuration can be applied globally to all clients, or to a single client
626
+ # on construction.
627
+ #
628
+ # @example
629
+ #
630
+ # # Modify the global config, setting the timeout for
631
+ # # create_content to 20 seconds,
632
+ # # and all remaining timeouts to 10 seconds.
633
+ # ::Google::Cloud::Dataplex::V1::ContentService::Client.configure do |config|
634
+ # config.timeout = 10.0
635
+ # config.rpcs.create_content.timeout = 20.0
636
+ # end
637
+ #
638
+ # # Apply the above configuration only to a new client.
639
+ # client = ::Google::Cloud::Dataplex::V1::ContentService::Client.new do |config|
640
+ # config.timeout = 10.0
641
+ # config.rpcs.create_content.timeout = 20.0
642
+ # end
643
+ #
644
+ # @!attribute [rw] endpoint
645
+ # The hostname or hostname:port of the service endpoint.
646
+ # Defaults to `"dataplex.googleapis.com"`.
647
+ # @return [::String]
648
+ # @!attribute [rw] credentials
649
+ # Credentials to send with calls. You may provide any of the following types:
650
+ # * (`String`) The path to a service account key file in JSON format
651
+ # * (`Hash`) A service account key as a Hash
652
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
653
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
654
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
655
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
656
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
657
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
658
+ # * (`nil`) indicating no credentials
659
+ # @return [::Object]
660
+ # @!attribute [rw] scope
661
+ # The OAuth scopes
662
+ # @return [::Array<::String>]
663
+ # @!attribute [rw] lib_name
664
+ # The library name as recorded in instrumentation and logging
665
+ # @return [::String]
666
+ # @!attribute [rw] lib_version
667
+ # The library version as recorded in instrumentation and logging
668
+ # @return [::String]
669
+ # @!attribute [rw] channel_args
670
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
671
+ # `GRPC::Core::Channel` object is provided as the credential.
672
+ # @return [::Hash]
673
+ # @!attribute [rw] interceptors
674
+ # An array of interceptors that are run before calls are executed.
675
+ # @return [::Array<::GRPC::ClientInterceptor>]
676
+ # @!attribute [rw] timeout
677
+ # The call timeout in seconds.
678
+ # @return [::Numeric]
679
+ # @!attribute [rw] metadata
680
+ # Additional gRPC headers to be sent with the call.
681
+ # @return [::Hash{::Symbol=>::String}]
682
+ # @!attribute [rw] retry_policy
683
+ # The retry policy. The value is a hash with the following keys:
684
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
685
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
686
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
687
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
688
+ # trigger a retry.
689
+ # @return [::Hash]
690
+ # @!attribute [rw] quota_project
691
+ # A separate project against which to charge quota.
692
+ # @return [::String]
693
+ #
694
+ class Configuration
695
+ extend ::Gapic::Config
696
+
697
+ config_attr :endpoint, "dataplex.googleapis.com", ::String
698
+ config_attr :credentials, nil do |value|
699
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
700
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
701
+ allowed.any? { |klass| klass === value }
702
+ end
703
+ config_attr :scope, nil, ::String, ::Array, nil
704
+ config_attr :lib_name, nil, ::String, nil
705
+ config_attr :lib_version, nil, ::String, nil
706
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
707
+ config_attr :interceptors, nil, ::Array, nil
708
+ config_attr :timeout, nil, ::Numeric, nil
709
+ config_attr :metadata, nil, ::Hash, nil
710
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
711
+ config_attr :quota_project, nil, ::String, nil
712
+
713
+ # @private
714
+ def initialize parent_config = nil
715
+ @parent_config = parent_config unless parent_config.nil?
716
+
717
+ yield self if block_given?
718
+ end
719
+
720
+ ##
721
+ # Configurations for individual RPCs
722
+ # @return [Rpcs]
723
+ #
724
+ def rpcs
725
+ @rpcs ||= begin
726
+ parent_rpcs = nil
727
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
728
+ Rpcs.new parent_rpcs
729
+ end
730
+ end
731
+
732
+ ##
733
+ # Configuration RPC class for the ContentService API.
734
+ #
735
+ # Includes fields providing the configuration for each RPC in this service.
736
+ # Each configuration object is of type `Gapic::Config::Method` and includes
737
+ # the following configuration fields:
738
+ #
739
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
740
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
741
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
742
+ # include the following keys:
743
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
744
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
745
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
746
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
747
+ # trigger a retry.
748
+ #
749
+ class Rpcs
750
+ ##
751
+ # RPC-specific configuration for `create_content`
752
+ # @return [::Gapic::Config::Method]
753
+ #
754
+ attr_reader :create_content
755
+ ##
756
+ # RPC-specific configuration for `update_content`
757
+ # @return [::Gapic::Config::Method]
758
+ #
759
+ attr_reader :update_content
760
+ ##
761
+ # RPC-specific configuration for `delete_content`
762
+ # @return [::Gapic::Config::Method]
763
+ #
764
+ attr_reader :delete_content
765
+ ##
766
+ # RPC-specific configuration for `get_content`
767
+ # @return [::Gapic::Config::Method]
768
+ #
769
+ attr_reader :get_content
770
+ ##
771
+ # RPC-specific configuration for `list_content`
772
+ # @return [::Gapic::Config::Method]
773
+ #
774
+ attr_reader :list_content
775
+
776
+ # @private
777
+ def initialize parent_rpcs = nil
778
+ create_content_config = parent_rpcs.create_content if parent_rpcs.respond_to? :create_content
779
+ @create_content = ::Gapic::Config::Method.new create_content_config
780
+ update_content_config = parent_rpcs.update_content if parent_rpcs.respond_to? :update_content
781
+ @update_content = ::Gapic::Config::Method.new update_content_config
782
+ delete_content_config = parent_rpcs.delete_content if parent_rpcs.respond_to? :delete_content
783
+ @delete_content = ::Gapic::Config::Method.new delete_content_config
784
+ get_content_config = parent_rpcs.get_content if parent_rpcs.respond_to? :get_content
785
+ @get_content = ::Gapic::Config::Method.new get_content_config
786
+ list_content_config = parent_rpcs.list_content if parent_rpcs.respond_to? :list_content
787
+ @list_content = ::Gapic::Config::Method.new list_content_config
788
+
789
+ yield self if block_given?
790
+ end
791
+ end
792
+ end
793
+ end
794
+ end
795
+ end
796
+ end
797
+ end
798
+ end