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