google-cloud-workflows-executions-v1 0.1.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 +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +201 -0
- data/README.md +139 -0
- data/lib/google/cloud/workflows/executions/v1/executions/client.rb +629 -0
- data/lib/google/cloud/workflows/executions/v1/executions/credentials.rb +53 -0
- data/lib/google/cloud/workflows/executions/v1/executions/paths.rb +75 -0
- data/lib/google/cloud/workflows/executions/v1/executions.rb +52 -0
- data/lib/google/cloud/workflows/executions/v1/executions_pb.rb +81 -0
- data/lib/google/cloud/workflows/executions/v1/executions_services_pb.rb +57 -0
- data/lib/google/cloud/workflows/executions/v1/version.rb +30 -0
- data/lib/google/cloud/workflows/executions/v1.rb +40 -0
- data/lib/google-cloud-workflows-executions-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +71 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/workflows/executions/v1/executions.rb +201 -0
- data/proto_docs/google/protobuf/timestamp.rb +129 -0
- metadata +212 -0
@@ -0,0 +1,629 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/workflows/executions/v1/executions_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Workflows
|
25
|
+
module Executions
|
26
|
+
module V1
|
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.v1.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::V1::Executions::Client::Configuration}
|
44
|
+
# for a description of the configuration fields.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
#
|
48
|
+
# # Modify the configuration for all Executions clients
|
49
|
+
# ::Google::Cloud::Workflows::Executions::V1::Executions::Client.configure do |config|
|
50
|
+
# config.timeout = 10.0
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# @yield [config] Configure the Client client.
|
54
|
+
# @yieldparam config [Client::Configuration]
|
55
|
+
#
|
56
|
+
# @return [Client::Configuration]
|
57
|
+
#
|
58
|
+
def self.configure
|
59
|
+
@configure ||= begin
|
60
|
+
namespace = ["Google", "Cloud", "Workflows", "Executions", "V1"]
|
61
|
+
parent_config = while namespace.any?
|
62
|
+
parent_name = namespace.join "::"
|
63
|
+
parent_const = const_get parent_name
|
64
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
65
|
+
namespace.pop
|
66
|
+
end
|
67
|
+
default_config = Client::Configuration.new parent_config
|
68
|
+
|
69
|
+
default_config
|
70
|
+
end
|
71
|
+
yield @configure if block_given?
|
72
|
+
@configure
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Configure the Executions Client instance.
|
77
|
+
#
|
78
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
79
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
80
|
+
# should be made on {Client.configure}.
|
81
|
+
#
|
82
|
+
# See {::Google::Cloud::Workflows::Executions::V1::Executions::Client::Configuration}
|
83
|
+
# for a description of the configuration fields.
|
84
|
+
#
|
85
|
+
# @yield [config] Configure the Client client.
|
86
|
+
# @yieldparam config [Client::Configuration]
|
87
|
+
#
|
88
|
+
# @return [Client::Configuration]
|
89
|
+
#
|
90
|
+
def configure
|
91
|
+
yield @config if block_given?
|
92
|
+
@config
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Create a new Executions client object.
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
#
|
100
|
+
# # Create a client using the default configuration
|
101
|
+
# client = ::Google::Cloud::Workflows::Executions::V1::Executions::Client.new
|
102
|
+
#
|
103
|
+
# # Create a client using a custom configuration
|
104
|
+
# client = ::Google::Cloud::Workflows::Executions::V1::Executions::Client.new do |config|
|
105
|
+
# config.timeout = 10.0
|
106
|
+
# end
|
107
|
+
#
|
108
|
+
# @yield [config] Configure the Executions client.
|
109
|
+
# @yieldparam config [Client::Configuration]
|
110
|
+
#
|
111
|
+
def initialize
|
112
|
+
# These require statements are intentionally placed here to initialize
|
113
|
+
# the gRPC module only when it's required.
|
114
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
115
|
+
require "gapic/grpc"
|
116
|
+
require "google/cloud/workflows/executions/v1/executions_services_pb"
|
117
|
+
|
118
|
+
# Create the configuration object
|
119
|
+
@config = Configuration.new Client.configure
|
120
|
+
|
121
|
+
# Yield the configuration if needed
|
122
|
+
yield @config if block_given?
|
123
|
+
|
124
|
+
# Create credentials
|
125
|
+
credentials = @config.credentials
|
126
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
127
|
+
# but only if the default endpoint does not have a region prefix.
|
128
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
129
|
+
!@config.endpoint.split(".").first.include?("-")
|
130
|
+
credentials ||= Credentials.default scope: @config.scope,
|
131
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
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::V1::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::V1::ListExecutionsRequest} or an equivalent Hash.
|
158
|
+
#
|
159
|
+
# @param request [::Google::Cloud::Workflows::Executions::V1::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::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.
|
188
|
+
#
|
189
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
190
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1::Execution>]
|
191
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
192
|
+
#
|
193
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Workflows::Executions::V1::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::V1::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::V1::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
|
+
|
224
|
+
options.apply_defaults timeout: @config.timeout,
|
225
|
+
metadata: @config.metadata,
|
226
|
+
retry_policy: @config.retry_policy
|
227
|
+
|
228
|
+
@executions_stub.call_rpc :list_executions, request, options: options do |response, operation|
|
229
|
+
response = ::Gapic::PagedEnumerable.new @executions_stub, :list_executions, request, response, operation, options
|
230
|
+
yield response, operation if block_given?
|
231
|
+
return response
|
232
|
+
end
|
233
|
+
rescue ::GRPC::BadStatus => e
|
234
|
+
raise ::Google::Cloud::Error.from_error(e)
|
235
|
+
end
|
236
|
+
|
237
|
+
##
|
238
|
+
# Creates a new execution using the latest revision of the given workflow.
|
239
|
+
#
|
240
|
+
# @overload create_execution(request, options = nil)
|
241
|
+
# Pass arguments to `create_execution` via a request object, either of type
|
242
|
+
# {::Google::Cloud::Workflows::Executions::V1::CreateExecutionRequest} or an equivalent Hash.
|
243
|
+
#
|
244
|
+
# @param request [::Google::Cloud::Workflows::Executions::V1::CreateExecutionRequest, ::Hash]
|
245
|
+
# A request object representing the call parameters. Required. To specify no
|
246
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
247
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
248
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
249
|
+
#
|
250
|
+
# @overload create_execution(parent: nil, execution: nil)
|
251
|
+
# Pass arguments to `create_execution` via keyword arguments. Note that at
|
252
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
253
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
254
|
+
#
|
255
|
+
# @param parent [::String]
|
256
|
+
# Required. Name of the workflow for which an execution should be created.
|
257
|
+
# Format: projects/\\{project}/locations/\\{location}/workflows/\\{workflow}
|
258
|
+
# The latest revision of the workflow will be used.
|
259
|
+
# @param execution [::Google::Cloud::Workflows::Executions::V1::Execution, ::Hash]
|
260
|
+
# Required. Execution to be created.
|
261
|
+
#
|
262
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
263
|
+
# @yieldparam response [::Google::Cloud::Workflows::Executions::V1::Execution]
|
264
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
265
|
+
#
|
266
|
+
# @return [::Google::Cloud::Workflows::Executions::V1::Execution]
|
267
|
+
#
|
268
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
269
|
+
#
|
270
|
+
def create_execution request, options = nil
|
271
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
272
|
+
|
273
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1::CreateExecutionRequest
|
274
|
+
|
275
|
+
# Converts hash and nil to an options object
|
276
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
277
|
+
|
278
|
+
# Customize the options with defaults
|
279
|
+
metadata = @config.rpcs.create_execution.metadata.to_h
|
280
|
+
|
281
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
282
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
283
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
284
|
+
gapic_version: ::Google::Cloud::Workflows::Executions::V1::VERSION
|
285
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
286
|
+
|
287
|
+
header_params = {
|
288
|
+
"parent" => request.parent
|
289
|
+
}
|
290
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
291
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
292
|
+
|
293
|
+
options.apply_defaults timeout: @config.rpcs.create_execution.timeout,
|
294
|
+
metadata: metadata,
|
295
|
+
retry_policy: @config.rpcs.create_execution.retry_policy
|
296
|
+
|
297
|
+
options.apply_defaults timeout: @config.timeout,
|
298
|
+
metadata: @config.metadata,
|
299
|
+
retry_policy: @config.retry_policy
|
300
|
+
|
301
|
+
@executions_stub.call_rpc :create_execution, request, options: options do |response, operation|
|
302
|
+
yield response, operation if block_given?
|
303
|
+
return response
|
304
|
+
end
|
305
|
+
rescue ::GRPC::BadStatus => e
|
306
|
+
raise ::Google::Cloud::Error.from_error(e)
|
307
|
+
end
|
308
|
+
|
309
|
+
##
|
310
|
+
# Returns an execution of the given name.
|
311
|
+
#
|
312
|
+
# @overload get_execution(request, options = nil)
|
313
|
+
# Pass arguments to `get_execution` via a request object, either of type
|
314
|
+
# {::Google::Cloud::Workflows::Executions::V1::GetExecutionRequest} or an equivalent Hash.
|
315
|
+
#
|
316
|
+
# @param request [::Google::Cloud::Workflows::Executions::V1::GetExecutionRequest, ::Hash]
|
317
|
+
# A request object representing the call parameters. Required. To specify no
|
318
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
319
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
320
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
321
|
+
#
|
322
|
+
# @overload get_execution(name: nil, view: nil)
|
323
|
+
# Pass arguments to `get_execution` via keyword arguments. Note that at
|
324
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
325
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
326
|
+
#
|
327
|
+
# @param name [::String]
|
328
|
+
# Required. Name of the execution to be retrieved.
|
329
|
+
# Format:
|
330
|
+
# projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
|
331
|
+
# @param view [::Google::Cloud::Workflows::Executions::V1::ExecutionView]
|
332
|
+
# Optional. A view defining which fields should be filled in the returned execution.
|
333
|
+
# The API will default to the FULL view.
|
334
|
+
#
|
335
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
336
|
+
# @yieldparam response [::Google::Cloud::Workflows::Executions::V1::Execution]
|
337
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
338
|
+
#
|
339
|
+
# @return [::Google::Cloud::Workflows::Executions::V1::Execution]
|
340
|
+
#
|
341
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
342
|
+
#
|
343
|
+
def get_execution request, options = nil
|
344
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
345
|
+
|
346
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1::GetExecutionRequest
|
347
|
+
|
348
|
+
# Converts hash and nil to an options object
|
349
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
350
|
+
|
351
|
+
# Customize the options with defaults
|
352
|
+
metadata = @config.rpcs.get_execution.metadata.to_h
|
353
|
+
|
354
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
355
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
356
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
357
|
+
gapic_version: ::Google::Cloud::Workflows::Executions::V1::VERSION
|
358
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
359
|
+
|
360
|
+
header_params = {
|
361
|
+
"name" => request.name
|
362
|
+
}
|
363
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
364
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
365
|
+
|
366
|
+
options.apply_defaults timeout: @config.rpcs.get_execution.timeout,
|
367
|
+
metadata: metadata,
|
368
|
+
retry_policy: @config.rpcs.get_execution.retry_policy
|
369
|
+
|
370
|
+
options.apply_defaults timeout: @config.timeout,
|
371
|
+
metadata: @config.metadata,
|
372
|
+
retry_policy: @config.retry_policy
|
373
|
+
|
374
|
+
@executions_stub.call_rpc :get_execution, request, options: options do |response, operation|
|
375
|
+
yield response, operation if block_given?
|
376
|
+
return response
|
377
|
+
end
|
378
|
+
rescue ::GRPC::BadStatus => e
|
379
|
+
raise ::Google::Cloud::Error.from_error(e)
|
380
|
+
end
|
381
|
+
|
382
|
+
##
|
383
|
+
# Cancels an execution of the given name.
|
384
|
+
#
|
385
|
+
# @overload cancel_execution(request, options = nil)
|
386
|
+
# Pass arguments to `cancel_execution` via a request object, either of type
|
387
|
+
# {::Google::Cloud::Workflows::Executions::V1::CancelExecutionRequest} or an equivalent Hash.
|
388
|
+
#
|
389
|
+
# @param request [::Google::Cloud::Workflows::Executions::V1::CancelExecutionRequest, ::Hash]
|
390
|
+
# A request object representing the call parameters. Required. To specify no
|
391
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
392
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
393
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
394
|
+
#
|
395
|
+
# @overload cancel_execution(name: nil)
|
396
|
+
# Pass arguments to `cancel_execution` via keyword arguments. Note that at
|
397
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
398
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
399
|
+
#
|
400
|
+
# @param name [::String]
|
401
|
+
# Required. Name of the execution to be cancelled.
|
402
|
+
# Format:
|
403
|
+
# projects/\\{project}/locations/\\{location}/workflows/\\{workflow}/executions/\\{execution}
|
404
|
+
#
|
405
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
406
|
+
# @yieldparam response [::Google::Cloud::Workflows::Executions::V1::Execution]
|
407
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
408
|
+
#
|
409
|
+
# @return [::Google::Cloud::Workflows::Executions::V1::Execution]
|
410
|
+
#
|
411
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
412
|
+
#
|
413
|
+
def cancel_execution request, options = nil
|
414
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
415
|
+
|
416
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Workflows::Executions::V1::CancelExecutionRequest
|
417
|
+
|
418
|
+
# Converts hash and nil to an options object
|
419
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
420
|
+
|
421
|
+
# Customize the options with defaults
|
422
|
+
metadata = @config.rpcs.cancel_execution.metadata.to_h
|
423
|
+
|
424
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
425
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
426
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
427
|
+
gapic_version: ::Google::Cloud::Workflows::Executions::V1::VERSION
|
428
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
429
|
+
|
430
|
+
header_params = {
|
431
|
+
"name" => request.name
|
432
|
+
}
|
433
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
434
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
435
|
+
|
436
|
+
options.apply_defaults timeout: @config.rpcs.cancel_execution.timeout,
|
437
|
+
metadata: metadata,
|
438
|
+
retry_policy: @config.rpcs.cancel_execution.retry_policy
|
439
|
+
|
440
|
+
options.apply_defaults timeout: @config.timeout,
|
441
|
+
metadata: @config.metadata,
|
442
|
+
retry_policy: @config.retry_policy
|
443
|
+
|
444
|
+
@executions_stub.call_rpc :cancel_execution, request, options: options do |response, operation|
|
445
|
+
yield response, operation if block_given?
|
446
|
+
return response
|
447
|
+
end
|
448
|
+
rescue ::GRPC::BadStatus => e
|
449
|
+
raise ::Google::Cloud::Error.from_error(e)
|
450
|
+
end
|
451
|
+
|
452
|
+
##
|
453
|
+
# Configuration class for the Executions API.
|
454
|
+
#
|
455
|
+
# This class represents the configuration for Executions,
|
456
|
+
# providing control over timeouts, retry behavior, logging, transport
|
457
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
458
|
+
# applied individually to specific RPCs. See
|
459
|
+
# {::Google::Cloud::Workflows::Executions::V1::Executions::Client::Configuration::Rpcs}
|
460
|
+
# for a list of RPCs that can be configured independently.
|
461
|
+
#
|
462
|
+
# Configuration can be applied globally to all clients, or to a single client
|
463
|
+
# on construction.
|
464
|
+
#
|
465
|
+
# @example
|
466
|
+
#
|
467
|
+
# # Modify the global config, setting the timeout for
|
468
|
+
# # list_executions to 20 seconds,
|
469
|
+
# # and all remaining timeouts to 10 seconds.
|
470
|
+
# ::Google::Cloud::Workflows::Executions::V1::Executions::Client.configure do |config|
|
471
|
+
# config.timeout = 10.0
|
472
|
+
# config.rpcs.list_executions.timeout = 20.0
|
473
|
+
# end
|
474
|
+
#
|
475
|
+
# # Apply the above configuration only to a new client.
|
476
|
+
# client = ::Google::Cloud::Workflows::Executions::V1::Executions::Client.new do |config|
|
477
|
+
# config.timeout = 10.0
|
478
|
+
# config.rpcs.list_executions.timeout = 20.0
|
479
|
+
# end
|
480
|
+
#
|
481
|
+
# @!attribute [rw] endpoint
|
482
|
+
# The hostname or hostname:port of the service endpoint.
|
483
|
+
# Defaults to `"workflowexecutions.googleapis.com"`.
|
484
|
+
# @return [::String]
|
485
|
+
# @!attribute [rw] credentials
|
486
|
+
# Credentials to send with calls. You may provide any of the following types:
|
487
|
+
# * (`String`) The path to a service account key file in JSON format
|
488
|
+
# * (`Hash`) A service account key as a Hash
|
489
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
490
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
491
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
492
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
493
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
494
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
495
|
+
# * (`nil`) indicating no credentials
|
496
|
+
# @return [::Object]
|
497
|
+
# @!attribute [rw] scope
|
498
|
+
# The OAuth scopes
|
499
|
+
# @return [::Array<::String>]
|
500
|
+
# @!attribute [rw] lib_name
|
501
|
+
# The library name as recorded in instrumentation and logging
|
502
|
+
# @return [::String]
|
503
|
+
# @!attribute [rw] lib_version
|
504
|
+
# The library version as recorded in instrumentation and logging
|
505
|
+
# @return [::String]
|
506
|
+
# @!attribute [rw] channel_args
|
507
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
508
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
509
|
+
# @return [::Hash]
|
510
|
+
# @!attribute [rw] interceptors
|
511
|
+
# An array of interceptors that are run before calls are executed.
|
512
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
513
|
+
# @!attribute [rw] timeout
|
514
|
+
# The call timeout in seconds.
|
515
|
+
# @return [::Numeric]
|
516
|
+
# @!attribute [rw] metadata
|
517
|
+
# Additional gRPC headers to be sent with the call.
|
518
|
+
# @return [::Hash{::Symbol=>::String}]
|
519
|
+
# @!attribute [rw] retry_policy
|
520
|
+
# The retry policy. The value is a hash with the following keys:
|
521
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
522
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
523
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
524
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
525
|
+
# trigger a retry.
|
526
|
+
# @return [::Hash]
|
527
|
+
# @!attribute [rw] quota_project
|
528
|
+
# A separate project against which to charge quota.
|
529
|
+
# @return [::String]
|
530
|
+
#
|
531
|
+
class Configuration
|
532
|
+
extend ::Gapic::Config
|
533
|
+
|
534
|
+
config_attr :endpoint, "workflowexecutions.googleapis.com", ::String
|
535
|
+
config_attr :credentials, nil do |value|
|
536
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
537
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
538
|
+
allowed.any? { |klass| klass === value }
|
539
|
+
end
|
540
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
541
|
+
config_attr :lib_name, nil, ::String, nil
|
542
|
+
config_attr :lib_version, nil, ::String, nil
|
543
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
544
|
+
config_attr :interceptors, nil, ::Array, nil
|
545
|
+
config_attr :timeout, nil, ::Numeric, nil
|
546
|
+
config_attr :metadata, nil, ::Hash, nil
|
547
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
548
|
+
config_attr :quota_project, nil, ::String, nil
|
549
|
+
|
550
|
+
# @private
|
551
|
+
def initialize parent_config = nil
|
552
|
+
@parent_config = parent_config unless parent_config.nil?
|
553
|
+
|
554
|
+
yield self if block_given?
|
555
|
+
end
|
556
|
+
|
557
|
+
##
|
558
|
+
# Configurations for individual RPCs
|
559
|
+
# @return [Rpcs]
|
560
|
+
#
|
561
|
+
def rpcs
|
562
|
+
@rpcs ||= begin
|
563
|
+
parent_rpcs = nil
|
564
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
565
|
+
Rpcs.new parent_rpcs
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
##
|
570
|
+
# Configuration RPC class for the Executions API.
|
571
|
+
#
|
572
|
+
# Includes fields providing the configuration for each RPC in this service.
|
573
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
574
|
+
# the following configuration fields:
|
575
|
+
#
|
576
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
577
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
578
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
579
|
+
# include the following keys:
|
580
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
581
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
582
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
583
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
584
|
+
# trigger a retry.
|
585
|
+
#
|
586
|
+
class Rpcs
|
587
|
+
##
|
588
|
+
# RPC-specific configuration for `list_executions`
|
589
|
+
# @return [::Gapic::Config::Method]
|
590
|
+
#
|
591
|
+
attr_reader :list_executions
|
592
|
+
##
|
593
|
+
# RPC-specific configuration for `create_execution`
|
594
|
+
# @return [::Gapic::Config::Method]
|
595
|
+
#
|
596
|
+
attr_reader :create_execution
|
597
|
+
##
|
598
|
+
# RPC-specific configuration for `get_execution`
|
599
|
+
# @return [::Gapic::Config::Method]
|
600
|
+
#
|
601
|
+
attr_reader :get_execution
|
602
|
+
##
|
603
|
+
# RPC-specific configuration for `cancel_execution`
|
604
|
+
# @return [::Gapic::Config::Method]
|
605
|
+
#
|
606
|
+
attr_reader :cancel_execution
|
607
|
+
|
608
|
+
# @private
|
609
|
+
def initialize parent_rpcs = nil
|
610
|
+
list_executions_config = parent_rpcs.list_executions if parent_rpcs.respond_to? :list_executions
|
611
|
+
@list_executions = ::Gapic::Config::Method.new list_executions_config
|
612
|
+
create_execution_config = parent_rpcs.create_execution if parent_rpcs.respond_to? :create_execution
|
613
|
+
@create_execution = ::Gapic::Config::Method.new create_execution_config
|
614
|
+
get_execution_config = parent_rpcs.get_execution if parent_rpcs.respond_to? :get_execution
|
615
|
+
@get_execution = ::Gapic::Config::Method.new get_execution_config
|
616
|
+
cancel_execution_config = parent_rpcs.cancel_execution if parent_rpcs.respond_to? :cancel_execution
|
617
|
+
@cancel_execution = ::Gapic::Config::Method.new cancel_execution_config
|
618
|
+
|
619
|
+
yield self if block_given?
|
620
|
+
end
|
621
|
+
end
|
622
|
+
end
|
623
|
+
end
|
624
|
+
end
|
625
|
+
end
|
626
|
+
end
|
627
|
+
end
|
628
|
+
end
|
629
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Workflows
|
24
|
+
module Executions
|
25
|
+
module V1
|
26
|
+
module Executions
|
27
|
+
# Credentials for the Executions API.
|
28
|
+
class Credentials < ::Google::Auth::Credentials
|
29
|
+
self.scope = [
|
30
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
31
|
+
]
|
32
|
+
self.env_vars = [
|
33
|
+
"WORKFLOWS_CREDENTIALS",
|
34
|
+
"WORKFLOWS_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE",
|
37
|
+
"GCLOUD_KEYFILE",
|
38
|
+
"WORKFLOWS_CREDENTIALS_JSON",
|
39
|
+
"WORKFLOWS_KEYFILE_JSON",
|
40
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
41
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
42
|
+
"GCLOUD_KEYFILE_JSON"
|
43
|
+
]
|
44
|
+
self.paths = [
|
45
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
46
|
+
]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|