google-cloud-api_hub-v1 0.1.1 → 0.2.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 +4 -4
- data/README.md +1 -27
- data/lib/google/cloud/api_hub/v1/api_hub.rb +0 -7
- data/lib/google/cloud/api_hub/v1/api_hub_dependencies.rb +0 -7
- data/lib/google/cloud/api_hub/v1/api_hub_plugin.rb +0 -7
- data/lib/google/cloud/api_hub/v1/host_project_registration_service.rb +0 -7
- data/lib/google/cloud/api_hub/v1/linting_service.rb +0 -7
- data/lib/google/cloud/api_hub/v1/provisioning.rb +0 -8
- data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service.rb +0 -7
- data/lib/google/cloud/api_hub/v1/version.rb +1 -1
- data/lib/google/cloud/api_hub/v1.rb +0 -5
- data/proto_docs/google/cloud/apihub/v1/apihub_service.rb +47 -47
- data/proto_docs/google/cloud/apihub/v1/common_fields.rb +1 -1
- data/proto_docs/google/cloud/apihub/v1/host_project_registration_service.rb +4 -4
- data/proto_docs/google/cloud/apihub/v1/plugin_service.rb +3 -3
- data/proto_docs/google/cloud/apihub/v1/provisioning_service.rb +4 -4
- data/proto_docs/google/cloud/apihub/v1/runtime_project_attachment_service.rb +7 -7
- metadata +2 -10
- data/lib/google/cloud/api_hub/v1/api_hub/client.rb +0 -4514
- data/lib/google/cloud/api_hub/v1/api_hub_dependencies/client.rb +0 -906
- data/lib/google/cloud/api_hub/v1/api_hub_plugin/client.rb +0 -640
- data/lib/google/cloud/api_hub/v1/host_project_registration_service/client.rb +0 -689
- data/lib/google/cloud/api_hub/v1/linting_service/client.rb +0 -744
- data/lib/google/cloud/api_hub/v1/provisioning/client.rb +0 -676
- data/lib/google/cloud/api_hub/v1/provisioning/operations.rb +0 -809
- data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service/client.rb +0 -885
@@ -1,809 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2024 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 ApiHub
|
25
|
-
module V1
|
26
|
-
module Provisioning
|
27
|
-
# Service that implements Longrunning Operations API.
|
28
|
-
class Operations
|
29
|
-
# @private
|
30
|
-
API_VERSION = ""
|
31
|
-
|
32
|
-
# @private
|
33
|
-
DEFAULT_ENDPOINT_TEMPLATE = "apihub.$UNIVERSE_DOMAIN$"
|
34
|
-
|
35
|
-
# @private
|
36
|
-
attr_reader :operations_stub
|
37
|
-
|
38
|
-
##
|
39
|
-
# Configuration for the Provisioning Operations API.
|
40
|
-
#
|
41
|
-
# @yield [config] Configure the Operations client.
|
42
|
-
# @yieldparam config [Operations::Configuration]
|
43
|
-
#
|
44
|
-
# @return [Operations::Configuration]
|
45
|
-
#
|
46
|
-
def self.configure
|
47
|
-
@configure ||= Operations::Configuration.new
|
48
|
-
yield @configure if block_given?
|
49
|
-
@configure
|
50
|
-
end
|
51
|
-
|
52
|
-
##
|
53
|
-
# Configure the Provisioning Operations instance.
|
54
|
-
#
|
55
|
-
# The configuration is set to the derived mode, meaning that values can be changed,
|
56
|
-
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
57
|
-
# should be made on {Operations.configure}.
|
58
|
-
#
|
59
|
-
# @yield [config] Configure the Operations client.
|
60
|
-
# @yieldparam config [Operations::Configuration]
|
61
|
-
#
|
62
|
-
# @return [Operations::Configuration]
|
63
|
-
#
|
64
|
-
def configure
|
65
|
-
yield @config if block_given?
|
66
|
-
@config
|
67
|
-
end
|
68
|
-
|
69
|
-
##
|
70
|
-
# The effective universe domain
|
71
|
-
#
|
72
|
-
# @return [String]
|
73
|
-
#
|
74
|
-
def universe_domain
|
75
|
-
@operations_stub.universe_domain
|
76
|
-
end
|
77
|
-
|
78
|
-
##
|
79
|
-
# Create a new Operations client object.
|
80
|
-
#
|
81
|
-
# @yield [config] Configure the Client client.
|
82
|
-
# @yieldparam config [Operations::Configuration]
|
83
|
-
#
|
84
|
-
def initialize
|
85
|
-
# These require statements are intentionally placed here to initialize
|
86
|
-
# the gRPC module only when it's required.
|
87
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
88
|
-
require "gapic/grpc"
|
89
|
-
require "google/longrunning/operations_services_pb"
|
90
|
-
|
91
|
-
# Create the configuration object
|
92
|
-
@config = Configuration.new Operations.configure
|
93
|
-
|
94
|
-
# Yield the configuration if needed
|
95
|
-
yield @config if block_given?
|
96
|
-
|
97
|
-
# Create credentials
|
98
|
-
credentials = @config.credentials
|
99
|
-
credentials ||= Credentials.default scope: @config.scope
|
100
|
-
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
101
|
-
credentials = Credentials.new credentials, scope: @config.scope
|
102
|
-
end
|
103
|
-
@quota_project_id = @config.quota_project
|
104
|
-
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
105
|
-
|
106
|
-
@operations_stub = ::Gapic::ServiceStub.new(
|
107
|
-
::Google::Longrunning::Operations::Stub,
|
108
|
-
credentials: credentials,
|
109
|
-
endpoint: @config.endpoint,
|
110
|
-
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
111
|
-
universe_domain: @config.universe_domain,
|
112
|
-
channel_args: @config.channel_args,
|
113
|
-
interceptors: @config.interceptors,
|
114
|
-
channel_pool_config: @config.channel_pool
|
115
|
-
)
|
116
|
-
|
117
|
-
# Used by an LRO wrapper for some methods of this service
|
118
|
-
@operations_client = self
|
119
|
-
end
|
120
|
-
|
121
|
-
# Service calls
|
122
|
-
|
123
|
-
##
|
124
|
-
# Lists operations that match the specified filter in the request. If the
|
125
|
-
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
126
|
-
#
|
127
|
-
# NOTE: the `name` binding allows API services to override the binding
|
128
|
-
# to use different resource name schemes, such as `users/*/operations`. To
|
129
|
-
# override the binding, API services can add a binding such as
|
130
|
-
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
131
|
-
# For backwards compatibility, the default name includes the operations
|
132
|
-
# collection id, however overriding users must ensure the name binding
|
133
|
-
# is the parent resource, without the operations collection id.
|
134
|
-
#
|
135
|
-
# @overload list_operations(request, options = nil)
|
136
|
-
# Pass arguments to `list_operations` via a request object, either of type
|
137
|
-
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
138
|
-
#
|
139
|
-
# @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
|
140
|
-
# A request object representing the call parameters. Required. To specify no
|
141
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
142
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
143
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
144
|
-
#
|
145
|
-
# @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
|
146
|
-
# Pass arguments to `list_operations` via keyword arguments. Note that at
|
147
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
148
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
149
|
-
#
|
150
|
-
# @param name [::String]
|
151
|
-
# The name of the operation's parent resource.
|
152
|
-
# @param filter [::String]
|
153
|
-
# The standard list filter.
|
154
|
-
# @param page_size [::Integer]
|
155
|
-
# The standard list page size.
|
156
|
-
# @param page_token [::String]
|
157
|
-
# The standard list page token.
|
158
|
-
#
|
159
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
160
|
-
# @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
|
161
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
162
|
-
#
|
163
|
-
# @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
|
164
|
-
#
|
165
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
166
|
-
#
|
167
|
-
# @example Basic example
|
168
|
-
# require "google/longrunning"
|
169
|
-
#
|
170
|
-
# # Create a client object. The client can be reused for multiple calls.
|
171
|
-
# client = Google::Longrunning::Operations::Client.new
|
172
|
-
#
|
173
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
174
|
-
# request = Google::Longrunning::ListOperationsRequest.new
|
175
|
-
#
|
176
|
-
# # Call the list_operations method.
|
177
|
-
# result = client.list_operations request
|
178
|
-
#
|
179
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
180
|
-
# # over elements, and API calls will be issued to fetch pages as needed.
|
181
|
-
# result.each do |item|
|
182
|
-
# # Each element is of type ::Google::Longrunning::Operation.
|
183
|
-
# p item
|
184
|
-
# end
|
185
|
-
#
|
186
|
-
def list_operations request, options = nil
|
187
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
188
|
-
|
189
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
|
190
|
-
|
191
|
-
# Converts hash and nil to an options object
|
192
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
193
|
-
|
194
|
-
# Customize the options with defaults
|
195
|
-
metadata = @config.rpcs.list_operations.metadata.to_h
|
196
|
-
|
197
|
-
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
198
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
199
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
200
|
-
gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
|
201
|
-
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
202
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
203
|
-
|
204
|
-
header_params = {}
|
205
|
-
if request.name
|
206
|
-
header_params["name"] = request.name
|
207
|
-
end
|
208
|
-
|
209
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
210
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
211
|
-
|
212
|
-
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
213
|
-
metadata: metadata,
|
214
|
-
retry_policy: @config.rpcs.list_operations.retry_policy
|
215
|
-
|
216
|
-
options.apply_defaults timeout: @config.timeout,
|
217
|
-
metadata: @config.metadata,
|
218
|
-
retry_policy: @config.retry_policy
|
219
|
-
|
220
|
-
@operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
|
221
|
-
wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
|
222
|
-
response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
223
|
-
yield response, operation if block_given?
|
224
|
-
return response
|
225
|
-
end
|
226
|
-
rescue ::GRPC::BadStatus => e
|
227
|
-
raise ::Google::Cloud::Error.from_error(e)
|
228
|
-
end
|
229
|
-
|
230
|
-
##
|
231
|
-
# Gets the latest state of a long-running operation. Clients can use this
|
232
|
-
# method to poll the operation result at intervals as recommended by the API
|
233
|
-
# service.
|
234
|
-
#
|
235
|
-
# @overload get_operation(request, options = nil)
|
236
|
-
# Pass arguments to `get_operation` via a request object, either of type
|
237
|
-
# {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
|
238
|
-
#
|
239
|
-
# @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
|
240
|
-
# A request object representing the call parameters. Required. To specify no
|
241
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
242
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
243
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
244
|
-
#
|
245
|
-
# @overload get_operation(name: nil)
|
246
|
-
# Pass arguments to `get_operation` via keyword arguments. Note that at
|
247
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
248
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
249
|
-
#
|
250
|
-
# @param name [::String]
|
251
|
-
# The name of the operation resource.
|
252
|
-
#
|
253
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
254
|
-
# @yieldparam response [::Gapic::Operation]
|
255
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
256
|
-
#
|
257
|
-
# @return [::Gapic::Operation]
|
258
|
-
#
|
259
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
260
|
-
#
|
261
|
-
# @example Basic example
|
262
|
-
# require "google/longrunning"
|
263
|
-
#
|
264
|
-
# # Create a client object. The client can be reused for multiple calls.
|
265
|
-
# client = Google::Longrunning::Operations::Client.new
|
266
|
-
#
|
267
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
268
|
-
# request = Google::Longrunning::GetOperationRequest.new
|
269
|
-
#
|
270
|
-
# # Call the get_operation method.
|
271
|
-
# result = client.get_operation request
|
272
|
-
#
|
273
|
-
# # The returned object is of type Gapic::Operation. You can use it to
|
274
|
-
# # check the status of an operation, cancel it, or wait for results.
|
275
|
-
# # Here is how to wait for a response.
|
276
|
-
# result.wait_until_done! timeout: 60
|
277
|
-
# if result.response?
|
278
|
-
# p result.response
|
279
|
-
# else
|
280
|
-
# puts "No response received."
|
281
|
-
# end
|
282
|
-
#
|
283
|
-
def get_operation request, options = nil
|
284
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
285
|
-
|
286
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
|
287
|
-
|
288
|
-
# Converts hash and nil to an options object
|
289
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
290
|
-
|
291
|
-
# Customize the options with defaults
|
292
|
-
metadata = @config.rpcs.get_operation.metadata.to_h
|
293
|
-
|
294
|
-
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
295
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
296
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
297
|
-
gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
|
298
|
-
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
299
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
300
|
-
|
301
|
-
header_params = {}
|
302
|
-
if request.name
|
303
|
-
header_params["name"] = request.name
|
304
|
-
end
|
305
|
-
|
306
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
307
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
308
|
-
|
309
|
-
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
310
|
-
metadata: metadata,
|
311
|
-
retry_policy: @config.rpcs.get_operation.retry_policy
|
312
|
-
|
313
|
-
options.apply_defaults timeout: @config.timeout,
|
314
|
-
metadata: @config.metadata,
|
315
|
-
retry_policy: @config.retry_policy
|
316
|
-
|
317
|
-
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
318
|
-
response = ::Gapic::Operation.new response, @operations_client, options: options
|
319
|
-
yield response, operation if block_given?
|
320
|
-
return response
|
321
|
-
end
|
322
|
-
rescue ::GRPC::BadStatus => e
|
323
|
-
raise ::Google::Cloud::Error.from_error(e)
|
324
|
-
end
|
325
|
-
|
326
|
-
##
|
327
|
-
# Deletes a long-running operation. This method indicates that the client is
|
328
|
-
# no longer interested in the operation result. It does not cancel the
|
329
|
-
# operation. If the server doesn't support this method, it returns
|
330
|
-
# `google.rpc.Code.UNIMPLEMENTED`.
|
331
|
-
#
|
332
|
-
# @overload delete_operation(request, options = nil)
|
333
|
-
# Pass arguments to `delete_operation` via a request object, either of type
|
334
|
-
# {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
|
335
|
-
#
|
336
|
-
# @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
|
337
|
-
# A request object representing the call parameters. Required. To specify no
|
338
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
339
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
340
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
341
|
-
#
|
342
|
-
# @overload delete_operation(name: nil)
|
343
|
-
# Pass arguments to `delete_operation` via keyword arguments. Note that at
|
344
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
345
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
346
|
-
#
|
347
|
-
# @param name [::String]
|
348
|
-
# The name of the operation resource to be deleted.
|
349
|
-
#
|
350
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
351
|
-
# @yieldparam response [::Google::Protobuf::Empty]
|
352
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
353
|
-
#
|
354
|
-
# @return [::Google::Protobuf::Empty]
|
355
|
-
#
|
356
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
357
|
-
#
|
358
|
-
# @example Basic example
|
359
|
-
# require "google/longrunning"
|
360
|
-
#
|
361
|
-
# # Create a client object. The client can be reused for multiple calls.
|
362
|
-
# client = Google::Longrunning::Operations::Client.new
|
363
|
-
#
|
364
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
365
|
-
# request = Google::Longrunning::DeleteOperationRequest.new
|
366
|
-
#
|
367
|
-
# # Call the delete_operation method.
|
368
|
-
# result = client.delete_operation request
|
369
|
-
#
|
370
|
-
# # The returned object is of type Google::Protobuf::Empty.
|
371
|
-
# p result
|
372
|
-
#
|
373
|
-
def delete_operation request, options = nil
|
374
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
375
|
-
|
376
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
|
377
|
-
|
378
|
-
# Converts hash and nil to an options object
|
379
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
380
|
-
|
381
|
-
# Customize the options with defaults
|
382
|
-
metadata = @config.rpcs.delete_operation.metadata.to_h
|
383
|
-
|
384
|
-
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
385
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
386
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
387
|
-
gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
|
388
|
-
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
389
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
390
|
-
|
391
|
-
header_params = {}
|
392
|
-
if request.name
|
393
|
-
header_params["name"] = request.name
|
394
|
-
end
|
395
|
-
|
396
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
397
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
398
|
-
|
399
|
-
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
400
|
-
metadata: metadata,
|
401
|
-
retry_policy: @config.rpcs.delete_operation.retry_policy
|
402
|
-
|
403
|
-
options.apply_defaults timeout: @config.timeout,
|
404
|
-
metadata: @config.metadata,
|
405
|
-
retry_policy: @config.retry_policy
|
406
|
-
|
407
|
-
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
408
|
-
yield response, operation if block_given?
|
409
|
-
return response
|
410
|
-
end
|
411
|
-
rescue ::GRPC::BadStatus => e
|
412
|
-
raise ::Google::Cloud::Error.from_error(e)
|
413
|
-
end
|
414
|
-
|
415
|
-
##
|
416
|
-
# Starts asynchronous cancellation on a long-running operation. The server
|
417
|
-
# makes a best effort to cancel the operation, but success is not
|
418
|
-
# guaranteed. If the server doesn't support this method, it returns
|
419
|
-
# `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
420
|
-
# Operations.GetOperation or
|
421
|
-
# other methods to check whether the cancellation succeeded or whether the
|
422
|
-
# operation completed despite cancellation. On successful cancellation,
|
423
|
-
# the operation is not deleted; instead, it becomes an operation with
|
424
|
-
# an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
|
425
|
-
# corresponding to `Code.CANCELLED`.
|
426
|
-
#
|
427
|
-
# @overload cancel_operation(request, options = nil)
|
428
|
-
# Pass arguments to `cancel_operation` via a request object, either of type
|
429
|
-
# {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
|
430
|
-
#
|
431
|
-
# @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
|
432
|
-
# A request object representing the call parameters. Required. To specify no
|
433
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
434
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
435
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
436
|
-
#
|
437
|
-
# @overload cancel_operation(name: nil)
|
438
|
-
# Pass arguments to `cancel_operation` via keyword arguments. Note that at
|
439
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
440
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
441
|
-
#
|
442
|
-
# @param name [::String]
|
443
|
-
# The name of the operation resource to be cancelled.
|
444
|
-
#
|
445
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
446
|
-
# @yieldparam response [::Google::Protobuf::Empty]
|
447
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
448
|
-
#
|
449
|
-
# @return [::Google::Protobuf::Empty]
|
450
|
-
#
|
451
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
452
|
-
#
|
453
|
-
# @example Basic example
|
454
|
-
# require "google/longrunning"
|
455
|
-
#
|
456
|
-
# # Create a client object. The client can be reused for multiple calls.
|
457
|
-
# client = Google::Longrunning::Operations::Client.new
|
458
|
-
#
|
459
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
460
|
-
# request = Google::Longrunning::CancelOperationRequest.new
|
461
|
-
#
|
462
|
-
# # Call the cancel_operation method.
|
463
|
-
# result = client.cancel_operation request
|
464
|
-
#
|
465
|
-
# # The returned object is of type Google::Protobuf::Empty.
|
466
|
-
# p result
|
467
|
-
#
|
468
|
-
def cancel_operation request, options = nil
|
469
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
470
|
-
|
471
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
|
472
|
-
|
473
|
-
# Converts hash and nil to an options object
|
474
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
475
|
-
|
476
|
-
# Customize the options with defaults
|
477
|
-
metadata = @config.rpcs.cancel_operation.metadata.to_h
|
478
|
-
|
479
|
-
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
480
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
481
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
482
|
-
gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
|
483
|
-
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
484
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
485
|
-
|
486
|
-
header_params = {}
|
487
|
-
if request.name
|
488
|
-
header_params["name"] = request.name
|
489
|
-
end
|
490
|
-
|
491
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
492
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
493
|
-
|
494
|
-
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
495
|
-
metadata: metadata,
|
496
|
-
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
497
|
-
|
498
|
-
options.apply_defaults timeout: @config.timeout,
|
499
|
-
metadata: @config.metadata,
|
500
|
-
retry_policy: @config.retry_policy
|
501
|
-
|
502
|
-
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
503
|
-
yield response, operation if block_given?
|
504
|
-
return response
|
505
|
-
end
|
506
|
-
rescue ::GRPC::BadStatus => e
|
507
|
-
raise ::Google::Cloud::Error.from_error(e)
|
508
|
-
end
|
509
|
-
|
510
|
-
##
|
511
|
-
# Waits until the specified long-running operation is done or reaches at most
|
512
|
-
# a specified timeout, returning the latest state. If the operation is
|
513
|
-
# already done, the latest state is immediately returned. If the timeout
|
514
|
-
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
515
|
-
# timeout is used. If the server does not support this method, it returns
|
516
|
-
# `google.rpc.Code.UNIMPLEMENTED`.
|
517
|
-
# Note that this method is on a best-effort basis. It may return the latest
|
518
|
-
# state before the specified timeout (including immediately), meaning even an
|
519
|
-
# immediate response is no guarantee that the operation is done.
|
520
|
-
#
|
521
|
-
# @overload wait_operation(request, options = nil)
|
522
|
-
# Pass arguments to `wait_operation` via a request object, either of type
|
523
|
-
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
524
|
-
#
|
525
|
-
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
526
|
-
# A request object representing the call parameters. Required. To specify no
|
527
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
528
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
529
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
530
|
-
#
|
531
|
-
# @overload wait_operation(name: nil, timeout: nil)
|
532
|
-
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
533
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
534
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
535
|
-
#
|
536
|
-
# @param name [::String]
|
537
|
-
# The name of the operation resource to wait on.
|
538
|
-
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
539
|
-
# The maximum duration to wait before timing out. If left blank, the wait
|
540
|
-
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
541
|
-
# If RPC context deadline is also specified, the shorter one will be used.
|
542
|
-
#
|
543
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
544
|
-
# @yieldparam response [::Gapic::Operation]
|
545
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
546
|
-
#
|
547
|
-
# @return [::Gapic::Operation]
|
548
|
-
#
|
549
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
550
|
-
#
|
551
|
-
# @example Basic example
|
552
|
-
# require "google/longrunning"
|
553
|
-
#
|
554
|
-
# # Create a client object. The client can be reused for multiple calls.
|
555
|
-
# client = Google::Longrunning::Operations::Client.new
|
556
|
-
#
|
557
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
558
|
-
# request = Google::Longrunning::WaitOperationRequest.new
|
559
|
-
#
|
560
|
-
# # Call the wait_operation method.
|
561
|
-
# result = client.wait_operation request
|
562
|
-
#
|
563
|
-
# # The returned object is of type Gapic::Operation. You can use it to
|
564
|
-
# # check the status of an operation, cancel it, or wait for results.
|
565
|
-
# # Here is how to wait for a response.
|
566
|
-
# result.wait_until_done! timeout: 60
|
567
|
-
# if result.response?
|
568
|
-
# p result.response
|
569
|
-
# else
|
570
|
-
# puts "No response received."
|
571
|
-
# end
|
572
|
-
#
|
573
|
-
def wait_operation request, options = nil
|
574
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
575
|
-
|
576
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
577
|
-
|
578
|
-
# Converts hash and nil to an options object
|
579
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
580
|
-
|
581
|
-
# Customize the options with defaults
|
582
|
-
metadata = @config.rpcs.wait_operation.metadata.to_h
|
583
|
-
|
584
|
-
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
585
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
586
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
587
|
-
gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
|
588
|
-
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
589
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
590
|
-
|
591
|
-
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
592
|
-
metadata: metadata,
|
593
|
-
retry_policy: @config.rpcs.wait_operation.retry_policy
|
594
|
-
|
595
|
-
options.apply_defaults timeout: @config.timeout,
|
596
|
-
metadata: @config.metadata,
|
597
|
-
retry_policy: @config.retry_policy
|
598
|
-
|
599
|
-
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
600
|
-
response = ::Gapic::Operation.new response, @operations_client, options: options
|
601
|
-
yield response, operation if block_given?
|
602
|
-
return response
|
603
|
-
end
|
604
|
-
rescue ::GRPC::BadStatus => e
|
605
|
-
raise ::Google::Cloud::Error.from_error(e)
|
606
|
-
end
|
607
|
-
|
608
|
-
##
|
609
|
-
# Configuration class for the Operations API.
|
610
|
-
#
|
611
|
-
# This class represents the configuration for Operations,
|
612
|
-
# providing control over timeouts, retry behavior, logging, transport
|
613
|
-
# parameters, and other low-level controls. Certain parameters can also be
|
614
|
-
# applied individually to specific RPCs. See
|
615
|
-
# {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
|
616
|
-
# for a list of RPCs that can be configured independently.
|
617
|
-
#
|
618
|
-
# Configuration can be applied globally to all clients, or to a single client
|
619
|
-
# on construction.
|
620
|
-
#
|
621
|
-
# @example
|
622
|
-
#
|
623
|
-
# # Modify the global config, setting the timeout for
|
624
|
-
# # list_operations to 20 seconds,
|
625
|
-
# # and all remaining timeouts to 10 seconds.
|
626
|
-
# ::Google::Longrunning::Operations::Client.configure do |config|
|
627
|
-
# config.timeout = 10.0
|
628
|
-
# config.rpcs.list_operations.timeout = 20.0
|
629
|
-
# end
|
630
|
-
#
|
631
|
-
# # Apply the above configuration only to a new client.
|
632
|
-
# client = ::Google::Longrunning::Operations::Client.new do |config|
|
633
|
-
# config.timeout = 10.0
|
634
|
-
# config.rpcs.list_operations.timeout = 20.0
|
635
|
-
# end
|
636
|
-
#
|
637
|
-
# @!attribute [rw] endpoint
|
638
|
-
# A custom service endpoint, as a hostname or hostname:port. The default is
|
639
|
-
# nil, indicating to use the default endpoint in the current universe domain.
|
640
|
-
# @return [::String,nil]
|
641
|
-
# @!attribute [rw] credentials
|
642
|
-
# Credentials to send with calls. You may provide any of the following types:
|
643
|
-
# * (`String`) The path to a service account key file in JSON format
|
644
|
-
# * (`Hash`) A service account key as a Hash
|
645
|
-
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
646
|
-
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
647
|
-
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
648
|
-
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
649
|
-
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
650
|
-
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
651
|
-
# * (`nil`) indicating no credentials
|
652
|
-
# @return [::Object]
|
653
|
-
# @!attribute [rw] scope
|
654
|
-
# The OAuth scopes
|
655
|
-
# @return [::Array<::String>]
|
656
|
-
# @!attribute [rw] lib_name
|
657
|
-
# The library name as recorded in instrumentation and logging
|
658
|
-
# @return [::String]
|
659
|
-
# @!attribute [rw] lib_version
|
660
|
-
# The library version as recorded in instrumentation and logging
|
661
|
-
# @return [::String]
|
662
|
-
# @!attribute [rw] channel_args
|
663
|
-
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
664
|
-
# `GRPC::Core::Channel` object is provided as the credential.
|
665
|
-
# @return [::Hash]
|
666
|
-
# @!attribute [rw] interceptors
|
667
|
-
# An array of interceptors that are run before calls are executed.
|
668
|
-
# @return [::Array<::GRPC::ClientInterceptor>]
|
669
|
-
# @!attribute [rw] timeout
|
670
|
-
# The call timeout in seconds.
|
671
|
-
# @return [::Numeric]
|
672
|
-
# @!attribute [rw] metadata
|
673
|
-
# Additional gRPC headers to be sent with the call.
|
674
|
-
# @return [::Hash{::Symbol=>::String}]
|
675
|
-
# @!attribute [rw] retry_policy
|
676
|
-
# The retry policy. The value is a hash with the following keys:
|
677
|
-
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
678
|
-
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
679
|
-
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
680
|
-
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
681
|
-
# trigger a retry.
|
682
|
-
# @return [::Hash]
|
683
|
-
# @!attribute [rw] quota_project
|
684
|
-
# A separate project against which to charge quota.
|
685
|
-
# @return [::String]
|
686
|
-
# @!attribute [rw] universe_domain
|
687
|
-
# The universe domain within which to make requests. This determines the
|
688
|
-
# default endpoint URL. The default value of nil uses the environment
|
689
|
-
# universe (usually the default "googleapis.com" universe).
|
690
|
-
# @return [::String,nil]
|
691
|
-
#
|
692
|
-
class Configuration
|
693
|
-
extend ::Gapic::Config
|
694
|
-
|
695
|
-
# @private
|
696
|
-
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
697
|
-
DEFAULT_ENDPOINT = "apihub.googleapis.com"
|
698
|
-
|
699
|
-
config_attr :endpoint, nil, ::String, nil
|
700
|
-
config_attr :credentials, nil do |value|
|
701
|
-
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
702
|
-
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
703
|
-
allowed.any? { |klass| klass === value }
|
704
|
-
end
|
705
|
-
config_attr :scope, nil, ::String, ::Array, nil
|
706
|
-
config_attr :lib_name, nil, ::String, nil
|
707
|
-
config_attr :lib_version, nil, ::String, nil
|
708
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
709
|
-
config_attr :interceptors, nil, ::Array, nil
|
710
|
-
config_attr :timeout, nil, ::Numeric, nil
|
711
|
-
config_attr :metadata, nil, ::Hash, nil
|
712
|
-
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
713
|
-
config_attr :quota_project, nil, ::String, nil
|
714
|
-
config_attr :universe_domain, nil, ::String, nil
|
715
|
-
|
716
|
-
# @private
|
717
|
-
def initialize parent_config = nil
|
718
|
-
@parent_config = parent_config unless parent_config.nil?
|
719
|
-
|
720
|
-
yield self if block_given?
|
721
|
-
end
|
722
|
-
|
723
|
-
##
|
724
|
-
# Configurations for individual RPCs
|
725
|
-
# @return [Rpcs]
|
726
|
-
#
|
727
|
-
def rpcs
|
728
|
-
@rpcs ||= begin
|
729
|
-
parent_rpcs = nil
|
730
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
731
|
-
Rpcs.new parent_rpcs
|
732
|
-
end
|
733
|
-
end
|
734
|
-
|
735
|
-
##
|
736
|
-
# Configuration for the channel pool
|
737
|
-
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
738
|
-
#
|
739
|
-
def channel_pool
|
740
|
-
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
741
|
-
end
|
742
|
-
|
743
|
-
##
|
744
|
-
# Configuration RPC class for the Operations API.
|
745
|
-
#
|
746
|
-
# Includes fields providing the configuration for each RPC in this service.
|
747
|
-
# Each configuration object is of type `Gapic::Config::Method` and includes
|
748
|
-
# the following configuration fields:
|
749
|
-
#
|
750
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
751
|
-
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
752
|
-
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
753
|
-
# include the following keys:
|
754
|
-
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
755
|
-
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
756
|
-
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
757
|
-
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
758
|
-
# trigger a retry.
|
759
|
-
#
|
760
|
-
class Rpcs
|
761
|
-
##
|
762
|
-
# RPC-specific configuration for `list_operations`
|
763
|
-
# @return [::Gapic::Config::Method]
|
764
|
-
#
|
765
|
-
attr_reader :list_operations
|
766
|
-
##
|
767
|
-
# RPC-specific configuration for `get_operation`
|
768
|
-
# @return [::Gapic::Config::Method]
|
769
|
-
#
|
770
|
-
attr_reader :get_operation
|
771
|
-
##
|
772
|
-
# RPC-specific configuration for `delete_operation`
|
773
|
-
# @return [::Gapic::Config::Method]
|
774
|
-
#
|
775
|
-
attr_reader :delete_operation
|
776
|
-
##
|
777
|
-
# RPC-specific configuration for `cancel_operation`
|
778
|
-
# @return [::Gapic::Config::Method]
|
779
|
-
#
|
780
|
-
attr_reader :cancel_operation
|
781
|
-
##
|
782
|
-
# RPC-specific configuration for `wait_operation`
|
783
|
-
# @return [::Gapic::Config::Method]
|
784
|
-
#
|
785
|
-
attr_reader :wait_operation
|
786
|
-
|
787
|
-
# @private
|
788
|
-
def initialize parent_rpcs = nil
|
789
|
-
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
790
|
-
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
791
|
-
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
792
|
-
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
793
|
-
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
794
|
-
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
795
|
-
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
796
|
-
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
797
|
-
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
798
|
-
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
799
|
-
|
800
|
-
yield self if block_given?
|
801
|
-
end
|
802
|
-
end
|
803
|
-
end
|
804
|
-
end
|
805
|
-
end
|
806
|
-
end
|
807
|
-
end
|
808
|
-
end
|
809
|
-
end
|