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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +144 -0
  6. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/client.rb +406 -0
  7. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/credentials.rb +49 -0
  8. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/paths.rb +49 -0
  9. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/rest/client.rb +359 -0
  10. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/rest/service_stub.rb +109 -0
  11. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service/rest.rb +54 -0
  12. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service.rb +57 -0
  13. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service_pb.rb +37 -0
  14. data/lib/google/cloud/kms/inventory/v1/key_dashboard_service_services_pb.rb +49 -0
  15. data/lib/google/cloud/kms/inventory/v1/key_tracking_service/client.rb +514 -0
  16. data/lib/google/cloud/kms/inventory/v1/key_tracking_service/credentials.rb +49 -0
  17. data/lib/google/cloud/kms/inventory/v1/key_tracking_service/paths.rb +98 -0
  18. data/lib/google/cloud/kms/inventory/v1/key_tracking_service/rest/client.rb +444 -0
  19. data/lib/google/cloud/kms/inventory/v1/key_tracking_service/rest/service_stub.rb +168 -0
  20. data/lib/google/cloud/kms/inventory/v1/key_tracking_service/rest.rb +55 -0
  21. data/lib/google/cloud/kms/inventory/v1/key_tracking_service.rb +58 -0
  22. data/lib/google/cloud/kms/inventory/v1/key_tracking_service_pb.rb +64 -0
  23. data/lib/google/cloud/kms/inventory/v1/key_tracking_service_services_pb.rb +55 -0
  24. data/lib/google/cloud/kms/inventory/v1/rest.rb +40 -0
  25. data/lib/google/cloud/kms/inventory/v1/version.rb +30 -0
  26. data/lib/google/cloud/kms/inventory/v1.rb +48 -0
  27. data/lib/google-cloud-kms-inventory-v1.rb +21 -0
  28. data/proto_docs/README.md +4 -0
  29. data/proto_docs/google/api/client.rb +318 -0
  30. data/proto_docs/google/api/field_behavior.rb +71 -0
  31. data/proto_docs/google/api/launch_stage.rb +71 -0
  32. data/proto_docs/google/api/resource.rb +222 -0
  33. data/proto_docs/google/cloud/kms/inventory/v1/key_dashboard_service.rb +62 -0
  34. data/proto_docs/google/cloud/kms/inventory/v1/key_tracking_service.rb +200 -0
  35. data/proto_docs/google/cloud/kms/v1/resources.rb +839 -0
  36. data/proto_docs/google/protobuf/duration.rb +98 -0
  37. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  38. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  39. metadata +248 -0
@@ -0,0 +1,514 @@
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
+
22
+ module Google
23
+ module Cloud
24
+ module Kms
25
+ module Inventory
26
+ module V1
27
+ module KeyTrackingService
28
+ ##
29
+ # Client for the KeyTrackingService service.
30
+ #
31
+ # Returns information about the resources in an org that are protected by a
32
+ # given Cloud KMS key via CMEK.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :key_tracking_service_stub
39
+
40
+ ##
41
+ # Configure the KeyTrackingService Client class.
42
+ #
43
+ # See {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all KeyTrackingService clients
49
+ # ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "Kms", "Inventory", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.rpcs.get_protected_resources_summary.timeout = 60.0
70
+
71
+ default_config.rpcs.search_protected_resources.timeout = 60.0
72
+
73
+ default_config
74
+ end
75
+ yield @configure if block_given?
76
+ @configure
77
+ end
78
+
79
+ ##
80
+ # Configure the KeyTrackingService Client instance.
81
+ #
82
+ # The configuration is set to the derived mode, meaning that values can be changed,
83
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
84
+ # should be made on {Client.configure}.
85
+ #
86
+ # See {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client::Configuration}
87
+ # for a description of the configuration fields.
88
+ #
89
+ # @yield [config] Configure the Client client.
90
+ # @yieldparam config [Client::Configuration]
91
+ #
92
+ # @return [Client::Configuration]
93
+ #
94
+ def configure
95
+ yield @config if block_given?
96
+ @config
97
+ end
98
+
99
+ ##
100
+ # Create a new KeyTrackingService client object.
101
+ #
102
+ # @example
103
+ #
104
+ # # Create a client using the default configuration
105
+ # client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new
106
+ #
107
+ # # Create a client using a custom configuration
108
+ # client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new do |config|
109
+ # config.timeout = 10.0
110
+ # end
111
+ #
112
+ # @yield [config] Configure the KeyTrackingService client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ def initialize
116
+ # These require statements are intentionally placed here to initialize
117
+ # the gRPC module only when it's required.
118
+ # See https://github.com/googleapis/toolkit/issues/446
119
+ require "gapic/grpc"
120
+ require "google/cloud/kms/inventory/v1/key_tracking_service_services_pb"
121
+
122
+ # Create the configuration object
123
+ @config = Configuration.new Client.configure
124
+
125
+ # Yield the configuration if needed
126
+ yield @config if block_given?
127
+
128
+ # Create credentials
129
+ credentials = @config.credentials
130
+ # Use self-signed JWT if the endpoint is unchanged from default,
131
+ # but only if the default endpoint does not have a region prefix.
132
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @key_tracking_service_stub = ::Gapic::ServiceStub.new(
143
+ ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Stub,
144
+ credentials: credentials,
145
+ endpoint: @config.endpoint,
146
+ channel_args: @config.channel_args,
147
+ interceptors: @config.interceptors
148
+ )
149
+ end
150
+
151
+ # Service calls
152
+
153
+ ##
154
+ # Returns aggregate information about the resources protected by the given
155
+ # Cloud KMS {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}. Only resources within
156
+ # the same Cloud organization as the key will be returned. The project that
157
+ # holds the key must be part of an organization in order for this call to
158
+ # succeed.
159
+ #
160
+ # @overload get_protected_resources_summary(request, options = nil)
161
+ # Pass arguments to `get_protected_resources_summary` via a request object, either of type
162
+ # {::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest} or an equivalent Hash.
163
+ #
164
+ # @param request [::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest, ::Hash]
165
+ # A request object representing the call parameters. Required. To specify no
166
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
167
+ # @param options [::Gapic::CallOptions, ::Hash]
168
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
169
+ #
170
+ # @overload get_protected_resources_summary(name: nil)
171
+ # Pass arguments to `get_protected_resources_summary` via keyword arguments. Note that at
172
+ # least one keyword argument is required. To specify no parameters, or to keep all
173
+ # the default parameter values, pass an empty Hash as a request object (see above).
174
+ #
175
+ # @param name [::String]
176
+ # Required. The resource name of the
177
+ # {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}.
178
+ #
179
+ # @yield [response, operation] Access the result along with the RPC operation
180
+ # @yieldparam response [::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary]
181
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
182
+ #
183
+ # @return [::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary]
184
+ #
185
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
186
+ #
187
+ # @example Basic example
188
+ # require "google/cloud/kms/inventory/v1"
189
+ #
190
+ # # Create a client object. The client can be reused for multiple calls.
191
+ # client = Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new
192
+ #
193
+ # # Create a request. To set request fields, pass in keyword arguments.
194
+ # request = Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest.new
195
+ #
196
+ # # Call the get_protected_resources_summary method.
197
+ # result = client.get_protected_resources_summary request
198
+ #
199
+ # # The returned object is of type Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary.
200
+ # p result
201
+ #
202
+ def get_protected_resources_summary request, options = nil
203
+ raise ::ArgumentError, "request must be provided" if request.nil?
204
+
205
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest
206
+
207
+ # Converts hash and nil to an options object
208
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
209
+
210
+ # Customize the options with defaults
211
+ metadata = @config.rpcs.get_protected_resources_summary.metadata.to_h
212
+
213
+ # Set x-goog-api-client and x-goog-user-project headers
214
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
215
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
216
+ gapic_version: ::Google::Cloud::Kms::Inventory::V1::VERSION
217
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
218
+
219
+ header_params = {}
220
+ if request.name
221
+ header_params["name"] = request.name
222
+ end
223
+
224
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
225
+ metadata[:"x-goog-request-params"] ||= request_params_header
226
+
227
+ options.apply_defaults timeout: @config.rpcs.get_protected_resources_summary.timeout,
228
+ metadata: metadata,
229
+ retry_policy: @config.rpcs.get_protected_resources_summary.retry_policy
230
+
231
+ options.apply_defaults timeout: @config.timeout,
232
+ metadata: @config.metadata,
233
+ retry_policy: @config.retry_policy
234
+
235
+ @key_tracking_service_stub.call_rpc :get_protected_resources_summary, request, options: options do |response, operation|
236
+ yield response, operation if block_given?
237
+ return response
238
+ end
239
+ rescue ::GRPC::BadStatus => e
240
+ raise ::Google::Cloud::Error.from_error(e)
241
+ end
242
+
243
+ ##
244
+ # Returns metadata about the resources protected by the given Cloud KMS
245
+ # {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} in the given Cloud organization.
246
+ #
247
+ # @overload search_protected_resources(request, options = nil)
248
+ # Pass arguments to `search_protected_resources` via a request object, either of type
249
+ # {::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest} or an equivalent Hash.
250
+ #
251
+ # @param request [::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest, ::Hash]
252
+ # A request object representing the call parameters. Required. To specify no
253
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
254
+ # @param options [::Gapic::CallOptions, ::Hash]
255
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
256
+ #
257
+ # @overload search_protected_resources(scope: nil, crypto_key: nil, page_size: nil, page_token: nil)
258
+ # Pass arguments to `search_protected_resources` via keyword arguments. Note that at
259
+ # least one keyword argument is required. To specify no parameters, or to keep all
260
+ # the default parameter values, pass an empty Hash as a request object (see above).
261
+ #
262
+ # @param scope [::String]
263
+ # Required. Resource name of the organization.
264
+ # Example: organizations/123
265
+ # @param crypto_key [::String]
266
+ # Required. The resource name of the
267
+ # {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}.
268
+ # @param page_size [::Integer]
269
+ # The maximum number of resources to return. The service may return fewer
270
+ # than this value.
271
+ # If unspecified, at most 500 resources will be returned.
272
+ # The maximum value is 500; values above 500 will be coerced to 500.
273
+ # @param page_token [::String]
274
+ # A page token, received from a previous
275
+ # {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client#search_protected_resources KeyTrackingService.SearchProtectedResources}
276
+ # call. Provide this to retrieve the subsequent page.
277
+ #
278
+ # When paginating, all other parameters provided to
279
+ # {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client#search_protected_resources KeyTrackingService.SearchProtectedResources}
280
+ # must match the call that provided the page token.
281
+ #
282
+ # @yield [response, operation] Access the result along with the RPC operation
283
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Kms::Inventory::V1::ProtectedResource>]
284
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
285
+ #
286
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Kms::Inventory::V1::ProtectedResource>]
287
+ #
288
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
+ #
290
+ # @example Basic example
291
+ # require "google/cloud/kms/inventory/v1"
292
+ #
293
+ # # Create a client object. The client can be reused for multiple calls.
294
+ # client = Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new
295
+ #
296
+ # # Create a request. To set request fields, pass in keyword arguments.
297
+ # request = Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest.new
298
+ #
299
+ # # Call the search_protected_resources method.
300
+ # result = client.search_protected_resources request
301
+ #
302
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
303
+ # # over elements, and API calls will be issued to fetch pages as needed.
304
+ # result.each do |item|
305
+ # # Each element is of type ::Google::Cloud::Kms::Inventory::V1::ProtectedResource.
306
+ # p item
307
+ # end
308
+ #
309
+ def search_protected_resources request, options = nil
310
+ raise ::ArgumentError, "request must be provided" if request.nil?
311
+
312
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest
313
+
314
+ # Converts hash and nil to an options object
315
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
316
+
317
+ # Customize the options with defaults
318
+ metadata = @config.rpcs.search_protected_resources.metadata.to_h
319
+
320
+ # Set x-goog-api-client and x-goog-user-project headers
321
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
322
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
323
+ gapic_version: ::Google::Cloud::Kms::Inventory::V1::VERSION
324
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
325
+
326
+ header_params = {}
327
+ if request.scope
328
+ header_params["scope"] = request.scope
329
+ end
330
+
331
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
332
+ metadata[:"x-goog-request-params"] ||= request_params_header
333
+
334
+ options.apply_defaults timeout: @config.rpcs.search_protected_resources.timeout,
335
+ metadata: metadata,
336
+ retry_policy: @config.rpcs.search_protected_resources.retry_policy
337
+
338
+ options.apply_defaults timeout: @config.timeout,
339
+ metadata: @config.metadata,
340
+ retry_policy: @config.retry_policy
341
+
342
+ @key_tracking_service_stub.call_rpc :search_protected_resources, request, options: options do |response, operation|
343
+ response = ::Gapic::PagedEnumerable.new @key_tracking_service_stub, :search_protected_resources, request, response, operation, options
344
+ yield response, operation if block_given?
345
+ return response
346
+ end
347
+ rescue ::GRPC::BadStatus => e
348
+ raise ::Google::Cloud::Error.from_error(e)
349
+ end
350
+
351
+ ##
352
+ # Configuration class for the KeyTrackingService API.
353
+ #
354
+ # This class represents the configuration for KeyTrackingService,
355
+ # providing control over timeouts, retry behavior, logging, transport
356
+ # parameters, and other low-level controls. Certain parameters can also be
357
+ # applied individually to specific RPCs. See
358
+ # {::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client::Configuration::Rpcs}
359
+ # for a list of RPCs that can be configured independently.
360
+ #
361
+ # Configuration can be applied globally to all clients, or to a single client
362
+ # on construction.
363
+ #
364
+ # @example
365
+ #
366
+ # # Modify the global config, setting the timeout for
367
+ # # get_protected_resources_summary to 20 seconds,
368
+ # # and all remaining timeouts to 10 seconds.
369
+ # ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.configure do |config|
370
+ # config.timeout = 10.0
371
+ # config.rpcs.get_protected_resources_summary.timeout = 20.0
372
+ # end
373
+ #
374
+ # # Apply the above configuration only to a new client.
375
+ # client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new do |config|
376
+ # config.timeout = 10.0
377
+ # config.rpcs.get_protected_resources_summary.timeout = 20.0
378
+ # end
379
+ #
380
+ # @!attribute [rw] endpoint
381
+ # The hostname or hostname:port of the service endpoint.
382
+ # Defaults to `"kmsinventory.googleapis.com"`.
383
+ # @return [::String]
384
+ # @!attribute [rw] credentials
385
+ # Credentials to send with calls. You may provide any of the following types:
386
+ # * (`String`) The path to a service account key file in JSON format
387
+ # * (`Hash`) A service account key as a Hash
388
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
389
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
390
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
391
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
392
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
393
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
394
+ # * (`nil`) indicating no credentials
395
+ # @return [::Object]
396
+ # @!attribute [rw] scope
397
+ # The OAuth scopes
398
+ # @return [::Array<::String>]
399
+ # @!attribute [rw] lib_name
400
+ # The library name as recorded in instrumentation and logging
401
+ # @return [::String]
402
+ # @!attribute [rw] lib_version
403
+ # The library version as recorded in instrumentation and logging
404
+ # @return [::String]
405
+ # @!attribute [rw] channel_args
406
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
407
+ # `GRPC::Core::Channel` object is provided as the credential.
408
+ # @return [::Hash]
409
+ # @!attribute [rw] interceptors
410
+ # An array of interceptors that are run before calls are executed.
411
+ # @return [::Array<::GRPC::ClientInterceptor>]
412
+ # @!attribute [rw] timeout
413
+ # The call timeout in seconds.
414
+ # @return [::Numeric]
415
+ # @!attribute [rw] metadata
416
+ # Additional gRPC headers to be sent with the call.
417
+ # @return [::Hash{::Symbol=>::String}]
418
+ # @!attribute [rw] retry_policy
419
+ # The retry policy. The value is a hash with the following keys:
420
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
421
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
422
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
423
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
424
+ # trigger a retry.
425
+ # @return [::Hash]
426
+ # @!attribute [rw] quota_project
427
+ # A separate project against which to charge quota.
428
+ # @return [::String]
429
+ #
430
+ class Configuration
431
+ extend ::Gapic::Config
432
+
433
+ config_attr :endpoint, "kmsinventory.googleapis.com", ::String
434
+ config_attr :credentials, nil do |value|
435
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
436
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
437
+ allowed.any? { |klass| klass === value }
438
+ end
439
+ config_attr :scope, nil, ::String, ::Array, nil
440
+ config_attr :lib_name, nil, ::String, nil
441
+ config_attr :lib_version, nil, ::String, nil
442
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
443
+ config_attr :interceptors, nil, ::Array, nil
444
+ config_attr :timeout, nil, ::Numeric, nil
445
+ config_attr :metadata, nil, ::Hash, nil
446
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
447
+ config_attr :quota_project, nil, ::String, nil
448
+
449
+ # @private
450
+ def initialize parent_config = nil
451
+ @parent_config = parent_config unless parent_config.nil?
452
+
453
+ yield self if block_given?
454
+ end
455
+
456
+ ##
457
+ # Configurations for individual RPCs
458
+ # @return [Rpcs]
459
+ #
460
+ def rpcs
461
+ @rpcs ||= begin
462
+ parent_rpcs = nil
463
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
464
+ Rpcs.new parent_rpcs
465
+ end
466
+ end
467
+
468
+ ##
469
+ # Configuration RPC class for the KeyTrackingService API.
470
+ #
471
+ # Includes fields providing the configuration for each RPC in this service.
472
+ # Each configuration object is of type `Gapic::Config::Method` and includes
473
+ # the following configuration fields:
474
+ #
475
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
476
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
477
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
478
+ # include the following keys:
479
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
480
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
481
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
482
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
483
+ # trigger a retry.
484
+ #
485
+ class Rpcs
486
+ ##
487
+ # RPC-specific configuration for `get_protected_resources_summary`
488
+ # @return [::Gapic::Config::Method]
489
+ #
490
+ attr_reader :get_protected_resources_summary
491
+ ##
492
+ # RPC-specific configuration for `search_protected_resources`
493
+ # @return [::Gapic::Config::Method]
494
+ #
495
+ attr_reader :search_protected_resources
496
+
497
+ # @private
498
+ def initialize parent_rpcs = nil
499
+ get_protected_resources_summary_config = parent_rpcs.get_protected_resources_summary if parent_rpcs.respond_to? :get_protected_resources_summary
500
+ @get_protected_resources_summary = ::Gapic::Config::Method.new get_protected_resources_summary_config
501
+ search_protected_resources_config = parent_rpcs.search_protected_resources if parent_rpcs.respond_to? :search_protected_resources
502
+ @search_protected_resources = ::Gapic::Config::Method.new search_protected_resources_config
503
+
504
+ yield self if block_given?
505
+ end
506
+ end
507
+ end
508
+ end
509
+ end
510
+ end
511
+ end
512
+ end
513
+ end
514
+ end
@@ -0,0 +1,49 @@
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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Kms
24
+ module Inventory
25
+ module V1
26
+ module KeyTrackingService
27
+ # Credentials for the KeyTrackingService API.
28
+ class Credentials < ::Google::Auth::Credentials
29
+ self.scope = [
30
+ "https://www.googleapis.com/auth/cloud-platform"
31
+ ]
32
+ self.env_vars = [
33
+ "GOOGLE_CLOUD_CREDENTIALS",
34
+ "GOOGLE_CLOUD_KEYFILE",
35
+ "GCLOUD_KEYFILE",
36
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
37
+ "GOOGLE_CLOUD_KEYFILE_JSON",
38
+ "GCLOUD_KEYFILE_JSON"
39
+ ]
40
+ self.paths = [
41
+ "~/.config/google_cloud/application_default_credentials.json"
42
+ ]
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,98 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module Kms
23
+ module Inventory
24
+ module V1
25
+ module KeyTrackingService
26
+ # Path helper methods for the KeyTrackingService API.
27
+ module Paths
28
+ ##
29
+ # Create a fully-qualified Organization resource string.
30
+ #
31
+ # The resource will be in the following format:
32
+ #
33
+ # `organizations/{organization}`
34
+ #
35
+ # @param organization [String]
36
+ #
37
+ # @return [::String]
38
+ def organization_path organization:
39
+ "organizations/#{organization}"
40
+ end
41
+
42
+ ##
43
+ # Create a fully-qualified ProtectedResourcesSummary resource string.
44
+ #
45
+ # @overload protected_resources_summary_path(project:, location:, key_ring:, crypto_key:)
46
+ # The resource will be in the following format:
47
+ #
48
+ # `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary`
49
+ #
50
+ # @param project [String]
51
+ # @param location [String]
52
+ # @param key_ring [String]
53
+ # @param crypto_key [String]
54
+ #
55
+ # @overload protected_resources_summary_path(project:, location:, key_ring:, crypto_key:, crypto_key_version:)
56
+ # The resource will be in the following format:
57
+ #
58
+ # `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary`
59
+ #
60
+ # @param project [String]
61
+ # @param location [String]
62
+ # @param key_ring [String]
63
+ # @param crypto_key [String]
64
+ # @param crypto_key_version [String]
65
+ #
66
+ # @return [::String]
67
+ def protected_resources_summary_path **args
68
+ resources = {
69
+ "crypto_key:key_ring:location:project" => (proc do |project:, location:, key_ring:, crypto_key:|
70
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
71
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
72
+ raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"
73
+
74
+ "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}/protectedResourcesSummary"
75
+ end),
76
+ "crypto_key:crypto_key_version:key_ring:location:project" => (proc do |project:, location:, key_ring:, crypto_key:, crypto_key_version:|
77
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
78
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
79
+ raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"
80
+ raise ::ArgumentError, "crypto_key cannot contain /" if crypto_key.to_s.include? "/"
81
+
82
+ "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}/cryptoKeyVersions/#{crypto_key_version}/protectedResourcesSummary"
83
+ end)
84
+ }
85
+
86
+ resource = resources[args.keys.sort.join(":")]
87
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
88
+ resource.call(**args)
89
+ end
90
+
91
+ extend self
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end