google-cloud-kms-v1 0.10.2 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +4 -4
- data/lib/google/cloud/kms/v1/ekm_service/client.rb +731 -0
- data/lib/google/cloud/kms/v1/ekm_service/credentials.rb +52 -0
- data/lib/google/cloud/kms/v1/ekm_service/paths.rb +90 -0
- data/lib/google/cloud/kms/v1/ekm_service.rb +53 -0
- data/lib/google/cloud/kms/v1/ekm_service_pb.rb +79 -0
- data/lib/google/cloud/kms/v1/ekm_service_services_pb.rb +57 -0
- data/lib/google/cloud/kms/v1/key_management_service/client.rb +427 -276
- data/lib/google/cloud/kms/v1/resources_pb.rb +10 -1
- data/lib/google/cloud/kms/v1/service_services_pb.rb +84 -48
- data/lib/google/cloud/kms/v1/version.rb +1 -1
- data/lib/google/cloud/kms/v1.rb +2 -1
- data/proto_docs/google/cloud/kms/v1/ekm_service.rb +226 -0
- data/proto_docs/google/cloud/kms/v1/resources.rb +299 -160
- data/proto_docs/google/cloud/kms/v1/service.rb +653 -412
- metadata +10 -3
@@ -0,0 +1,731 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/kms/v1/ekm_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Kms
|
25
|
+
module V1
|
26
|
+
module EkmService
|
27
|
+
##
|
28
|
+
# Client for the EkmService service.
|
29
|
+
#
|
30
|
+
# Google Cloud Key Management EKM Service
|
31
|
+
#
|
32
|
+
# Manages external cryptographic keys and operations using those keys.
|
33
|
+
# Implements a REST model with the following objects:
|
34
|
+
# * {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}
|
35
|
+
#
|
36
|
+
class Client
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :ekm_service_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the EkmService Client class.
|
44
|
+
#
|
45
|
+
# See {::Google::Cloud::Kms::V1::EkmService::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# # Modify the configuration for all EkmService clients
|
51
|
+
# ::Google::Cloud::Kms::V1::EkmService::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Cloud", "Kms", "V1"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.rpcs.list_ekm_connections.timeout = 60.0
|
72
|
+
default_config.rpcs.list_ekm_connections.retry_policy = {
|
73
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
74
|
+
}
|
75
|
+
|
76
|
+
default_config.rpcs.get_ekm_connection.timeout = 60.0
|
77
|
+
default_config.rpcs.get_ekm_connection.retry_policy = {
|
78
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
79
|
+
}
|
80
|
+
|
81
|
+
default_config.rpcs.create_ekm_connection.timeout = 60.0
|
82
|
+
default_config.rpcs.create_ekm_connection.retry_policy = {
|
83
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
84
|
+
}
|
85
|
+
|
86
|
+
default_config.rpcs.update_ekm_connection.timeout = 60.0
|
87
|
+
default_config.rpcs.update_ekm_connection.retry_policy = {
|
88
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
89
|
+
}
|
90
|
+
|
91
|
+
default_config
|
92
|
+
end
|
93
|
+
yield @configure if block_given?
|
94
|
+
@configure
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Configure the EkmService Client instance.
|
99
|
+
#
|
100
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
101
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
102
|
+
# should be made on {Client.configure}.
|
103
|
+
#
|
104
|
+
# See {::Google::Cloud::Kms::V1::EkmService::Client::Configuration}
|
105
|
+
# for a description of the configuration fields.
|
106
|
+
#
|
107
|
+
# @yield [config] Configure the Client client.
|
108
|
+
# @yieldparam config [Client::Configuration]
|
109
|
+
#
|
110
|
+
# @return [Client::Configuration]
|
111
|
+
#
|
112
|
+
def configure
|
113
|
+
yield @config if block_given?
|
114
|
+
@config
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Create a new EkmService client object.
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
#
|
122
|
+
# # Create a client using the default configuration
|
123
|
+
# client = ::Google::Cloud::Kms::V1::EkmService::Client.new
|
124
|
+
#
|
125
|
+
# # Create a client using a custom configuration
|
126
|
+
# client = ::Google::Cloud::Kms::V1::EkmService::Client.new do |config|
|
127
|
+
# config.timeout = 10.0
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# @yield [config] Configure the EkmService client.
|
131
|
+
# @yieldparam config [Client::Configuration]
|
132
|
+
#
|
133
|
+
def initialize
|
134
|
+
# These require statements are intentionally placed here to initialize
|
135
|
+
# the gRPC module only when it's required.
|
136
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
137
|
+
require "gapic/grpc"
|
138
|
+
require "google/cloud/kms/v1/ekm_service_services_pb"
|
139
|
+
|
140
|
+
# Create the configuration object
|
141
|
+
@config = Configuration.new Client.configure
|
142
|
+
|
143
|
+
# Yield the configuration if needed
|
144
|
+
yield @config if block_given?
|
145
|
+
|
146
|
+
# Create credentials
|
147
|
+
credentials = @config.credentials
|
148
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
149
|
+
# but only if the default endpoint does not have a region prefix.
|
150
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
151
|
+
!@config.endpoint.split(".").first.include?("-")
|
152
|
+
credentials ||= Credentials.default scope: @config.scope,
|
153
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
154
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
155
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
156
|
+
end
|
157
|
+
@quota_project_id = @config.quota_project
|
158
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
159
|
+
|
160
|
+
@ekm_service_stub = ::Gapic::ServiceStub.new(
|
161
|
+
::Google::Cloud::Kms::V1::EkmService::Stub,
|
162
|
+
credentials: credentials,
|
163
|
+
endpoint: @config.endpoint,
|
164
|
+
channel_args: @config.channel_args,
|
165
|
+
interceptors: @config.interceptors
|
166
|
+
)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Service calls
|
170
|
+
|
171
|
+
##
|
172
|
+
# Lists {::Google::Cloud::Kms::V1::EkmConnection EkmConnections}.
|
173
|
+
#
|
174
|
+
# @overload list_ekm_connections(request, options = nil)
|
175
|
+
# Pass arguments to `list_ekm_connections` via a request object, either of type
|
176
|
+
# {::Google::Cloud::Kms::V1::ListEkmConnectionsRequest} or an equivalent Hash.
|
177
|
+
#
|
178
|
+
# @param request [::Google::Cloud::Kms::V1::ListEkmConnectionsRequest, ::Hash]
|
179
|
+
# A request object representing the call parameters. Required. To specify no
|
180
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
181
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
182
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
183
|
+
#
|
184
|
+
# @overload list_ekm_connections(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
|
185
|
+
# Pass arguments to `list_ekm_connections` via keyword arguments. Note that at
|
186
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
187
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
188
|
+
#
|
189
|
+
# @param parent [::String]
|
190
|
+
# Required. The resource name of the location associated with the
|
191
|
+
# {::Google::Cloud::Kms::V1::EkmConnection EkmConnections} to list, in the format
|
192
|
+
# `projects/*/locations/*`.
|
193
|
+
# @param page_size [::Integer]
|
194
|
+
# Optional. Optional limit on the number of
|
195
|
+
# {::Google::Cloud::Kms::V1::EkmConnection EkmConnections} to include in the
|
196
|
+
# response. Further {::Google::Cloud::Kms::V1::EkmConnection EkmConnections} can
|
197
|
+
# subsequently be obtained by including the
|
198
|
+
# {::Google::Cloud::Kms::V1::ListEkmConnectionsResponse#next_page_token ListEkmConnectionsResponse.next_page_token}
|
199
|
+
# in a subsequent request. If unspecified, the server will pick an
|
200
|
+
# appropriate default.
|
201
|
+
# @param page_token [::String]
|
202
|
+
# Optional. Optional pagination token, returned earlier via
|
203
|
+
# {::Google::Cloud::Kms::V1::ListEkmConnectionsResponse#next_page_token ListEkmConnectionsResponse.next_page_token}.
|
204
|
+
# @param filter [::String]
|
205
|
+
# Optional. Only include resources that match the filter in the response. For
|
206
|
+
# more information, see
|
207
|
+
# [Sorting and filtering list
|
208
|
+
# results](https://cloud.google.com/kms/docs/sorting-and-filtering).
|
209
|
+
# @param order_by [::String]
|
210
|
+
# Optional. Specify how the results should be sorted. If not specified, the
|
211
|
+
# results will be sorted in the default order. For more information, see
|
212
|
+
# [Sorting and filtering list
|
213
|
+
# results](https://cloud.google.com/kms/docs/sorting-and-filtering).
|
214
|
+
#
|
215
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
216
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::EkmConnection>]
|
217
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
218
|
+
#
|
219
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::EkmConnection>]
|
220
|
+
#
|
221
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
222
|
+
#
|
223
|
+
# @example Basic example
|
224
|
+
# require "google/cloud/kms/v1"
|
225
|
+
#
|
226
|
+
# # Create a client object. The client can be reused for multiple calls.
|
227
|
+
# client = Google::Cloud::Kms::V1::EkmService::Client.new
|
228
|
+
#
|
229
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
230
|
+
# request = Google::Cloud::Kms::V1::ListEkmConnectionsRequest.new
|
231
|
+
#
|
232
|
+
# # Call the list_ekm_connections method.
|
233
|
+
# result = client.list_ekm_connections request
|
234
|
+
#
|
235
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
236
|
+
# # iterate over all elements by calling #each, and the enumerable
|
237
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
238
|
+
# # methods are also available for managing paging directly.
|
239
|
+
# result.each do |response|
|
240
|
+
# # Each element is of type ::Google::Cloud::Kms::V1::EkmConnection.
|
241
|
+
# p response
|
242
|
+
# end
|
243
|
+
#
|
244
|
+
def list_ekm_connections request, options = nil
|
245
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
246
|
+
|
247
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::ListEkmConnectionsRequest
|
248
|
+
|
249
|
+
# Converts hash and nil to an options object
|
250
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
251
|
+
|
252
|
+
# Customize the options with defaults
|
253
|
+
metadata = @config.rpcs.list_ekm_connections.metadata.to_h
|
254
|
+
|
255
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
256
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
257
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
258
|
+
gapic_version: ::Google::Cloud::Kms::V1::VERSION
|
259
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
260
|
+
|
261
|
+
header_params = {}
|
262
|
+
if request.parent
|
263
|
+
header_params["parent"] = request.parent
|
264
|
+
end
|
265
|
+
|
266
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
267
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
268
|
+
|
269
|
+
options.apply_defaults timeout: @config.rpcs.list_ekm_connections.timeout,
|
270
|
+
metadata: metadata,
|
271
|
+
retry_policy: @config.rpcs.list_ekm_connections.retry_policy
|
272
|
+
|
273
|
+
options.apply_defaults timeout: @config.timeout,
|
274
|
+
metadata: @config.metadata,
|
275
|
+
retry_policy: @config.retry_policy
|
276
|
+
|
277
|
+
@ekm_service_stub.call_rpc :list_ekm_connections, request, options: options do |response, operation|
|
278
|
+
response = ::Gapic::PagedEnumerable.new @ekm_service_stub, :list_ekm_connections, request, response, operation, options
|
279
|
+
yield response, operation if block_given?
|
280
|
+
return response
|
281
|
+
end
|
282
|
+
rescue ::GRPC::BadStatus => e
|
283
|
+
raise ::Google::Cloud::Error.from_error(e)
|
284
|
+
end
|
285
|
+
|
286
|
+
##
|
287
|
+
# Returns metadata for a given
|
288
|
+
# {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}.
|
289
|
+
#
|
290
|
+
# @overload get_ekm_connection(request, options = nil)
|
291
|
+
# Pass arguments to `get_ekm_connection` via a request object, either of type
|
292
|
+
# {::Google::Cloud::Kms::V1::GetEkmConnectionRequest} or an equivalent Hash.
|
293
|
+
#
|
294
|
+
# @param request [::Google::Cloud::Kms::V1::GetEkmConnectionRequest, ::Hash]
|
295
|
+
# A request object representing the call parameters. Required. To specify no
|
296
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
297
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
298
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
299
|
+
#
|
300
|
+
# @overload get_ekm_connection(name: nil)
|
301
|
+
# Pass arguments to `get_ekm_connection` via keyword arguments. Note that at
|
302
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
303
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
304
|
+
#
|
305
|
+
# @param name [::String]
|
306
|
+
# Required. The {::Google::Cloud::Kms::V1::EkmConnection#name name} of the
|
307
|
+
# {::Google::Cloud::Kms::V1::EkmConnection EkmConnection} to get.
|
308
|
+
#
|
309
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
310
|
+
# @yieldparam response [::Google::Cloud::Kms::V1::EkmConnection]
|
311
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
312
|
+
#
|
313
|
+
# @return [::Google::Cloud::Kms::V1::EkmConnection]
|
314
|
+
#
|
315
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
316
|
+
#
|
317
|
+
# @example Basic example
|
318
|
+
# require "google/cloud/kms/v1"
|
319
|
+
#
|
320
|
+
# # Create a client object. The client can be reused for multiple calls.
|
321
|
+
# client = Google::Cloud::Kms::V1::EkmService::Client.new
|
322
|
+
#
|
323
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
324
|
+
# request = Google::Cloud::Kms::V1::GetEkmConnectionRequest.new
|
325
|
+
#
|
326
|
+
# # Call the get_ekm_connection method.
|
327
|
+
# result = client.get_ekm_connection request
|
328
|
+
#
|
329
|
+
# # The returned object is of type Google::Cloud::Kms::V1::EkmConnection.
|
330
|
+
# p result
|
331
|
+
#
|
332
|
+
def get_ekm_connection request, options = nil
|
333
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
334
|
+
|
335
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetEkmConnectionRequest
|
336
|
+
|
337
|
+
# Converts hash and nil to an options object
|
338
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
339
|
+
|
340
|
+
# Customize the options with defaults
|
341
|
+
metadata = @config.rpcs.get_ekm_connection.metadata.to_h
|
342
|
+
|
343
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
344
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
345
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
346
|
+
gapic_version: ::Google::Cloud::Kms::V1::VERSION
|
347
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
348
|
+
|
349
|
+
header_params = {}
|
350
|
+
if request.name
|
351
|
+
header_params["name"] = request.name
|
352
|
+
end
|
353
|
+
|
354
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
355
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
356
|
+
|
357
|
+
options.apply_defaults timeout: @config.rpcs.get_ekm_connection.timeout,
|
358
|
+
metadata: metadata,
|
359
|
+
retry_policy: @config.rpcs.get_ekm_connection.retry_policy
|
360
|
+
|
361
|
+
options.apply_defaults timeout: @config.timeout,
|
362
|
+
metadata: @config.metadata,
|
363
|
+
retry_policy: @config.retry_policy
|
364
|
+
|
365
|
+
@ekm_service_stub.call_rpc :get_ekm_connection, request, options: options do |response, operation|
|
366
|
+
yield response, operation if block_given?
|
367
|
+
return response
|
368
|
+
end
|
369
|
+
rescue ::GRPC::BadStatus => e
|
370
|
+
raise ::Google::Cloud::Error.from_error(e)
|
371
|
+
end
|
372
|
+
|
373
|
+
##
|
374
|
+
# Creates a new {::Google::Cloud::Kms::V1::EkmConnection EkmConnection} in a given
|
375
|
+
# Project and Location.
|
376
|
+
#
|
377
|
+
# @overload create_ekm_connection(request, options = nil)
|
378
|
+
# Pass arguments to `create_ekm_connection` via a request object, either of type
|
379
|
+
# {::Google::Cloud::Kms::V1::CreateEkmConnectionRequest} or an equivalent Hash.
|
380
|
+
#
|
381
|
+
# @param request [::Google::Cloud::Kms::V1::CreateEkmConnectionRequest, ::Hash]
|
382
|
+
# A request object representing the call parameters. Required. To specify no
|
383
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
384
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
385
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
386
|
+
#
|
387
|
+
# @overload create_ekm_connection(parent: nil, ekm_connection_id: nil, ekm_connection: nil)
|
388
|
+
# Pass arguments to `create_ekm_connection` via keyword arguments. Note that at
|
389
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
390
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
391
|
+
#
|
392
|
+
# @param parent [::String]
|
393
|
+
# Required. The resource name of the location associated with the
|
394
|
+
# {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}, in the format
|
395
|
+
# `projects/*/locations/*`.
|
396
|
+
# @param ekm_connection_id [::String]
|
397
|
+
# Required. It must be unique within a location and match the regular
|
398
|
+
# expression `[a-zA-Z0-9_-]{1,63}`.
|
399
|
+
# @param ekm_connection [::Google::Cloud::Kms::V1::EkmConnection, ::Hash]
|
400
|
+
# Required. An {::Google::Cloud::Kms::V1::EkmConnection EkmConnection} with
|
401
|
+
# initial field values.
|
402
|
+
#
|
403
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
404
|
+
# @yieldparam response [::Google::Cloud::Kms::V1::EkmConnection]
|
405
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
406
|
+
#
|
407
|
+
# @return [::Google::Cloud::Kms::V1::EkmConnection]
|
408
|
+
#
|
409
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
410
|
+
#
|
411
|
+
# @example Basic example
|
412
|
+
# require "google/cloud/kms/v1"
|
413
|
+
#
|
414
|
+
# # Create a client object. The client can be reused for multiple calls.
|
415
|
+
# client = Google::Cloud::Kms::V1::EkmService::Client.new
|
416
|
+
#
|
417
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
418
|
+
# request = Google::Cloud::Kms::V1::CreateEkmConnectionRequest.new
|
419
|
+
#
|
420
|
+
# # Call the create_ekm_connection method.
|
421
|
+
# result = client.create_ekm_connection request
|
422
|
+
#
|
423
|
+
# # The returned object is of type Google::Cloud::Kms::V1::EkmConnection.
|
424
|
+
# p result
|
425
|
+
#
|
426
|
+
def create_ekm_connection request, options = nil
|
427
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
428
|
+
|
429
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::CreateEkmConnectionRequest
|
430
|
+
|
431
|
+
# Converts hash and nil to an options object
|
432
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
433
|
+
|
434
|
+
# Customize the options with defaults
|
435
|
+
metadata = @config.rpcs.create_ekm_connection.metadata.to_h
|
436
|
+
|
437
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
438
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
439
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
440
|
+
gapic_version: ::Google::Cloud::Kms::V1::VERSION
|
441
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
442
|
+
|
443
|
+
header_params = {}
|
444
|
+
if request.parent
|
445
|
+
header_params["parent"] = request.parent
|
446
|
+
end
|
447
|
+
|
448
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
449
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
450
|
+
|
451
|
+
options.apply_defaults timeout: @config.rpcs.create_ekm_connection.timeout,
|
452
|
+
metadata: metadata,
|
453
|
+
retry_policy: @config.rpcs.create_ekm_connection.retry_policy
|
454
|
+
|
455
|
+
options.apply_defaults timeout: @config.timeout,
|
456
|
+
metadata: @config.metadata,
|
457
|
+
retry_policy: @config.retry_policy
|
458
|
+
|
459
|
+
@ekm_service_stub.call_rpc :create_ekm_connection, request, options: options do |response, operation|
|
460
|
+
yield response, operation if block_given?
|
461
|
+
return response
|
462
|
+
end
|
463
|
+
rescue ::GRPC::BadStatus => e
|
464
|
+
raise ::Google::Cloud::Error.from_error(e)
|
465
|
+
end
|
466
|
+
|
467
|
+
##
|
468
|
+
# Updates an {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}'s metadata.
|
469
|
+
#
|
470
|
+
# @overload update_ekm_connection(request, options = nil)
|
471
|
+
# Pass arguments to `update_ekm_connection` via a request object, either of type
|
472
|
+
# {::Google::Cloud::Kms::V1::UpdateEkmConnectionRequest} or an equivalent Hash.
|
473
|
+
#
|
474
|
+
# @param request [::Google::Cloud::Kms::V1::UpdateEkmConnectionRequest, ::Hash]
|
475
|
+
# A request object representing the call parameters. Required. To specify no
|
476
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
477
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
478
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
479
|
+
#
|
480
|
+
# @overload update_ekm_connection(ekm_connection: nil, update_mask: nil)
|
481
|
+
# Pass arguments to `update_ekm_connection` via keyword arguments. Note that at
|
482
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
483
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
484
|
+
#
|
485
|
+
# @param ekm_connection [::Google::Cloud::Kms::V1::EkmConnection, ::Hash]
|
486
|
+
# Required. {::Google::Cloud::Kms::V1::EkmConnection EkmConnection} with updated
|
487
|
+
# values.
|
488
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
489
|
+
# Required. List of fields to be updated in this request.
|
490
|
+
#
|
491
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
492
|
+
# @yieldparam response [::Google::Cloud::Kms::V1::EkmConnection]
|
493
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
494
|
+
#
|
495
|
+
# @return [::Google::Cloud::Kms::V1::EkmConnection]
|
496
|
+
#
|
497
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
498
|
+
#
|
499
|
+
# @example Basic example
|
500
|
+
# require "google/cloud/kms/v1"
|
501
|
+
#
|
502
|
+
# # Create a client object. The client can be reused for multiple calls.
|
503
|
+
# client = Google::Cloud::Kms::V1::EkmService::Client.new
|
504
|
+
#
|
505
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
506
|
+
# request = Google::Cloud::Kms::V1::UpdateEkmConnectionRequest.new
|
507
|
+
#
|
508
|
+
# # Call the update_ekm_connection method.
|
509
|
+
# result = client.update_ekm_connection request
|
510
|
+
#
|
511
|
+
# # The returned object is of type Google::Cloud::Kms::V1::EkmConnection.
|
512
|
+
# p result
|
513
|
+
#
|
514
|
+
def update_ekm_connection request, options = nil
|
515
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
516
|
+
|
517
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::UpdateEkmConnectionRequest
|
518
|
+
|
519
|
+
# Converts hash and nil to an options object
|
520
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
521
|
+
|
522
|
+
# Customize the options with defaults
|
523
|
+
metadata = @config.rpcs.update_ekm_connection.metadata.to_h
|
524
|
+
|
525
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
526
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
527
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
528
|
+
gapic_version: ::Google::Cloud::Kms::V1::VERSION
|
529
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
530
|
+
|
531
|
+
header_params = {}
|
532
|
+
if request.ekm_connection&.name
|
533
|
+
header_params["ekm_connection.name"] = request.ekm_connection.name
|
534
|
+
end
|
535
|
+
|
536
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
537
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
538
|
+
|
539
|
+
options.apply_defaults timeout: @config.rpcs.update_ekm_connection.timeout,
|
540
|
+
metadata: metadata,
|
541
|
+
retry_policy: @config.rpcs.update_ekm_connection.retry_policy
|
542
|
+
|
543
|
+
options.apply_defaults timeout: @config.timeout,
|
544
|
+
metadata: @config.metadata,
|
545
|
+
retry_policy: @config.retry_policy
|
546
|
+
|
547
|
+
@ekm_service_stub.call_rpc :update_ekm_connection, request, options: options do |response, operation|
|
548
|
+
yield response, operation if block_given?
|
549
|
+
return response
|
550
|
+
end
|
551
|
+
rescue ::GRPC::BadStatus => e
|
552
|
+
raise ::Google::Cloud::Error.from_error(e)
|
553
|
+
end
|
554
|
+
|
555
|
+
##
|
556
|
+
# Configuration class for the EkmService API.
|
557
|
+
#
|
558
|
+
# This class represents the configuration for EkmService,
|
559
|
+
# providing control over timeouts, retry behavior, logging, transport
|
560
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
561
|
+
# applied individually to specific RPCs. See
|
562
|
+
# {::Google::Cloud::Kms::V1::EkmService::Client::Configuration::Rpcs}
|
563
|
+
# for a list of RPCs that can be configured independently.
|
564
|
+
#
|
565
|
+
# Configuration can be applied globally to all clients, or to a single client
|
566
|
+
# on construction.
|
567
|
+
#
|
568
|
+
# @example
|
569
|
+
#
|
570
|
+
# # Modify the global config, setting the timeout for
|
571
|
+
# # list_ekm_connections to 20 seconds,
|
572
|
+
# # and all remaining timeouts to 10 seconds.
|
573
|
+
# ::Google::Cloud::Kms::V1::EkmService::Client.configure do |config|
|
574
|
+
# config.timeout = 10.0
|
575
|
+
# config.rpcs.list_ekm_connections.timeout = 20.0
|
576
|
+
# end
|
577
|
+
#
|
578
|
+
# # Apply the above configuration only to a new client.
|
579
|
+
# client = ::Google::Cloud::Kms::V1::EkmService::Client.new do |config|
|
580
|
+
# config.timeout = 10.0
|
581
|
+
# config.rpcs.list_ekm_connections.timeout = 20.0
|
582
|
+
# end
|
583
|
+
#
|
584
|
+
# @!attribute [rw] endpoint
|
585
|
+
# The hostname or hostname:port of the service endpoint.
|
586
|
+
# Defaults to `"cloudkms.googleapis.com"`.
|
587
|
+
# @return [::String]
|
588
|
+
# @!attribute [rw] credentials
|
589
|
+
# Credentials to send with calls. You may provide any of the following types:
|
590
|
+
# * (`String`) The path to a service account key file in JSON format
|
591
|
+
# * (`Hash`) A service account key as a Hash
|
592
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
593
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
594
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
595
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
596
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
597
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
598
|
+
# * (`nil`) indicating no credentials
|
599
|
+
# @return [::Object]
|
600
|
+
# @!attribute [rw] scope
|
601
|
+
# The OAuth scopes
|
602
|
+
# @return [::Array<::String>]
|
603
|
+
# @!attribute [rw] lib_name
|
604
|
+
# The library name as recorded in instrumentation and logging
|
605
|
+
# @return [::String]
|
606
|
+
# @!attribute [rw] lib_version
|
607
|
+
# The library version as recorded in instrumentation and logging
|
608
|
+
# @return [::String]
|
609
|
+
# @!attribute [rw] channel_args
|
610
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
611
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
612
|
+
# @return [::Hash]
|
613
|
+
# @!attribute [rw] interceptors
|
614
|
+
# An array of interceptors that are run before calls are executed.
|
615
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
616
|
+
# @!attribute [rw] timeout
|
617
|
+
# The call timeout in seconds.
|
618
|
+
# @return [::Numeric]
|
619
|
+
# @!attribute [rw] metadata
|
620
|
+
# Additional gRPC headers to be sent with the call.
|
621
|
+
# @return [::Hash{::Symbol=>::String}]
|
622
|
+
# @!attribute [rw] retry_policy
|
623
|
+
# The retry policy. The value is a hash with the following keys:
|
624
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
625
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
626
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
627
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
628
|
+
# trigger a retry.
|
629
|
+
# @return [::Hash]
|
630
|
+
# @!attribute [rw] quota_project
|
631
|
+
# A separate project against which to charge quota.
|
632
|
+
# @return [::String]
|
633
|
+
#
|
634
|
+
class Configuration
|
635
|
+
extend ::Gapic::Config
|
636
|
+
|
637
|
+
config_attr :endpoint, "cloudkms.googleapis.com", ::String
|
638
|
+
config_attr :credentials, nil do |value|
|
639
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
640
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
641
|
+
allowed.any? { |klass| klass === value }
|
642
|
+
end
|
643
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
644
|
+
config_attr :lib_name, nil, ::String, nil
|
645
|
+
config_attr :lib_version, nil, ::String, nil
|
646
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
647
|
+
config_attr :interceptors, nil, ::Array, nil
|
648
|
+
config_attr :timeout, nil, ::Numeric, nil
|
649
|
+
config_attr :metadata, nil, ::Hash, nil
|
650
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
651
|
+
config_attr :quota_project, nil, ::String, nil
|
652
|
+
|
653
|
+
# @private
|
654
|
+
def initialize parent_config = nil
|
655
|
+
@parent_config = parent_config unless parent_config.nil?
|
656
|
+
|
657
|
+
yield self if block_given?
|
658
|
+
end
|
659
|
+
|
660
|
+
##
|
661
|
+
# Configurations for individual RPCs
|
662
|
+
# @return [Rpcs]
|
663
|
+
#
|
664
|
+
def rpcs
|
665
|
+
@rpcs ||= begin
|
666
|
+
parent_rpcs = nil
|
667
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
668
|
+
Rpcs.new parent_rpcs
|
669
|
+
end
|
670
|
+
end
|
671
|
+
|
672
|
+
##
|
673
|
+
# Configuration RPC class for the EkmService API.
|
674
|
+
#
|
675
|
+
# Includes fields providing the configuration for each RPC in this service.
|
676
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
677
|
+
# the following configuration fields:
|
678
|
+
#
|
679
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
680
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
681
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
682
|
+
# include the following keys:
|
683
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
684
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
685
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
686
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
687
|
+
# trigger a retry.
|
688
|
+
#
|
689
|
+
class Rpcs
|
690
|
+
##
|
691
|
+
# RPC-specific configuration for `list_ekm_connections`
|
692
|
+
# @return [::Gapic::Config::Method]
|
693
|
+
#
|
694
|
+
attr_reader :list_ekm_connections
|
695
|
+
##
|
696
|
+
# RPC-specific configuration for `get_ekm_connection`
|
697
|
+
# @return [::Gapic::Config::Method]
|
698
|
+
#
|
699
|
+
attr_reader :get_ekm_connection
|
700
|
+
##
|
701
|
+
# RPC-specific configuration for `create_ekm_connection`
|
702
|
+
# @return [::Gapic::Config::Method]
|
703
|
+
#
|
704
|
+
attr_reader :create_ekm_connection
|
705
|
+
##
|
706
|
+
# RPC-specific configuration for `update_ekm_connection`
|
707
|
+
# @return [::Gapic::Config::Method]
|
708
|
+
#
|
709
|
+
attr_reader :update_ekm_connection
|
710
|
+
|
711
|
+
# @private
|
712
|
+
def initialize parent_rpcs = nil
|
713
|
+
list_ekm_connections_config = parent_rpcs.list_ekm_connections if parent_rpcs.respond_to? :list_ekm_connections
|
714
|
+
@list_ekm_connections = ::Gapic::Config::Method.new list_ekm_connections_config
|
715
|
+
get_ekm_connection_config = parent_rpcs.get_ekm_connection if parent_rpcs.respond_to? :get_ekm_connection
|
716
|
+
@get_ekm_connection = ::Gapic::Config::Method.new get_ekm_connection_config
|
717
|
+
create_ekm_connection_config = parent_rpcs.create_ekm_connection if parent_rpcs.respond_to? :create_ekm_connection
|
718
|
+
@create_ekm_connection = ::Gapic::Config::Method.new create_ekm_connection_config
|
719
|
+
update_ekm_connection_config = parent_rpcs.update_ekm_connection if parent_rpcs.respond_to? :update_ekm_connection
|
720
|
+
@update_ekm_connection = ::Gapic::Config::Method.new update_ekm_connection_config
|
721
|
+
|
722
|
+
yield self if block_given?
|
723
|
+
end
|
724
|
+
end
|
725
|
+
end
|
726
|
+
end
|
727
|
+
end
|
728
|
+
end
|
729
|
+
end
|
730
|
+
end
|
731
|
+
end
|