google-cloud-workflows-executions-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/executions/v1beta"
@@ -0,0 +1,37 @@
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/executions/v1beta/executions"
20
+ require "google/cloud/workflows/executions/v1beta/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Workflows
25
+ module Executions
26
+ ##
27
+ # To load this package, including all its services, and instantiate a client:
28
+ #
29
+ # require "google/cloud/workflows/executions/v1beta"
30
+ # client = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Client.new
31
+ #
32
+ module V1beta
33
+ end
34
+ end
35
+ end
36
+ end
37
+ 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/executions/v1beta/version"
24
+
25
+ require "google/cloud/workflows/executions/v1beta/executions/credentials"
26
+ require "google/cloud/workflows/executions/v1beta/executions/paths"
27
+ require "google/cloud/workflows/executions/v1beta/executions/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Workflows
32
+ module Executions
33
+ module V1beta
34
+ ##
35
+ # Executions is used to start and manage running instances of
36
+ # [Workflows][google.cloud.workflows.v1beta.Workflow] called executions.
37
+ #
38
+ # To load this service and instantiate a client:
39
+ #
40
+ # require "google/cloud/workflows/executions/v1beta/executions"
41
+ # client = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Client.new
42
+ #
43
+ module Executions
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ helper_path = ::File.join __dir__, "executions", "helpers.rb"
52
+ require "google/cloud/workflows/executions/v1beta/executions/helpers" if ::File.file? helper_path
@@ -0,0 +1,622 @@
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/executions/v1beta/executions_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Workflows
25
+ module Executions
26
+ module V1beta
27
+ module Executions
28
+ ##
29
+ # Client for the Executions service.
30
+ #
31
+ # Executions is used to start and manage running instances of
32
+ # [Workflows][google.cloud.workflows.v1beta.Workflow] called executions.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :executions_stub
39
+
40
+ ##
41
+ # Configure the Executions Client class.
42
+ #
43
+ # See {::Google::Cloud::Workflows::Executions::V1beta::Executions::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # ## Example
47
+ #
48
+ # To modify the configuration for all Executions clients:
49
+ #
50
+ # ::Google::Cloud::Workflows::Executions::V1beta::Executions::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", "Executions", "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 Executions 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::Executions::V1beta::Executions::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 Executions client object.
98
+ #
99
+ # ## Examples
100
+ #
101
+ # To create a new Executions client with the default
102
+ # configuration:
103
+ #
104
+ # client = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Client.new
105
+ #
106
+ # To create a new Executions client with a custom
107
+ # configuration:
108
+ #
109
+ # client = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Client.new do |config|
110
+ # config.timeout = 10.0
111
+ # end
112
+ #
113
+ # @yield [config] Configure the Executions 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/executions/v1beta/executions_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
+ @executions_stub = ::Gapic::ServiceStub.new(
139
+ ::Google::Cloud::Workflows::Executions::V1beta::Executions::Stub,
140
+ credentials: credentials,
141
+ endpoint: @config.endpoint,
142
+ channel_args: @config.channel_args,
143
+ interceptors: @config.interceptors
144
+ )
145
+ end
146
+
147
+ # Service calls
148
+
149
+ ##
150
+ # Returns a list of executions which belong to the workflow with
151
+ # the given name. The method returns executions of all workflow
152
+ # revisions. Returned executions are ordered by their start time (newest
153
+ # first).
154
+ #
155
+ # @overload list_executions(request, options = nil)
156
+ # Pass arguments to `list_executions` via a request object, either of type
157
+ # {::Google::Cloud::Workflows::Executions::V1beta::ListExecutionsRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::Workflows::Executions::V1beta::ListExecutionsRequest, ::Hash]
160
+ # A request object representing the call parameters. Required. To specify no
161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
162
+ # @param options [::Gapic::CallOptions, ::Hash]
163
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
164
+ #
165
+ # @overload list_executions(parent: nil, page_size: nil, page_token: nil, view: nil)
166
+ # Pass arguments to `list_executions` via keyword arguments. Note that at
167
+ # least one keyword argument is required. To specify no parameters, or to keep all
168
+ # the default parameter values, pass an empty Hash as a request object (see above).
169
+ #
170
+ # @param parent [::String]
171
+ # Required. Name of the workflow for which the executions should be listed.
172
+ # Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
173
+ # @param page_size [::Integer]
174
+ # Maximum number of executions to return per call.
175
+ # Max supported value depends on the selected Execution view: it's 10000 for
176
+ # BASIC and 100 for FULL. The default value used if the field is not
177
+ # specified is 100, regardless of the selected view. Values greater than
178
+ # the max value will be coerced down to it.
179
+ # @param page_token [::String]
180
+ # A page token, received from a previous `ListExecutions` call.
181
+ # Provide this to retrieve the subsequent page.
182
+ #
183
+ # When paginating, all other parameters provided to `ListExecutions` must
184
+ # match the call that provided the page token.
185
+ # @param view [::Google::Cloud::Workflows::Executions::V1beta::ExecutionView]
186
+ # Optional. A view defining which fields should be filled in the returned executions.
187
+ # The API will default to the BASIC view.
188
+ #
189
+ # @yield [response, operation] Access the result along with the RPC operation
190
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1beta::Execution>]
191
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
192
+ #
193
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1beta::Execution>]
194
+ #
195
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
196
+ #
197
+ def list_executions request, options = nil
198
+ raise ::ArgumentError, "request must be provided" if request.nil?
199
+
200
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1beta::ListExecutionsRequest
201
+
202
+ # Converts hash and nil to an options object
203
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
204
+
205
+ # Customize the options with defaults
206
+ metadata = @config.rpcs.list_executions.metadata.to_h
207
+
208
+ # Set x-goog-api-client and x-goog-user-project headers
209
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
210
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
211
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1beta::VERSION
212
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
213
+
214
+ header_params = {
215
+ "parent" => request.parent
216
+ }
217
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
218
+ metadata[:"x-goog-request-params"] ||= request_params_header
219
+
220
+ options.apply_defaults timeout: @config.rpcs.list_executions.timeout,
221
+ metadata: metadata,
222
+ retry_policy: @config.rpcs.list_executions.retry_policy
223
+ options.apply_defaults metadata: @config.metadata,
224
+ retry_policy: @config.retry_policy
225
+
226
+ @executions_stub.call_rpc :list_executions, request, options: options do |response, operation|
227
+ response = ::Gapic::PagedEnumerable.new @executions_stub, :list_executions, request, response, operation, options
228
+ yield response, operation if block_given?
229
+ return response
230
+ end
231
+ rescue ::GRPC::BadStatus => 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::V1beta::CreateExecutionRequest} or an equivalent Hash.
241
+ #
242
+ # @param request [::Google::Cloud::Workflows::Executions::V1beta::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::V1beta::Execution, ::Hash]
258
+ # Required. Execution to be created.
259
+ #
260
+ # @yield [response, operation] Access the result along with the RPC operation
261
+ # @yieldparam response [::Google::Cloud::Workflows::Executions::V1beta::Execution]
262
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
263
+ #
264
+ # @return [::Google::Cloud::Workflows::Executions::V1beta::Execution]
265
+ #
266
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
267
+ #
268
+ def create_execution request, options = nil
269
+ raise ::ArgumentError, "request must be provided" if request.nil?
270
+
271
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1beta::CreateExecutionRequest
272
+
273
+ # Converts hash and nil to an options object
274
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
275
+
276
+ # Customize the options with defaults
277
+ metadata = @config.rpcs.create_execution.metadata.to_h
278
+
279
+ # Set x-goog-api-client and x-goog-user-project headers
280
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
281
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
282
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1beta::VERSION
283
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
284
+
285
+ header_params = {
286
+ "parent" => request.parent
287
+ }
288
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
289
+ metadata[:"x-goog-request-params"] ||= request_params_header
290
+
291
+ options.apply_defaults timeout: @config.rpcs.create_execution.timeout,
292
+ metadata: metadata,
293
+ retry_policy: @config.rpcs.create_execution.retry_policy
294
+ options.apply_defaults metadata: @config.metadata,
295
+ retry_policy: @config.retry_policy
296
+
297
+ @executions_stub.call_rpc :create_execution, request, options: options do |response, operation|
298
+ yield response, operation if block_given?
299
+ return response
300
+ end
301
+ rescue ::GRPC::BadStatus => e
302
+ raise ::Google::Cloud::Error.from_error(e)
303
+ end
304
+
305
+ ##
306
+ # Returns an execution of the given name.
307
+ #
308
+ # @overload get_execution(request, options = nil)
309
+ # Pass arguments to `get_execution` via a request object, either of type
310
+ # {::Google::Cloud::Workflows::Executions::V1beta::GetExecutionRequest} or an equivalent Hash.
311
+ #
312
+ # @param request [::Google::Cloud::Workflows::Executions::V1beta::GetExecutionRequest, ::Hash]
313
+ # A request object representing the call parameters. Required. To specify no
314
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
315
+ # @param options [::Gapic::CallOptions, ::Hash]
316
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
317
+ #
318
+ # @overload get_execution(name: nil, view: nil)
319
+ # Pass arguments to `get_execution` via keyword arguments. Note that at
320
+ # least one keyword argument is required. To specify no parameters, or to keep all
321
+ # the default parameter values, pass an empty Hash as a request object (see above).
322
+ #
323
+ # @param name [::String]
324
+ # Required. Name of the execution to be retrieved.
325
+ # Format:
326
+ # projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
327
+ # @param view [::Google::Cloud::Workflows::Executions::V1beta::ExecutionView]
328
+ # Optional. A view defining which fields should be filled in the returned execution.
329
+ # The API will default to the FULL view.
330
+ #
331
+ # @yield [response, operation] Access the result along with the RPC operation
332
+ # @yieldparam response [::Google::Cloud::Workflows::Executions::V1beta::Execution]
333
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
334
+ #
335
+ # @return [::Google::Cloud::Workflows::Executions::V1beta::Execution]
336
+ #
337
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
338
+ #
339
+ def get_execution request, options = nil
340
+ raise ::ArgumentError, "request must be provided" if request.nil?
341
+
342
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1beta::GetExecutionRequest
343
+
344
+ # Converts hash and nil to an options object
345
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
346
+
347
+ # Customize the options with defaults
348
+ metadata = @config.rpcs.get_execution.metadata.to_h
349
+
350
+ # Set x-goog-api-client and x-goog-user-project headers
351
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
352
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
353
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1beta::VERSION
354
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
355
+
356
+ header_params = {
357
+ "name" => request.name
358
+ }
359
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
360
+ metadata[:"x-goog-request-params"] ||= request_params_header
361
+
362
+ options.apply_defaults timeout: @config.rpcs.get_execution.timeout,
363
+ metadata: metadata,
364
+ retry_policy: @config.rpcs.get_execution.retry_policy
365
+ options.apply_defaults metadata: @config.metadata,
366
+ retry_policy: @config.retry_policy
367
+
368
+ @executions_stub.call_rpc :get_execution, request, options: options do |response, operation|
369
+ yield response, operation if block_given?
370
+ return response
371
+ end
372
+ rescue ::GRPC::BadStatus => e
373
+ raise ::Google::Cloud::Error.from_error(e)
374
+ end
375
+
376
+ ##
377
+ # Cancels an execution of the given name.
378
+ #
379
+ # @overload cancel_execution(request, options = nil)
380
+ # Pass arguments to `cancel_execution` via a request object, either of type
381
+ # {::Google::Cloud::Workflows::Executions::V1beta::CancelExecutionRequest} or an equivalent Hash.
382
+ #
383
+ # @param request [::Google::Cloud::Workflows::Executions::V1beta::CancelExecutionRequest, ::Hash]
384
+ # A request object representing the call parameters. Required. To specify no
385
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
386
+ # @param options [::Gapic::CallOptions, ::Hash]
387
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
388
+ #
389
+ # @overload cancel_execution(name: nil)
390
+ # Pass arguments to `cancel_execution` via keyword arguments. Note that at
391
+ # least one keyword argument is required. To specify no parameters, or to keep all
392
+ # the default parameter values, pass an empty Hash as a request object (see above).
393
+ #
394
+ # @param name [::String]
395
+ # Required. Name of the execution to be cancelled.
396
+ # Format:
397
+ # projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
398
+ #
399
+ # @yield [response, operation] Access the result along with the RPC operation
400
+ # @yieldparam response [::Google::Cloud::Workflows::Executions::V1beta::Execution]
401
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
402
+ #
403
+ # @return [::Google::Cloud::Workflows::Executions::V1beta::Execution]
404
+ #
405
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
406
+ #
407
+ def cancel_execution request, options = nil
408
+ raise ::ArgumentError, "request must be provided" if request.nil?
409
+
410
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1beta::CancelExecutionRequest
411
+
412
+ # Converts hash and nil to an options object
413
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
414
+
415
+ # Customize the options with defaults
416
+ metadata = @config.rpcs.cancel_execution.metadata.to_h
417
+
418
+ # Set x-goog-api-client and x-goog-user-project headers
419
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
420
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
421
+ gapic_version: ::Google::Cloud::Workflows::Executions::V1beta::VERSION
422
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
423
+
424
+ header_params = {
425
+ "name" => request.name
426
+ }
427
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
428
+ metadata[:"x-goog-request-params"] ||= request_params_header
429
+
430
+ options.apply_defaults timeout: @config.rpcs.cancel_execution.timeout,
431
+ metadata: metadata,
432
+ retry_policy: @config.rpcs.cancel_execution.retry_policy
433
+ options.apply_defaults metadata: @config.metadata,
434
+ retry_policy: @config.retry_policy
435
+
436
+ @executions_stub.call_rpc :cancel_execution, request, options: options do |response, operation|
437
+ yield response, operation if block_given?
438
+ return response
439
+ end
440
+ rescue ::GRPC::BadStatus => e
441
+ raise ::Google::Cloud::Error.from_error(e)
442
+ end
443
+
444
+ ##
445
+ # Configuration class for the Executions API.
446
+ #
447
+ # This class represents the configuration for Executions,
448
+ # providing control over timeouts, retry behavior, logging, transport
449
+ # parameters, and other low-level controls. Certain parameters can also be
450
+ # applied individually to specific RPCs. See
451
+ # {::Google::Cloud::Workflows::Executions::V1beta::Executions::Client::Configuration::Rpcs}
452
+ # for a list of RPCs that can be configured independently.
453
+ #
454
+ # Configuration can be applied globally to all clients, or to a single client
455
+ # on construction.
456
+ #
457
+ # # Examples
458
+ #
459
+ # To modify the global config, setting the timeout for list_executions
460
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
461
+ #
462
+ # ::Google::Cloud::Workflows::Executions::V1beta::Executions::Client.configure do |config|
463
+ # config.timeout = 10.0
464
+ # config.rpcs.list_executions.timeout = 20.0
465
+ # end
466
+ #
467
+ # To apply the above configuration only to a new client:
468
+ #
469
+ # client = ::Google::Cloud::Workflows::Executions::V1beta::Executions::Client.new do |config|
470
+ # config.timeout = 10.0
471
+ # config.rpcs.list_executions.timeout = 20.0
472
+ # end
473
+ #
474
+ # @!attribute [rw] endpoint
475
+ # The hostname or hostname:port of the service endpoint.
476
+ # Defaults to `"workflowexecutions.googleapis.com"`.
477
+ # @return [::String]
478
+ # @!attribute [rw] credentials
479
+ # Credentials to send with calls. You may provide any of the following types:
480
+ # * (`String`) The path to a service account key file in JSON format
481
+ # * (`Hash`) A service account key as a Hash
482
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
483
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
484
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
485
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
486
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
487
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
488
+ # * (`nil`) indicating no credentials
489
+ # @return [::Object]
490
+ # @!attribute [rw] scope
491
+ # The OAuth scopes
492
+ # @return [::Array<::String>]
493
+ # @!attribute [rw] lib_name
494
+ # The library name as recorded in instrumentation and logging
495
+ # @return [::String]
496
+ # @!attribute [rw] lib_version
497
+ # The library version as recorded in instrumentation and logging
498
+ # @return [::String]
499
+ # @!attribute [rw] channel_args
500
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
501
+ # `GRPC::Core::Channel` object is provided as the credential.
502
+ # @return [::Hash]
503
+ # @!attribute [rw] interceptors
504
+ # An array of interceptors that are run before calls are executed.
505
+ # @return [::Array<::GRPC::ClientInterceptor>]
506
+ # @!attribute [rw] timeout
507
+ # The call timeout in seconds.
508
+ # @return [::Numeric]
509
+ # @!attribute [rw] metadata
510
+ # Additional gRPC headers to be sent with the call.
511
+ # @return [::Hash{::Symbol=>::String}]
512
+ # @!attribute [rw] retry_policy
513
+ # The retry policy. The value is a hash with the following keys:
514
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
515
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
516
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
517
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
518
+ # trigger a retry.
519
+ # @return [::Hash]
520
+ # @!attribute [rw] quota_project
521
+ # A separate project against which to charge quota.
522
+ # @return [::String]
523
+ #
524
+ class Configuration
525
+ extend ::Gapic::Config
526
+
527
+ config_attr :endpoint, "workflowexecutions.googleapis.com", ::String
528
+ config_attr :credentials, nil do |value|
529
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
530
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
531
+ allowed.any? { |klass| klass === value }
532
+ end
533
+ config_attr :scope, nil, ::String, ::Array, nil
534
+ config_attr :lib_name, nil, ::String, nil
535
+ config_attr :lib_version, nil, ::String, nil
536
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
537
+ config_attr :interceptors, nil, ::Array, nil
538
+ config_attr :timeout, nil, ::Numeric, nil
539
+ config_attr :metadata, nil, ::Hash, nil
540
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
541
+ config_attr :quota_project, nil, ::String, nil
542
+
543
+ # @private
544
+ def initialize parent_config = nil
545
+ @parent_config = parent_config unless parent_config.nil?
546
+
547
+ yield self if block_given?
548
+ end
549
+
550
+ ##
551
+ # Configurations for individual RPCs
552
+ # @return [Rpcs]
553
+ #
554
+ def rpcs
555
+ @rpcs ||= begin
556
+ parent_rpcs = nil
557
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
558
+ Rpcs.new parent_rpcs
559
+ end
560
+ end
561
+
562
+ ##
563
+ # Configuration RPC class for the Executions API.
564
+ #
565
+ # Includes fields providing the configuration for each RPC in this service.
566
+ # Each configuration object is of type `Gapic::Config::Method` and includes
567
+ # the following configuration fields:
568
+ #
569
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
570
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
571
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
572
+ # include the following keys:
573
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
574
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
575
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
576
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
577
+ # trigger a retry.
578
+ #
579
+ class Rpcs
580
+ ##
581
+ # RPC-specific configuration for `list_executions`
582
+ # @return [::Gapic::Config::Method]
583
+ #
584
+ attr_reader :list_executions
585
+ ##
586
+ # RPC-specific configuration for `create_execution`
587
+ # @return [::Gapic::Config::Method]
588
+ #
589
+ attr_reader :create_execution
590
+ ##
591
+ # RPC-specific configuration for `get_execution`
592
+ # @return [::Gapic::Config::Method]
593
+ #
594
+ attr_reader :get_execution
595
+ ##
596
+ # RPC-specific configuration for `cancel_execution`
597
+ # @return [::Gapic::Config::Method]
598
+ #
599
+ attr_reader :cancel_execution
600
+
601
+ # @private
602
+ def initialize parent_rpcs = nil
603
+ list_executions_config = parent_rpcs&.list_executions if parent_rpcs&.respond_to? :list_executions
604
+ @list_executions = ::Gapic::Config::Method.new list_executions_config
605
+ create_execution_config = parent_rpcs&.create_execution if parent_rpcs&.respond_to? :create_execution
606
+ @create_execution = ::Gapic::Config::Method.new create_execution_config
607
+ get_execution_config = parent_rpcs&.get_execution if parent_rpcs&.respond_to? :get_execution
608
+ @get_execution = ::Gapic::Config::Method.new get_execution_config
609
+ cancel_execution_config = parent_rpcs&.cancel_execution if parent_rpcs&.respond_to? :cancel_execution
610
+ @cancel_execution = ::Gapic::Config::Method.new cancel_execution_config
611
+
612
+ yield self if block_given?
613
+ end
614
+ end
615
+ end
616
+ end
617
+ end
618
+ end
619
+ end
620
+ end
621
+ end
622
+ end