google-cloud-workflows-executions-v1 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0300716ce421693850269655e3ba7245e3509f77de5ac8a96e7e53dc9305db92
4
- data.tar.gz: 151bd3c50b2988b25afda5f41b2f9673d6828b1dc5bf71eb17922c5cc56407ef
3
+ metadata.gz: 9001200b164299a0cf6f7de02899a2cc5c159bda9721a159668698accc91dc2b
4
+ data.tar.gz: 6edce306b9aaf112a7f4b8dbf0bc01d1354b51fe83cac46e5c5cef048a3b3785
5
5
  SHA512:
6
- metadata.gz: 9e4029e174da3d49331760ed670b15dff50916b009d72ceecf05a852c0f7eb7f8f1364639fe1198327fea936141fac170437a2aaa152b66fdfefbea02b80b288
7
- data.tar.gz: a9a959826fc239f4a3e949aa36764d6a701d063c5c690e822ee04b2dcbeb6aebbc0c3187ec48651f9c9a081b630b3145e1de91faba2dd32f910ebc6fcb32ef55
6
+ metadata.gz: 0f28ba4f9c902c338f0c1dd8d8bcc8c53cbc9200a1a8a1a892ebf277e9c3bb4b8531bc85651b012333a616bcd60ec343d1a5b91b238242deaf314f36d41d36fb
7
+ data.tar.gz: 28f8052ab8030190e11c1b09672977e7357ee0d24d9a9962e1a0a2a1dc5537065c9b89237ac9d77e376dffc099bd44c9a79af94c66a3399b4b060edc814a9743
@@ -162,7 +162,7 @@ module Google
162
162
  # @param options [::Gapic::CallOptions, ::Hash]
163
163
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
164
164
  #
165
- # @overload list_executions(parent: nil, page_size: nil, page_token: nil, view: nil)
165
+ # @overload list_executions(parent: nil, page_size: nil, page_token: nil, view: nil, filter: nil, order_by: nil)
166
166
  # Pass arguments to `list_executions` via keyword arguments. Note that at
167
167
  # least one keyword argument is required. To specify no parameters, or to keep all
168
168
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -172,7 +172,7 @@ module Google
172
172
  # Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
173
173
  # @param page_size [::Integer]
174
174
  # Maximum number of executions to return per call.
175
- # Max supported value depends on the selected Execution view: it's 10000 for
175
+ # Max supported value depends on the selected Execution view: it's 1000 for
176
176
  # BASIC and 100 for FULL. The default value used if the field is not
177
177
  # specified is 100, regardless of the selected view. Values greater than
178
178
  # the max value will be coerced down to it.
@@ -182,9 +182,22 @@ module Google
182
182
  #
183
183
  # When paginating, all other parameters provided to `ListExecutions` must
184
184
  # match the call that provided the page token.
185
+ #
186
+ # Note that pagination is applied to dynamic data. The list of executions
187
+ # returned can change between page requests.
185
188
  # @param view [::Google::Cloud::Workflows::Executions::V1::ExecutionView]
186
- # Optional. A view defining which fields should be filled in the returned executions.
187
- # The API will default to the BASIC view.
189
+ # Optional. A view defining which fields should be filled in the returned
190
+ # executions. The API will default to the BASIC view.
191
+ # @param filter [::String]
192
+ # Optional. Filters applied to the [Executions.ListExecutions] results.
193
+ # The following fields are supported for filtering:
194
+ # executionID, state, startTime, endTime, duration, workflowRevisionID,
195
+ # stepName, and label.
196
+ # @param order_by [::String]
197
+ # Optional. The ordering applied to the [Executions.ListExecutions] results.
198
+ # By default the ordering is based on descending start time.
199
+ # The following fields are supported for order by:
200
+ # executionID, startTime, endTime, duration, state, and workflowRevisionID.
188
201
  #
189
202
  # @yield [response, operation] Access the result along with the RPC operation
190
203
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1::Execution>]
@@ -367,8 +380,8 @@ module Google
367
380
  # Format:
368
381
  # projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
369
382
  # @param view [::Google::Cloud::Workflows::Executions::V1::ExecutionView]
370
- # Optional. A view defining which fields should be filled in the returned execution.
371
- # The API will default to the FULL view.
383
+ # Optional. A view defining which fields should be filled in the returned
384
+ # execution. The API will default to the FULL view.
372
385
  #
373
386
  # @yield [response, operation] Access the result along with the RPC operation
374
387
  # @yieldparam response [::Google::Cloud::Workflows::Executions::V1::Execution]
@@ -0,0 +1,600 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/workflows/executions/v1/executions_pb"
21
+ require "google/cloud/workflows/executions/v1/executions/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Workflows
26
+ module Executions
27
+ module V1
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.v1.Workflow] called executions.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :executions_stub
41
+
42
+ ##
43
+ # Configure the Executions Client class.
44
+ #
45
+ # See {::Google::Cloud::Workflows::Executions::V1::Executions::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Executions clients
51
+ # ::Google::Cloud::Workflows::Executions::V1::Executions::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Workflows", "Executions", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config
72
+ end
73
+ yield @configure if block_given?
74
+ @configure
75
+ end
76
+
77
+ ##
78
+ # Configure the Executions Client instance.
79
+ #
80
+ # The configuration is set to the derived mode, meaning that values can be changed,
81
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
82
+ # should be made on {Client.configure}.
83
+ #
84
+ # See {::Google::Cloud::Workflows::Executions::V1::Executions::Rest::Client::Configuration}
85
+ # for a description of the configuration fields.
86
+ #
87
+ # @yield [config] Configure the Client client.
88
+ # @yieldparam config [Client::Configuration]
89
+ #
90
+ # @return [Client::Configuration]
91
+ #
92
+ def configure
93
+ yield @config if block_given?
94
+ @config
95
+ end
96
+
97
+ ##
98
+ # Create a new Executions REST client object.
99
+ #
100
+ # @example
101
+ #
102
+ # # Create a client using the default configuration
103
+ # client = ::Google::Cloud::Workflows::Executions::V1::Executions::Rest::Client.new
104
+ #
105
+ # # Create a client using a custom configuration
106
+ # client = ::Google::Cloud::Workflows::Executions::V1::Executions::Rest::Client.new do |config|
107
+ # config.timeout = 10.0
108
+ # end
109
+ #
110
+ # @yield [config] Configure the Executions client.
111
+ # @yieldparam config [Client::Configuration]
112
+ #
113
+ def initialize
114
+ # Create the configuration object
115
+ @config = Configuration.new Client.configure
116
+
117
+ # Yield the configuration if needed
118
+ yield @config if block_given?
119
+
120
+ # Create credentials
121
+ credentials = @config.credentials
122
+ # Use self-signed JWT if the endpoint is unchanged from default,
123
+ # but only if the default endpoint does not have a region prefix.
124
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
125
+ !@config.endpoint.split(".").first.include?("-")
126
+ credentials ||= Credentials.default scope: @config.scope,
127
+ enable_self_signed_jwt: enable_self_signed_jwt
128
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
129
+ credentials = Credentials.new credentials, scope: @config.scope
130
+ end
131
+
132
+ @quota_project_id = @config.quota_project
133
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
134
+
135
+ @executions_stub = ::Google::Cloud::Workflows::Executions::V1::Executions::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
136
+ end
137
+
138
+ # Service calls
139
+
140
+ ##
141
+ # Returns a list of executions which belong to the workflow with
142
+ # the given name. The method returns executions of all workflow
143
+ # revisions. Returned executions are ordered by their start time (newest
144
+ # first).
145
+ #
146
+ # @overload list_executions(request, options = nil)
147
+ # Pass arguments to `list_executions` via a request object, either of type
148
+ # {::Google::Cloud::Workflows::Executions::V1::ListExecutionsRequest} or an equivalent Hash.
149
+ #
150
+ # @param request [::Google::Cloud::Workflows::Executions::V1::ListExecutionsRequest, ::Hash]
151
+ # A request object representing the call parameters. Required. To specify no
152
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
153
+ # @param options [::Gapic::CallOptions, ::Hash]
154
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
155
+ #
156
+ # @overload list_executions(parent: nil, page_size: nil, page_token: nil, view: nil, filter: nil, order_by: nil)
157
+ # Pass arguments to `list_executions` via keyword arguments. Note that at
158
+ # least one keyword argument is required. To specify no parameters, or to keep all
159
+ # the default parameter values, pass an empty Hash as a request object (see above).
160
+ #
161
+ # @param parent [::String]
162
+ # Required. Name of the workflow for which the executions should be listed.
163
+ # Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
164
+ # @param page_size [::Integer]
165
+ # Maximum number of executions to return per call.
166
+ # Max supported value depends on the selected Execution view: it's 1000 for
167
+ # BASIC and 100 for FULL. The default value used if the field is not
168
+ # specified is 100, regardless of the selected view. Values greater than
169
+ # the max value will be coerced down to it.
170
+ # @param page_token [::String]
171
+ # A page token, received from a previous `ListExecutions` call.
172
+ # Provide this to retrieve the subsequent page.
173
+ #
174
+ # When paginating, all other parameters provided to `ListExecutions` must
175
+ # match the call that provided the page token.
176
+ #
177
+ # Note that pagination is applied to dynamic data. The list of executions
178
+ # returned can change between page requests.
179
+ # @param view [::Google::Cloud::Workflows::Executions::V1::ExecutionView]
180
+ # Optional. A view defining which fields should be filled in the returned
181
+ # executions. The API will default to the BASIC view.
182
+ # @param filter [::String]
183
+ # Optional. Filters applied to the [Executions.ListExecutions] results.
184
+ # The following fields are supported for filtering:
185
+ # executionID, state, startTime, endTime, duration, workflowRevisionID,
186
+ # stepName, and label.
187
+ # @param order_by [::String]
188
+ # Optional. The ordering applied to the [Executions.ListExecutions] results.
189
+ # By default the ordering is based on descending start time.
190
+ # The following fields are supported for order by:
191
+ # executionID, startTime, endTime, duration, state, and workflowRevisionID.
192
+ # @yield [result, operation] Access the result along with the TransportOperation object
193
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1::Execution>]
194
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
195
+ #
196
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1::Execution>]
197
+ #
198
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
199
+ def list_executions request, options = nil
200
+ raise ::ArgumentError, "request must be provided" if request.nil?
201
+
202
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1::ListExecutionsRequest
203
+
204
+ # Converts hash and nil to an options object
205
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
206
+
207
+ # Customize the options with defaults
208
+ call_metadata = @config.rpcs.list_executions.metadata.to_h
209
+
210
+ # Set x-goog-api-client and x-goog-user-project headers
211
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
212
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
213
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1::VERSION,
214
+ transports_version_send: [:rest]
215
+
216
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
217
+
218
+ options.apply_defaults timeout: @config.rpcs.list_executions.timeout,
219
+ metadata: call_metadata,
220
+ retry_policy: @config.rpcs.list_executions.retry_policy
221
+
222
+ options.apply_defaults timeout: @config.timeout,
223
+ metadata: @config.metadata,
224
+ retry_policy: @config.retry_policy
225
+
226
+ @executions_stub.list_executions request, options do |result, operation|
227
+ result = ::Gapic::Rest::PagedEnumerable.new @executions_stub, :list_executions, "executions", request, result, options
228
+ yield result, operation if block_given?
229
+ return result
230
+ end
231
+ rescue ::Gapic::Rest::Error => e
232
+ raise ::Google::Cloud::Error.from_error(e)
233
+ end
234
+
235
+ ##
236
+ # Creates a new execution using the latest revision of the given workflow.
237
+ #
238
+ # @overload create_execution(request, options = nil)
239
+ # Pass arguments to `create_execution` via a request object, either of type
240
+ # {::Google::Cloud::Workflows::Executions::V1::CreateExecutionRequest} or an equivalent Hash.
241
+ #
242
+ # @param request [::Google::Cloud::Workflows::Executions::V1::CreateExecutionRequest, ::Hash]
243
+ # A request object representing the call parameters. Required. To specify no
244
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
245
+ # @param options [::Gapic::CallOptions, ::Hash]
246
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
247
+ #
248
+ # @overload create_execution(parent: nil, execution: nil)
249
+ # Pass arguments to `create_execution` via keyword arguments. Note that at
250
+ # least one keyword argument is required. To specify no parameters, or to keep all
251
+ # the default parameter values, pass an empty Hash as a request object (see above).
252
+ #
253
+ # @param parent [::String]
254
+ # Required. Name of the workflow for which an execution should be created.
255
+ # Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
256
+ # The latest revision of the workflow will be used.
257
+ # @param execution [::Google::Cloud::Workflows::Executions::V1::Execution, ::Hash]
258
+ # Required. Execution to be created.
259
+ # @yield [result, operation] Access the result along with the TransportOperation object
260
+ # @yieldparam result [::Google::Cloud::Workflows::Executions::V1::Execution]
261
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
262
+ #
263
+ # @return [::Google::Cloud::Workflows::Executions::V1::Execution]
264
+ #
265
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
266
+ def create_execution request, options = nil
267
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
+
269
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1::CreateExecutionRequest
270
+
271
+ # Converts hash and nil to an options object
272
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
273
+
274
+ # Customize the options with defaults
275
+ call_metadata = @config.rpcs.create_execution.metadata.to_h
276
+
277
+ # Set x-goog-api-client and x-goog-user-project headers
278
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
280
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1::VERSION,
281
+ transports_version_send: [:rest]
282
+
283
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
284
+
285
+ options.apply_defaults timeout: @config.rpcs.create_execution.timeout,
286
+ metadata: call_metadata,
287
+ retry_policy: @config.rpcs.create_execution.retry_policy
288
+
289
+ options.apply_defaults timeout: @config.timeout,
290
+ metadata: @config.metadata,
291
+ retry_policy: @config.retry_policy
292
+
293
+ @executions_stub.create_execution request, options do |result, operation|
294
+ yield result, operation if block_given?
295
+ return result
296
+ end
297
+ rescue ::Gapic::Rest::Error => e
298
+ raise ::Google::Cloud::Error.from_error(e)
299
+ end
300
+
301
+ ##
302
+ # Returns an execution of the given name.
303
+ #
304
+ # @overload get_execution(request, options = nil)
305
+ # Pass arguments to `get_execution` via a request object, either of type
306
+ # {::Google::Cloud::Workflows::Executions::V1::GetExecutionRequest} or an equivalent Hash.
307
+ #
308
+ # @param request [::Google::Cloud::Workflows::Executions::V1::GetExecutionRequest, ::Hash]
309
+ # A request object representing the call parameters. Required. To specify no
310
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
311
+ # @param options [::Gapic::CallOptions, ::Hash]
312
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
313
+ #
314
+ # @overload get_execution(name: nil, view: nil)
315
+ # Pass arguments to `get_execution` via keyword arguments. Note that at
316
+ # least one keyword argument is required. To specify no parameters, or to keep all
317
+ # the default parameter values, pass an empty Hash as a request object (see above).
318
+ #
319
+ # @param name [::String]
320
+ # Required. Name of the execution to be retrieved.
321
+ # Format:
322
+ # projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
323
+ # @param view [::Google::Cloud::Workflows::Executions::V1::ExecutionView]
324
+ # Optional. A view defining which fields should be filled in the returned
325
+ # execution. The API will default to the FULL view.
326
+ # @yield [result, operation] Access the result along with the TransportOperation object
327
+ # @yieldparam result [::Google::Cloud::Workflows::Executions::V1::Execution]
328
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
329
+ #
330
+ # @return [::Google::Cloud::Workflows::Executions::V1::Execution]
331
+ #
332
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
333
+ def get_execution request, options = nil
334
+ raise ::ArgumentError, "request must be provided" if request.nil?
335
+
336
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1::GetExecutionRequest
337
+
338
+ # Converts hash and nil to an options object
339
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
340
+
341
+ # Customize the options with defaults
342
+ call_metadata = @config.rpcs.get_execution.metadata.to_h
343
+
344
+ # Set x-goog-api-client and x-goog-user-project headers
345
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
346
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
347
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1::VERSION,
348
+ transports_version_send: [:rest]
349
+
350
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
351
+
352
+ options.apply_defaults timeout: @config.rpcs.get_execution.timeout,
353
+ metadata: call_metadata,
354
+ retry_policy: @config.rpcs.get_execution.retry_policy
355
+
356
+ options.apply_defaults timeout: @config.timeout,
357
+ metadata: @config.metadata,
358
+ retry_policy: @config.retry_policy
359
+
360
+ @executions_stub.get_execution request, options do |result, operation|
361
+ yield result, operation if block_given?
362
+ return result
363
+ end
364
+ rescue ::Gapic::Rest::Error => e
365
+ raise ::Google::Cloud::Error.from_error(e)
366
+ end
367
+
368
+ ##
369
+ # Cancels an execution of the given name.
370
+ #
371
+ # @overload cancel_execution(request, options = nil)
372
+ # Pass arguments to `cancel_execution` via a request object, either of type
373
+ # {::Google::Cloud::Workflows::Executions::V1::CancelExecutionRequest} or an equivalent Hash.
374
+ #
375
+ # @param request [::Google::Cloud::Workflows::Executions::V1::CancelExecutionRequest, ::Hash]
376
+ # A request object representing the call parameters. Required. To specify no
377
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
378
+ # @param options [::Gapic::CallOptions, ::Hash]
379
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
380
+ #
381
+ # @overload cancel_execution(name: nil)
382
+ # Pass arguments to `cancel_execution` via keyword arguments. Note that at
383
+ # least one keyword argument is required. To specify no parameters, or to keep all
384
+ # the default parameter values, pass an empty Hash as a request object (see above).
385
+ #
386
+ # @param name [::String]
387
+ # Required. Name of the execution to be cancelled.
388
+ # Format:
389
+ # projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
390
+ # @yield [result, operation] Access the result along with the TransportOperation object
391
+ # @yieldparam result [::Google::Cloud::Workflows::Executions::V1::Execution]
392
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
393
+ #
394
+ # @return [::Google::Cloud::Workflows::Executions::V1::Execution]
395
+ #
396
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
397
+ def cancel_execution request, options = nil
398
+ raise ::ArgumentError, "request must be provided" if request.nil?
399
+
400
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1::CancelExecutionRequest
401
+
402
+ # Converts hash and nil to an options object
403
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
404
+
405
+ # Customize the options with defaults
406
+ call_metadata = @config.rpcs.cancel_execution.metadata.to_h
407
+
408
+ # Set x-goog-api-client and x-goog-user-project headers
409
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
410
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
411
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1::VERSION,
412
+ transports_version_send: [:rest]
413
+
414
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
415
+
416
+ options.apply_defaults timeout: @config.rpcs.cancel_execution.timeout,
417
+ metadata: call_metadata,
418
+ retry_policy: @config.rpcs.cancel_execution.retry_policy
419
+
420
+ options.apply_defaults timeout: @config.timeout,
421
+ metadata: @config.metadata,
422
+ retry_policy: @config.retry_policy
423
+
424
+ @executions_stub.cancel_execution request, options do |result, operation|
425
+ yield result, operation if block_given?
426
+ return result
427
+ end
428
+ rescue ::Gapic::Rest::Error => e
429
+ raise ::Google::Cloud::Error.from_error(e)
430
+ end
431
+
432
+ ##
433
+ # Configuration class for the Executions REST API.
434
+ #
435
+ # This class represents the configuration for Executions REST,
436
+ # providing control over timeouts, retry behavior, logging, transport
437
+ # parameters, and other low-level controls. Certain parameters can also be
438
+ # applied individually to specific RPCs. See
439
+ # {::Google::Cloud::Workflows::Executions::V1::Executions::Rest::Client::Configuration::Rpcs}
440
+ # for a list of RPCs that can be configured independently.
441
+ #
442
+ # Configuration can be applied globally to all clients, or to a single client
443
+ # on construction.
444
+ #
445
+ # @example
446
+ #
447
+ # # Modify the global config, setting the timeout for
448
+ # # list_executions to 20 seconds,
449
+ # # and all remaining timeouts to 10 seconds.
450
+ # ::Google::Cloud::Workflows::Executions::V1::Executions::Rest::Client.configure do |config|
451
+ # config.timeout = 10.0
452
+ # config.rpcs.list_executions.timeout = 20.0
453
+ # end
454
+ #
455
+ # # Apply the above configuration only to a new client.
456
+ # client = ::Google::Cloud::Workflows::Executions::V1::Executions::Rest::Client.new do |config|
457
+ # config.timeout = 10.0
458
+ # config.rpcs.list_executions.timeout = 20.0
459
+ # end
460
+ #
461
+ # @!attribute [rw] endpoint
462
+ # The hostname or hostname:port of the service endpoint.
463
+ # Defaults to `"workflowexecutions.googleapis.com"`.
464
+ # @return [::String]
465
+ # @!attribute [rw] credentials
466
+ # Credentials to send with calls. You may provide any of the following types:
467
+ # * (`String`) The path to a service account key file in JSON format
468
+ # * (`Hash`) A service account key as a Hash
469
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
470
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
471
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
472
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
473
+ # * (`nil`) indicating no credentials
474
+ # @return [::Object]
475
+ # @!attribute [rw] scope
476
+ # The OAuth scopes
477
+ # @return [::Array<::String>]
478
+ # @!attribute [rw] lib_name
479
+ # The library name as recorded in instrumentation and logging
480
+ # @return [::String]
481
+ # @!attribute [rw] lib_version
482
+ # The library version as recorded in instrumentation and logging
483
+ # @return [::String]
484
+ # @!attribute [rw] timeout
485
+ # The call timeout in seconds.
486
+ # @return [::Numeric]
487
+ # @!attribute [rw] metadata
488
+ # Additional headers to be sent with the call.
489
+ # @return [::Hash{::Symbol=>::String}]
490
+ # @!attribute [rw] retry_policy
491
+ # The retry policy. The value is a hash with the following keys:
492
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
493
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
494
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
495
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
496
+ # trigger a retry.
497
+ # @return [::Hash]
498
+ # @!attribute [rw] quota_project
499
+ # A separate project against which to charge quota.
500
+ # @return [::String]
501
+ #
502
+ class Configuration
503
+ extend ::Gapic::Config
504
+
505
+ DEFAULT_ENDPOINT = "workflowexecutions.googleapis.com"
506
+
507
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
508
+ config_attr :credentials, nil do |value|
509
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
510
+ allowed.any? { |klass| klass === value }
511
+ end
512
+ config_attr :scope, nil, ::String, ::Array, nil
513
+ config_attr :lib_name, nil, ::String, nil
514
+ config_attr :lib_version, nil, ::String, nil
515
+ config_attr :timeout, nil, ::Numeric, nil
516
+ config_attr :metadata, nil, ::Hash, nil
517
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
518
+ config_attr :quota_project, nil, ::String, nil
519
+
520
+ # @private
521
+ def initialize parent_config = nil
522
+ @parent_config = parent_config unless parent_config.nil?
523
+
524
+ yield self if block_given?
525
+ end
526
+
527
+ ##
528
+ # Configurations for individual RPCs
529
+ # @return [Rpcs]
530
+ #
531
+ def rpcs
532
+ @rpcs ||= begin
533
+ parent_rpcs = nil
534
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
535
+ Rpcs.new parent_rpcs
536
+ end
537
+ end
538
+
539
+ ##
540
+ # Configuration RPC class for the Executions API.
541
+ #
542
+ # Includes fields providing the configuration for each RPC in this service.
543
+ # Each configuration object is of type `Gapic::Config::Method` and includes
544
+ # the following configuration fields:
545
+ #
546
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
547
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
548
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
549
+ # include the following keys:
550
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
551
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
552
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
553
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
554
+ # trigger a retry.
555
+ #
556
+ class Rpcs
557
+ ##
558
+ # RPC-specific configuration for `list_executions`
559
+ # @return [::Gapic::Config::Method]
560
+ #
561
+ attr_reader :list_executions
562
+ ##
563
+ # RPC-specific configuration for `create_execution`
564
+ # @return [::Gapic::Config::Method]
565
+ #
566
+ attr_reader :create_execution
567
+ ##
568
+ # RPC-specific configuration for `get_execution`
569
+ # @return [::Gapic::Config::Method]
570
+ #
571
+ attr_reader :get_execution
572
+ ##
573
+ # RPC-specific configuration for `cancel_execution`
574
+ # @return [::Gapic::Config::Method]
575
+ #
576
+ attr_reader :cancel_execution
577
+
578
+ # @private
579
+ def initialize parent_rpcs = nil
580
+ list_executions_config = parent_rpcs.list_executions if parent_rpcs.respond_to? :list_executions
581
+ @list_executions = ::Gapic::Config::Method.new list_executions_config
582
+ create_execution_config = parent_rpcs.create_execution if parent_rpcs.respond_to? :create_execution
583
+ @create_execution = ::Gapic::Config::Method.new create_execution_config
584
+ get_execution_config = parent_rpcs.get_execution if parent_rpcs.respond_to? :get_execution
585
+ @get_execution = ::Gapic::Config::Method.new get_execution_config
586
+ cancel_execution_config = parent_rpcs.cancel_execution if parent_rpcs.respond_to? :cancel_execution
587
+ @cancel_execution = ::Gapic::Config::Method.new cancel_execution_config
588
+
589
+ yield self if block_given?
590
+ end
591
+ end
592
+ end
593
+ end
594
+ end
595
+ end
596
+ end
597
+ end
598
+ end
599
+ end
600
+ end