google-cloud-workflows-v1beta 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +75 -0
- data/lib/google-cloud-workflows-v1beta.rb +21 -0
- data/lib/google/cloud/workflows/v1beta.rb +35 -0
- data/lib/google/cloud/workflows/v1beta/version.rb +28 -0
- data/lib/google/cloud/workflows/v1beta/workflows.rb +52 -0
- data/lib/google/cloud/workflows/v1beta/workflows/client.rb +724 -0
- data/lib/google/cloud/workflows/v1beta/workflows/credentials.rb +51 -0
- data/lib/google/cloud/workflows/v1beta/workflows/operations.rb +570 -0
- data/lib/google/cloud/workflows/v1beta/workflows/paths.rb +69 -0
- data/lib/google/cloud/workflows/v1beta/workflows_pb.rb +86 -0
- data/lib/google/cloud/workflows/v1beta/workflows_services_pb.rb +64 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/workflows/v1beta/workflows.rb +242 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +210 -0
@@ -0,0 +1,51 @@
|
|
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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Workflows
|
24
|
+
module V1beta
|
25
|
+
module Workflows
|
26
|
+
# Credentials for the Workflows API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"WORKFLOWS_CREDENTIALS",
|
33
|
+
"WORKFLOWS_KEYFILE",
|
34
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
35
|
+
"GOOGLE_CLOUD_KEYFILE",
|
36
|
+
"GCLOUD_KEYFILE",
|
37
|
+
"WORKFLOWS_CREDENTIALS_JSON",
|
38
|
+
"WORKFLOWS_KEYFILE_JSON",
|
39
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
40
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
41
|
+
"GCLOUD_KEYFILE_JSON"
|
42
|
+
]
|
43
|
+
self.paths = [
|
44
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
45
|
+
]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,570 @@
|
|
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/operation"
|
20
|
+
require "google/longrunning/operations_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Workflows
|
25
|
+
module V1beta
|
26
|
+
module Workflows
|
27
|
+
# Service that implements Longrunning Operations API.
|
28
|
+
class Operations
|
29
|
+
# @private
|
30
|
+
attr_reader :operations_stub
|
31
|
+
|
32
|
+
##
|
33
|
+
# Configuration for the Workflows Operations API.
|
34
|
+
#
|
35
|
+
# @yield [config] Configure the Operations client.
|
36
|
+
# @yieldparam config [Operations::Configuration]
|
37
|
+
#
|
38
|
+
# @return [Operations::Configuration]
|
39
|
+
#
|
40
|
+
def self.configure
|
41
|
+
@configure ||= Operations::Configuration.new
|
42
|
+
yield @configure if block_given?
|
43
|
+
@configure
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Configure the Workflows Operations instance.
|
48
|
+
#
|
49
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
50
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
51
|
+
# should be made on {Operations.configure}.
|
52
|
+
#
|
53
|
+
# @yield [config] Configure the Operations client.
|
54
|
+
# @yieldparam config [Operations::Configuration]
|
55
|
+
#
|
56
|
+
# @return [Operations::Configuration]
|
57
|
+
#
|
58
|
+
def configure
|
59
|
+
yield @config if block_given?
|
60
|
+
@config
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Create a new Operations client object.
|
65
|
+
#
|
66
|
+
# @yield [config] Configure the Client client.
|
67
|
+
# @yieldparam config [Operations::Configuration]
|
68
|
+
#
|
69
|
+
def initialize
|
70
|
+
# These require statements are intentionally placed here to initialize
|
71
|
+
# the gRPC module only when it's required.
|
72
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
73
|
+
require "gapic/grpc"
|
74
|
+
require "google/longrunning/operations_services_pb"
|
75
|
+
|
76
|
+
# Create the configuration object
|
77
|
+
@config = Configuration.new Operations.configure
|
78
|
+
|
79
|
+
# Yield the configuration if needed
|
80
|
+
yield @config if block_given?
|
81
|
+
|
82
|
+
# Create credentials
|
83
|
+
credentials = @config.credentials
|
84
|
+
credentials ||= Credentials.default scope: @config.scope
|
85
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
86
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
87
|
+
end
|
88
|
+
@quota_project_id = @config.quota_project
|
89
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
90
|
+
|
91
|
+
@operations_stub = ::Gapic::ServiceStub.new(
|
92
|
+
::Google::Longrunning::Operations::Stub,
|
93
|
+
credentials: credentials,
|
94
|
+
endpoint: @config.endpoint,
|
95
|
+
channel_args: @config.channel_args,
|
96
|
+
interceptors: @config.interceptors
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Service calls
|
101
|
+
|
102
|
+
##
|
103
|
+
# Lists operations that match the specified filter in the request. If the
|
104
|
+
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
105
|
+
#
|
106
|
+
# NOTE: the `name` binding below allows API services to override the binding
|
107
|
+
# to use different resource name schemes, such as `users/*/operations`.
|
108
|
+
#
|
109
|
+
# @overload list_operations(request, options = nil)
|
110
|
+
# Pass arguments to `list_operations` via a request object, either of type
|
111
|
+
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
112
|
+
#
|
113
|
+
# @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
|
114
|
+
# A request object representing the call parameters. Required. To specify no
|
115
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
116
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
117
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
118
|
+
#
|
119
|
+
# @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
|
120
|
+
# Pass arguments to `list_operations` via keyword arguments. Note that at
|
121
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
122
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
123
|
+
#
|
124
|
+
# @param name [::String]
|
125
|
+
# The name of the operation collection.
|
126
|
+
# @param filter [::String]
|
127
|
+
# The standard list filter.
|
128
|
+
# @param page_size [::Integer]
|
129
|
+
# The standard list page size.
|
130
|
+
# @param page_token [::String]
|
131
|
+
# The standard list page token.
|
132
|
+
#
|
133
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
134
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
|
135
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
136
|
+
#
|
137
|
+
# @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
|
138
|
+
#
|
139
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
140
|
+
#
|
141
|
+
def list_operations request, options = nil
|
142
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
143
|
+
|
144
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
|
145
|
+
|
146
|
+
# Converts hash and nil to an options object
|
147
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
148
|
+
|
149
|
+
# Customize the options with defaults
|
150
|
+
metadata = @config.rpcs.list_operations.metadata.to_h
|
151
|
+
|
152
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
153
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
154
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
155
|
+
gapic_version: ::Google::Cloud::Workflows::V1beta::VERSION
|
156
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
157
|
+
|
158
|
+
header_params = {
|
159
|
+
"name" => request.name
|
160
|
+
}
|
161
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
162
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
163
|
+
|
164
|
+
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
165
|
+
metadata: metadata,
|
166
|
+
retry_policy: @config.rpcs.list_operations.retry_policy
|
167
|
+
options.apply_defaults metadata: @config.metadata,
|
168
|
+
retry_policy: @config.retry_policy
|
169
|
+
|
170
|
+
@operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
|
171
|
+
wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
|
172
|
+
response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
173
|
+
yield response, operation if block_given?
|
174
|
+
return response
|
175
|
+
end
|
176
|
+
rescue ::GRPC::BadStatus => e
|
177
|
+
raise ::Google::Cloud::Error.from_error(e)
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Gets the latest state of a long-running operation. Clients can use this
|
182
|
+
# method to poll the operation result at intervals as recommended by the API
|
183
|
+
# service.
|
184
|
+
#
|
185
|
+
# @overload get_operation(request, options = nil)
|
186
|
+
# Pass arguments to `get_operation` via a request object, either of type
|
187
|
+
# {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
|
188
|
+
#
|
189
|
+
# @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
|
190
|
+
# A request object representing the call parameters. Required. To specify no
|
191
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
192
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
193
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
194
|
+
#
|
195
|
+
# @overload get_operation(name: nil)
|
196
|
+
# Pass arguments to `get_operation` via keyword arguments. Note that at
|
197
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
198
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
199
|
+
#
|
200
|
+
# @param name [::String]
|
201
|
+
# The name of the operation resource.
|
202
|
+
#
|
203
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
204
|
+
# @yieldparam response [::Gapic::Operation]
|
205
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
206
|
+
#
|
207
|
+
# @return [::Gapic::Operation]
|
208
|
+
#
|
209
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
210
|
+
#
|
211
|
+
def get_operation request, options = nil
|
212
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
213
|
+
|
214
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
|
215
|
+
|
216
|
+
# Converts hash and nil to an options object
|
217
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
218
|
+
|
219
|
+
# Customize the options with defaults
|
220
|
+
metadata = @config.rpcs.get_operation.metadata.to_h
|
221
|
+
|
222
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
223
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
224
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
225
|
+
gapic_version: ::Google::Cloud::Workflows::V1beta::VERSION
|
226
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
227
|
+
|
228
|
+
header_params = {
|
229
|
+
"name" => request.name
|
230
|
+
}
|
231
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
232
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
233
|
+
|
234
|
+
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
235
|
+
metadata: metadata,
|
236
|
+
retry_policy: @config.rpcs.get_operation.retry_policy
|
237
|
+
options.apply_defaults metadata: @config.metadata,
|
238
|
+
retry_policy: @config.retry_policy
|
239
|
+
|
240
|
+
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
241
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
242
|
+
yield response, operation if block_given?
|
243
|
+
return response
|
244
|
+
end
|
245
|
+
rescue ::GRPC::BadStatus => e
|
246
|
+
raise ::Google::Cloud::Error.from_error(e)
|
247
|
+
end
|
248
|
+
|
249
|
+
##
|
250
|
+
# Deletes a long-running operation. This method indicates that the client is
|
251
|
+
# no longer interested in the operation result. It does not cancel the
|
252
|
+
# operation. If the server doesn't support this method, it returns
|
253
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
254
|
+
#
|
255
|
+
# @overload delete_operation(request, options = nil)
|
256
|
+
# Pass arguments to `delete_operation` via a request object, either of type
|
257
|
+
# {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
|
258
|
+
#
|
259
|
+
# @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
|
260
|
+
# A request object representing the call parameters. Required. To specify no
|
261
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
262
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
263
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
264
|
+
#
|
265
|
+
# @overload delete_operation(name: nil)
|
266
|
+
# Pass arguments to `delete_operation` via keyword arguments. Note that at
|
267
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
268
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
269
|
+
#
|
270
|
+
# @param name [::String]
|
271
|
+
# The name of the operation resource to be deleted.
|
272
|
+
#
|
273
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
274
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
275
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
276
|
+
#
|
277
|
+
# @return [::Google::Protobuf::Empty]
|
278
|
+
#
|
279
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
280
|
+
#
|
281
|
+
def delete_operation request, options = nil
|
282
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
283
|
+
|
284
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
|
285
|
+
|
286
|
+
# Converts hash and nil to an options object
|
287
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
288
|
+
|
289
|
+
# Customize the options with defaults
|
290
|
+
metadata = @config.rpcs.delete_operation.metadata.to_h
|
291
|
+
|
292
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
293
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
294
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
295
|
+
gapic_version: ::Google::Cloud::Workflows::V1beta::VERSION
|
296
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
297
|
+
|
298
|
+
header_params = {
|
299
|
+
"name" => request.name
|
300
|
+
}
|
301
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
302
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
303
|
+
|
304
|
+
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
305
|
+
metadata: metadata,
|
306
|
+
retry_policy: @config.rpcs.delete_operation.retry_policy
|
307
|
+
options.apply_defaults metadata: @config.metadata,
|
308
|
+
retry_policy: @config.retry_policy
|
309
|
+
|
310
|
+
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
311
|
+
yield response, operation if block_given?
|
312
|
+
return response
|
313
|
+
end
|
314
|
+
rescue ::GRPC::BadStatus => e
|
315
|
+
raise ::Google::Cloud::Error.from_error(e)
|
316
|
+
end
|
317
|
+
|
318
|
+
##
|
319
|
+
# Starts asynchronous cancellation on a long-running operation. The server
|
320
|
+
# makes a best effort to cancel the operation, but success is not
|
321
|
+
# guaranteed. If the server doesn't support this method, it returns
|
322
|
+
# `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
323
|
+
# Operations.GetOperation or
|
324
|
+
# other methods to check whether the cancellation succeeded or whether the
|
325
|
+
# operation completed despite cancellation. On successful cancellation,
|
326
|
+
# the operation is not deleted; instead, it becomes an operation with
|
327
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
|
328
|
+
# corresponding to `Code.CANCELLED`.
|
329
|
+
#
|
330
|
+
# @overload cancel_operation(request, options = nil)
|
331
|
+
# Pass arguments to `cancel_operation` via a request object, either of type
|
332
|
+
# {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
|
333
|
+
#
|
334
|
+
# @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
|
335
|
+
# A request object representing the call parameters. Required. To specify no
|
336
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
337
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
338
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
339
|
+
#
|
340
|
+
# @overload cancel_operation(name: nil)
|
341
|
+
# Pass arguments to `cancel_operation` via keyword arguments. Note that at
|
342
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
343
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
344
|
+
#
|
345
|
+
# @param name [::String]
|
346
|
+
# The name of the operation resource to be cancelled.
|
347
|
+
#
|
348
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
349
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
350
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
351
|
+
#
|
352
|
+
# @return [::Google::Protobuf::Empty]
|
353
|
+
#
|
354
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
355
|
+
#
|
356
|
+
def cancel_operation request, options = nil
|
357
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
358
|
+
|
359
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
|
360
|
+
|
361
|
+
# Converts hash and nil to an options object
|
362
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
363
|
+
|
364
|
+
# Customize the options with defaults
|
365
|
+
metadata = @config.rpcs.cancel_operation.metadata.to_h
|
366
|
+
|
367
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
368
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
369
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
370
|
+
gapic_version: ::Google::Cloud::Workflows::V1beta::VERSION
|
371
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
372
|
+
|
373
|
+
header_params = {
|
374
|
+
"name" => request.name
|
375
|
+
}
|
376
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
377
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
378
|
+
|
379
|
+
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
380
|
+
metadata: metadata,
|
381
|
+
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
382
|
+
options.apply_defaults metadata: @config.metadata,
|
383
|
+
retry_policy: @config.retry_policy
|
384
|
+
|
385
|
+
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
386
|
+
yield response, operation if block_given?
|
387
|
+
return response
|
388
|
+
end
|
389
|
+
rescue ::GRPC::BadStatus => e
|
390
|
+
raise ::Google::Cloud::Error.from_error(e)
|
391
|
+
end
|
392
|
+
|
393
|
+
##
|
394
|
+
# Configuration class for the Operations API.
|
395
|
+
#
|
396
|
+
# This class represents the configuration for Operations,
|
397
|
+
# providing control over timeouts, retry behavior, logging, transport
|
398
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
399
|
+
# applied individually to specific RPCs. See
|
400
|
+
# {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
|
401
|
+
# for a list of RPCs that can be configured independently.
|
402
|
+
#
|
403
|
+
# Configuration can be applied globally to all clients, or to a single client
|
404
|
+
# on construction.
|
405
|
+
#
|
406
|
+
# # Examples
|
407
|
+
#
|
408
|
+
# To modify the global config, setting the timeout for list_operations
|
409
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
410
|
+
#
|
411
|
+
# ::Google::Longrunning::Operations::Client.configure do |config|
|
412
|
+
# config.timeout = 10.0
|
413
|
+
# config.rpcs.list_operations.timeout = 20.0
|
414
|
+
# end
|
415
|
+
#
|
416
|
+
# To apply the above configuration only to a new client:
|
417
|
+
#
|
418
|
+
# client = ::Google::Longrunning::Operations::Client.new do |config|
|
419
|
+
# config.timeout = 10.0
|
420
|
+
# config.rpcs.list_operations.timeout = 20.0
|
421
|
+
# end
|
422
|
+
#
|
423
|
+
# @!attribute [rw] endpoint
|
424
|
+
# The hostname or hostname:port of the service endpoint.
|
425
|
+
# Defaults to `"workflows.googleapis.com"`.
|
426
|
+
# @return [::String]
|
427
|
+
# @!attribute [rw] credentials
|
428
|
+
# Credentials to send with calls. You may provide any of the following types:
|
429
|
+
# * (`String`) The path to a service account key file in JSON format
|
430
|
+
# * (`Hash`) A service account key as a Hash
|
431
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
432
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
433
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
434
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
435
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
436
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
437
|
+
# * (`nil`) indicating no credentials
|
438
|
+
# @return [::Object]
|
439
|
+
# @!attribute [rw] scope
|
440
|
+
# The OAuth scopes
|
441
|
+
# @return [::Array<::String>]
|
442
|
+
# @!attribute [rw] lib_name
|
443
|
+
# The library name as recorded in instrumentation and logging
|
444
|
+
# @return [::String]
|
445
|
+
# @!attribute [rw] lib_version
|
446
|
+
# The library version as recorded in instrumentation and logging
|
447
|
+
# @return [::String]
|
448
|
+
# @!attribute [rw] channel_args
|
449
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
450
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
451
|
+
# @return [::Hash]
|
452
|
+
# @!attribute [rw] interceptors
|
453
|
+
# An array of interceptors that are run before calls are executed.
|
454
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
455
|
+
# @!attribute [rw] timeout
|
456
|
+
# The call timeout in seconds.
|
457
|
+
# @return [::Numeric]
|
458
|
+
# @!attribute [rw] metadata
|
459
|
+
# Additional gRPC headers to be sent with the call.
|
460
|
+
# @return [::Hash{::Symbol=>::String}]
|
461
|
+
# @!attribute [rw] retry_policy
|
462
|
+
# The retry policy. The value is a hash with the following keys:
|
463
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
464
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
465
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
466
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
467
|
+
# trigger a retry.
|
468
|
+
# @return [::Hash]
|
469
|
+
# @!attribute [rw] quota_project
|
470
|
+
# A separate project against which to charge quota.
|
471
|
+
# @return [::String]
|
472
|
+
#
|
473
|
+
class Configuration
|
474
|
+
extend ::Gapic::Config
|
475
|
+
|
476
|
+
config_attr :endpoint, "workflows.googleapis.com", ::String
|
477
|
+
config_attr :credentials, nil do |value|
|
478
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
479
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
480
|
+
allowed.any? { |klass| klass === value }
|
481
|
+
end
|
482
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
483
|
+
config_attr :lib_name, nil, ::String, nil
|
484
|
+
config_attr :lib_version, nil, ::String, nil
|
485
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
486
|
+
config_attr :interceptors, nil, ::Array, nil
|
487
|
+
config_attr :timeout, nil, ::Numeric, nil
|
488
|
+
config_attr :metadata, nil, ::Hash, nil
|
489
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
490
|
+
config_attr :quota_project, nil, ::String, nil
|
491
|
+
|
492
|
+
# @private
|
493
|
+
def initialize parent_config = nil
|
494
|
+
@parent_config = parent_config unless parent_config.nil?
|
495
|
+
|
496
|
+
yield self if block_given?
|
497
|
+
end
|
498
|
+
|
499
|
+
##
|
500
|
+
# Configurations for individual RPCs
|
501
|
+
# @return [Rpcs]
|
502
|
+
#
|
503
|
+
def rpcs
|
504
|
+
@rpcs ||= begin
|
505
|
+
parent_rpcs = nil
|
506
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
507
|
+
Rpcs.new parent_rpcs
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
511
|
+
##
|
512
|
+
# Configuration RPC class for the Operations API.
|
513
|
+
#
|
514
|
+
# Includes fields providing the configuration for each RPC in this service.
|
515
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
|
+
# the following configuration fields:
|
517
|
+
#
|
518
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
519
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
|
+
# include the following keys:
|
522
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
523
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
524
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
525
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
526
|
+
# trigger a retry.
|
527
|
+
#
|
528
|
+
class Rpcs
|
529
|
+
##
|
530
|
+
# RPC-specific configuration for `list_operations`
|
531
|
+
# @return [::Gapic::Config::Method]
|
532
|
+
#
|
533
|
+
attr_reader :list_operations
|
534
|
+
##
|
535
|
+
# RPC-specific configuration for `get_operation`
|
536
|
+
# @return [::Gapic::Config::Method]
|
537
|
+
#
|
538
|
+
attr_reader :get_operation
|
539
|
+
##
|
540
|
+
# RPC-specific configuration for `delete_operation`
|
541
|
+
# @return [::Gapic::Config::Method]
|
542
|
+
#
|
543
|
+
attr_reader :delete_operation
|
544
|
+
##
|
545
|
+
# RPC-specific configuration for `cancel_operation`
|
546
|
+
# @return [::Gapic::Config::Method]
|
547
|
+
#
|
548
|
+
attr_reader :cancel_operation
|
549
|
+
|
550
|
+
# @private
|
551
|
+
def initialize parent_rpcs = nil
|
552
|
+
list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
|
553
|
+
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
554
|
+
get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
|
555
|
+
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
556
|
+
delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
|
557
|
+
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
558
|
+
cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
|
559
|
+
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
560
|
+
|
561
|
+
yield self if block_given?
|
562
|
+
end
|
563
|
+
end
|
564
|
+
end
|
565
|
+
end
|
566
|
+
end
|
567
|
+
end
|
568
|
+
end
|
569
|
+
end
|
570
|
+
end
|