google-cloud-kms-inventory-v1 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 +149 -0
- data/LICENSE.md +201 -0
- data/README.md +144 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/client.rb +406 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/credentials.rb +49 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/paths.rb +49 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/rest/client.rb +359 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/rest/service_stub.rb +109 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/rest.rb +54 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service.rb +57 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service_pb.rb +37 -0
- data/lib/google/cloud/kms/inventory/v1/key_dashboard_service_services_pb.rb +49 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service/client.rb +514 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service/credentials.rb +49 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service/paths.rb +98 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service/rest/client.rb +444 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service/rest/service_stub.rb +168 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service/rest.rb +55 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service.rb +58 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service_pb.rb +64 -0
- data/lib/google/cloud/kms/inventory/v1/key_tracking_service_services_pb.rb +55 -0
- data/lib/google/cloud/kms/inventory/v1/rest.rb +40 -0
- data/lib/google/cloud/kms/inventory/v1/version.rb +30 -0
- data/lib/google/cloud/kms/inventory/v1.rb +48 -0
- data/lib/google-cloud-kms-inventory-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/field_behavior.rb +71 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/cloud/kms/inventory/v1/key_dashboard_service.rb +62 -0
- data/proto_docs/google/cloud/kms/inventory/v1/key_tracking_service.rb +200 -0
- data/proto_docs/google/cloud/kms/v1/resources.rb +839 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +129 -0
- data/proto_docs/google/protobuf/wrappers.rb +121 -0
- metadata +248 -0
@@ -0,0 +1,359 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/inventory/v1/key_dashboard_service_pb"
|
21
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Kms
|
26
|
+
module Inventory
|
27
|
+
module V1
|
28
|
+
module KeyDashboardService
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the KeyDashboardService service.
|
32
|
+
#
|
33
|
+
# Provides a cross-region view of all Cloud KMS keys in a given Cloud project.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :key_dashboard_service_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the KeyDashboardService Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all KeyDashboardService clients
|
50
|
+
# ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @yield [config] Configure the Client client.
|
55
|
+
# @yieldparam config [Client::Configuration]
|
56
|
+
#
|
57
|
+
# @return [Client::Configuration]
|
58
|
+
#
|
59
|
+
def self.configure
|
60
|
+
@configure ||= begin
|
61
|
+
namespace = ["Google", "Cloud", "Kms", "Inventory", "V1"]
|
62
|
+
parent_config = while namespace.any?
|
63
|
+
parent_name = namespace.join "::"
|
64
|
+
parent_const = const_get parent_name
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
+
namespace.pop
|
67
|
+
end
|
68
|
+
default_config = Client::Configuration.new parent_config
|
69
|
+
|
70
|
+
default_config.rpcs.list_crypto_keys.timeout = 60.0
|
71
|
+
|
72
|
+
default_config
|
73
|
+
end
|
74
|
+
yield @configure if block_given?
|
75
|
+
@configure
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Configure the KeyDashboardService Client instance.
|
80
|
+
#
|
81
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
82
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
83
|
+
# should be made on {Client.configure}.
|
84
|
+
#
|
85
|
+
# See {::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client::Configuration}
|
86
|
+
# for a description of the configuration fields.
|
87
|
+
#
|
88
|
+
# @yield [config] Configure the Client client.
|
89
|
+
# @yieldparam config [Client::Configuration]
|
90
|
+
#
|
91
|
+
# @return [Client::Configuration]
|
92
|
+
#
|
93
|
+
def configure
|
94
|
+
yield @config if block_given?
|
95
|
+
@config
|
96
|
+
end
|
97
|
+
|
98
|
+
##
|
99
|
+
# Create a new KeyDashboardService REST client object.
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
#
|
103
|
+
# # Create a client using the default configuration
|
104
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client.new
|
105
|
+
#
|
106
|
+
# # Create a client using a custom configuration
|
107
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client.new do |config|
|
108
|
+
# config.timeout = 10.0
|
109
|
+
# end
|
110
|
+
#
|
111
|
+
# @yield [config] Configure the KeyDashboardService client.
|
112
|
+
# @yieldparam config [Client::Configuration]
|
113
|
+
#
|
114
|
+
def initialize
|
115
|
+
# Create the configuration object
|
116
|
+
@config = Configuration.new Client.configure
|
117
|
+
|
118
|
+
# Yield the configuration if needed
|
119
|
+
yield @config if block_given?
|
120
|
+
|
121
|
+
# Create credentials
|
122
|
+
credentials = @config.credentials
|
123
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
124
|
+
# but only if the default endpoint does not have a region prefix.
|
125
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
126
|
+
!@config.endpoint.split(".").first.include?("-")
|
127
|
+
credentials ||= Credentials.default scope: @config.scope,
|
128
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
129
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
130
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
131
|
+
end
|
132
|
+
|
133
|
+
@quota_project_id = @config.quota_project
|
134
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
135
|
+
|
136
|
+
@key_dashboard_service_stub = ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
137
|
+
end
|
138
|
+
|
139
|
+
# Service calls
|
140
|
+
|
141
|
+
##
|
142
|
+
# Returns cryptographic keys managed by Cloud KMS in a given Cloud project.
|
143
|
+
# Note that this data is sourced from snapshots, meaning it may not
|
144
|
+
# completely reflect the actual state of key metadata at call time.
|
145
|
+
#
|
146
|
+
# @overload list_crypto_keys(request, options = nil)
|
147
|
+
# Pass arguments to `list_crypto_keys` via a request object, either of type
|
148
|
+
# {::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysRequest} or an equivalent Hash.
|
149
|
+
#
|
150
|
+
# @param request [::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysRequest, ::Hash]
|
151
|
+
# A request object representing the call parameters. Required. To specify no
|
152
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
153
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
154
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
155
|
+
#
|
156
|
+
# @overload list_crypto_keys(parent: nil, page_size: nil, page_token: nil)
|
157
|
+
# Pass arguments to `list_crypto_keys` via keyword arguments. Note that at
|
158
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
159
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
160
|
+
#
|
161
|
+
# @param parent [::String]
|
162
|
+
# Required. The Google Cloud project for which to retrieve key metadata, in
|
163
|
+
# the format `projects/*`
|
164
|
+
# @param page_size [::Integer]
|
165
|
+
# Optional. The maximum number of keys to return. The service may return
|
166
|
+
# fewer than this value. If unspecified, at most 1000 keys will be returned.
|
167
|
+
# The maximum value is 1000; values above 1000 will be coerced to 1000.
|
168
|
+
# @param page_token [::String]
|
169
|
+
# Optional. Pass this into a subsequent request in order to receive the next
|
170
|
+
# page of results.
|
171
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
172
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>]
|
173
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
174
|
+
#
|
175
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>]
|
176
|
+
#
|
177
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
178
|
+
def list_crypto_keys request, options = nil
|
179
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
180
|
+
|
181
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysRequest
|
182
|
+
|
183
|
+
# Converts hash and nil to an options object
|
184
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
185
|
+
|
186
|
+
# Customize the options with defaults
|
187
|
+
call_metadata = @config.rpcs.list_crypto_keys.metadata.to_h
|
188
|
+
|
189
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
190
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
191
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
192
|
+
gapic_version: ::Google::Cloud::Kms::Inventory::V1::VERSION,
|
193
|
+
transports_version_send: [:rest]
|
194
|
+
|
195
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
196
|
+
|
197
|
+
options.apply_defaults timeout: @config.rpcs.list_crypto_keys.timeout,
|
198
|
+
metadata: call_metadata,
|
199
|
+
retry_policy: @config.rpcs.list_crypto_keys.retry_policy
|
200
|
+
|
201
|
+
options.apply_defaults timeout: @config.timeout,
|
202
|
+
metadata: @config.metadata,
|
203
|
+
retry_policy: @config.retry_policy
|
204
|
+
|
205
|
+
@key_dashboard_service_stub.list_crypto_keys request, options do |result, operation|
|
206
|
+
result = ::Gapic::Rest::PagedEnumerable.new @key_dashboard_service_stub, :list_crypto_keys, "crypto_keys", request, result, options
|
207
|
+
yield result, operation if block_given?
|
208
|
+
return result
|
209
|
+
end
|
210
|
+
rescue ::Gapic::Rest::Error => e
|
211
|
+
raise ::Google::Cloud::Error.from_error(e)
|
212
|
+
end
|
213
|
+
|
214
|
+
##
|
215
|
+
# Configuration class for the KeyDashboardService REST API.
|
216
|
+
#
|
217
|
+
# This class represents the configuration for KeyDashboardService REST,
|
218
|
+
# providing control over timeouts, retry behavior, logging, transport
|
219
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
220
|
+
# applied individually to specific RPCs. See
|
221
|
+
# {::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client::Configuration::Rpcs}
|
222
|
+
# for a list of RPCs that can be configured independently.
|
223
|
+
#
|
224
|
+
# Configuration can be applied globally to all clients, or to a single client
|
225
|
+
# on construction.
|
226
|
+
#
|
227
|
+
# @example
|
228
|
+
#
|
229
|
+
# # Modify the global config, setting the timeout for
|
230
|
+
# # list_crypto_keys to 20 seconds,
|
231
|
+
# # and all remaining timeouts to 10 seconds.
|
232
|
+
# ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client.configure do |config|
|
233
|
+
# config.timeout = 10.0
|
234
|
+
# config.rpcs.list_crypto_keys.timeout = 20.0
|
235
|
+
# end
|
236
|
+
#
|
237
|
+
# # Apply the above configuration only to a new client.
|
238
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client.new do |config|
|
239
|
+
# config.timeout = 10.0
|
240
|
+
# config.rpcs.list_crypto_keys.timeout = 20.0
|
241
|
+
# end
|
242
|
+
#
|
243
|
+
# @!attribute [rw] endpoint
|
244
|
+
# The hostname or hostname:port of the service endpoint.
|
245
|
+
# Defaults to `"kmsinventory.googleapis.com"`.
|
246
|
+
# @return [::String]
|
247
|
+
# @!attribute [rw] credentials
|
248
|
+
# Credentials to send with calls. You may provide any of the following types:
|
249
|
+
# * (`String`) The path to a service account key file in JSON format
|
250
|
+
# * (`Hash`) A service account key as a Hash
|
251
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
252
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
253
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
254
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
255
|
+
# * (`nil`) indicating no credentials
|
256
|
+
# @return [::Object]
|
257
|
+
# @!attribute [rw] scope
|
258
|
+
# The OAuth scopes
|
259
|
+
# @return [::Array<::String>]
|
260
|
+
# @!attribute [rw] lib_name
|
261
|
+
# The library name as recorded in instrumentation and logging
|
262
|
+
# @return [::String]
|
263
|
+
# @!attribute [rw] lib_version
|
264
|
+
# The library version as recorded in instrumentation and logging
|
265
|
+
# @return [::String]
|
266
|
+
# @!attribute [rw] timeout
|
267
|
+
# The call timeout in seconds.
|
268
|
+
# @return [::Numeric]
|
269
|
+
# @!attribute [rw] metadata
|
270
|
+
# Additional headers to be sent with the call.
|
271
|
+
# @return [::Hash{::Symbol=>::String}]
|
272
|
+
# @!attribute [rw] retry_policy
|
273
|
+
# The retry policy. The value is a hash with the following keys:
|
274
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
275
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
276
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
277
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
278
|
+
# trigger a retry.
|
279
|
+
# @return [::Hash]
|
280
|
+
# @!attribute [rw] quota_project
|
281
|
+
# A separate project against which to charge quota.
|
282
|
+
# @return [::String]
|
283
|
+
#
|
284
|
+
class Configuration
|
285
|
+
extend ::Gapic::Config
|
286
|
+
|
287
|
+
config_attr :endpoint, "kmsinventory.googleapis.com", ::String
|
288
|
+
config_attr :credentials, nil do |value|
|
289
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
290
|
+
allowed.any? { |klass| klass === value }
|
291
|
+
end
|
292
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
293
|
+
config_attr :lib_name, nil, ::String, nil
|
294
|
+
config_attr :lib_version, nil, ::String, nil
|
295
|
+
config_attr :timeout, nil, ::Numeric, nil
|
296
|
+
config_attr :metadata, nil, ::Hash, nil
|
297
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
298
|
+
config_attr :quota_project, nil, ::String, nil
|
299
|
+
|
300
|
+
# @private
|
301
|
+
def initialize parent_config = nil
|
302
|
+
@parent_config = parent_config unless parent_config.nil?
|
303
|
+
|
304
|
+
yield self if block_given?
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# Configurations for individual RPCs
|
309
|
+
# @return [Rpcs]
|
310
|
+
#
|
311
|
+
def rpcs
|
312
|
+
@rpcs ||= begin
|
313
|
+
parent_rpcs = nil
|
314
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
315
|
+
Rpcs.new parent_rpcs
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
##
|
320
|
+
# Configuration RPC class for the KeyDashboardService API.
|
321
|
+
#
|
322
|
+
# Includes fields providing the configuration for each RPC in this service.
|
323
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
324
|
+
# the following configuration fields:
|
325
|
+
#
|
326
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
327
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
328
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
329
|
+
# include the following keys:
|
330
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
331
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
332
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
333
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
334
|
+
# trigger a retry.
|
335
|
+
#
|
336
|
+
class Rpcs
|
337
|
+
##
|
338
|
+
# RPC-specific configuration for `list_crypto_keys`
|
339
|
+
# @return [::Gapic::Config::Method]
|
340
|
+
#
|
341
|
+
attr_reader :list_crypto_keys
|
342
|
+
|
343
|
+
# @private
|
344
|
+
def initialize parent_rpcs = nil
|
345
|
+
list_crypto_keys_config = parent_rpcs.list_crypto_keys if parent_rpcs.respond_to? :list_crypto_keys
|
346
|
+
@list_crypto_keys = ::Gapic::Config::Method.new list_crypto_keys_config
|
347
|
+
|
348
|
+
yield self if block_given?
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/kms/inventory/v1/key_dashboard_service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Kms
|
24
|
+
module Inventory
|
25
|
+
module V1
|
26
|
+
module KeyDashboardService
|
27
|
+
module Rest
|
28
|
+
##
|
29
|
+
# REST service stub for the KeyDashboardService service.
|
30
|
+
# Service stub contains baseline method implementations
|
31
|
+
# including transcoding, making the REST call, and deserialing the response.
|
32
|
+
#
|
33
|
+
class ServiceStub
|
34
|
+
def initialize endpoint:, credentials:
|
35
|
+
# These require statements are intentionally placed here to initialize
|
36
|
+
# the REST modules only when it's required.
|
37
|
+
require "gapic/rest"
|
38
|
+
|
39
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
|
40
|
+
numeric_enums: true,
|
41
|
+
raise_faraday_errors: false
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# Baseline implementation for the list_crypto_keys REST call
|
46
|
+
#
|
47
|
+
# @param request_pb [::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysRequest]
|
48
|
+
# A request object representing the call parameters. Required.
|
49
|
+
# @param options [::Gapic::CallOptions]
|
50
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
51
|
+
#
|
52
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
53
|
+
# @yieldparam result [::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysResponse]
|
54
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
55
|
+
#
|
56
|
+
# @return [::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysResponse]
|
57
|
+
# A result object deserialized from the server's reply
|
58
|
+
def list_crypto_keys request_pb, options = nil
|
59
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
60
|
+
|
61
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_list_crypto_keys_request request_pb
|
62
|
+
query_string_params = if query_string_params.any?
|
63
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
64
|
+
else
|
65
|
+
{}
|
66
|
+
end
|
67
|
+
|
68
|
+
response = @client_stub.make_http_request(
|
69
|
+
verb,
|
70
|
+
uri: uri,
|
71
|
+
body: body || "",
|
72
|
+
params: query_string_params,
|
73
|
+
options: options
|
74
|
+
)
|
75
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
76
|
+
result = ::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysResponse.decode_json response.body, ignore_unknown_fields: true
|
77
|
+
|
78
|
+
yield result, operation if block_given?
|
79
|
+
result
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# @private
|
84
|
+
#
|
85
|
+
# GRPC transcoding helper method for the list_crypto_keys REST call
|
86
|
+
#
|
87
|
+
# @param request_pb [::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysRequest]
|
88
|
+
# A request object representing the call parameters. Required.
|
89
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
90
|
+
# Uri, Body, Query string parameters
|
91
|
+
def self.transcode_list_crypto_keys_request request_pb
|
92
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
93
|
+
.with_bindings(
|
94
|
+
uri_method: :get,
|
95
|
+
uri_template: "/v1/{parent}/cryptoKeys",
|
96
|
+
matches: [
|
97
|
+
["parent", %r{^projects/[^/]+/?$}, false]
|
98
|
+
]
|
99
|
+
)
|
100
|
+
transcoder.transcode request_pb
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/kms/inventory/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/credentials"
|
26
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/paths"
|
27
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/rest/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Kms
|
32
|
+
module Inventory
|
33
|
+
module V1
|
34
|
+
##
|
35
|
+
# Provides a cross-region view of all Cloud KMS keys in a given Cloud project.
|
36
|
+
#
|
37
|
+
# To load this service and instantiate a REST client:
|
38
|
+
#
|
39
|
+
# require "google/cloud/kms/inventory/v1/key_dashboard_service/rest"
|
40
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client.new
|
41
|
+
#
|
42
|
+
module KeyDashboardService
|
43
|
+
# Client for the REST transport
|
44
|
+
module Rest
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
54
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/rest/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/kms/inventory/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/credentials"
|
26
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/paths"
|
27
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/client"
|
28
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/rest"
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module Kms
|
33
|
+
module Inventory
|
34
|
+
module V1
|
35
|
+
##
|
36
|
+
# Provides a cross-region view of all Cloud KMS keys in a given Cloud project.
|
37
|
+
#
|
38
|
+
# @example Load this service and instantiate a gRPC client
|
39
|
+
#
|
40
|
+
# require "google/cloud/kms/inventory/v1/key_dashboard_service"
|
41
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Client.new
|
42
|
+
#
|
43
|
+
# @example Load this service and instantiate a REST client
|
44
|
+
#
|
45
|
+
# require "google/cloud/kms/inventory/v1/key_dashboard_service/rest"
|
46
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyDashboardService::Rest::Client.new
|
47
|
+
#
|
48
|
+
module KeyDashboardService
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
helper_path = ::File.join __dir__, "key_dashboard_service", "helpers.rb"
|
57
|
+
require "google/cloud/kms/inventory/v1/key_dashboard_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/kms/inventory/v1/key_dashboard_service.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/client_pb'
|
8
|
+
require 'google/api/field_behavior_pb'
|
9
|
+
require 'google/api/resource_pb'
|
10
|
+
require 'google/cloud/kms/v1/resources_pb'
|
11
|
+
|
12
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
13
|
+
add_file("google/cloud/kms/inventory/v1/key_dashboard_service.proto", :syntax => :proto3) do
|
14
|
+
add_message "google.cloud.kms.inventory.v1.ListCryptoKeysRequest" do
|
15
|
+
optional :parent, :string, 1
|
16
|
+
optional :page_size, :int32, 2
|
17
|
+
optional :page_token, :string, 3
|
18
|
+
end
|
19
|
+
add_message "google.cloud.kms.inventory.v1.ListCryptoKeysResponse" do
|
20
|
+
repeated :crypto_keys, :message, 1, "google.cloud.kms.v1.CryptoKey"
|
21
|
+
optional :next_page_token, :string, 2
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module Google
|
27
|
+
module Cloud
|
28
|
+
module Kms
|
29
|
+
module Inventory
|
30
|
+
module V1
|
31
|
+
ListCryptoKeysRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.inventory.v1.ListCryptoKeysRequest").msgclass
|
32
|
+
ListCryptoKeysResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.inventory.v1.ListCryptoKeysResponse").msgclass
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/kms/inventory/v1/key_dashboard_service.proto for package 'google.cloud.kms.inventory.v1'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2022 Google LLC
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/kms/inventory/v1/key_dashboard_service_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Kms
|
25
|
+
module Inventory
|
26
|
+
module V1
|
27
|
+
module KeyDashboardService
|
28
|
+
# Provides a cross-region view of all Cloud KMS keys in a given Cloud project.
|
29
|
+
class Service
|
30
|
+
|
31
|
+
include ::GRPC::GenericService
|
32
|
+
|
33
|
+
self.marshal_class_method = :encode
|
34
|
+
self.unmarshal_class_method = :decode
|
35
|
+
self.service_name = 'google.cloud.kms.inventory.v1.KeyDashboardService'
|
36
|
+
|
37
|
+
# Returns cryptographic keys managed by Cloud KMS in a given Cloud project.
|
38
|
+
# Note that this data is sourced from snapshots, meaning it may not
|
39
|
+
# completely reflect the actual state of key metadata at call time.
|
40
|
+
rpc :ListCryptoKeys, ::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysRequest, ::Google::Cloud::Kms::Inventory::V1::ListCryptoKeysResponse
|
41
|
+
end
|
42
|
+
|
43
|
+
Stub = Service.rpc_stub_class
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|