google-cloud-workflows-executions-v1beta 0.14.1 → 0.14.2

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,720 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/executions/v1beta/executions_pb"
21
+ require "google/cloud/workflows/executions/v1beta/executions/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Workflows
26
+ module Executions
27
+ module V1beta
28
+ module Executions
29
+ module Rest
30
+ ##
31
+ # REST client for the Executions service.
32
+ #
33
+ # Executions is used to start and manage running instances of
34
+ # [Workflows][google.cloud.workflows.v1beta.Workflow] called executions.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "workflowexecutions.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :executions_stub
47
+
48
+ ##
49
+ # Configure the Executions Client class.
50
+ #
51
+ # See {::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all Executions clients
57
+ # ::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "Workflows", "Executions", "V1beta"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the Executions Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # The effective universe domain
105
+ #
106
+ # @return [String]
107
+ #
108
+ def universe_domain
109
+ @executions_stub.universe_domain
110
+ end
111
+
112
+ ##
113
+ # Create a new Executions REST client object.
114
+ #
115
+ # @example
116
+ #
117
+ # # Create a client using the default configuration
118
+ # client = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.new
119
+ #
120
+ # # Create a client using a custom configuration
121
+ # client = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
124
+ #
125
+ # @yield [config] Configure the Executions client.
126
+ # @yieldparam config [Client::Configuration]
127
+ #
128
+ def initialize
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
+ # but only if the default endpoint does not have a region prefix.
139
+ enable_self_signed_jwt = @config.endpoint.nil? ||
140
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
+ !@config.endpoint.split(".").first.include?("-"))
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @executions_stub = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::ServiceStub.new(
152
+ endpoint: @config.endpoint,
153
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
154
+ universe_domain: @config.universe_domain,
155
+ credentials: credentials,
156
+ logger: @config.logger
157
+ )
158
+
159
+ @executions_stub.logger(stub: true)&.info do |entry|
160
+ entry.set_system_name
161
+ entry.set_service
162
+ entry.message = "Created client for #{entry.service}"
163
+ entry.set_credentials_fields credentials
164
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
165
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
166
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
167
+ end
168
+ end
169
+
170
+ ##
171
+ # The logger used for request/response debug logging.
172
+ #
173
+ # @return [Logger]
174
+ #
175
+ def logger
176
+ @executions_stub.logger
177
+ end
178
+
179
+ # Service calls
180
+
181
+ ##
182
+ # Returns a list of executions which belong to the workflow with
183
+ # the given name. The method returns executions of all workflow
184
+ # revisions. Returned executions are ordered by their start time (newest
185
+ # first).
186
+ #
187
+ # @overload list_executions(request, options = nil)
188
+ # Pass arguments to `list_executions` via a request object, either of type
189
+ # {::Google::Cloud::Workflows::Executions::V1beta::ListExecutionsRequest} or an equivalent Hash.
190
+ #
191
+ # @param request [::Google::Cloud::Workflows::Executions::V1beta::ListExecutionsRequest, ::Hash]
192
+ # A request object representing the call parameters. Required. To specify no
193
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
194
+ # @param options [::Gapic::CallOptions, ::Hash]
195
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
196
+ #
197
+ # @overload list_executions(parent: nil, page_size: nil, page_token: nil, view: nil)
198
+ # Pass arguments to `list_executions` via keyword arguments. Note that at
199
+ # least one keyword argument is required. To specify no parameters, or to keep all
200
+ # the default parameter values, pass an empty Hash as a request object (see above).
201
+ #
202
+ # @param parent [::String]
203
+ # Required. Name of the workflow for which the executions should be listed.
204
+ # Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
205
+ # @param page_size [::Integer]
206
+ # Maximum number of executions to return per call.
207
+ # Max supported value depends on the selected Execution view: it's 10000 for
208
+ # BASIC and 100 for FULL. The default value used if the field is not
209
+ # specified is 100, regardless of the selected view. Values greater than
210
+ # the max value will be coerced down to it.
211
+ # @param page_token [::String]
212
+ # A page token, received from a previous `ListExecutions` call.
213
+ # Provide this to retrieve the subsequent page.
214
+ #
215
+ # When paginating, all other parameters provided to `ListExecutions` must
216
+ # match the call that provided the page token.
217
+ # @param view [::Google::Cloud::Workflows::Executions::V1beta::ExecutionView]
218
+ # Optional. A view defining which fields should be filled in the returned executions.
219
+ # The API will default to the BASIC view.
220
+ # @yield [result, operation] Access the result along with the TransportOperation object
221
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1beta::Execution>]
222
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
223
+ #
224
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1beta::Execution>]
225
+ #
226
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
227
+ #
228
+ # @example Basic example
229
+ # require "google/cloud/workflows/executions/v1beta"
230
+ #
231
+ # # Create a client object. The client can be reused for multiple calls.
232
+ # client = Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.new
233
+ #
234
+ # # Create a request. To set request fields, pass in keyword arguments.
235
+ # request = Google::Cloud::Workflows::Executions::V1beta::ListExecutionsRequest.new
236
+ #
237
+ # # Call the list_executions method.
238
+ # result = client.list_executions request
239
+ #
240
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
241
+ # # over elements, and API calls will be issued to fetch pages as needed.
242
+ # result.each do |item|
243
+ # # Each element is of type ::Google::Cloud::Workflows::Executions::V1beta::Execution.
244
+ # p item
245
+ # end
246
+ #
247
+ def list_executions request, options = nil
248
+ raise ::ArgumentError, "request must be provided" if request.nil?
249
+
250
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1beta::ListExecutionsRequest
251
+
252
+ # Converts hash and nil to an options object
253
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
254
+
255
+ # Customize the options with defaults
256
+ call_metadata = @config.rpcs.list_executions.metadata.to_h
257
+
258
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
259
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
260
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
261
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1beta::VERSION,
262
+ transports_version_send: [:rest]
263
+
264
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
265
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
266
+
267
+ options.apply_defaults timeout: @config.rpcs.list_executions.timeout,
268
+ metadata: call_metadata,
269
+ retry_policy: @config.rpcs.list_executions.retry_policy
270
+
271
+ options.apply_defaults timeout: @config.timeout,
272
+ metadata: @config.metadata,
273
+ retry_policy: @config.retry_policy
274
+
275
+ @executions_stub.list_executions request, options do |result, operation|
276
+ result = ::Gapic::Rest::PagedEnumerable.new @executions_stub, :list_executions, "executions", request, result, options
277
+ yield result, operation if block_given?
278
+ throw :response, result
279
+ end
280
+ rescue ::Gapic::Rest::Error => e
281
+ raise ::Google::Cloud::Error.from_error(e)
282
+ end
283
+
284
+ ##
285
+ # Creates a new execution using the latest revision of the given workflow.
286
+ #
287
+ # @overload create_execution(request, options = nil)
288
+ # Pass arguments to `create_execution` via a request object, either of type
289
+ # {::Google::Cloud::Workflows::Executions::V1beta::CreateExecutionRequest} or an equivalent Hash.
290
+ #
291
+ # @param request [::Google::Cloud::Workflows::Executions::V1beta::CreateExecutionRequest, ::Hash]
292
+ # A request object representing the call parameters. Required. To specify no
293
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
294
+ # @param options [::Gapic::CallOptions, ::Hash]
295
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
296
+ #
297
+ # @overload create_execution(parent: nil, execution: nil)
298
+ # Pass arguments to `create_execution` via keyword arguments. Note that at
299
+ # least one keyword argument is required. To specify no parameters, or to keep all
300
+ # the default parameter values, pass an empty Hash as a request object (see above).
301
+ #
302
+ # @param parent [::String]
303
+ # Required. Name of the workflow for which an execution should be created.
304
+ # Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
305
+ # The latest revision of the workflow will be used.
306
+ # @param execution [::Google::Cloud::Workflows::Executions::V1beta::Execution, ::Hash]
307
+ # Required. Execution to be created.
308
+ # @yield [result, operation] Access the result along with the TransportOperation object
309
+ # @yieldparam result [::Google::Cloud::Workflows::Executions::V1beta::Execution]
310
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
311
+ #
312
+ # @return [::Google::Cloud::Workflows::Executions::V1beta::Execution]
313
+ #
314
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
315
+ #
316
+ # @example Basic example
317
+ # require "google/cloud/workflows/executions/v1beta"
318
+ #
319
+ # # Create a client object. The client can be reused for multiple calls.
320
+ # client = Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.new
321
+ #
322
+ # # Create a request. To set request fields, pass in keyword arguments.
323
+ # request = Google::Cloud::Workflows::Executions::V1beta::CreateExecutionRequest.new
324
+ #
325
+ # # Call the create_execution method.
326
+ # result = client.create_execution request
327
+ #
328
+ # # The returned object is of type Google::Cloud::Workflows::Executions::V1beta::Execution.
329
+ # p result
330
+ #
331
+ def create_execution request, options = nil
332
+ raise ::ArgumentError, "request must be provided" if request.nil?
333
+
334
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1beta::CreateExecutionRequest
335
+
336
+ # Converts hash and nil to an options object
337
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
338
+
339
+ # Customize the options with defaults
340
+ call_metadata = @config.rpcs.create_execution.metadata.to_h
341
+
342
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
343
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
344
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
345
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1beta::VERSION,
346
+ transports_version_send: [:rest]
347
+
348
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
349
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
350
+
351
+ options.apply_defaults timeout: @config.rpcs.create_execution.timeout,
352
+ metadata: call_metadata,
353
+ retry_policy: @config.rpcs.create_execution.retry_policy
354
+
355
+ options.apply_defaults timeout: @config.timeout,
356
+ metadata: @config.metadata,
357
+ retry_policy: @config.retry_policy
358
+
359
+ @executions_stub.create_execution request, options do |result, operation|
360
+ yield result, operation if block_given?
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Returns an execution of the given name.
368
+ #
369
+ # @overload get_execution(request, options = nil)
370
+ # Pass arguments to `get_execution` via a request object, either of type
371
+ # {::Google::Cloud::Workflows::Executions::V1beta::GetExecutionRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::Workflows::Executions::V1beta::GetExecutionRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
378
+ #
379
+ # @overload get_execution(name: nil, view: nil)
380
+ # Pass arguments to `get_execution` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param name [::String]
385
+ # Required. Name of the execution to be retrieved.
386
+ # Format:
387
+ # projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
388
+ # @param view [::Google::Cloud::Workflows::Executions::V1beta::ExecutionView]
389
+ # Optional. A view defining which fields should be filled in the returned execution.
390
+ # The API will default to the FULL view.
391
+ # @yield [result, operation] Access the result along with the TransportOperation object
392
+ # @yieldparam result [::Google::Cloud::Workflows::Executions::V1beta::Execution]
393
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
394
+ #
395
+ # @return [::Google::Cloud::Workflows::Executions::V1beta::Execution]
396
+ #
397
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
398
+ #
399
+ # @example Basic example
400
+ # require "google/cloud/workflows/executions/v1beta"
401
+ #
402
+ # # Create a client object. The client can be reused for multiple calls.
403
+ # client = Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.new
404
+ #
405
+ # # Create a request. To set request fields, pass in keyword arguments.
406
+ # request = Google::Cloud::Workflows::Executions::V1beta::GetExecutionRequest.new
407
+ #
408
+ # # Call the get_execution method.
409
+ # result = client.get_execution request
410
+ #
411
+ # # The returned object is of type Google::Cloud::Workflows::Executions::V1beta::Execution.
412
+ # p result
413
+ #
414
+ def get_execution request, options = nil
415
+ raise ::ArgumentError, "request must be provided" if request.nil?
416
+
417
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1beta::GetExecutionRequest
418
+
419
+ # Converts hash and nil to an options object
420
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
421
+
422
+ # Customize the options with defaults
423
+ call_metadata = @config.rpcs.get_execution.metadata.to_h
424
+
425
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
426
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
427
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
428
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1beta::VERSION,
429
+ transports_version_send: [:rest]
430
+
431
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
432
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
433
+
434
+ options.apply_defaults timeout: @config.rpcs.get_execution.timeout,
435
+ metadata: call_metadata,
436
+ retry_policy: @config.rpcs.get_execution.retry_policy
437
+
438
+ options.apply_defaults timeout: @config.timeout,
439
+ metadata: @config.metadata,
440
+ retry_policy: @config.retry_policy
441
+
442
+ @executions_stub.get_execution request, options do |result, operation|
443
+ yield result, operation if block_given?
444
+ end
445
+ rescue ::Gapic::Rest::Error => e
446
+ raise ::Google::Cloud::Error.from_error(e)
447
+ end
448
+
449
+ ##
450
+ # Cancels an execution of the given name.
451
+ #
452
+ # @overload cancel_execution(request, options = nil)
453
+ # Pass arguments to `cancel_execution` via a request object, either of type
454
+ # {::Google::Cloud::Workflows::Executions::V1beta::CancelExecutionRequest} or an equivalent Hash.
455
+ #
456
+ # @param request [::Google::Cloud::Workflows::Executions::V1beta::CancelExecutionRequest, ::Hash]
457
+ # A request object representing the call parameters. Required. To specify no
458
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
459
+ # @param options [::Gapic::CallOptions, ::Hash]
460
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
461
+ #
462
+ # @overload cancel_execution(name: nil)
463
+ # Pass arguments to `cancel_execution` via keyword arguments. Note that at
464
+ # least one keyword argument is required. To specify no parameters, or to keep all
465
+ # the default parameter values, pass an empty Hash as a request object (see above).
466
+ #
467
+ # @param name [::String]
468
+ # Required. Name of the execution to be cancelled.
469
+ # Format:
470
+ # projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
471
+ # @yield [result, operation] Access the result along with the TransportOperation object
472
+ # @yieldparam result [::Google::Cloud::Workflows::Executions::V1beta::Execution]
473
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
474
+ #
475
+ # @return [::Google::Cloud::Workflows::Executions::V1beta::Execution]
476
+ #
477
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
478
+ #
479
+ # @example Basic example
480
+ # require "google/cloud/workflows/executions/v1beta"
481
+ #
482
+ # # Create a client object. The client can be reused for multiple calls.
483
+ # client = Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.new
484
+ #
485
+ # # Create a request. To set request fields, pass in keyword arguments.
486
+ # request = Google::Cloud::Workflows::Executions::V1beta::CancelExecutionRequest.new
487
+ #
488
+ # # Call the cancel_execution method.
489
+ # result = client.cancel_execution request
490
+ #
491
+ # # The returned object is of type Google::Cloud::Workflows::Executions::V1beta::Execution.
492
+ # p result
493
+ #
494
+ def cancel_execution request, options = nil
495
+ raise ::ArgumentError, "request must be provided" if request.nil?
496
+
497
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1beta::CancelExecutionRequest
498
+
499
+ # Converts hash and nil to an options object
500
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
501
+
502
+ # Customize the options with defaults
503
+ call_metadata = @config.rpcs.cancel_execution.metadata.to_h
504
+
505
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
506
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
507
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
508
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1beta::VERSION,
509
+ transports_version_send: [:rest]
510
+
511
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
512
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
513
+
514
+ options.apply_defaults timeout: @config.rpcs.cancel_execution.timeout,
515
+ metadata: call_metadata,
516
+ retry_policy: @config.rpcs.cancel_execution.retry_policy
517
+
518
+ options.apply_defaults timeout: @config.timeout,
519
+ metadata: @config.metadata,
520
+ retry_policy: @config.retry_policy
521
+
522
+ @executions_stub.cancel_execution request, options do |result, operation|
523
+ yield result, operation if block_given?
524
+ end
525
+ rescue ::Gapic::Rest::Error => e
526
+ raise ::Google::Cloud::Error.from_error(e)
527
+ end
528
+
529
+ ##
530
+ # Configuration class for the Executions REST API.
531
+ #
532
+ # This class represents the configuration for Executions REST,
533
+ # providing control over timeouts, retry behavior, logging, transport
534
+ # parameters, and other low-level controls. Certain parameters can also be
535
+ # applied individually to specific RPCs. See
536
+ # {::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client::Configuration::Rpcs}
537
+ # for a list of RPCs that can be configured independently.
538
+ #
539
+ # Configuration can be applied globally to all clients, or to a single client
540
+ # on construction.
541
+ #
542
+ # @example
543
+ #
544
+ # # Modify the global config, setting the timeout for
545
+ # # list_executions to 20 seconds,
546
+ # # and all remaining timeouts to 10 seconds.
547
+ # ::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.configure do |config|
548
+ # config.timeout = 10.0
549
+ # config.rpcs.list_executions.timeout = 20.0
550
+ # end
551
+ #
552
+ # # Apply the above configuration only to a new client.
553
+ # client = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Rest::Client.new do |config|
554
+ # config.timeout = 10.0
555
+ # config.rpcs.list_executions.timeout = 20.0
556
+ # end
557
+ #
558
+ # @!attribute [rw] endpoint
559
+ # A custom service endpoint, as a hostname or hostname:port. The default is
560
+ # nil, indicating to use the default endpoint in the current universe domain.
561
+ # @return [::String,nil]
562
+ # @!attribute [rw] credentials
563
+ # Credentials to send with calls. You may provide any of the following types:
564
+ # * (`String`) The path to a service account key file in JSON format
565
+ # * (`Hash`) A service account key as a Hash
566
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
567
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
568
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
569
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
570
+ # * (`nil`) indicating no credentials
571
+ #
572
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
573
+ # external source for authentication to Google Cloud, you must validate it before
574
+ # providing it to a Google API client library. Providing an unvalidated credential
575
+ # configuration to Google APIs can compromise the security of your systems and data.
576
+ # For more information, refer to [Validate credential configurations from external
577
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
578
+ # @return [::Object]
579
+ # @!attribute [rw] scope
580
+ # The OAuth scopes
581
+ # @return [::Array<::String>]
582
+ # @!attribute [rw] lib_name
583
+ # The library name as recorded in instrumentation and logging
584
+ # @return [::String]
585
+ # @!attribute [rw] lib_version
586
+ # The library version as recorded in instrumentation and logging
587
+ # @return [::String]
588
+ # @!attribute [rw] timeout
589
+ # The call timeout in seconds.
590
+ # @return [::Numeric]
591
+ # @!attribute [rw] metadata
592
+ # Additional headers to be sent with the call.
593
+ # @return [::Hash{::Symbol=>::String}]
594
+ # @!attribute [rw] retry_policy
595
+ # The retry policy. The value is a hash with the following keys:
596
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
597
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
598
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
599
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
600
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
601
+ # trigger a retry.
602
+ # @return [::Hash]
603
+ # @!attribute [rw] quota_project
604
+ # A separate project against which to charge quota.
605
+ # @return [::String]
606
+ # @!attribute [rw] universe_domain
607
+ # The universe domain within which to make requests. This determines the
608
+ # default endpoint URL. The default value of nil uses the environment
609
+ # universe (usually the default "googleapis.com" universe).
610
+ # @return [::String,nil]
611
+ # @!attribute [rw] logger
612
+ # A custom logger to use for request/response debug logging, or the value
613
+ # `:default` (the default) to construct a default logger, or `nil` to
614
+ # explicitly disable logging.
615
+ # @return [::Logger,:default,nil]
616
+ #
617
+ class Configuration
618
+ extend ::Gapic::Config
619
+
620
+ # @private
621
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
622
+ DEFAULT_ENDPOINT = "workflowexecutions.googleapis.com"
623
+
624
+ config_attr :endpoint, nil, ::String, nil
625
+ config_attr :credentials, nil do |value|
626
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
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 :timeout, nil, ::Numeric, nil
633
+ config_attr :metadata, nil, ::Hash, nil
634
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
635
+ config_attr :quota_project, nil, ::String, nil
636
+ config_attr :universe_domain, nil, ::String, nil
637
+ config_attr :logger, :default, ::Logger, nil, :default
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 Executions 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 seconds
666
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional 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
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
673
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
674
+ # trigger a retry.
675
+ #
676
+ class Rpcs
677
+ ##
678
+ # RPC-specific configuration for `list_executions`
679
+ # @return [::Gapic::Config::Method]
680
+ #
681
+ attr_reader :list_executions
682
+ ##
683
+ # RPC-specific configuration for `create_execution`
684
+ # @return [::Gapic::Config::Method]
685
+ #
686
+ attr_reader :create_execution
687
+ ##
688
+ # RPC-specific configuration for `get_execution`
689
+ # @return [::Gapic::Config::Method]
690
+ #
691
+ attr_reader :get_execution
692
+ ##
693
+ # RPC-specific configuration for `cancel_execution`
694
+ # @return [::Gapic::Config::Method]
695
+ #
696
+ attr_reader :cancel_execution
697
+
698
+ # @private
699
+ def initialize parent_rpcs = nil
700
+ list_executions_config = parent_rpcs.list_executions if parent_rpcs.respond_to? :list_executions
701
+ @list_executions = ::Gapic::Config::Method.new list_executions_config
702
+ create_execution_config = parent_rpcs.create_execution if parent_rpcs.respond_to? :create_execution
703
+ @create_execution = ::Gapic::Config::Method.new create_execution_config
704
+ get_execution_config = parent_rpcs.get_execution if parent_rpcs.respond_to? :get_execution
705
+ @get_execution = ::Gapic::Config::Method.new get_execution_config
706
+ cancel_execution_config = parent_rpcs.cancel_execution if parent_rpcs.respond_to? :cancel_execution
707
+ @cancel_execution = ::Gapic::Config::Method.new cancel_execution_config
708
+
709
+ yield self if block_given?
710
+ end
711
+ end
712
+ end
713
+ end
714
+ end
715
+ end
716
+ end
717
+ end
718
+ end
719
+ end
720
+ end