google-cloud-dataform-v1 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +4 -4
- data/README.md +5 -5
- data/lib/google/cloud/dataform/v1/bindings_override.rb +0 -57
- data/lib/google/cloud/dataform/v1/dataform/client.rb +2061 -48
- data/lib/google/cloud/dataform/v1/dataform/operations.rb +843 -0
- data/lib/google/cloud/dataform/v1/dataform/paths.rb +38 -0
- data/lib/google/cloud/dataform/v1/dataform/rest/client.rb +1944 -65
- data/lib/google/cloud/dataform/v1/dataform/rest/operations.rb +927 -0
- data/lib/google/cloud/dataform/v1/dataform/rest/service_stub.rb +1719 -481
- data/lib/google/cloud/dataform/v1/dataform/rest.rb +1 -0
- data/lib/google/cloud/dataform/v1/dataform.rb +1 -0
- data/lib/google/cloud/dataform/v1/dataform_pb.rb +44 -28
- data/lib/google/cloud/dataform/v1/dataform_services_pb.rb +54 -0
- data/lib/google/cloud/dataform/v1/version.rb +1 -1
- data/lib/google/longrunning/bindings_override.rb +71 -0
- data/lib/google/longrunning/operations/client.rb +954 -0
- data/lib/google/longrunning/operations/credentials.rb +40 -0
- data/lib/google/longrunning/operations/operations.rb +839 -0
- data/lib/google/longrunning/operations/rest/client.rb +777 -0
- data/lib/google/longrunning/operations/rest/operations.rb +923 -0
- data/lib/google/longrunning/operations/rest/service_stub.rb +322 -0
- data/lib/google/longrunning/operations/rest.rb +57 -0
- data/lib/google/longrunning/operations.rb +59 -0
- data/lib/google/longrunning/rest.rb +34 -0
- data/lib/google/longrunning.rb +41 -0
- data/lib/google-cloud-dataform-v1.rb +1 -0
- data/proto_docs/google/api/client.rb +149 -29
- data/proto_docs/google/cloud/dataform/v1/dataform.rb +759 -3
- data/proto_docs/google/longrunning/operations.rb +191 -0
- metadata +18 -4
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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/longrunning/operations_pb"
|
|
21
|
+
require "google/longrunning/operations/rest/service_stub"
|
|
22
|
+
require "google/cloud/location/rest"
|
|
23
|
+
require "google/iam/v1/rest"
|
|
24
|
+
|
|
25
|
+
module Google
|
|
26
|
+
module Longrunning
|
|
27
|
+
module Operations
|
|
28
|
+
module Rest
|
|
29
|
+
##
|
|
30
|
+
# REST client for the Operations service.
|
|
31
|
+
#
|
|
32
|
+
# Manages long-running operations with an API service.
|
|
33
|
+
#
|
|
34
|
+
# When an API method normally takes long time to complete, it can be designed
|
|
35
|
+
# to return {::Google::Longrunning::Operation Operation} to the client, and the
|
|
36
|
+
# client can use this interface to receive the real response asynchronously by
|
|
37
|
+
# polling the operation resource, or pass the operation resource to another API
|
|
38
|
+
# (such as Pub/Sub API) to receive the response. Any API service that returns
|
|
39
|
+
# long-running operations should implement the `Operations` interface so
|
|
40
|
+
# developers can have a consistent client experience.
|
|
41
|
+
#
|
|
42
|
+
class Client
|
|
43
|
+
# @private
|
|
44
|
+
API_VERSION = ""
|
|
45
|
+
|
|
46
|
+
# @private
|
|
47
|
+
DEFAULT_ENDPOINT_TEMPLATE = "longrunning.$UNIVERSE_DOMAIN$"
|
|
48
|
+
|
|
49
|
+
# @private
|
|
50
|
+
attr_reader :operations_stub
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
# Configure the Operations Client class.
|
|
54
|
+
#
|
|
55
|
+
# See {::Google::Longrunning::Operations::Rest::Client::Configuration}
|
|
56
|
+
# for a description of the configuration fields.
|
|
57
|
+
#
|
|
58
|
+
# @example
|
|
59
|
+
#
|
|
60
|
+
# # Modify the configuration for all Operations clients
|
|
61
|
+
# ::Google::Longrunning::Operations::Rest::Client.configure do |config|
|
|
62
|
+
# config.timeout = 10.0
|
|
63
|
+
# end
|
|
64
|
+
#
|
|
65
|
+
# @yield [config] Configure the Client client.
|
|
66
|
+
# @yieldparam config [Client::Configuration]
|
|
67
|
+
#
|
|
68
|
+
# @return [Client::Configuration]
|
|
69
|
+
#
|
|
70
|
+
def self.configure
|
|
71
|
+
@configure ||= begin
|
|
72
|
+
namespace = ["Google", "Longrunning"]
|
|
73
|
+
parent_config = while namespace.any?
|
|
74
|
+
parent_name = namespace.join "::"
|
|
75
|
+
parent_const = const_get parent_name
|
|
76
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
77
|
+
namespace.pop
|
|
78
|
+
end
|
|
79
|
+
default_config = Client::Configuration.new parent_config
|
|
80
|
+
|
|
81
|
+
default_config
|
|
82
|
+
end
|
|
83
|
+
yield @configure if block_given?
|
|
84
|
+
@configure
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
##
|
|
88
|
+
# Configure the Operations Client instance.
|
|
89
|
+
#
|
|
90
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
91
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
92
|
+
# should be made on {Client.configure}.
|
|
93
|
+
#
|
|
94
|
+
# See {::Google::Longrunning::Operations::Rest::Client::Configuration}
|
|
95
|
+
# for a description of the configuration fields.
|
|
96
|
+
#
|
|
97
|
+
# @yield [config] Configure the Client client.
|
|
98
|
+
# @yieldparam config [Client::Configuration]
|
|
99
|
+
#
|
|
100
|
+
# @return [Client::Configuration]
|
|
101
|
+
#
|
|
102
|
+
def configure
|
|
103
|
+
yield @config if block_given?
|
|
104
|
+
@config
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
##
|
|
108
|
+
# The effective universe domain
|
|
109
|
+
#
|
|
110
|
+
# @return [String]
|
|
111
|
+
#
|
|
112
|
+
def universe_domain
|
|
113
|
+
@operations_stub.universe_domain
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
##
|
|
117
|
+
# Create a new Operations REST client object.
|
|
118
|
+
#
|
|
119
|
+
# @example
|
|
120
|
+
#
|
|
121
|
+
# # Create a client using the default configuration
|
|
122
|
+
# client = ::Google::Longrunning::Operations::Rest::Client.new
|
|
123
|
+
#
|
|
124
|
+
# # Create a client using a custom configuration
|
|
125
|
+
# client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
|
|
126
|
+
# config.timeout = 10.0
|
|
127
|
+
# end
|
|
128
|
+
#
|
|
129
|
+
# @yield [config] Configure the Operations client.
|
|
130
|
+
# @yieldparam config [Client::Configuration]
|
|
131
|
+
#
|
|
132
|
+
def initialize
|
|
133
|
+
# Create the configuration object
|
|
134
|
+
@config = Configuration.new Client.configure
|
|
135
|
+
|
|
136
|
+
# Yield the configuration if needed
|
|
137
|
+
yield @config if block_given?
|
|
138
|
+
|
|
139
|
+
# Create credentials
|
|
140
|
+
credentials = @config.credentials
|
|
141
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
142
|
+
# but only if the default endpoint does not have a region prefix.
|
|
143
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
144
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
145
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
146
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
147
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
148
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
149
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
@quota_project_id = @config.quota_project
|
|
153
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
154
|
+
|
|
155
|
+
@operations_client = ::Google::Longrunning::Operations::Rest::Operations.new do |config|
|
|
156
|
+
config.credentials = credentials
|
|
157
|
+
config.quota_project = @quota_project_id
|
|
158
|
+
config.endpoint = @config.endpoint
|
|
159
|
+
config.universe_domain = @config.universe_domain
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
@operations_stub = ::Google::Longrunning::Operations::Rest::ServiceStub.new(
|
|
163
|
+
endpoint: @config.endpoint,
|
|
164
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
165
|
+
universe_domain: @config.universe_domain,
|
|
166
|
+
credentials: credentials,
|
|
167
|
+
logger: @config.logger
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
@operations_stub.logger(stub: true)&.info do |entry|
|
|
171
|
+
entry.set_system_name
|
|
172
|
+
entry.set_service
|
|
173
|
+
entry.message = "Created client for #{entry.service}"
|
|
174
|
+
entry.set_credentials_fields credentials
|
|
175
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
176
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
177
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
|
181
|
+
config.credentials = credentials
|
|
182
|
+
config.quota_project = @quota_project_id
|
|
183
|
+
config.endpoint = @operations_stub.endpoint
|
|
184
|
+
config.universe_domain = @operations_stub.universe_domain
|
|
185
|
+
config.logger = @operations_stub.logger if config.respond_to? :logger=
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
@iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
|
189
|
+
config.credentials = credentials
|
|
190
|
+
config.quota_project = @quota_project_id
|
|
191
|
+
config.endpoint = @operations_stub.endpoint
|
|
192
|
+
config.universe_domain = @operations_stub.universe_domain
|
|
193
|
+
config.logger = @operations_stub.logger if config.respond_to? :logger=
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
##
|
|
198
|
+
# Get the associated client for long-running operations.
|
|
199
|
+
#
|
|
200
|
+
# @return [::Google::Longrunning::Operations::Rest::Operations]
|
|
201
|
+
#
|
|
202
|
+
attr_reader :operations_client
|
|
203
|
+
|
|
204
|
+
##
|
|
205
|
+
# Get the associated client for mix-in of the Locations.
|
|
206
|
+
#
|
|
207
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
|
208
|
+
#
|
|
209
|
+
attr_reader :location_client
|
|
210
|
+
|
|
211
|
+
##
|
|
212
|
+
# Get the associated client for mix-in of the IAMPolicy.
|
|
213
|
+
#
|
|
214
|
+
# @return [Google::Iam::V1::IAMPolicy::Rest::Client]
|
|
215
|
+
#
|
|
216
|
+
attr_reader :iam_policy_client
|
|
217
|
+
|
|
218
|
+
##
|
|
219
|
+
# The logger used for request/response debug logging.
|
|
220
|
+
#
|
|
221
|
+
# @return [Logger]
|
|
222
|
+
#
|
|
223
|
+
def logger
|
|
224
|
+
@operations_stub.logger
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Service calls
|
|
228
|
+
|
|
229
|
+
##
|
|
230
|
+
# Lists operations that match the specified filter in the request. If the
|
|
231
|
+
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
|
232
|
+
#
|
|
233
|
+
# @overload list_operations(request, options = nil)
|
|
234
|
+
# Pass arguments to `list_operations` via a request object, either of type
|
|
235
|
+
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
|
236
|
+
#
|
|
237
|
+
# @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
|
|
238
|
+
# A request object representing the call parameters. Required. To specify no
|
|
239
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
240
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
241
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
242
|
+
#
|
|
243
|
+
# @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil)
|
|
244
|
+
# Pass arguments to `list_operations` via keyword arguments. Note that at
|
|
245
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
246
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
247
|
+
#
|
|
248
|
+
# @param name [::String]
|
|
249
|
+
# The name of the operation's parent resource.
|
|
250
|
+
# @param filter [::String]
|
|
251
|
+
# The standard list filter.
|
|
252
|
+
# @param page_size [::Integer]
|
|
253
|
+
# The standard list page size.
|
|
254
|
+
# @param page_token [::String]
|
|
255
|
+
# The standard list page token.
|
|
256
|
+
# @param return_partial_success [::Boolean]
|
|
257
|
+
# When set to `true`, operations that are reachable are returned as normal,
|
|
258
|
+
# and those that are unreachable are returned in the
|
|
259
|
+
# [ListOperationsResponse.unreachable] field.
|
|
260
|
+
#
|
|
261
|
+
# This can only be `true` when reading across collections e.g. when `parent`
|
|
262
|
+
# is set to `"projects/example/locations/-"`.
|
|
263
|
+
#
|
|
264
|
+
# This field is not by default supported and will result in an
|
|
265
|
+
# `UNIMPLEMENTED` error if set unless explicitly documented otherwise in
|
|
266
|
+
# service or product specific documentation.
|
|
267
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
268
|
+
# @yieldparam result [::Gapic::Operation]
|
|
269
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
270
|
+
#
|
|
271
|
+
# @return [::Gapic::Operation]
|
|
272
|
+
#
|
|
273
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
274
|
+
#
|
|
275
|
+
# @example Basic example
|
|
276
|
+
# require "google/longrunning"
|
|
277
|
+
#
|
|
278
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
279
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
|
280
|
+
#
|
|
281
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
282
|
+
# request = Google::Longrunning::ListOperationsRequest.new
|
|
283
|
+
#
|
|
284
|
+
# # Call the list_operations method.
|
|
285
|
+
# result = client.list_operations request
|
|
286
|
+
#
|
|
287
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
288
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
289
|
+
# result.each do |item|
|
|
290
|
+
# # Each element is of type ::Google::Longrunning::Operation.
|
|
291
|
+
# p item
|
|
292
|
+
# end
|
|
293
|
+
#
|
|
294
|
+
def list_operations request, options = nil
|
|
295
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
296
|
+
|
|
297
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
|
|
298
|
+
|
|
299
|
+
# Converts hash and nil to an options object
|
|
300
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
301
|
+
|
|
302
|
+
# Customize the options with defaults
|
|
303
|
+
call_metadata = @config.rpcs.list_operations.metadata.to_h
|
|
304
|
+
|
|
305
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
306
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
307
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
308
|
+
gapic_version: ::Google::Cloud::Dataform::V1::VERSION,
|
|
309
|
+
transports_version_send: [:rest]
|
|
310
|
+
|
|
311
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
312
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
313
|
+
|
|
314
|
+
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
|
315
|
+
metadata: call_metadata,
|
|
316
|
+
retry_policy: @config.rpcs.list_operations.retry_policy
|
|
317
|
+
|
|
318
|
+
options.apply_defaults timeout: @config.timeout,
|
|
319
|
+
metadata: @config.metadata,
|
|
320
|
+
retry_policy: @config.retry_policy
|
|
321
|
+
|
|
322
|
+
@operations_stub.list_operations request, options do |result, operation|
|
|
323
|
+
result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
|
|
324
|
+
yield result, operation if block_given?
|
|
325
|
+
throw :response, result
|
|
326
|
+
end
|
|
327
|
+
rescue ::Gapic::Rest::Error => e
|
|
328
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
##
|
|
332
|
+
# Gets the latest state of a long-running operation. Clients can use this
|
|
333
|
+
# method to poll the operation result at intervals as recommended by the API
|
|
334
|
+
# service.
|
|
335
|
+
#
|
|
336
|
+
# @overload get_operation(request, options = nil)
|
|
337
|
+
# Pass arguments to `get_operation` via a request object, either of type
|
|
338
|
+
# {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
|
|
339
|
+
#
|
|
340
|
+
# @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
|
|
341
|
+
# A request object representing the call parameters. Required. To specify no
|
|
342
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
343
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
344
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
345
|
+
#
|
|
346
|
+
# @overload get_operation(name: nil)
|
|
347
|
+
# Pass arguments to `get_operation` via keyword arguments. Note that at
|
|
348
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
349
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
350
|
+
#
|
|
351
|
+
# @param name [::String]
|
|
352
|
+
# The name of the operation resource.
|
|
353
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
354
|
+
# @yieldparam result [::Gapic::Operation]
|
|
355
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
356
|
+
#
|
|
357
|
+
# @return [::Gapic::Operation]
|
|
358
|
+
#
|
|
359
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
360
|
+
#
|
|
361
|
+
# @example Basic example
|
|
362
|
+
# require "google/longrunning"
|
|
363
|
+
#
|
|
364
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
365
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
|
366
|
+
#
|
|
367
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
368
|
+
# request = Google::Longrunning::GetOperationRequest.new
|
|
369
|
+
#
|
|
370
|
+
# # Call the get_operation method.
|
|
371
|
+
# result = client.get_operation request
|
|
372
|
+
#
|
|
373
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
374
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
375
|
+
# # Here is how to wait for a response.
|
|
376
|
+
# result.wait_until_done! timeout: 60
|
|
377
|
+
# if result.response?
|
|
378
|
+
# p result.response
|
|
379
|
+
# else
|
|
380
|
+
# puts "No response received."
|
|
381
|
+
# end
|
|
382
|
+
#
|
|
383
|
+
def get_operation request, options = nil
|
|
384
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
385
|
+
|
|
386
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
|
|
387
|
+
|
|
388
|
+
# Converts hash and nil to an options object
|
|
389
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
390
|
+
|
|
391
|
+
# Customize the options with defaults
|
|
392
|
+
call_metadata = @config.rpcs.get_operation.metadata.to_h
|
|
393
|
+
|
|
394
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
395
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
396
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
397
|
+
gapic_version: ::Google::Cloud::Dataform::V1::VERSION,
|
|
398
|
+
transports_version_send: [:rest]
|
|
399
|
+
|
|
400
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
401
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
402
|
+
|
|
403
|
+
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
|
404
|
+
metadata: call_metadata,
|
|
405
|
+
retry_policy: @config.rpcs.get_operation.retry_policy
|
|
406
|
+
|
|
407
|
+
options.apply_defaults timeout: @config.timeout,
|
|
408
|
+
metadata: @config.metadata,
|
|
409
|
+
retry_policy: @config.retry_policy
|
|
410
|
+
|
|
411
|
+
@operations_stub.get_operation request, options do |result, operation|
|
|
412
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
413
|
+
yield result, operation if block_given?
|
|
414
|
+
throw :response, result
|
|
415
|
+
end
|
|
416
|
+
rescue ::Gapic::Rest::Error => e
|
|
417
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
##
|
|
421
|
+
# Deletes a long-running operation. This method indicates that the client is
|
|
422
|
+
# no longer interested in the operation result. It does not cancel the
|
|
423
|
+
# operation. If the server doesn't support this method, it returns
|
|
424
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
|
425
|
+
#
|
|
426
|
+
# @overload delete_operation(request, options = nil)
|
|
427
|
+
# Pass arguments to `delete_operation` via a request object, either of type
|
|
428
|
+
# {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
|
|
429
|
+
#
|
|
430
|
+
# @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
|
|
431
|
+
# A request object representing the call parameters. Required. To specify no
|
|
432
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
433
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
434
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
435
|
+
#
|
|
436
|
+
# @overload delete_operation(name: nil)
|
|
437
|
+
# Pass arguments to `delete_operation` via keyword arguments. Note that at
|
|
438
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
439
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
440
|
+
#
|
|
441
|
+
# @param name [::String]
|
|
442
|
+
# The name of the operation resource to be deleted.
|
|
443
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
444
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
|
445
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
446
|
+
#
|
|
447
|
+
# @return [::Google::Protobuf::Empty]
|
|
448
|
+
#
|
|
449
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
450
|
+
#
|
|
451
|
+
# @example Basic example
|
|
452
|
+
# require "google/longrunning"
|
|
453
|
+
#
|
|
454
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
455
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
|
456
|
+
#
|
|
457
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
458
|
+
# request = Google::Longrunning::DeleteOperationRequest.new
|
|
459
|
+
#
|
|
460
|
+
# # Call the delete_operation method.
|
|
461
|
+
# result = client.delete_operation request
|
|
462
|
+
#
|
|
463
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
|
464
|
+
# p result
|
|
465
|
+
#
|
|
466
|
+
def delete_operation request, options = nil
|
|
467
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
468
|
+
|
|
469
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
|
|
470
|
+
|
|
471
|
+
# Converts hash and nil to an options object
|
|
472
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
473
|
+
|
|
474
|
+
# Customize the options with defaults
|
|
475
|
+
call_metadata = @config.rpcs.delete_operation.metadata.to_h
|
|
476
|
+
|
|
477
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
478
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
479
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
480
|
+
gapic_version: ::Google::Cloud::Dataform::V1::VERSION,
|
|
481
|
+
transports_version_send: [:rest]
|
|
482
|
+
|
|
483
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
484
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
485
|
+
|
|
486
|
+
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
|
487
|
+
metadata: call_metadata,
|
|
488
|
+
retry_policy: @config.rpcs.delete_operation.retry_policy
|
|
489
|
+
|
|
490
|
+
options.apply_defaults timeout: @config.timeout,
|
|
491
|
+
metadata: @config.metadata,
|
|
492
|
+
retry_policy: @config.retry_policy
|
|
493
|
+
|
|
494
|
+
@operations_stub.delete_operation request, options do |result, operation|
|
|
495
|
+
yield result, operation if block_given?
|
|
496
|
+
end
|
|
497
|
+
rescue ::Gapic::Rest::Error => e
|
|
498
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
##
|
|
502
|
+
# Starts asynchronous cancellation on a long-running operation. The server
|
|
503
|
+
# makes a best effort to cancel the operation, but success is not
|
|
504
|
+
# guaranteed. If the server doesn't support this method, it returns
|
|
505
|
+
# `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
|
506
|
+
# Operations.GetOperation or
|
|
507
|
+
# other methods to check whether the cancellation succeeded or whether the
|
|
508
|
+
# operation completed despite cancellation. On successful cancellation,
|
|
509
|
+
# the operation is not deleted; instead, it becomes an operation with
|
|
510
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
|
511
|
+
# {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
|
|
512
|
+
# `Code.CANCELLED`.
|
|
513
|
+
#
|
|
514
|
+
# @overload cancel_operation(request, options = nil)
|
|
515
|
+
# Pass arguments to `cancel_operation` via a request object, either of type
|
|
516
|
+
# {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
|
|
517
|
+
#
|
|
518
|
+
# @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
|
|
519
|
+
# A request object representing the call parameters. Required. To specify no
|
|
520
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
521
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
522
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
523
|
+
#
|
|
524
|
+
# @overload cancel_operation(name: nil)
|
|
525
|
+
# Pass arguments to `cancel_operation` via keyword arguments. Note that at
|
|
526
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
527
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
528
|
+
#
|
|
529
|
+
# @param name [::String]
|
|
530
|
+
# The name of the operation resource to be cancelled.
|
|
531
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
532
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
|
533
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
534
|
+
#
|
|
535
|
+
# @return [::Google::Protobuf::Empty]
|
|
536
|
+
#
|
|
537
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
538
|
+
#
|
|
539
|
+
# @example Basic example
|
|
540
|
+
# require "google/longrunning"
|
|
541
|
+
#
|
|
542
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
543
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
|
544
|
+
#
|
|
545
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
546
|
+
# request = Google::Longrunning::CancelOperationRequest.new
|
|
547
|
+
#
|
|
548
|
+
# # Call the cancel_operation method.
|
|
549
|
+
# result = client.cancel_operation request
|
|
550
|
+
#
|
|
551
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
|
552
|
+
# p result
|
|
553
|
+
#
|
|
554
|
+
def cancel_operation request, options = nil
|
|
555
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
556
|
+
|
|
557
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
|
|
558
|
+
|
|
559
|
+
# Converts hash and nil to an options object
|
|
560
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
561
|
+
|
|
562
|
+
# Customize the options with defaults
|
|
563
|
+
call_metadata = @config.rpcs.cancel_operation.metadata.to_h
|
|
564
|
+
|
|
565
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
566
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
567
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
568
|
+
gapic_version: ::Google::Cloud::Dataform::V1::VERSION,
|
|
569
|
+
transports_version_send: [:rest]
|
|
570
|
+
|
|
571
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
572
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
573
|
+
|
|
574
|
+
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
|
575
|
+
metadata: call_metadata,
|
|
576
|
+
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
|
577
|
+
|
|
578
|
+
options.apply_defaults timeout: @config.timeout,
|
|
579
|
+
metadata: @config.metadata,
|
|
580
|
+
retry_policy: @config.retry_policy
|
|
581
|
+
|
|
582
|
+
@operations_stub.cancel_operation request, options do |result, operation|
|
|
583
|
+
yield result, operation if block_given?
|
|
584
|
+
end
|
|
585
|
+
rescue ::Gapic::Rest::Error => e
|
|
586
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
##
|
|
590
|
+
# Configuration class for the Operations REST API.
|
|
591
|
+
#
|
|
592
|
+
# This class represents the configuration for Operations REST,
|
|
593
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
594
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
595
|
+
# applied individually to specific RPCs. See
|
|
596
|
+
# {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
|
|
597
|
+
# for a list of RPCs that can be configured independently.
|
|
598
|
+
#
|
|
599
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
600
|
+
# on construction.
|
|
601
|
+
#
|
|
602
|
+
# @example
|
|
603
|
+
#
|
|
604
|
+
# # Modify the global config, setting the timeout for
|
|
605
|
+
# # list_operations to 20 seconds,
|
|
606
|
+
# # and all remaining timeouts to 10 seconds.
|
|
607
|
+
# ::Google::Longrunning::Operations::Rest::Client.configure do |config|
|
|
608
|
+
# config.timeout = 10.0
|
|
609
|
+
# config.rpcs.list_operations.timeout = 20.0
|
|
610
|
+
# end
|
|
611
|
+
#
|
|
612
|
+
# # Apply the above configuration only to a new client.
|
|
613
|
+
# client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
|
|
614
|
+
# config.timeout = 10.0
|
|
615
|
+
# config.rpcs.list_operations.timeout = 20.0
|
|
616
|
+
# end
|
|
617
|
+
#
|
|
618
|
+
# @!attribute [rw] endpoint
|
|
619
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
620
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
621
|
+
# @return [::String,nil]
|
|
622
|
+
# @!attribute [rw] credentials
|
|
623
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
624
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
625
|
+
# * (`Hash`) A service account key as a Hash
|
|
626
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
627
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
628
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
629
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
630
|
+
# * (`nil`) indicating no credentials
|
|
631
|
+
#
|
|
632
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
633
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
634
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
635
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
636
|
+
# For more information, refer to [Validate credential configurations from external
|
|
637
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
638
|
+
# @return [::Object]
|
|
639
|
+
# @!attribute [rw] scope
|
|
640
|
+
# The OAuth scopes
|
|
641
|
+
# @return [::Array<::String>]
|
|
642
|
+
# @!attribute [rw] lib_name
|
|
643
|
+
# The library name as recorded in instrumentation and logging
|
|
644
|
+
# @return [::String]
|
|
645
|
+
# @!attribute [rw] lib_version
|
|
646
|
+
# The library version as recorded in instrumentation and logging
|
|
647
|
+
# @return [::String]
|
|
648
|
+
# @!attribute [rw] timeout
|
|
649
|
+
# The call timeout in seconds.
|
|
650
|
+
# @return [::Numeric]
|
|
651
|
+
# @!attribute [rw] metadata
|
|
652
|
+
# Additional headers to be sent with the call.
|
|
653
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
654
|
+
# @!attribute [rw] retry_policy
|
|
655
|
+
# The retry policy. The value is a hash with the following keys:
|
|
656
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
657
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
658
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
659
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
660
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
661
|
+
# trigger a retry.
|
|
662
|
+
# @return [::Hash]
|
|
663
|
+
# @!attribute [rw] quota_project
|
|
664
|
+
# A separate project against which to charge quota.
|
|
665
|
+
# @return [::String]
|
|
666
|
+
# @!attribute [rw] universe_domain
|
|
667
|
+
# The universe domain within which to make requests. This determines the
|
|
668
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
669
|
+
# universe (usually the default "googleapis.com" universe).
|
|
670
|
+
# @return [::String,nil]
|
|
671
|
+
# @!attribute [rw] logger
|
|
672
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
673
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
674
|
+
# explicitly disable logging.
|
|
675
|
+
# @return [::Logger,:default,nil]
|
|
676
|
+
#
|
|
677
|
+
class Configuration
|
|
678
|
+
extend ::Gapic::Config
|
|
679
|
+
|
|
680
|
+
# @private
|
|
681
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
682
|
+
DEFAULT_ENDPOINT = "longrunning.googleapis.com"
|
|
683
|
+
|
|
684
|
+
config_attr :endpoint, nil, ::String, nil
|
|
685
|
+
config_attr :credentials, nil do |value|
|
|
686
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
687
|
+
allowed.any? { |klass| klass === value }
|
|
688
|
+
end
|
|
689
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
690
|
+
config_attr :lib_name, nil, ::String, nil
|
|
691
|
+
config_attr :lib_version, nil, ::String, nil
|
|
692
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
693
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
694
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
695
|
+
config_attr :quota_project, nil, ::String, nil
|
|
696
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
697
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
698
|
+
|
|
699
|
+
# @private
|
|
700
|
+
def initialize parent_config = nil
|
|
701
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
702
|
+
|
|
703
|
+
yield self if block_given?
|
|
704
|
+
end
|
|
705
|
+
|
|
706
|
+
##
|
|
707
|
+
# Configurations for individual RPCs
|
|
708
|
+
# @return [Rpcs]
|
|
709
|
+
#
|
|
710
|
+
def rpcs
|
|
711
|
+
@rpcs ||= begin
|
|
712
|
+
parent_rpcs = nil
|
|
713
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
714
|
+
Rpcs.new parent_rpcs
|
|
715
|
+
end
|
|
716
|
+
end
|
|
717
|
+
|
|
718
|
+
##
|
|
719
|
+
# Configuration RPC class for the Operations API.
|
|
720
|
+
#
|
|
721
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
722
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
723
|
+
# the following configuration fields:
|
|
724
|
+
#
|
|
725
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
726
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
727
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
728
|
+
# include the following keys:
|
|
729
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
730
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
731
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
732
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
733
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
734
|
+
# trigger a retry.
|
|
735
|
+
#
|
|
736
|
+
class Rpcs
|
|
737
|
+
##
|
|
738
|
+
# RPC-specific configuration for `list_operations`
|
|
739
|
+
# @return [::Gapic::Config::Method]
|
|
740
|
+
#
|
|
741
|
+
attr_reader :list_operations
|
|
742
|
+
##
|
|
743
|
+
# RPC-specific configuration for `get_operation`
|
|
744
|
+
# @return [::Gapic::Config::Method]
|
|
745
|
+
#
|
|
746
|
+
attr_reader :get_operation
|
|
747
|
+
##
|
|
748
|
+
# RPC-specific configuration for `delete_operation`
|
|
749
|
+
# @return [::Gapic::Config::Method]
|
|
750
|
+
#
|
|
751
|
+
attr_reader :delete_operation
|
|
752
|
+
##
|
|
753
|
+
# RPC-specific configuration for `cancel_operation`
|
|
754
|
+
# @return [::Gapic::Config::Method]
|
|
755
|
+
#
|
|
756
|
+
attr_reader :cancel_operation
|
|
757
|
+
|
|
758
|
+
# @private
|
|
759
|
+
def initialize parent_rpcs = nil
|
|
760
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
|
761
|
+
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
|
762
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
|
763
|
+
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
|
764
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
|
765
|
+
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
|
766
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
|
767
|
+
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
|
768
|
+
|
|
769
|
+
yield self if block_given?
|
|
770
|
+
end
|
|
771
|
+
end
|
|
772
|
+
end
|
|
773
|
+
end
|
|
774
|
+
end
|
|
775
|
+
end
|
|
776
|
+
end
|
|
777
|
+
end
|