google-cloud-kms-inventory-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +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,444 @@
|
|
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_tracking_service_pb"
|
21
|
+
require "google/cloud/kms/inventory/v1/key_tracking_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Kms
|
26
|
+
module Inventory
|
27
|
+
module V1
|
28
|
+
module KeyTrackingService
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the KeyTrackingService service.
|
32
|
+
#
|
33
|
+
# Returns information about the resources in an org that are protected by a
|
34
|
+
# given Cloud KMS key via CMEK.
|
35
|
+
#
|
36
|
+
class Client
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :key_tracking_service_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the KeyTrackingService Client class.
|
44
|
+
#
|
45
|
+
# See {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# # Modify the configuration for all KeyTrackingService clients
|
51
|
+
# ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::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", "Inventory", "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.get_protected_resources_summary.timeout = 60.0
|
72
|
+
|
73
|
+
default_config.rpcs.search_protected_resources.timeout = 60.0
|
74
|
+
|
75
|
+
default_config
|
76
|
+
end
|
77
|
+
yield @configure if block_given?
|
78
|
+
@configure
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Configure the KeyTrackingService Client instance.
|
83
|
+
#
|
84
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
85
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
86
|
+
# should be made on {Client.configure}.
|
87
|
+
#
|
88
|
+
# See {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client::Configuration}
|
89
|
+
# for a description of the configuration fields.
|
90
|
+
#
|
91
|
+
# @yield [config] Configure the Client client.
|
92
|
+
# @yieldparam config [Client::Configuration]
|
93
|
+
#
|
94
|
+
# @return [Client::Configuration]
|
95
|
+
#
|
96
|
+
def configure
|
97
|
+
yield @config if block_given?
|
98
|
+
@config
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Create a new KeyTrackingService REST client object.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
#
|
106
|
+
# # Create a client using the default configuration
|
107
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client.new
|
108
|
+
#
|
109
|
+
# # Create a client using a custom configuration
|
110
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client.new do |config|
|
111
|
+
# config.timeout = 10.0
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# @yield [config] Configure the KeyTrackingService client.
|
115
|
+
# @yieldparam config [Client::Configuration]
|
116
|
+
#
|
117
|
+
def initialize
|
118
|
+
# Create the configuration object
|
119
|
+
@config = Configuration.new Client.configure
|
120
|
+
|
121
|
+
# Yield the configuration if needed
|
122
|
+
yield @config if block_given?
|
123
|
+
|
124
|
+
# Create credentials
|
125
|
+
credentials = @config.credentials
|
126
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
127
|
+
# but only if the default endpoint does not have a region prefix.
|
128
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
129
|
+
!@config.endpoint.split(".").first.include?("-")
|
130
|
+
credentials ||= Credentials.default scope: @config.scope,
|
131
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
132
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
133
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
134
|
+
end
|
135
|
+
|
136
|
+
@quota_project_id = @config.quota_project
|
137
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
138
|
+
|
139
|
+
@key_tracking_service_stub = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
140
|
+
end
|
141
|
+
|
142
|
+
# Service calls
|
143
|
+
|
144
|
+
##
|
145
|
+
# Returns aggregate information about the resources protected by the given
|
146
|
+
# Cloud KMS {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}. Only resources within
|
147
|
+
# the same Cloud organization as the key will be returned. The project that
|
148
|
+
# holds the key must be part of an organization in order for this call to
|
149
|
+
# succeed.
|
150
|
+
#
|
151
|
+
# @overload get_protected_resources_summary(request, options = nil)
|
152
|
+
# Pass arguments to `get_protected_resources_summary` via a request object, either of type
|
153
|
+
# {::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest} or an equivalent Hash.
|
154
|
+
#
|
155
|
+
# @param request [::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest, ::Hash]
|
156
|
+
# A request object representing the call parameters. Required. To specify no
|
157
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
158
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
159
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
160
|
+
#
|
161
|
+
# @overload get_protected_resources_summary(name: nil)
|
162
|
+
# Pass arguments to `get_protected_resources_summary` via keyword arguments. Note that at
|
163
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
164
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
165
|
+
#
|
166
|
+
# @param name [::String]
|
167
|
+
# Required. The resource name of the
|
168
|
+
# {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}.
|
169
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
170
|
+
# @yieldparam result [::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary]
|
171
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
172
|
+
#
|
173
|
+
# @return [::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary]
|
174
|
+
#
|
175
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
176
|
+
def get_protected_resources_summary request, options = nil
|
177
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
178
|
+
|
179
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest
|
180
|
+
|
181
|
+
# Converts hash and nil to an options object
|
182
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
183
|
+
|
184
|
+
# Customize the options with defaults
|
185
|
+
call_metadata = @config.rpcs.get_protected_resources_summary.metadata.to_h
|
186
|
+
|
187
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
188
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
189
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
190
|
+
gapic_version: ::Google::Cloud::Kms::Inventory::V1::VERSION,
|
191
|
+
transports_version_send: [:rest]
|
192
|
+
|
193
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
194
|
+
|
195
|
+
options.apply_defaults timeout: @config.rpcs.get_protected_resources_summary.timeout,
|
196
|
+
metadata: call_metadata,
|
197
|
+
retry_policy: @config.rpcs.get_protected_resources_summary.retry_policy
|
198
|
+
|
199
|
+
options.apply_defaults timeout: @config.timeout,
|
200
|
+
metadata: @config.metadata,
|
201
|
+
retry_policy: @config.retry_policy
|
202
|
+
|
203
|
+
@key_tracking_service_stub.get_protected_resources_summary request, options do |result, operation|
|
204
|
+
yield result, operation if block_given?
|
205
|
+
return result
|
206
|
+
end
|
207
|
+
rescue ::Gapic::Rest::Error => e
|
208
|
+
raise ::Google::Cloud::Error.from_error(e)
|
209
|
+
end
|
210
|
+
|
211
|
+
##
|
212
|
+
# Returns metadata about the resources protected by the given Cloud KMS
|
213
|
+
# {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} in the given Cloud organization.
|
214
|
+
#
|
215
|
+
# @overload search_protected_resources(request, options = nil)
|
216
|
+
# Pass arguments to `search_protected_resources` via a request object, either of type
|
217
|
+
# {::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest} or an equivalent Hash.
|
218
|
+
#
|
219
|
+
# @param request [::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest, ::Hash]
|
220
|
+
# A request object representing the call parameters. Required. To specify no
|
221
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
222
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
223
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
224
|
+
#
|
225
|
+
# @overload search_protected_resources(scope: nil, crypto_key: nil, page_size: nil, page_token: nil)
|
226
|
+
# Pass arguments to `search_protected_resources` via keyword arguments. Note that at
|
227
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
228
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
229
|
+
#
|
230
|
+
# @param scope [::String]
|
231
|
+
# Required. Resource name of the organization.
|
232
|
+
# Example: organizations/123
|
233
|
+
# @param crypto_key [::String]
|
234
|
+
# Required. The resource name of the
|
235
|
+
# {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}.
|
236
|
+
# @param page_size [::Integer]
|
237
|
+
# The maximum number of resources to return. The service may return fewer
|
238
|
+
# than this value.
|
239
|
+
# If unspecified, at most 500 resources will be returned.
|
240
|
+
# The maximum value is 500; values above 500 will be coerced to 500.
|
241
|
+
# @param page_token [::String]
|
242
|
+
# A page token, received from a previous
|
243
|
+
# {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client#search_protected_resources KeyTrackingService.SearchProtectedResources}
|
244
|
+
# call. Provide this to retrieve the subsequent page.
|
245
|
+
#
|
246
|
+
# When paginating, all other parameters provided to
|
247
|
+
# {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client#search_protected_resources KeyTrackingService.SearchProtectedResources}
|
248
|
+
# must match the call that provided the page token.
|
249
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
250
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::Inventory::V1::ProtectedResource>]
|
251
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
252
|
+
#
|
253
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::Inventory::V1::ProtectedResource>]
|
254
|
+
#
|
255
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
256
|
+
def search_protected_resources request, options = nil
|
257
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
258
|
+
|
259
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest
|
260
|
+
|
261
|
+
# Converts hash and nil to an options object
|
262
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
263
|
+
|
264
|
+
# Customize the options with defaults
|
265
|
+
call_metadata = @config.rpcs.search_protected_resources.metadata.to_h
|
266
|
+
|
267
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
268
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
269
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
270
|
+
gapic_version: ::Google::Cloud::Kms::Inventory::V1::VERSION,
|
271
|
+
transports_version_send: [:rest]
|
272
|
+
|
273
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
274
|
+
|
275
|
+
options.apply_defaults timeout: @config.rpcs.search_protected_resources.timeout,
|
276
|
+
metadata: call_metadata,
|
277
|
+
retry_policy: @config.rpcs.search_protected_resources.retry_policy
|
278
|
+
|
279
|
+
options.apply_defaults timeout: @config.timeout,
|
280
|
+
metadata: @config.metadata,
|
281
|
+
retry_policy: @config.retry_policy
|
282
|
+
|
283
|
+
@key_tracking_service_stub.search_protected_resources request, options do |result, operation|
|
284
|
+
result = ::Gapic::Rest::PagedEnumerable.new @key_tracking_service_stub, :search_protected_resources, "protected_resources", request, result, options
|
285
|
+
yield result, operation if block_given?
|
286
|
+
return result
|
287
|
+
end
|
288
|
+
rescue ::Gapic::Rest::Error => e
|
289
|
+
raise ::Google::Cloud::Error.from_error(e)
|
290
|
+
end
|
291
|
+
|
292
|
+
##
|
293
|
+
# Configuration class for the KeyTrackingService REST API.
|
294
|
+
#
|
295
|
+
# This class represents the configuration for KeyTrackingService REST,
|
296
|
+
# providing control over timeouts, retry behavior, logging, transport
|
297
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
298
|
+
# applied individually to specific RPCs. See
|
299
|
+
# {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client::Configuration::Rpcs}
|
300
|
+
# for a list of RPCs that can be configured independently.
|
301
|
+
#
|
302
|
+
# Configuration can be applied globally to all clients, or to a single client
|
303
|
+
# on construction.
|
304
|
+
#
|
305
|
+
# @example
|
306
|
+
#
|
307
|
+
# # Modify the global config, setting the timeout for
|
308
|
+
# # get_protected_resources_summary to 20 seconds,
|
309
|
+
# # and all remaining timeouts to 10 seconds.
|
310
|
+
# ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client.configure do |config|
|
311
|
+
# config.timeout = 10.0
|
312
|
+
# config.rpcs.get_protected_resources_summary.timeout = 20.0
|
313
|
+
# end
|
314
|
+
#
|
315
|
+
# # Apply the above configuration only to a new client.
|
316
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client.new do |config|
|
317
|
+
# config.timeout = 10.0
|
318
|
+
# config.rpcs.get_protected_resources_summary.timeout = 20.0
|
319
|
+
# end
|
320
|
+
#
|
321
|
+
# @!attribute [rw] endpoint
|
322
|
+
# The hostname or hostname:port of the service endpoint.
|
323
|
+
# Defaults to `"kmsinventory.googleapis.com"`.
|
324
|
+
# @return [::String]
|
325
|
+
# @!attribute [rw] credentials
|
326
|
+
# Credentials to send with calls. You may provide any of the following types:
|
327
|
+
# * (`String`) The path to a service account key file in JSON format
|
328
|
+
# * (`Hash`) A service account key as a Hash
|
329
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
330
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
331
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
332
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
333
|
+
# * (`nil`) indicating no credentials
|
334
|
+
# @return [::Object]
|
335
|
+
# @!attribute [rw] scope
|
336
|
+
# The OAuth scopes
|
337
|
+
# @return [::Array<::String>]
|
338
|
+
# @!attribute [rw] lib_name
|
339
|
+
# The library name as recorded in instrumentation and logging
|
340
|
+
# @return [::String]
|
341
|
+
# @!attribute [rw] lib_version
|
342
|
+
# The library version as recorded in instrumentation and logging
|
343
|
+
# @return [::String]
|
344
|
+
# @!attribute [rw] timeout
|
345
|
+
# The call timeout in seconds.
|
346
|
+
# @return [::Numeric]
|
347
|
+
# @!attribute [rw] metadata
|
348
|
+
# Additional headers to be sent with the call.
|
349
|
+
# @return [::Hash{::Symbol=>::String}]
|
350
|
+
# @!attribute [rw] retry_policy
|
351
|
+
# The retry policy. The value is a hash with the following keys:
|
352
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
353
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
354
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
355
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
356
|
+
# trigger a retry.
|
357
|
+
# @return [::Hash]
|
358
|
+
# @!attribute [rw] quota_project
|
359
|
+
# A separate project against which to charge quota.
|
360
|
+
# @return [::String]
|
361
|
+
#
|
362
|
+
class Configuration
|
363
|
+
extend ::Gapic::Config
|
364
|
+
|
365
|
+
config_attr :endpoint, "kmsinventory.googleapis.com", ::String
|
366
|
+
config_attr :credentials, nil do |value|
|
367
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
368
|
+
allowed.any? { |klass| klass === value }
|
369
|
+
end
|
370
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
371
|
+
config_attr :lib_name, nil, ::String, nil
|
372
|
+
config_attr :lib_version, nil, ::String, nil
|
373
|
+
config_attr :timeout, nil, ::Numeric, nil
|
374
|
+
config_attr :metadata, nil, ::Hash, nil
|
375
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
376
|
+
config_attr :quota_project, nil, ::String, nil
|
377
|
+
|
378
|
+
# @private
|
379
|
+
def initialize parent_config = nil
|
380
|
+
@parent_config = parent_config unless parent_config.nil?
|
381
|
+
|
382
|
+
yield self if block_given?
|
383
|
+
end
|
384
|
+
|
385
|
+
##
|
386
|
+
# Configurations for individual RPCs
|
387
|
+
# @return [Rpcs]
|
388
|
+
#
|
389
|
+
def rpcs
|
390
|
+
@rpcs ||= begin
|
391
|
+
parent_rpcs = nil
|
392
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
393
|
+
Rpcs.new parent_rpcs
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
##
|
398
|
+
# Configuration RPC class for the KeyTrackingService API.
|
399
|
+
#
|
400
|
+
# Includes fields providing the configuration for each RPC in this service.
|
401
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
402
|
+
# the following configuration fields:
|
403
|
+
#
|
404
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
405
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
406
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
407
|
+
# include the following keys:
|
408
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
409
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
410
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
411
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
412
|
+
# trigger a retry.
|
413
|
+
#
|
414
|
+
class Rpcs
|
415
|
+
##
|
416
|
+
# RPC-specific configuration for `get_protected_resources_summary`
|
417
|
+
# @return [::Gapic::Config::Method]
|
418
|
+
#
|
419
|
+
attr_reader :get_protected_resources_summary
|
420
|
+
##
|
421
|
+
# RPC-specific configuration for `search_protected_resources`
|
422
|
+
# @return [::Gapic::Config::Method]
|
423
|
+
#
|
424
|
+
attr_reader :search_protected_resources
|
425
|
+
|
426
|
+
# @private
|
427
|
+
def initialize parent_rpcs = nil
|
428
|
+
get_protected_resources_summary_config = parent_rpcs.get_protected_resources_summary if parent_rpcs.respond_to? :get_protected_resources_summary
|
429
|
+
@get_protected_resources_summary = ::Gapic::Config::Method.new get_protected_resources_summary_config
|
430
|
+
search_protected_resources_config = parent_rpcs.search_protected_resources if parent_rpcs.respond_to? :search_protected_resources
|
431
|
+
@search_protected_resources = ::Gapic::Config::Method.new search_protected_resources_config
|
432
|
+
|
433
|
+
yield self if block_given?
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
@@ -0,0 +1,168 @@
|
|
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_tracking_service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Kms
|
24
|
+
module Inventory
|
25
|
+
module V1
|
26
|
+
module KeyTrackingService
|
27
|
+
module Rest
|
28
|
+
##
|
29
|
+
# REST service stub for the KeyTrackingService 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 get_protected_resources_summary REST call
|
46
|
+
#
|
47
|
+
# @param request_pb [::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest]
|
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::ProtectedResourcesSummary]
|
54
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
55
|
+
#
|
56
|
+
# @return [::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary]
|
57
|
+
# A result object deserialized from the server's reply
|
58
|
+
def get_protected_resources_summary 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_get_protected_resources_summary_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::ProtectedResourcesSummary.decode_json response.body, ignore_unknown_fields: true
|
77
|
+
|
78
|
+
yield result, operation if block_given?
|
79
|
+
result
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Baseline implementation for the search_protected_resources REST call
|
84
|
+
#
|
85
|
+
# @param request_pb [::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest]
|
86
|
+
# A request object representing the call parameters. Required.
|
87
|
+
# @param options [::Gapic::CallOptions]
|
88
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
89
|
+
#
|
90
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
91
|
+
# @yieldparam result [::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesResponse]
|
92
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
93
|
+
#
|
94
|
+
# @return [::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesResponse]
|
95
|
+
# A result object deserialized from the server's reply
|
96
|
+
def search_protected_resources request_pb, options = nil
|
97
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
98
|
+
|
99
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_search_protected_resources_request request_pb
|
100
|
+
query_string_params = if query_string_params.any?
|
101
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
102
|
+
else
|
103
|
+
{}
|
104
|
+
end
|
105
|
+
|
106
|
+
response = @client_stub.make_http_request(
|
107
|
+
verb,
|
108
|
+
uri: uri,
|
109
|
+
body: body || "",
|
110
|
+
params: query_string_params,
|
111
|
+
options: options
|
112
|
+
)
|
113
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
114
|
+
result = ::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesResponse.decode_json response.body, ignore_unknown_fields: true
|
115
|
+
|
116
|
+
yield result, operation if block_given?
|
117
|
+
result
|
118
|
+
end
|
119
|
+
|
120
|
+
##
|
121
|
+
# @private
|
122
|
+
#
|
123
|
+
# GRPC transcoding helper method for the get_protected_resources_summary REST call
|
124
|
+
#
|
125
|
+
# @param request_pb [::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest]
|
126
|
+
# A request object representing the call parameters. Required.
|
127
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
128
|
+
# Uri, Body, Query string parameters
|
129
|
+
def self.transcode_get_protected_resources_summary_request request_pb
|
130
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
131
|
+
.with_bindings(
|
132
|
+
uri_method: :get,
|
133
|
+
uri_template: "/v1/{name}/protectedResourcesSummary",
|
134
|
+
matches: [
|
135
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys(?:/.*)?$}, true]
|
136
|
+
]
|
137
|
+
)
|
138
|
+
transcoder.transcode request_pb
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# @private
|
143
|
+
#
|
144
|
+
# GRPC transcoding helper method for the search_protected_resources REST call
|
145
|
+
#
|
146
|
+
# @param request_pb [::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest]
|
147
|
+
# A request object representing the call parameters. Required.
|
148
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
149
|
+
# Uri, Body, Query string parameters
|
150
|
+
def self.transcode_search_protected_resources_request request_pb
|
151
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
152
|
+
.with_bindings(
|
153
|
+
uri_method: :get,
|
154
|
+
uri_template: "/v1/{scope}/protectedResources:search",
|
155
|
+
matches: [
|
156
|
+
["scope", %r{^organizations/[^/]+/?$}, false]
|
157
|
+
]
|
158
|
+
)
|
159
|
+
transcoder.transcode request_pb
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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_tracking_service/credentials"
|
26
|
+
require "google/cloud/kms/inventory/v1/key_tracking_service/paths"
|
27
|
+
require "google/cloud/kms/inventory/v1/key_tracking_service/rest/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Kms
|
32
|
+
module Inventory
|
33
|
+
module V1
|
34
|
+
##
|
35
|
+
# Returns information about the resources in an org that are protected by a
|
36
|
+
# given Cloud KMS key via CMEK.
|
37
|
+
#
|
38
|
+
# To load this service and instantiate a REST client:
|
39
|
+
#
|
40
|
+
# require "google/cloud/kms/inventory/v1/key_tracking_service/rest"
|
41
|
+
# client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Rest::Client.new
|
42
|
+
#
|
43
|
+
module KeyTrackingService
|
44
|
+
# Client for the REST transport
|
45
|
+
module Rest
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
55
|
+
require "google/cloud/kms/inventory/v1/key_tracking_service/rest/helpers" if ::File.file? helper_path
|