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