google-cloud-data_fusion-v1 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,821 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/datafusion/v1/datafusion_pb"
21
+ require "google/cloud/data_fusion/v1/data_fusion/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DataFusion
26
+ module V1
27
+ module DataFusion
28
+ module Rest
29
+ ##
30
+ # REST client for the DataFusion service.
31
+ #
32
+ # Service for creating and managing Data Fusion instances.
33
+ # Data Fusion enables ETL developers to build code-free, data integration
34
+ # pipelines via a point-and-click UI.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :data_fusion_stub
41
+
42
+ ##
43
+ # Configure the DataFusion Client class.
44
+ #
45
+ # See {::Google::Cloud::DataFusion::V1::DataFusion::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all DataFusion clients
51
+ # ::Google::Cloud::DataFusion::V1::DataFusion::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "DataFusion", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 60.0
72
+
73
+ default_config
74
+ end
75
+ yield @configure if block_given?
76
+ @configure
77
+ end
78
+
79
+ ##
80
+ # Configure the DataFusion Client instance.
81
+ #
82
+ # The configuration is set to the derived mode, meaning that values can be changed,
83
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
84
+ # should be made on {Client.configure}.
85
+ #
86
+ # See {::Google::Cloud::DataFusion::V1::DataFusion::Rest::Client::Configuration}
87
+ # for a description of the configuration fields.
88
+ #
89
+ # @yield [config] Configure the Client client.
90
+ # @yieldparam config [Client::Configuration]
91
+ #
92
+ # @return [Client::Configuration]
93
+ #
94
+ def configure
95
+ yield @config if block_given?
96
+ @config
97
+ end
98
+
99
+ ##
100
+ # Create a new DataFusion REST client object.
101
+ #
102
+ # @example
103
+ #
104
+ # # Create a client using the default configuration
105
+ # client = ::Google::Cloud::DataFusion::V1::DataFusion::Rest::Client.new
106
+ #
107
+ # # Create a client using a custom configuration
108
+ # client = ::Google::Cloud::DataFusion::V1::DataFusion::Rest::Client.new do |config|
109
+ # config.timeout = 10.0
110
+ # end
111
+ #
112
+ # @yield [config] Configure the DataFusion client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ def initialize
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
+
134
+ @quota_project_id = @config.quota_project
135
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
136
+
137
+ @operations_client = ::Google::Cloud::DataFusion::V1::DataFusion::Rest::Operations.new do |config|
138
+ config.credentials = credentials
139
+ config.quota_project = @quota_project_id
140
+ config.endpoint = @config.endpoint
141
+ end
142
+
143
+ @data_fusion_stub = ::Google::Cloud::DataFusion::V1::DataFusion::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
144
+ end
145
+
146
+ ##
147
+ # Get the associated client for long-running operations.
148
+ #
149
+ # @return [::Google::Cloud::DataFusion::V1::DataFusion::Rest::Operations]
150
+ #
151
+ attr_reader :operations_client
152
+
153
+ # Service calls
154
+
155
+ ##
156
+ # Lists possible versions for Data Fusion instances in the specified project
157
+ # and location.
158
+ #
159
+ # @overload list_available_versions(request, options = nil)
160
+ # Pass arguments to `list_available_versions` via a request object, either of type
161
+ # {::Google::Cloud::DataFusion::V1::ListAvailableVersionsRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Cloud::DataFusion::V1::ListAvailableVersionsRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
168
+ #
169
+ # @overload list_available_versions(parent: nil, page_size: nil, page_token: nil, latest_patch_only: nil)
170
+ # Pass arguments to `list_available_versions` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param parent [::String]
175
+ # Required. The project and location for which to retrieve instance information
176
+ # in the format projects/\\{project}/locations/\\{location}.
177
+ # @param page_size [::Integer]
178
+ # The maximum number of items to return.
179
+ # @param page_token [::String]
180
+ # The next_page_token value to use if there are additional
181
+ # results to retrieve for this list request.
182
+ # @param latest_patch_only [::Boolean]
183
+ # Whether or not to return the latest patch of every available minor version.
184
+ # If true, only the latest patch will be returned. Ex. if allowed versions is
185
+ # [6.1.1, 6.1.2, 6.2.0] then response will be [6.1.2, 6.2.0]
186
+ # @yield [result, operation] Access the result along with the TransportOperation object
187
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DataFusion::V1::Version>]
188
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
189
+ #
190
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DataFusion::V1::Version>]
191
+ #
192
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
193
+ def list_available_versions request, options = nil
194
+ raise ::ArgumentError, "request must be provided" if request.nil?
195
+
196
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataFusion::V1::ListAvailableVersionsRequest
197
+
198
+ # Converts hash and nil to an options object
199
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
200
+
201
+ # Customize the options with defaults
202
+ call_metadata = @config.rpcs.list_available_versions.metadata.to_h
203
+
204
+ # Set x-goog-api-client and x-goog-user-project headers
205
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
206
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
207
+ gapic_version: ::Google::Cloud::DataFusion::V1::VERSION,
208
+ transports_version_send: [:rest]
209
+
210
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
211
+
212
+ options.apply_defaults timeout: @config.rpcs.list_available_versions.timeout,
213
+ metadata: call_metadata,
214
+ retry_policy: @config.rpcs.list_available_versions.retry_policy
215
+
216
+ options.apply_defaults timeout: @config.timeout,
217
+ metadata: @config.metadata,
218
+ retry_policy: @config.retry_policy
219
+
220
+ @data_fusion_stub.list_available_versions request, options do |result, operation|
221
+ result = ::Gapic::Rest::PagedEnumerable.new @data_fusion_stub, :list_available_versions, "available_versions", request, result, options
222
+ yield result, operation if block_given?
223
+ return result
224
+ end
225
+ rescue ::Gapic::Rest::Error => e
226
+ raise ::Google::Cloud::Error.from_error(e)
227
+ end
228
+
229
+ ##
230
+ # Lists Data Fusion instances in the specified project and location.
231
+ #
232
+ # @overload list_instances(request, options = nil)
233
+ # Pass arguments to `list_instances` via a request object, either of type
234
+ # {::Google::Cloud::DataFusion::V1::ListInstancesRequest} or an equivalent Hash.
235
+ #
236
+ # @param request [::Google::Cloud::DataFusion::V1::ListInstancesRequest, ::Hash]
237
+ # A request object representing the call parameters. Required. To specify no
238
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
239
+ # @param options [::Gapic::CallOptions, ::Hash]
240
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
241
+ #
242
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
243
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
244
+ # least one keyword argument is required. To specify no parameters, or to keep all
245
+ # the default parameter values, pass an empty Hash as a request object (see above).
246
+ #
247
+ # @param parent [::String]
248
+ # Required. The project and location for which to retrieve instance information
249
+ # in the format projects/\\{project}/locations/\\{location}. If the location is
250
+ # specified as '-' (wildcard), then all regions available to the project
251
+ # are queried, and the results are aggregated.
252
+ # @param page_size [::Integer]
253
+ # The maximum number of items to return.
254
+ # @param page_token [::String]
255
+ # The next_page_token value to use if there are additional
256
+ # results to retrieve for this list request.
257
+ # @param filter [::String]
258
+ # List filter.
259
+ # @param order_by [::String]
260
+ # Sort results. Supported values are "name", "name desc", or "" (unsorted).
261
+ # @yield [result, operation] Access the result along with the TransportOperation object
262
+ # @yieldparam result [::Google::Cloud::DataFusion::V1::ListInstancesResponse]
263
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
264
+ #
265
+ # @return [::Google::Cloud::DataFusion::V1::ListInstancesResponse]
266
+ #
267
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
268
+ def list_instances request, options = nil
269
+ raise ::ArgumentError, "request must be provided" if request.nil?
270
+
271
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataFusion::V1::ListInstancesRequest
272
+
273
+ # Converts hash and nil to an options object
274
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
275
+
276
+ # Customize the options with defaults
277
+ call_metadata = @config.rpcs.list_instances.metadata.to_h
278
+
279
+ # Set x-goog-api-client and x-goog-user-project headers
280
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
281
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
282
+ gapic_version: ::Google::Cloud::DataFusion::V1::VERSION,
283
+ transports_version_send: [:rest]
284
+
285
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
286
+
287
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
288
+ metadata: call_metadata,
289
+ retry_policy: @config.rpcs.list_instances.retry_policy
290
+
291
+ options.apply_defaults timeout: @config.timeout,
292
+ metadata: @config.metadata,
293
+ retry_policy: @config.retry_policy
294
+
295
+ @data_fusion_stub.list_instances request, options do |result, operation|
296
+ yield result, operation if block_given?
297
+ return result
298
+ end
299
+ rescue ::Gapic::Rest::Error => e
300
+ raise ::Google::Cloud::Error.from_error(e)
301
+ end
302
+
303
+ ##
304
+ # Gets details of a single Data Fusion instance.
305
+ #
306
+ # @overload get_instance(request, options = nil)
307
+ # Pass arguments to `get_instance` via a request object, either of type
308
+ # {::Google::Cloud::DataFusion::V1::GetInstanceRequest} or an equivalent Hash.
309
+ #
310
+ # @param request [::Google::Cloud::DataFusion::V1::GetInstanceRequest, ::Hash]
311
+ # A request object representing the call parameters. Required. To specify no
312
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
313
+ # @param options [::Gapic::CallOptions, ::Hash]
314
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
315
+ #
316
+ # @overload get_instance(name: nil)
317
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
318
+ # least one keyword argument is required. To specify no parameters, or to keep all
319
+ # the default parameter values, pass an empty Hash as a request object (see above).
320
+ #
321
+ # @param name [::String]
322
+ # Required. The instance resource name in the format
323
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}.
324
+ # @yield [result, operation] Access the result along with the TransportOperation object
325
+ # @yieldparam result [::Google::Cloud::DataFusion::V1::Instance]
326
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
327
+ #
328
+ # @return [::Google::Cloud::DataFusion::V1::Instance]
329
+ #
330
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
331
+ def get_instance request, options = nil
332
+ raise ::ArgumentError, "request must be provided" if request.nil?
333
+
334
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataFusion::V1::GetInstanceRequest
335
+
336
+ # Converts hash and nil to an options object
337
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
338
+
339
+ # Customize the options with defaults
340
+ call_metadata = @config.rpcs.get_instance.metadata.to_h
341
+
342
+ # Set x-goog-api-client and x-goog-user-project headers
343
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
344
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
345
+ gapic_version: ::Google::Cloud::DataFusion::V1::VERSION,
346
+ transports_version_send: [:rest]
347
+
348
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
349
+
350
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
351
+ metadata: call_metadata,
352
+ retry_policy: @config.rpcs.get_instance.retry_policy
353
+
354
+ options.apply_defaults timeout: @config.timeout,
355
+ metadata: @config.metadata,
356
+ retry_policy: @config.retry_policy
357
+
358
+ @data_fusion_stub.get_instance request, options do |result, operation|
359
+ yield result, operation if block_given?
360
+ return result
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Creates a new Data Fusion instance in the specified project and location.
368
+ #
369
+ # @overload create_instance(request, options = nil)
370
+ # Pass arguments to `create_instance` via a request object, either of type
371
+ # {::Google::Cloud::DataFusion::V1::CreateInstanceRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::DataFusion::V1::CreateInstanceRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
378
+ #
379
+ # @overload create_instance(parent: nil, instance_id: nil, instance: nil)
380
+ # Pass arguments to `create_instance` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param parent [::String]
385
+ # Required. The instance's project and location in the format
386
+ # projects/\\{project}/locations/\\{location}.
387
+ # @param instance_id [::String]
388
+ # Required. The name of the instance to create.
389
+ # @param instance [::Google::Cloud::DataFusion::V1::Instance, ::Hash]
390
+ # An instance resource.
391
+ # @yield [result, operation] Access the result along with the TransportOperation object
392
+ # @yieldparam result [::Gapic::Operation]
393
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
394
+ #
395
+ # @return [::Gapic::Operation]
396
+ #
397
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
398
+ def create_instance request, options = nil
399
+ raise ::ArgumentError, "request must be provided" if request.nil?
400
+
401
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataFusion::V1::CreateInstanceRequest
402
+
403
+ # Converts hash and nil to an options object
404
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
405
+
406
+ # Customize the options with defaults
407
+ call_metadata = @config.rpcs.create_instance.metadata.to_h
408
+
409
+ # Set x-goog-api-client and x-goog-user-project headers
410
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
411
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
412
+ gapic_version: ::Google::Cloud::DataFusion::V1::VERSION,
413
+ transports_version_send: [:rest]
414
+
415
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
416
+
417
+ options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
418
+ metadata: call_metadata,
419
+ retry_policy: @config.rpcs.create_instance.retry_policy
420
+
421
+ options.apply_defaults timeout: @config.timeout,
422
+ metadata: @config.metadata,
423
+ retry_policy: @config.retry_policy
424
+
425
+ @data_fusion_stub.create_instance request, options do |result, operation|
426
+ result = ::Gapic::Operation.new result, @operations_client, options: options
427
+ yield result, operation if block_given?
428
+ return result
429
+ end
430
+ rescue ::Gapic::Rest::Error => e
431
+ raise ::Google::Cloud::Error.from_error(e)
432
+ end
433
+
434
+ ##
435
+ # Deletes a single Date Fusion instance.
436
+ #
437
+ # @overload delete_instance(request, options = nil)
438
+ # Pass arguments to `delete_instance` via a request object, either of type
439
+ # {::Google::Cloud::DataFusion::V1::DeleteInstanceRequest} or an equivalent Hash.
440
+ #
441
+ # @param request [::Google::Cloud::DataFusion::V1::DeleteInstanceRequest, ::Hash]
442
+ # A request object representing the call parameters. Required. To specify no
443
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
444
+ # @param options [::Gapic::CallOptions, ::Hash]
445
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
446
+ #
447
+ # @overload delete_instance(name: nil)
448
+ # Pass arguments to `delete_instance` via keyword arguments. Note that at
449
+ # least one keyword argument is required. To specify no parameters, or to keep all
450
+ # the default parameter values, pass an empty Hash as a request object (see above).
451
+ #
452
+ # @param name [::String]
453
+ # Required. The instance resource name in the format
454
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}
455
+ # @yield [result, operation] Access the result along with the TransportOperation object
456
+ # @yieldparam result [::Gapic::Operation]
457
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
458
+ #
459
+ # @return [::Gapic::Operation]
460
+ #
461
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
462
+ def delete_instance request, options = nil
463
+ raise ::ArgumentError, "request must be provided" if request.nil?
464
+
465
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataFusion::V1::DeleteInstanceRequest
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
+ call_metadata = @config.rpcs.delete_instance.metadata.to_h
472
+
473
+ # Set x-goog-api-client and x-goog-user-project headers
474
+ call_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::DataFusion::V1::VERSION,
477
+ transports_version_send: [:rest]
478
+
479
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
480
+
481
+ options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
482
+ metadata: call_metadata,
483
+ retry_policy: @config.rpcs.delete_instance.retry_policy
484
+
485
+ options.apply_defaults timeout: @config.timeout,
486
+ metadata: @config.metadata,
487
+ retry_policy: @config.retry_policy
488
+
489
+ @data_fusion_stub.delete_instance request, options do |result, operation|
490
+ result = ::Gapic::Operation.new result, @operations_client, options: options
491
+ yield result, operation if block_given?
492
+ return result
493
+ end
494
+ rescue ::Gapic::Rest::Error => e
495
+ raise ::Google::Cloud::Error.from_error(e)
496
+ end
497
+
498
+ ##
499
+ # Updates a single Data Fusion instance.
500
+ #
501
+ # @overload update_instance(request, options = nil)
502
+ # Pass arguments to `update_instance` via a request object, either of type
503
+ # {::Google::Cloud::DataFusion::V1::UpdateInstanceRequest} or an equivalent Hash.
504
+ #
505
+ # @param request [::Google::Cloud::DataFusion::V1::UpdateInstanceRequest, ::Hash]
506
+ # A request object representing the call parameters. Required. To specify no
507
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
508
+ # @param options [::Gapic::CallOptions, ::Hash]
509
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
510
+ #
511
+ # @overload update_instance(instance: nil, update_mask: nil)
512
+ # Pass arguments to `update_instance` via keyword arguments. Note that at
513
+ # least one keyword argument is required. To specify no parameters, or to keep all
514
+ # the default parameter values, pass an empty Hash as a request object (see above).
515
+ #
516
+ # @param instance [::Google::Cloud::DataFusion::V1::Instance, ::Hash]
517
+ # Required. The instance resource that replaces the resource on the server. Currently,
518
+ # Data Fusion only allows replacing labels, options, and stack driver
519
+ # settings. All other fields will be ignored.
520
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
521
+ # Field mask is used to specify the fields that the update will overwrite
522
+ # in an instance resource. The fields specified in the update_mask are
523
+ # relative to the resource, not the full request.
524
+ # A field will be overwritten if it is in the mask.
525
+ # If the user does not provide a mask, all the supported fields (labels,
526
+ # options, and version currently) will be overwritten.
527
+ # @yield [result, operation] Access the result along with the TransportOperation object
528
+ # @yieldparam result [::Gapic::Operation]
529
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
530
+ #
531
+ # @return [::Gapic::Operation]
532
+ #
533
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
534
+ def update_instance request, options = nil
535
+ raise ::ArgumentError, "request must be provided" if request.nil?
536
+
537
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataFusion::V1::UpdateInstanceRequest
538
+
539
+ # Converts hash and nil to an options object
540
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
541
+
542
+ # Customize the options with defaults
543
+ call_metadata = @config.rpcs.update_instance.metadata.to_h
544
+
545
+ # Set x-goog-api-client and x-goog-user-project headers
546
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
547
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
548
+ gapic_version: ::Google::Cloud::DataFusion::V1::VERSION,
549
+ transports_version_send: [:rest]
550
+
551
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
552
+
553
+ options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
554
+ metadata: call_metadata,
555
+ retry_policy: @config.rpcs.update_instance.retry_policy
556
+
557
+ options.apply_defaults timeout: @config.timeout,
558
+ metadata: @config.metadata,
559
+ retry_policy: @config.retry_policy
560
+
561
+ @data_fusion_stub.update_instance request, options do |result, operation|
562
+ result = ::Gapic::Operation.new result, @operations_client, options: options
563
+ yield result, operation if block_given?
564
+ return result
565
+ end
566
+ rescue ::Gapic::Rest::Error => e
567
+ raise ::Google::Cloud::Error.from_error(e)
568
+ end
569
+
570
+ ##
571
+ # Restart a single Data Fusion instance.
572
+ # At the end of an operation instance is fully restarted.
573
+ #
574
+ # @overload restart_instance(request, options = nil)
575
+ # Pass arguments to `restart_instance` via a request object, either of type
576
+ # {::Google::Cloud::DataFusion::V1::RestartInstanceRequest} or an equivalent Hash.
577
+ #
578
+ # @param request [::Google::Cloud::DataFusion::V1::RestartInstanceRequest, ::Hash]
579
+ # A request object representing the call parameters. Required. To specify no
580
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
581
+ # @param options [::Gapic::CallOptions, ::Hash]
582
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
583
+ #
584
+ # @overload restart_instance(name: nil)
585
+ # Pass arguments to `restart_instance` via keyword arguments. Note that at
586
+ # least one keyword argument is required. To specify no parameters, or to keep all
587
+ # the default parameter values, pass an empty Hash as a request object (see above).
588
+ #
589
+ # @param name [::String]
590
+ # Required. Name of the Data Fusion instance which need to be restarted in the form of
591
+ # projects/\\{project}/locations/\\{location}/instances/\\{instance}
592
+ # @yield [result, operation] Access the result along with the TransportOperation object
593
+ # @yieldparam result [::Gapic::Operation]
594
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
595
+ #
596
+ # @return [::Gapic::Operation]
597
+ #
598
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
599
+ def restart_instance request, options = nil
600
+ raise ::ArgumentError, "request must be provided" if request.nil?
601
+
602
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataFusion::V1::RestartInstanceRequest
603
+
604
+ # Converts hash and nil to an options object
605
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
606
+
607
+ # Customize the options with defaults
608
+ call_metadata = @config.rpcs.restart_instance.metadata.to_h
609
+
610
+ # Set x-goog-api-client and x-goog-user-project headers
611
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
612
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
613
+ gapic_version: ::Google::Cloud::DataFusion::V1::VERSION,
614
+ transports_version_send: [:rest]
615
+
616
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
617
+
618
+ options.apply_defaults timeout: @config.rpcs.restart_instance.timeout,
619
+ metadata: call_metadata,
620
+ retry_policy: @config.rpcs.restart_instance.retry_policy
621
+
622
+ options.apply_defaults timeout: @config.timeout,
623
+ metadata: @config.metadata,
624
+ retry_policy: @config.retry_policy
625
+
626
+ @data_fusion_stub.restart_instance request, options do |result, operation|
627
+ result = ::Gapic::Operation.new result, @operations_client, options: options
628
+ yield result, operation if block_given?
629
+ return result
630
+ end
631
+ rescue ::Gapic::Rest::Error => e
632
+ raise ::Google::Cloud::Error.from_error(e)
633
+ end
634
+
635
+ ##
636
+ # Configuration class for the DataFusion REST API.
637
+ #
638
+ # This class represents the configuration for DataFusion REST,
639
+ # providing control over timeouts, retry behavior, logging, transport
640
+ # parameters, and other low-level controls. Certain parameters can also be
641
+ # applied individually to specific RPCs. See
642
+ # {::Google::Cloud::DataFusion::V1::DataFusion::Rest::Client::Configuration::Rpcs}
643
+ # for a list of RPCs that can be configured independently.
644
+ #
645
+ # Configuration can be applied globally to all clients, or to a single client
646
+ # on construction.
647
+ #
648
+ # @example
649
+ #
650
+ # # Modify the global config, setting the timeout for
651
+ # # list_available_versions to 20 seconds,
652
+ # # and all remaining timeouts to 10 seconds.
653
+ # ::Google::Cloud::DataFusion::V1::DataFusion::Rest::Client.configure do |config|
654
+ # config.timeout = 10.0
655
+ # config.rpcs.list_available_versions.timeout = 20.0
656
+ # end
657
+ #
658
+ # # Apply the above configuration only to a new client.
659
+ # client = ::Google::Cloud::DataFusion::V1::DataFusion::Rest::Client.new do |config|
660
+ # config.timeout = 10.0
661
+ # config.rpcs.list_available_versions.timeout = 20.0
662
+ # end
663
+ #
664
+ # @!attribute [rw] endpoint
665
+ # The hostname or hostname:port of the service endpoint.
666
+ # Defaults to `"datafusion.googleapis.com"`.
667
+ # @return [::String]
668
+ # @!attribute [rw] credentials
669
+ # Credentials to send with calls. You may provide any of the following types:
670
+ # * (`String`) The path to a service account key file in JSON format
671
+ # * (`Hash`) A service account key as a Hash
672
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
673
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
674
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
675
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
676
+ # * (`nil`) indicating no credentials
677
+ # @return [::Object]
678
+ # @!attribute [rw] scope
679
+ # The OAuth scopes
680
+ # @return [::Array<::String>]
681
+ # @!attribute [rw] lib_name
682
+ # The library name as recorded in instrumentation and logging
683
+ # @return [::String]
684
+ # @!attribute [rw] lib_version
685
+ # The library version as recorded in instrumentation and logging
686
+ # @return [::String]
687
+ # @!attribute [rw] timeout
688
+ # The call timeout in seconds.
689
+ # @return [::Numeric]
690
+ # @!attribute [rw] metadata
691
+ # Additional headers to be sent with the call.
692
+ # @return [::Hash{::Symbol=>::String}]
693
+ # @!attribute [rw] retry_policy
694
+ # The retry policy. The value is a hash with the following keys:
695
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
696
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
697
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
698
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
699
+ # trigger a retry.
700
+ # @return [::Hash]
701
+ # @!attribute [rw] quota_project
702
+ # A separate project against which to charge quota.
703
+ # @return [::String]
704
+ #
705
+ class Configuration
706
+ extend ::Gapic::Config
707
+
708
+ config_attr :endpoint, "datafusion.googleapis.com", ::String
709
+ config_attr :credentials, nil do |value|
710
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
711
+ allowed.any? { |klass| klass === value }
712
+ end
713
+ config_attr :scope, nil, ::String, ::Array, nil
714
+ config_attr :lib_name, nil, ::String, nil
715
+ config_attr :lib_version, nil, ::String, nil
716
+ config_attr :timeout, nil, ::Numeric, nil
717
+ config_attr :metadata, nil, ::Hash, nil
718
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
719
+ config_attr :quota_project, nil, ::String, nil
720
+
721
+ # @private
722
+ def initialize parent_config = nil
723
+ @parent_config = parent_config unless parent_config.nil?
724
+
725
+ yield self if block_given?
726
+ end
727
+
728
+ ##
729
+ # Configurations for individual RPCs
730
+ # @return [Rpcs]
731
+ #
732
+ def rpcs
733
+ @rpcs ||= begin
734
+ parent_rpcs = nil
735
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
736
+ Rpcs.new parent_rpcs
737
+ end
738
+ end
739
+
740
+ ##
741
+ # Configuration RPC class for the DataFusion API.
742
+ #
743
+ # Includes fields providing the configuration for each RPC in this service.
744
+ # Each configuration object is of type `Gapic::Config::Method` and includes
745
+ # the following configuration fields:
746
+ #
747
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
748
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
749
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
750
+ # include the following keys:
751
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
752
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
753
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
754
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
755
+ # trigger a retry.
756
+ #
757
+ class Rpcs
758
+ ##
759
+ # RPC-specific configuration for `list_available_versions`
760
+ # @return [::Gapic::Config::Method]
761
+ #
762
+ attr_reader :list_available_versions
763
+ ##
764
+ # RPC-specific configuration for `list_instances`
765
+ # @return [::Gapic::Config::Method]
766
+ #
767
+ attr_reader :list_instances
768
+ ##
769
+ # RPC-specific configuration for `get_instance`
770
+ # @return [::Gapic::Config::Method]
771
+ #
772
+ attr_reader :get_instance
773
+ ##
774
+ # RPC-specific configuration for `create_instance`
775
+ # @return [::Gapic::Config::Method]
776
+ #
777
+ attr_reader :create_instance
778
+ ##
779
+ # RPC-specific configuration for `delete_instance`
780
+ # @return [::Gapic::Config::Method]
781
+ #
782
+ attr_reader :delete_instance
783
+ ##
784
+ # RPC-specific configuration for `update_instance`
785
+ # @return [::Gapic::Config::Method]
786
+ #
787
+ attr_reader :update_instance
788
+ ##
789
+ # RPC-specific configuration for `restart_instance`
790
+ # @return [::Gapic::Config::Method]
791
+ #
792
+ attr_reader :restart_instance
793
+
794
+ # @private
795
+ def initialize parent_rpcs = nil
796
+ list_available_versions_config = parent_rpcs.list_available_versions if parent_rpcs.respond_to? :list_available_versions
797
+ @list_available_versions = ::Gapic::Config::Method.new list_available_versions_config
798
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
799
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
800
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
801
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
802
+ create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
803
+ @create_instance = ::Gapic::Config::Method.new create_instance_config
804
+ delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
805
+ @delete_instance = ::Gapic::Config::Method.new delete_instance_config
806
+ update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
807
+ @update_instance = ::Gapic::Config::Method.new update_instance_config
808
+ restart_instance_config = parent_rpcs.restart_instance if parent_rpcs.respond_to? :restart_instance
809
+ @restart_instance = ::Gapic::Config::Method.new restart_instance_config
810
+
811
+ yield self if block_given?
812
+ end
813
+ end
814
+ end
815
+ end
816
+ end
817
+ end
818
+ end
819
+ end
820
+ end
821
+ end