google-cloud-workflows-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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/workflows/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/workflows/v1/workflows"
20
+ require "google/cloud/workflows/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Workflows
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/workflows/v1"
29
+ # client = ::Google::Cloud::Workflows::V1::Workflows::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/workflows/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,28 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module Workflows
23
+ module V1
24
+ VERSION = "0.1.0"
25
+ end
26
+ end
27
+ end
28
+ end
@@ -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/workflows/v1/version"
24
+
25
+ require "google/cloud/workflows/v1/workflows/credentials"
26
+ require "google/cloud/workflows/v1/workflows/paths"
27
+ require "google/cloud/workflows/v1/workflows/operations"
28
+ require "google/cloud/workflows/v1/workflows/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Workflows
33
+ module V1
34
+ ##
35
+ # Workflows is used to deploy and execute workflow programs.
36
+ # Workflows makes sure the program executes reliably, despite hardware and
37
+ # networking interruptions.
38
+ #
39
+ # To load this service and instantiate a client:
40
+ #
41
+ # require "google/cloud/workflows/v1/workflows"
42
+ # client = ::Google::Cloud::Workflows::V1::Workflows::Client.new
43
+ #
44
+ module Workflows
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ helper_path = ::File.join __dir__, "workflows", "helpers.rb"
52
+ require "google/cloud/workflows/v1/workflows/helpers" if ::File.file? helper_path
@@ -0,0 +1,730 @@
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/workflows/v1/workflows_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Workflows
25
+ module V1
26
+ module Workflows
27
+ ##
28
+ # Client for the Workflows service.
29
+ #
30
+ # Workflows is used to deploy and execute workflow programs.
31
+ # Workflows makes sure the program executes reliably, despite hardware and
32
+ # networking interruptions.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :workflows_stub
39
+
40
+ ##
41
+ # Configure the Workflows Client class.
42
+ #
43
+ # See {::Google::Cloud::Workflows::V1::Workflows::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # ## Example
47
+ #
48
+ # To modify the configuration for all Workflows clients:
49
+ #
50
+ # ::Google::Cloud::Workflows::V1::Workflows::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", "Workflows", "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
71
+ end
72
+ yield @configure if block_given?
73
+ @configure
74
+ end
75
+
76
+ ##
77
+ # Configure the Workflows Client instance.
78
+ #
79
+ # The configuration is set to the derived mode, meaning that values can be changed,
80
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
81
+ # should be made on {Client.configure}.
82
+ #
83
+ # See {::Google::Cloud::Workflows::V1::Workflows::Client::Configuration}
84
+ # for a description of the configuration fields.
85
+ #
86
+ # @yield [config] Configure the Client client.
87
+ # @yieldparam config [Client::Configuration]
88
+ #
89
+ # @return [Client::Configuration]
90
+ #
91
+ def configure
92
+ yield @config if block_given?
93
+ @config
94
+ end
95
+
96
+ ##
97
+ # Create a new Workflows client object.
98
+ #
99
+ # ## Examples
100
+ #
101
+ # To create a new Workflows client with the default
102
+ # configuration:
103
+ #
104
+ # client = ::Google::Cloud::Workflows::V1::Workflows::Client.new
105
+ #
106
+ # To create a new Workflows client with a custom
107
+ # configuration:
108
+ #
109
+ # client = ::Google::Cloud::Workflows::V1::Workflows::Client.new do |config|
110
+ # config.timeout = 10.0
111
+ # end
112
+ #
113
+ # @yield [config] Configure the Workflows client.
114
+ # @yieldparam config [Client::Configuration]
115
+ #
116
+ def initialize
117
+ # These require statements are intentionally placed here to initialize
118
+ # the gRPC module only when it's required.
119
+ # See https://github.com/googleapis/toolkit/issues/446
120
+ require "gapic/grpc"
121
+ require "google/cloud/workflows/v1/workflows_services_pb"
122
+
123
+ # Create the configuration object
124
+ @config = Configuration.new Client.configure
125
+
126
+ # Yield the configuration if needed
127
+ yield @config if block_given?
128
+
129
+ # Create credentials
130
+ credentials = @config.credentials
131
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
132
+ # but only if the default endpoint does not have a region prefix.
133
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
134
+ @config.endpoint == Client.configure.endpoint &&
135
+ !@config.endpoint.split(".").first.include?("-")
136
+ credentials ||= Credentials.default scope: @config.scope,
137
+ enable_self_signed_jwt: enable_self_signed_jwt
138
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
139
+ credentials = Credentials.new credentials, scope: @config.scope
140
+ end
141
+ @quota_project_id = @config.quota_project
142
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
143
+
144
+ @operations_client = Operations.new do |config|
145
+ config.credentials = credentials
146
+ config.endpoint = @config.endpoint
147
+ end
148
+
149
+ @workflows_stub = ::Gapic::ServiceStub.new(
150
+ ::Google::Cloud::Workflows::V1::Workflows::Stub,
151
+ credentials: credentials,
152
+ endpoint: @config.endpoint,
153
+ channel_args: @config.channel_args,
154
+ interceptors: @config.interceptors
155
+ )
156
+ end
157
+
158
+ ##
159
+ # Get the associated client for long-running operations.
160
+ #
161
+ # @return [::Google::Cloud::Workflows::V1::Workflows::Operations]
162
+ #
163
+ attr_reader :operations_client
164
+
165
+ # Service calls
166
+
167
+ ##
168
+ # Lists Workflows in a given project and location.
169
+ # The default order is not specified.
170
+ #
171
+ # @overload list_workflows(request, options = nil)
172
+ # Pass arguments to `list_workflows` via a request object, either of type
173
+ # {::Google::Cloud::Workflows::V1::ListWorkflowsRequest} or an equivalent Hash.
174
+ #
175
+ # @param request [::Google::Cloud::Workflows::V1::ListWorkflowsRequest, ::Hash]
176
+ # A request object representing the call parameters. Required. To specify no
177
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
178
+ # @param options [::Gapic::CallOptions, ::Hash]
179
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
180
+ #
181
+ # @overload list_workflows(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
182
+ # Pass arguments to `list_workflows` via keyword arguments. Note that at
183
+ # least one keyword argument is required. To specify no parameters, or to keep all
184
+ # the default parameter values, pass an empty Hash as a request object (see above).
185
+ #
186
+ # @param parent [::String]
187
+ # Required. Project and location from which the workflows should be listed.
188
+ # Format: projects/\\{project}/locations/\\{location}
189
+ # @param page_size [::Integer]
190
+ # Maximum number of workflows to return per call. The service may return
191
+ # fewer than this value. If the value is not specified, a default value of
192
+ # 500 will be used. The maximum permitted value is 1000 and values greater
193
+ # than 1000 will be coerced down to 1000.
194
+ # @param page_token [::String]
195
+ # A page token, received from a previous `ListWorkflows` call.
196
+ # Provide this to retrieve the subsequent page.
197
+ #
198
+ # When paginating, all other parameters provided to `ListWorkflows` must
199
+ # match the call that provided the page token.
200
+ # @param filter [::String]
201
+ # Filter to restrict results to specific workflows.
202
+ # @param order_by [::String]
203
+ # Comma-separated list of fields that that specify the order of the results.
204
+ # Default sorting order for a field is ascending. To specify descending order
205
+ # for a field, append a " desc" suffix.
206
+ # If not specified, the results will be returned in an unspecified order.
207
+ #
208
+ # @yield [response, operation] Access the result along with the RPC operation
209
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Workflows::V1::Workflow>]
210
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
211
+ #
212
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Workflows::V1::Workflow>]
213
+ #
214
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
215
+ #
216
+ def list_workflows request, options = nil
217
+ raise ::ArgumentError, "request must be provided" if request.nil?
218
+
219
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::V1::ListWorkflowsRequest
220
+
221
+ # Converts hash and nil to an options object
222
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
223
+
224
+ # Customize the options with defaults
225
+ metadata = @config.rpcs.list_workflows.metadata.to_h
226
+
227
+ # Set x-goog-api-client and x-goog-user-project headers
228
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
229
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
230
+ gapic_version: ::Google::Cloud::Workflows::V1::VERSION
231
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
232
+
233
+ header_params = {
234
+ "parent" => request.parent
235
+ }
236
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
237
+ metadata[:"x-goog-request-params"] ||= request_params_header
238
+
239
+ options.apply_defaults timeout: @config.rpcs.list_workflows.timeout,
240
+ metadata: metadata,
241
+ retry_policy: @config.rpcs.list_workflows.retry_policy
242
+ options.apply_defaults metadata: @config.metadata,
243
+ retry_policy: @config.retry_policy
244
+
245
+ @workflows_stub.call_rpc :list_workflows, request, options: options do |response, operation|
246
+ response = ::Gapic::PagedEnumerable.new @workflows_stub, :list_workflows, request, response, operation, options
247
+ yield response, operation if block_given?
248
+ return response
249
+ end
250
+ rescue ::GRPC::BadStatus => e
251
+ raise ::Google::Cloud::Error.from_error(e)
252
+ end
253
+
254
+ ##
255
+ # Gets details of a single Workflow.
256
+ #
257
+ # @overload get_workflow(request, options = nil)
258
+ # Pass arguments to `get_workflow` via a request object, either of type
259
+ # {::Google::Cloud::Workflows::V1::GetWorkflowRequest} or an equivalent Hash.
260
+ #
261
+ # @param request [::Google::Cloud::Workflows::V1::GetWorkflowRequest, ::Hash]
262
+ # A request object representing the call parameters. Required. To specify no
263
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
264
+ # @param options [::Gapic::CallOptions, ::Hash]
265
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
266
+ #
267
+ # @overload get_workflow(name: nil)
268
+ # Pass arguments to `get_workflow` via keyword arguments. Note that at
269
+ # least one keyword argument is required. To specify no parameters, or to keep all
270
+ # the default parameter values, pass an empty Hash as a request object (see above).
271
+ #
272
+ # @param name [::String]
273
+ # Required. Name of the workflow which information should be retrieved.
274
+ # Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
275
+ #
276
+ # @yield [response, operation] Access the result along with the RPC operation
277
+ # @yieldparam response [::Google::Cloud::Workflows::V1::Workflow]
278
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
279
+ #
280
+ # @return [::Google::Cloud::Workflows::V1::Workflow]
281
+ #
282
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
283
+ #
284
+ def get_workflow request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::V1::GetWorkflowRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ metadata = @config.rpcs.get_workflow.metadata.to_h
294
+
295
+ # Set x-goog-api-client and x-goog-user-project headers
296
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::Workflows::V1::VERSION
299
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
300
+
301
+ header_params = {
302
+ "name" => request.name
303
+ }
304
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
305
+ metadata[:"x-goog-request-params"] ||= request_params_header
306
+
307
+ options.apply_defaults timeout: @config.rpcs.get_workflow.timeout,
308
+ metadata: metadata,
309
+ retry_policy: @config.rpcs.get_workflow.retry_policy
310
+ options.apply_defaults metadata: @config.metadata,
311
+ retry_policy: @config.retry_policy
312
+
313
+ @workflows_stub.call_rpc :get_workflow, request, options: options do |response, operation|
314
+ yield response, operation if block_given?
315
+ return response
316
+ end
317
+ rescue ::GRPC::BadStatus => e
318
+ raise ::Google::Cloud::Error.from_error(e)
319
+ end
320
+
321
+ ##
322
+ # Creates a new workflow. If a workflow with the specified name already
323
+ # exists in the specified project and location, the long running operation
324
+ # will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
325
+ #
326
+ # @overload create_workflow(request, options = nil)
327
+ # Pass arguments to `create_workflow` via a request object, either of type
328
+ # {::Google::Cloud::Workflows::V1::CreateWorkflowRequest} or an equivalent Hash.
329
+ #
330
+ # @param request [::Google::Cloud::Workflows::V1::CreateWorkflowRequest, ::Hash]
331
+ # A request object representing the call parameters. Required. To specify no
332
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
333
+ # @param options [::Gapic::CallOptions, ::Hash]
334
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
335
+ #
336
+ # @overload create_workflow(parent: nil, workflow: nil, workflow_id: nil)
337
+ # Pass arguments to `create_workflow` via keyword arguments. Note that at
338
+ # least one keyword argument is required. To specify no parameters, or to keep all
339
+ # the default parameter values, pass an empty Hash as a request object (see above).
340
+ #
341
+ # @param parent [::String]
342
+ # Required. Project and location in which the workflow should be created.
343
+ # Format: projects/\\{project}/locations/\\{location}
344
+ # @param workflow [::Google::Cloud::Workflows::V1::Workflow, ::Hash]
345
+ # Required. Workflow to be created.
346
+ # @param workflow_id [::String]
347
+ # Required. The ID of the workflow to be created. It has to fulfill the
348
+ # following requirements:
349
+ #
350
+ # * Must contain only letters, numbers, underscores and hyphens.
351
+ # * Must start with a letter.
352
+ # * Must be between 1-64 characters.
353
+ # * Must end with a number or a letter.
354
+ # * Must be unique within the customer project and location.
355
+ #
356
+ # @yield [response, operation] Access the result along with the RPC operation
357
+ # @yieldparam response [::Gapic::Operation]
358
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
359
+ #
360
+ # @return [::Gapic::Operation]
361
+ #
362
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
363
+ #
364
+ def create_workflow request, options = nil
365
+ raise ::ArgumentError, "request must be provided" if request.nil?
366
+
367
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::V1::CreateWorkflowRequest
368
+
369
+ # Converts hash and nil to an options object
370
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
371
+
372
+ # Customize the options with defaults
373
+ metadata = @config.rpcs.create_workflow.metadata.to_h
374
+
375
+ # Set x-goog-api-client and x-goog-user-project headers
376
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
377
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
378
+ gapic_version: ::Google::Cloud::Workflows::V1::VERSION
379
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
380
+
381
+ header_params = {
382
+ "parent" => request.parent
383
+ }
384
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
385
+ metadata[:"x-goog-request-params"] ||= request_params_header
386
+
387
+ options.apply_defaults timeout: @config.rpcs.create_workflow.timeout,
388
+ metadata: metadata,
389
+ retry_policy: @config.rpcs.create_workflow.retry_policy
390
+ options.apply_defaults metadata: @config.metadata,
391
+ retry_policy: @config.retry_policy
392
+
393
+ @workflows_stub.call_rpc :create_workflow, request, options: options do |response, operation|
394
+ response = ::Gapic::Operation.new response, @operations_client, options: options
395
+ yield response, operation if block_given?
396
+ return response
397
+ end
398
+ rescue ::GRPC::BadStatus => e
399
+ raise ::Google::Cloud::Error.from_error(e)
400
+ end
401
+
402
+ ##
403
+ # Deletes a workflow with the specified name.
404
+ # This method also cancels and deletes all running executions of the
405
+ # workflow.
406
+ #
407
+ # @overload delete_workflow(request, options = nil)
408
+ # Pass arguments to `delete_workflow` via a request object, either of type
409
+ # {::Google::Cloud::Workflows::V1::DeleteWorkflowRequest} or an equivalent Hash.
410
+ #
411
+ # @param request [::Google::Cloud::Workflows::V1::DeleteWorkflowRequest, ::Hash]
412
+ # A request object representing the call parameters. Required. To specify no
413
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
414
+ # @param options [::Gapic::CallOptions, ::Hash]
415
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
416
+ #
417
+ # @overload delete_workflow(name: nil)
418
+ # Pass arguments to `delete_workflow` via keyword arguments. Note that at
419
+ # least one keyword argument is required. To specify no parameters, or to keep all
420
+ # the default parameter values, pass an empty Hash as a request object (see above).
421
+ #
422
+ # @param name [::String]
423
+ # Required. Name of the workflow to be deleted.
424
+ # Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
425
+ #
426
+ # @yield [response, operation] Access the result along with the RPC operation
427
+ # @yieldparam response [::Gapic::Operation]
428
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
429
+ #
430
+ # @return [::Gapic::Operation]
431
+ #
432
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
433
+ #
434
+ def delete_workflow request, options = nil
435
+ raise ::ArgumentError, "request must be provided" if request.nil?
436
+
437
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::V1::DeleteWorkflowRequest
438
+
439
+ # Converts hash and nil to an options object
440
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
441
+
442
+ # Customize the options with defaults
443
+ metadata = @config.rpcs.delete_workflow.metadata.to_h
444
+
445
+ # Set x-goog-api-client and x-goog-user-project headers
446
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
447
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
448
+ gapic_version: ::Google::Cloud::Workflows::V1::VERSION
449
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
450
+
451
+ header_params = {
452
+ "name" => request.name
453
+ }
454
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
455
+ metadata[:"x-goog-request-params"] ||= request_params_header
456
+
457
+ options.apply_defaults timeout: @config.rpcs.delete_workflow.timeout,
458
+ metadata: metadata,
459
+ retry_policy: @config.rpcs.delete_workflow.retry_policy
460
+ options.apply_defaults metadata: @config.metadata,
461
+ retry_policy: @config.retry_policy
462
+
463
+ @workflows_stub.call_rpc :delete_workflow, request, options: options do |response, operation|
464
+ response = ::Gapic::Operation.new response, @operations_client, options: options
465
+ yield response, operation if block_given?
466
+ return response
467
+ end
468
+ rescue ::GRPC::BadStatus => e
469
+ raise ::Google::Cloud::Error.from_error(e)
470
+ end
471
+
472
+ ##
473
+ # Updates an existing workflow.
474
+ # Running this method has no impact on already running executions of the
475
+ # workflow. A new revision of the workflow may be created as a result of a
476
+ # successful update operation. In that case, such revision will be used
477
+ # in new workflow executions.
478
+ #
479
+ # @overload update_workflow(request, options = nil)
480
+ # Pass arguments to `update_workflow` via a request object, either of type
481
+ # {::Google::Cloud::Workflows::V1::UpdateWorkflowRequest} or an equivalent Hash.
482
+ #
483
+ # @param request [::Google::Cloud::Workflows::V1::UpdateWorkflowRequest, ::Hash]
484
+ # A request object representing the call parameters. Required. To specify no
485
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
486
+ # @param options [::Gapic::CallOptions, ::Hash]
487
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
488
+ #
489
+ # @overload update_workflow(workflow: nil, update_mask: nil)
490
+ # Pass arguments to `update_workflow` via keyword arguments. Note that at
491
+ # least one keyword argument is required. To specify no parameters, or to keep all
492
+ # the default parameter values, pass an empty Hash as a request object (see above).
493
+ #
494
+ # @param workflow [::Google::Cloud::Workflows::V1::Workflow, ::Hash]
495
+ # Required. Workflow to be updated.
496
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
497
+ # List of fields to be updated. If not present, the entire workflow
498
+ # will be updated.
499
+ #
500
+ # @yield [response, operation] Access the result along with the RPC operation
501
+ # @yieldparam response [::Gapic::Operation]
502
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
503
+ #
504
+ # @return [::Gapic::Operation]
505
+ #
506
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
507
+ #
508
+ def update_workflow request, options = nil
509
+ raise ::ArgumentError, "request must be provided" if request.nil?
510
+
511
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::V1::UpdateWorkflowRequest
512
+
513
+ # Converts hash and nil to an options object
514
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
515
+
516
+ # Customize the options with defaults
517
+ metadata = @config.rpcs.update_workflow.metadata.to_h
518
+
519
+ # Set x-goog-api-client and x-goog-user-project headers
520
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
521
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
522
+ gapic_version: ::Google::Cloud::Workflows::V1::VERSION
523
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
524
+
525
+ header_params = {
526
+ "workflow.name" => request.workflow.name
527
+ }
528
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
529
+ metadata[:"x-goog-request-params"] ||= request_params_header
530
+
531
+ options.apply_defaults timeout: @config.rpcs.update_workflow.timeout,
532
+ metadata: metadata,
533
+ retry_policy: @config.rpcs.update_workflow.retry_policy
534
+ options.apply_defaults metadata: @config.metadata,
535
+ retry_policy: @config.retry_policy
536
+
537
+ @workflows_stub.call_rpc :update_workflow, request, options: options do |response, operation|
538
+ response = ::Gapic::Operation.new response, @operations_client, options: options
539
+ yield response, operation if block_given?
540
+ return response
541
+ end
542
+ rescue ::GRPC::BadStatus => e
543
+ raise ::Google::Cloud::Error.from_error(e)
544
+ end
545
+
546
+ ##
547
+ # Configuration class for the Workflows API.
548
+ #
549
+ # This class represents the configuration for Workflows,
550
+ # providing control over timeouts, retry behavior, logging, transport
551
+ # parameters, and other low-level controls. Certain parameters can also be
552
+ # applied individually to specific RPCs. See
553
+ # {::Google::Cloud::Workflows::V1::Workflows::Client::Configuration::Rpcs}
554
+ # for a list of RPCs that can be configured independently.
555
+ #
556
+ # Configuration can be applied globally to all clients, or to a single client
557
+ # on construction.
558
+ #
559
+ # # Examples
560
+ #
561
+ # To modify the global config, setting the timeout for list_workflows
562
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
563
+ #
564
+ # ::Google::Cloud::Workflows::V1::Workflows::Client.configure do |config|
565
+ # config.timeout = 10.0
566
+ # config.rpcs.list_workflows.timeout = 20.0
567
+ # end
568
+ #
569
+ # To apply the above configuration only to a new client:
570
+ #
571
+ # client = ::Google::Cloud::Workflows::V1::Workflows::Client.new do |config|
572
+ # config.timeout = 10.0
573
+ # config.rpcs.list_workflows.timeout = 20.0
574
+ # end
575
+ #
576
+ # @!attribute [rw] endpoint
577
+ # The hostname or hostname:port of the service endpoint.
578
+ # Defaults to `"workflows.googleapis.com"`.
579
+ # @return [::String]
580
+ # @!attribute [rw] credentials
581
+ # Credentials to send with calls. You may provide any of the following types:
582
+ # * (`String`) The path to a service account key file in JSON format
583
+ # * (`Hash`) A service account key as a Hash
584
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
585
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
586
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
587
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
588
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
589
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
590
+ # * (`nil`) indicating no credentials
591
+ # @return [::Object]
592
+ # @!attribute [rw] scope
593
+ # The OAuth scopes
594
+ # @return [::Array<::String>]
595
+ # @!attribute [rw] lib_name
596
+ # The library name as recorded in instrumentation and logging
597
+ # @return [::String]
598
+ # @!attribute [rw] lib_version
599
+ # The library version as recorded in instrumentation and logging
600
+ # @return [::String]
601
+ # @!attribute [rw] channel_args
602
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
603
+ # `GRPC::Core::Channel` object is provided as the credential.
604
+ # @return [::Hash]
605
+ # @!attribute [rw] interceptors
606
+ # An array of interceptors that are run before calls are executed.
607
+ # @return [::Array<::GRPC::ClientInterceptor>]
608
+ # @!attribute [rw] timeout
609
+ # The call timeout in seconds.
610
+ # @return [::Numeric]
611
+ # @!attribute [rw] metadata
612
+ # Additional gRPC headers to be sent with the call.
613
+ # @return [::Hash{::Symbol=>::String}]
614
+ # @!attribute [rw] retry_policy
615
+ # The retry policy. The value is a hash with the following keys:
616
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
617
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
618
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
619
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
620
+ # trigger a retry.
621
+ # @return [::Hash]
622
+ # @!attribute [rw] quota_project
623
+ # A separate project against which to charge quota.
624
+ # @return [::String]
625
+ #
626
+ class Configuration
627
+ extend ::Gapic::Config
628
+
629
+ config_attr :endpoint, "workflows.googleapis.com", ::String
630
+ config_attr :credentials, nil do |value|
631
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
632
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
633
+ allowed.any? { |klass| klass === value }
634
+ end
635
+ config_attr :scope, nil, ::String, ::Array, nil
636
+ config_attr :lib_name, nil, ::String, nil
637
+ config_attr :lib_version, nil, ::String, nil
638
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
639
+ config_attr :interceptors, nil, ::Array, nil
640
+ config_attr :timeout, nil, ::Numeric, nil
641
+ config_attr :metadata, nil, ::Hash, nil
642
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
643
+ config_attr :quota_project, nil, ::String, nil
644
+
645
+ # @private
646
+ def initialize parent_config = nil
647
+ @parent_config = parent_config unless parent_config.nil?
648
+
649
+ yield self if block_given?
650
+ end
651
+
652
+ ##
653
+ # Configurations for individual RPCs
654
+ # @return [Rpcs]
655
+ #
656
+ def rpcs
657
+ @rpcs ||= begin
658
+ parent_rpcs = nil
659
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
660
+ Rpcs.new parent_rpcs
661
+ end
662
+ end
663
+
664
+ ##
665
+ # Configuration RPC class for the Workflows API.
666
+ #
667
+ # Includes fields providing the configuration for each RPC in this service.
668
+ # Each configuration object is of type `Gapic::Config::Method` and includes
669
+ # the following configuration fields:
670
+ #
671
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
672
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
673
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
674
+ # include the following keys:
675
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
676
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
677
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
678
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
679
+ # trigger a retry.
680
+ #
681
+ class Rpcs
682
+ ##
683
+ # RPC-specific configuration for `list_workflows`
684
+ # @return [::Gapic::Config::Method]
685
+ #
686
+ attr_reader :list_workflows
687
+ ##
688
+ # RPC-specific configuration for `get_workflow`
689
+ # @return [::Gapic::Config::Method]
690
+ #
691
+ attr_reader :get_workflow
692
+ ##
693
+ # RPC-specific configuration for `create_workflow`
694
+ # @return [::Gapic::Config::Method]
695
+ #
696
+ attr_reader :create_workflow
697
+ ##
698
+ # RPC-specific configuration for `delete_workflow`
699
+ # @return [::Gapic::Config::Method]
700
+ #
701
+ attr_reader :delete_workflow
702
+ ##
703
+ # RPC-specific configuration for `update_workflow`
704
+ # @return [::Gapic::Config::Method]
705
+ #
706
+ attr_reader :update_workflow
707
+
708
+ # @private
709
+ def initialize parent_rpcs = nil
710
+ list_workflows_config = parent_rpcs.list_workflows if parent_rpcs.respond_to? :list_workflows
711
+ @list_workflows = ::Gapic::Config::Method.new list_workflows_config
712
+ get_workflow_config = parent_rpcs.get_workflow if parent_rpcs.respond_to? :get_workflow
713
+ @get_workflow = ::Gapic::Config::Method.new get_workflow_config
714
+ create_workflow_config = parent_rpcs.create_workflow if parent_rpcs.respond_to? :create_workflow
715
+ @create_workflow = ::Gapic::Config::Method.new create_workflow_config
716
+ delete_workflow_config = parent_rpcs.delete_workflow if parent_rpcs.respond_to? :delete_workflow
717
+ @delete_workflow = ::Gapic::Config::Method.new delete_workflow_config
718
+ update_workflow_config = parent_rpcs.update_workflow if parent_rpcs.respond_to? :update_workflow
719
+ @update_workflow = ::Gapic::Config::Method.new update_workflow_config
720
+
721
+ yield self if block_given?
722
+ end
723
+ end
724
+ end
725
+ end
726
+ end
727
+ end
728
+ end
729
+ end
730
+ end