google-cloud-metastore-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 +201 -0
- data/README.md +139 -0
- data/lib/google-cloud-metastore-v1beta.rb +21 -0
- data/lib/google/cloud/metastore/v1beta.rb +38 -0
- data/lib/google/cloud/metastore/v1beta/dataproc_metastore.rb +66 -0
- data/lib/google/cloud/metastore/v1beta/dataproc_metastore/client.rb +1745 -0
- data/lib/google/cloud/metastore/v1beta/dataproc_metastore/credentials.rb +51 -0
- data/lib/google/cloud/metastore/v1beta/dataproc_metastore/operations.rb +655 -0
- data/lib/google/cloud/metastore/v1beta/dataproc_metastore/paths.rb +128 -0
- data/lib/google/cloud/metastore/v1beta/metastore_pb.rb +337 -0
- data/lib/google/cloud/metastore/v1beta/metastore_services_pb.rb +90 -0
- data/lib/google/cloud/metastore/v1beta/version.rb +28 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +65 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/metastore/v1beta/metastore.rb +1077 -0
- data/proto_docs/google/longrunning/operations.rb +164 -0
- data/proto_docs/google/protobuf/any.rb +141 -0
- data/proto_docs/google/protobuf/duration.rb +98 -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 +129 -0
- data/proto_docs/google/protobuf/wrappers.rb +121 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/google/type/dayofweek.rb +49 -0
- metadata +215 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Metastore
|
24
|
+
module V1beta
|
25
|
+
module DataprocMetastore
|
26
|
+
# Credentials for the DataprocMetastore API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"METASTORE_CREDENTIALS",
|
33
|
+
"METASTORE_KEYFILE",
|
34
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
35
|
+
"GOOGLE_CLOUD_KEYFILE",
|
36
|
+
"GCLOUD_KEYFILE",
|
37
|
+
"METASTORE_CREDENTIALS_JSON",
|
38
|
+
"METASTORE_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,655 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/operation"
|
20
|
+
require "google/longrunning/operations_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Metastore
|
25
|
+
module V1beta
|
26
|
+
module DataprocMetastore
|
27
|
+
# Service that implements Longrunning Operations API.
|
28
|
+
class Operations
|
29
|
+
# @private
|
30
|
+
attr_reader :operations_stub
|
31
|
+
|
32
|
+
##
|
33
|
+
# Configuration for the DataprocMetastore 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 DataprocMetastore 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 allows API services to override the binding
|
107
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
108
|
+
# override the binding, API services can add a binding such as
|
109
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
110
|
+
# For backwards compatibility, the default name includes the operations
|
111
|
+
# collection id, however overriding users must ensure the name binding
|
112
|
+
# is the parent resource, without the operations collection id.
|
113
|
+
#
|
114
|
+
# @overload list_operations(request, options = nil)
|
115
|
+
# Pass arguments to `list_operations` via a request object, either of type
|
116
|
+
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
117
|
+
#
|
118
|
+
# @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
|
119
|
+
# A request object representing the call parameters. Required. To specify no
|
120
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
121
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
122
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
123
|
+
#
|
124
|
+
# @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
|
125
|
+
# Pass arguments to `list_operations` via keyword arguments. Note that at
|
126
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
127
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
128
|
+
#
|
129
|
+
# @param name [::String]
|
130
|
+
# The name of the operation's parent resource.
|
131
|
+
# @param filter [::String]
|
132
|
+
# The standard list filter.
|
133
|
+
# @param page_size [::Integer]
|
134
|
+
# The standard list page size.
|
135
|
+
# @param page_token [::String]
|
136
|
+
# The standard list page token.
|
137
|
+
#
|
138
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
139
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
|
140
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
141
|
+
#
|
142
|
+
# @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
|
143
|
+
#
|
144
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
145
|
+
#
|
146
|
+
def list_operations request, options = nil
|
147
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
148
|
+
|
149
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
|
150
|
+
|
151
|
+
# Converts hash and nil to an options object
|
152
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
153
|
+
|
154
|
+
# Customize the options with defaults
|
155
|
+
metadata = @config.rpcs.list_operations.metadata.to_h
|
156
|
+
|
157
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
158
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
159
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
160
|
+
gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
|
161
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
162
|
+
|
163
|
+
header_params = {
|
164
|
+
"name" => request.name
|
165
|
+
}
|
166
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
167
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
168
|
+
|
169
|
+
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
170
|
+
metadata: metadata,
|
171
|
+
retry_policy: @config.rpcs.list_operations.retry_policy
|
172
|
+
options.apply_defaults metadata: @config.metadata,
|
173
|
+
retry_policy: @config.retry_policy
|
174
|
+
|
175
|
+
@operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
|
176
|
+
wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
|
177
|
+
response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
178
|
+
yield response, operation if block_given?
|
179
|
+
return response
|
180
|
+
end
|
181
|
+
rescue ::GRPC::BadStatus => e
|
182
|
+
raise ::Google::Cloud::Error.from_error(e)
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# Gets the latest state of a long-running operation. Clients can use this
|
187
|
+
# method to poll the operation result at intervals as recommended by the API
|
188
|
+
# service.
|
189
|
+
#
|
190
|
+
# @overload get_operation(request, options = nil)
|
191
|
+
# Pass arguments to `get_operation` via a request object, either of type
|
192
|
+
# {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
|
193
|
+
#
|
194
|
+
# @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
|
195
|
+
# A request object representing the call parameters. Required. To specify no
|
196
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
197
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
198
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
199
|
+
#
|
200
|
+
# @overload get_operation(name: nil)
|
201
|
+
# Pass arguments to `get_operation` via keyword arguments. Note that at
|
202
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
203
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
204
|
+
#
|
205
|
+
# @param name [::String]
|
206
|
+
# The name of the operation resource.
|
207
|
+
#
|
208
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
209
|
+
# @yieldparam response [::Gapic::Operation]
|
210
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
211
|
+
#
|
212
|
+
# @return [::Gapic::Operation]
|
213
|
+
#
|
214
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
215
|
+
#
|
216
|
+
def get_operation request, options = nil
|
217
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
218
|
+
|
219
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
|
220
|
+
|
221
|
+
# Converts hash and nil to an options object
|
222
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
223
|
+
|
224
|
+
# Customize the options with defaults
|
225
|
+
metadata = @config.rpcs.get_operation.metadata.to_h
|
226
|
+
|
227
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
228
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
229
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
230
|
+
gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
|
231
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
232
|
+
|
233
|
+
header_params = {
|
234
|
+
"name" => request.name
|
235
|
+
}
|
236
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
237
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
238
|
+
|
239
|
+
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
240
|
+
metadata: metadata,
|
241
|
+
retry_policy: @config.rpcs.get_operation.retry_policy
|
242
|
+
options.apply_defaults metadata: @config.metadata,
|
243
|
+
retry_policy: @config.retry_policy
|
244
|
+
|
245
|
+
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
246
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
247
|
+
yield response, operation if block_given?
|
248
|
+
return response
|
249
|
+
end
|
250
|
+
rescue ::GRPC::BadStatus => e
|
251
|
+
raise ::Google::Cloud::Error.from_error(e)
|
252
|
+
end
|
253
|
+
|
254
|
+
##
|
255
|
+
# Deletes a long-running operation. This method indicates that the client is
|
256
|
+
# no longer interested in the operation result. It does not cancel the
|
257
|
+
# operation. If the server doesn't support this method, it returns
|
258
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
259
|
+
#
|
260
|
+
# @overload delete_operation(request, options = nil)
|
261
|
+
# Pass arguments to `delete_operation` via a request object, either of type
|
262
|
+
# {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
|
263
|
+
#
|
264
|
+
# @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
|
265
|
+
# A request object representing the call parameters. Required. To specify no
|
266
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
267
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
268
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
269
|
+
#
|
270
|
+
# @overload delete_operation(name: nil)
|
271
|
+
# Pass arguments to `delete_operation` via keyword arguments. Note that at
|
272
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
273
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
274
|
+
#
|
275
|
+
# @param name [::String]
|
276
|
+
# The name of the operation resource to be deleted.
|
277
|
+
#
|
278
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
279
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
280
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
281
|
+
#
|
282
|
+
# @return [::Google::Protobuf::Empty]
|
283
|
+
#
|
284
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
285
|
+
#
|
286
|
+
def delete_operation request, options = nil
|
287
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
288
|
+
|
289
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
|
290
|
+
|
291
|
+
# Converts hash and nil to an options object
|
292
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
293
|
+
|
294
|
+
# Customize the options with defaults
|
295
|
+
metadata = @config.rpcs.delete_operation.metadata.to_h
|
296
|
+
|
297
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
298
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
299
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
300
|
+
gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
|
301
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
302
|
+
|
303
|
+
header_params = {
|
304
|
+
"name" => request.name
|
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.delete_operation.timeout,
|
310
|
+
metadata: metadata,
|
311
|
+
retry_policy: @config.rpcs.delete_operation.retry_policy
|
312
|
+
options.apply_defaults metadata: @config.metadata,
|
313
|
+
retry_policy: @config.retry_policy
|
314
|
+
|
315
|
+
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
316
|
+
yield response, operation if block_given?
|
317
|
+
return response
|
318
|
+
end
|
319
|
+
rescue ::GRPC::BadStatus => e
|
320
|
+
raise ::Google::Cloud::Error.from_error(e)
|
321
|
+
end
|
322
|
+
|
323
|
+
##
|
324
|
+
# Starts asynchronous cancellation on a long-running operation. The server
|
325
|
+
# makes a best effort to cancel the operation, but success is not
|
326
|
+
# guaranteed. If the server doesn't support this method, it returns
|
327
|
+
# `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
328
|
+
# Operations.GetOperation or
|
329
|
+
# other methods to check whether the cancellation succeeded or whether the
|
330
|
+
# operation completed despite cancellation. On successful cancellation,
|
331
|
+
# the operation is not deleted; instead, it becomes an operation with
|
332
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
|
333
|
+
# corresponding to `Code.CANCELLED`.
|
334
|
+
#
|
335
|
+
# @overload cancel_operation(request, options = nil)
|
336
|
+
# Pass arguments to `cancel_operation` via a request object, either of type
|
337
|
+
# {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
|
338
|
+
#
|
339
|
+
# @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
|
340
|
+
# A request object representing the call parameters. Required. To specify no
|
341
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
342
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
343
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
344
|
+
#
|
345
|
+
# @overload cancel_operation(name: nil)
|
346
|
+
# Pass arguments to `cancel_operation` via keyword arguments. Note that at
|
347
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
348
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
349
|
+
#
|
350
|
+
# @param name [::String]
|
351
|
+
# The name of the operation resource to be cancelled.
|
352
|
+
#
|
353
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
354
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
355
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
356
|
+
#
|
357
|
+
# @return [::Google::Protobuf::Empty]
|
358
|
+
#
|
359
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
360
|
+
#
|
361
|
+
def cancel_operation request, options = nil
|
362
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
363
|
+
|
364
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
|
365
|
+
|
366
|
+
# Converts hash and nil to an options object
|
367
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
368
|
+
|
369
|
+
# Customize the options with defaults
|
370
|
+
metadata = @config.rpcs.cancel_operation.metadata.to_h
|
371
|
+
|
372
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
373
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
374
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
375
|
+
gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
|
376
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
377
|
+
|
378
|
+
header_params = {
|
379
|
+
"name" => request.name
|
380
|
+
}
|
381
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
382
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
383
|
+
|
384
|
+
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
385
|
+
metadata: metadata,
|
386
|
+
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
387
|
+
options.apply_defaults metadata: @config.metadata,
|
388
|
+
retry_policy: @config.retry_policy
|
389
|
+
|
390
|
+
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
391
|
+
yield response, operation if block_given?
|
392
|
+
return response
|
393
|
+
end
|
394
|
+
rescue ::GRPC::BadStatus => e
|
395
|
+
raise ::Google::Cloud::Error.from_error(e)
|
396
|
+
end
|
397
|
+
|
398
|
+
##
|
399
|
+
# Waits for the specified long-running operation until it is done or reaches
|
400
|
+
# at most a specified timeout, returning the latest state. If the operation
|
401
|
+
# is already done, the latest state is immediately returned. If the timeout
|
402
|
+
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
403
|
+
# timeout is used. If the server does not support this method, it returns
|
404
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
405
|
+
# Note that this method is on a best-effort basis. It may return the latest
|
406
|
+
# state before the specified timeout (including immediately), meaning even an
|
407
|
+
# immediate response is no guarantee that the operation is done.
|
408
|
+
#
|
409
|
+
# @overload wait_operation(request, options = nil)
|
410
|
+
# Pass arguments to `wait_operation` via a request object, either of type
|
411
|
+
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
412
|
+
#
|
413
|
+
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
414
|
+
# A request object representing the call parameters. Required. To specify no
|
415
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
416
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
417
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
418
|
+
#
|
419
|
+
# @overload wait_operation(name: nil, timeout: nil)
|
420
|
+
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
421
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
422
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
423
|
+
#
|
424
|
+
# @param name [::String]
|
425
|
+
# The name of the operation resource to wait on.
|
426
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
427
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
428
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
429
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
430
|
+
#
|
431
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
432
|
+
# @yieldparam response [::Gapic::Operation]
|
433
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
434
|
+
#
|
435
|
+
# @return [::Gapic::Operation]
|
436
|
+
#
|
437
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
438
|
+
#
|
439
|
+
def wait_operation request, options = nil
|
440
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
441
|
+
|
442
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
443
|
+
|
444
|
+
# Converts hash and nil to an options object
|
445
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
446
|
+
|
447
|
+
# Customize the options with defaults
|
448
|
+
metadata = @config.rpcs.wait_operation.metadata.to_h
|
449
|
+
|
450
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
451
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
452
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
453
|
+
gapic_version: ::Google::Cloud::Metastore::V1beta::VERSION
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
|
+
metadata: metadata,
|
458
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
+
options.apply_defaults metadata: @config.metadata,
|
460
|
+
retry_policy: @config.retry_policy
|
461
|
+
|
462
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
463
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
471
|
+
##
|
472
|
+
# Configuration class for the Operations API.
|
473
|
+
#
|
474
|
+
# This class represents the configuration for Operations,
|
475
|
+
# providing control over timeouts, retry behavior, logging, transport
|
476
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
477
|
+
# applied individually to specific RPCs. See
|
478
|
+
# {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
|
479
|
+
# for a list of RPCs that can be configured independently.
|
480
|
+
#
|
481
|
+
# Configuration can be applied globally to all clients, or to a single client
|
482
|
+
# on construction.
|
483
|
+
#
|
484
|
+
# # Examples
|
485
|
+
#
|
486
|
+
# To modify the global config, setting the timeout for list_operations
|
487
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
488
|
+
#
|
489
|
+
# ::Google::Longrunning::Operations::Client.configure do |config|
|
490
|
+
# config.timeout = 10.0
|
491
|
+
# config.rpcs.list_operations.timeout = 20.0
|
492
|
+
# end
|
493
|
+
#
|
494
|
+
# To apply the above configuration only to a new client:
|
495
|
+
#
|
496
|
+
# client = ::Google::Longrunning::Operations::Client.new do |config|
|
497
|
+
# config.timeout = 10.0
|
498
|
+
# config.rpcs.list_operations.timeout = 20.0
|
499
|
+
# end
|
500
|
+
#
|
501
|
+
# @!attribute [rw] endpoint
|
502
|
+
# The hostname or hostname:port of the service endpoint.
|
503
|
+
# Defaults to `"metastore.googleapis.com"`.
|
504
|
+
# @return [::String]
|
505
|
+
# @!attribute [rw] credentials
|
506
|
+
# Credentials to send with calls. You may provide any of the following types:
|
507
|
+
# * (`String`) The path to a service account key file in JSON format
|
508
|
+
# * (`Hash`) A service account key as a Hash
|
509
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
510
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
511
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
512
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
513
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
514
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
515
|
+
# * (`nil`) indicating no credentials
|
516
|
+
# @return [::Object]
|
517
|
+
# @!attribute [rw] scope
|
518
|
+
# The OAuth scopes
|
519
|
+
# @return [::Array<::String>]
|
520
|
+
# @!attribute [rw] lib_name
|
521
|
+
# The library name as recorded in instrumentation and logging
|
522
|
+
# @return [::String]
|
523
|
+
# @!attribute [rw] lib_version
|
524
|
+
# The library version as recorded in instrumentation and logging
|
525
|
+
# @return [::String]
|
526
|
+
# @!attribute [rw] channel_args
|
527
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
528
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
529
|
+
# @return [::Hash]
|
530
|
+
# @!attribute [rw] interceptors
|
531
|
+
# An array of interceptors that are run before calls are executed.
|
532
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
533
|
+
# @!attribute [rw] timeout
|
534
|
+
# The call timeout in seconds.
|
535
|
+
# @return [::Numeric]
|
536
|
+
# @!attribute [rw] metadata
|
537
|
+
# Additional gRPC headers to be sent with the call.
|
538
|
+
# @return [::Hash{::Symbol=>::String}]
|
539
|
+
# @!attribute [rw] retry_policy
|
540
|
+
# The retry policy. The value is a hash with the following keys:
|
541
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
542
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
543
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
544
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
545
|
+
# trigger a retry.
|
546
|
+
# @return [::Hash]
|
547
|
+
# @!attribute [rw] quota_project
|
548
|
+
# A separate project against which to charge quota.
|
549
|
+
# @return [::String]
|
550
|
+
#
|
551
|
+
class Configuration
|
552
|
+
extend ::Gapic::Config
|
553
|
+
|
554
|
+
config_attr :endpoint, "metastore.googleapis.com", ::String
|
555
|
+
config_attr :credentials, nil do |value|
|
556
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
557
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
558
|
+
allowed.any? { |klass| klass === value }
|
559
|
+
end
|
560
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
561
|
+
config_attr :lib_name, nil, ::String, nil
|
562
|
+
config_attr :lib_version, nil, ::String, nil
|
563
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
564
|
+
config_attr :interceptors, nil, ::Array, nil
|
565
|
+
config_attr :timeout, nil, ::Numeric, nil
|
566
|
+
config_attr :metadata, nil, ::Hash, nil
|
567
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
568
|
+
config_attr :quota_project, nil, ::String, nil
|
569
|
+
|
570
|
+
# @private
|
571
|
+
def initialize parent_config = nil
|
572
|
+
@parent_config = parent_config unless parent_config.nil?
|
573
|
+
|
574
|
+
yield self if block_given?
|
575
|
+
end
|
576
|
+
|
577
|
+
##
|
578
|
+
# Configurations for individual RPCs
|
579
|
+
# @return [Rpcs]
|
580
|
+
#
|
581
|
+
def rpcs
|
582
|
+
@rpcs ||= begin
|
583
|
+
parent_rpcs = nil
|
584
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
585
|
+
Rpcs.new parent_rpcs
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
##
|
590
|
+
# Configuration RPC class for the Operations API.
|
591
|
+
#
|
592
|
+
# Includes fields providing the configuration for each RPC in this service.
|
593
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
594
|
+
# the following configuration fields:
|
595
|
+
#
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
597
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
598
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
599
|
+
# include the following keys:
|
600
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
601
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
602
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
603
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
604
|
+
# trigger a retry.
|
605
|
+
#
|
606
|
+
class Rpcs
|
607
|
+
##
|
608
|
+
# RPC-specific configuration for `list_operations`
|
609
|
+
# @return [::Gapic::Config::Method]
|
610
|
+
#
|
611
|
+
attr_reader :list_operations
|
612
|
+
##
|
613
|
+
# RPC-specific configuration for `get_operation`
|
614
|
+
# @return [::Gapic::Config::Method]
|
615
|
+
#
|
616
|
+
attr_reader :get_operation
|
617
|
+
##
|
618
|
+
# RPC-specific configuration for `delete_operation`
|
619
|
+
# @return [::Gapic::Config::Method]
|
620
|
+
#
|
621
|
+
attr_reader :delete_operation
|
622
|
+
##
|
623
|
+
# RPC-specific configuration for `cancel_operation`
|
624
|
+
# @return [::Gapic::Config::Method]
|
625
|
+
#
|
626
|
+
attr_reader :cancel_operation
|
627
|
+
##
|
628
|
+
# RPC-specific configuration for `wait_operation`
|
629
|
+
# @return [::Gapic::Config::Method]
|
630
|
+
#
|
631
|
+
attr_reader :wait_operation
|
632
|
+
|
633
|
+
# @private
|
634
|
+
def initialize parent_rpcs = nil
|
635
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
636
|
+
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
637
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
638
|
+
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
639
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
640
|
+
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
641
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
642
|
+
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
644
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
645
|
+
|
646
|
+
yield self if block_given?
|
647
|
+
end
|
648
|
+
end
|
649
|
+
end
|
650
|
+
end
|
651
|
+
end
|
652
|
+
end
|
653
|
+
end
|
654
|
+
end
|
655
|
+
end
|