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