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