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