google-cloud-cloud_security_compliance-v1 0.1.1 → 0.2.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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +4 -4
  4. data/lib/google/cloud/cloud_security_compliance/v1/audit/client.rb +859 -0
  5. data/lib/google/cloud/cloud_security_compliance/v1/audit/credentials.rb +47 -0
  6. data/lib/google/cloud/cloud_security_compliance/v1/audit/operations.rb +841 -0
  7. data/lib/google/cloud/cloud_security_compliance/v1/audit/paths.rb +110 -0
  8. data/lib/google/cloud/cloud_security_compliance/v1/audit/rest/client.rb +796 -0
  9. data/lib/google/cloud/cloud_security_compliance/v1/audit/rest/operations.rb +925 -0
  10. data/lib/google/cloud/cloud_security_compliance/v1/audit/rest/service_stub.rb +387 -0
  11. data/lib/google/cloud/cloud_security_compliance/v1/audit/rest.rb +54 -0
  12. data/lib/google/cloud/cloud_security_compliance/v1/audit.rb +56 -0
  13. data/lib/google/cloud/cloud_security_compliance/v1/bindings_override.rb +1 -1
  14. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/client.rb +608 -0
  15. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/credentials.rb +47 -0
  16. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/paths.rb +72 -0
  17. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/rest/client.rb +559 -0
  18. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/rest/service_stub.rb +234 -0
  19. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/rest.rb +54 -0
  20. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service.rb +56 -0
  21. data/lib/google/cloud/cloud_security_compliance/v1/config/client.rb +113 -99
  22. data/lib/google/cloud/cloud_security_compliance/v1/config/rest/client.rb +113 -99
  23. data/lib/google/cloud/cloud_security_compliance/v1/deployment/client.rb +60 -38
  24. data/lib/google/cloud/cloud_security_compliance/v1/deployment/rest/client.rb +60 -38
  25. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/client.rb +940 -0
  26. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/credentials.rb +47 -0
  27. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/paths.rb +142 -0
  28. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/rest/client.rb +870 -0
  29. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/rest/service_stub.rb +456 -0
  30. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/rest.rb +53 -0
  31. data/lib/google/cloud/cloud_security_compliance/v1/monitoring.rb +55 -0
  32. data/lib/google/cloud/cloud_security_compliance/v1/rest.rb +4 -1
  33. data/lib/google/cloud/cloud_security_compliance/v1/version.rb +1 -1
  34. data/lib/google/cloud/cloud_security_compliance/v1.rb +5 -2
  35. data/lib/google/cloud/cloudsecuritycompliance/v1/audit_pb.rb +70 -0
  36. data/lib/google/cloud/cloudsecuritycompliance/v1/audit_services_pb.rb +51 -0
  37. data/lib/google/cloud/cloudsecuritycompliance/v1/cm_enrollment_service_pb.rb +54 -0
  38. data/lib/google/cloud/cloudsecuritycompliance/v1/cm_enrollment_service_services_pb.rb +54 -0
  39. data/lib/google/cloud/cloudsecuritycompliance/v1/common_pb.rb +4 -1
  40. data/lib/google/cloud/cloudsecuritycompliance/v1/config_pb.rb +1 -1
  41. data/lib/google/cloud/cloudsecuritycompliance/v1/config_services_pb.rb +58 -55
  42. data/lib/google/cloud/cloudsecuritycompliance/v1/deployment_services_pb.rb +9 -6
  43. data/lib/google/cloud/cloudsecuritycompliance/v1/monitoring_pb.rb +74 -0
  44. data/lib/google/cloud/cloudsecuritycompliance/v1/monitoring_services_pb.rb +53 -0
  45. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/audit.rb +413 -0
  46. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/cm_enrollment_service.rb +108 -0
  47. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/common.rb +210 -181
  48. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/config.rb +69 -57
  49. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/deployment.rb +180 -139
  50. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/monitoring.rb +527 -0
  51. data/proto_docs/google/type/interval.rb +45 -0
  52. metadata +34 -1
@@ -0,0 +1,608 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/cloudsecuritycompliance/v1/cm_enrollment_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module CloudSecurityCompliance
26
+ module V1
27
+ module CmEnrollmentService
28
+ ##
29
+ # Client for the CmEnrollmentService service.
30
+ #
31
+ # Service describing CmEnrollment related RPCs for
32
+ # complianceManager.
33
+ #
34
+ class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudsecuritycompliance.$UNIVERSE_DOMAIN$"
40
+
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :cm_enrollment_service_stub
45
+
46
+ ##
47
+ # Configure the CmEnrollmentService Client class.
48
+ #
49
+ # See {::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all CmEnrollmentService clients
55
+ # ::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Cloud", "CloudSecurityCompliance", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config.rpcs.update_cm_enrollment.timeout = 60.0
76
+ default_config.rpcs.update_cm_enrollment.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config.rpcs.calculate_effective_cm_enrollment.timeout = 60.0
81
+ default_config.rpcs.calculate_effective_cm_enrollment.retry_policy = {
82
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
83
+ }
84
+
85
+ default_config
86
+ end
87
+ yield @configure if block_given?
88
+ @configure
89
+ end
90
+
91
+ ##
92
+ # Configure the CmEnrollmentService Client instance.
93
+ #
94
+ # The configuration is set to the derived mode, meaning that values can be changed,
95
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
96
+ # should be made on {Client.configure}.
97
+ #
98
+ # See {::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client::Configuration}
99
+ # for a description of the configuration fields.
100
+ #
101
+ # @yield [config] Configure the Client client.
102
+ # @yieldparam config [Client::Configuration]
103
+ #
104
+ # @return [Client::Configuration]
105
+ #
106
+ def configure
107
+ yield @config if block_given?
108
+ @config
109
+ end
110
+
111
+ ##
112
+ # The effective universe domain
113
+ #
114
+ # @return [String]
115
+ #
116
+ def universe_domain
117
+ @cm_enrollment_service_stub.universe_domain
118
+ end
119
+
120
+ ##
121
+ # Create a new CmEnrollmentService client object.
122
+ #
123
+ # @example
124
+ #
125
+ # # Create a client using the default configuration
126
+ # client = ::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client.new
127
+ #
128
+ # # Create a client using a custom configuration
129
+ # client = ::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client.new do |config|
130
+ # config.timeout = 10.0
131
+ # end
132
+ #
133
+ # @yield [config] Configure the CmEnrollmentService client.
134
+ # @yieldparam config [Client::Configuration]
135
+ #
136
+ def initialize
137
+ # These require statements are intentionally placed here to initialize
138
+ # the gRPC module only when it's required.
139
+ # See https://github.com/googleapis/toolkit/issues/446
140
+ require "gapic/grpc"
141
+ require "google/cloud/cloudsecuritycompliance/v1/cm_enrollment_service_services_pb"
142
+
143
+ # Create the configuration object
144
+ @config = Configuration.new Client.configure
145
+
146
+ # Yield the configuration if needed
147
+ yield @config if block_given?
148
+
149
+ # Create credentials
150
+ credentials = @config.credentials
151
+ # Use self-signed JWT if the endpoint is unchanged from default,
152
+ # but only if the default endpoint does not have a region prefix.
153
+ enable_self_signed_jwt = @config.endpoint.nil? ||
154
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
155
+ !@config.endpoint.split(".").first.include?("-"))
156
+ credentials ||= Credentials.default scope: @config.scope,
157
+ enable_self_signed_jwt: enable_self_signed_jwt
158
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
159
+ credentials = Credentials.new credentials, scope: @config.scope
160
+ end
161
+ @quota_project_id = @config.quota_project
162
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
163
+
164
+ @cm_enrollment_service_stub = ::Gapic::ServiceStub.new(
165
+ ::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Stub,
166
+ credentials: credentials,
167
+ endpoint: @config.endpoint,
168
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
169
+ universe_domain: @config.universe_domain,
170
+ channel_args: @config.channel_args,
171
+ interceptors: @config.interceptors,
172
+ channel_pool_config: @config.channel_pool,
173
+ logger: @config.logger
174
+ )
175
+
176
+ @cm_enrollment_service_stub.stub_logger&.info do |entry|
177
+ entry.set_system_name
178
+ entry.set_service
179
+ entry.message = "Created client for #{entry.service}"
180
+ entry.set_credentials_fields credentials
181
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
182
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
183
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
184
+ end
185
+
186
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
187
+ config.credentials = credentials
188
+ config.quota_project = @quota_project_id
189
+ config.endpoint = @cm_enrollment_service_stub.endpoint
190
+ config.universe_domain = @cm_enrollment_service_stub.universe_domain
191
+ config.logger = @cm_enrollment_service_stub.logger if config.respond_to? :logger=
192
+ end
193
+ end
194
+
195
+ ##
196
+ # Get the associated client for mix-in of the Locations.
197
+ #
198
+ # @return [Google::Cloud::Location::Locations::Client]
199
+ #
200
+ attr_reader :location_client
201
+
202
+ ##
203
+ # The logger used for request/response debug logging.
204
+ #
205
+ # @return [Logger]
206
+ #
207
+ def logger
208
+ @cm_enrollment_service_stub.logger
209
+ end
210
+
211
+ # Service calls
212
+
213
+ ##
214
+ # Updates the Compliance Manager enrollment for a resource to facilitate
215
+ # an audit.
216
+ # Use this method to enroll a resource in Compliance Manager or to
217
+ # create or update feature-specific configurations.
218
+ #
219
+ # @overload update_cm_enrollment(request, options = nil)
220
+ # Pass arguments to `update_cm_enrollment` via a request object, either of type
221
+ # {::Google::Cloud::CloudSecurityCompliance::V1::UpdateCmEnrollmentRequest} or an equivalent Hash.
222
+ #
223
+ # @param request [::Google::Cloud::CloudSecurityCompliance::V1::UpdateCmEnrollmentRequest, ::Hash]
224
+ # A request object representing the call parameters. Required. To specify no
225
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
226
+ # @param options [::Gapic::CallOptions, ::Hash]
227
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
228
+ #
229
+ # @overload update_cm_enrollment(cm_enrollment: nil, update_mask: nil)
230
+ # Pass arguments to `update_cm_enrollment` via keyword arguments. Note that at
231
+ # least one keyword argument is required. To specify no parameters, or to keep all
232
+ # the default parameter values, pass an empty Hash as a request object (see above).
233
+ #
234
+ # @param cm_enrollment [::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollment, ::Hash]
235
+ # Required. The Compliance Manager enrollment to update.
236
+ # The `name` field is used to identify the settings that you want to update.
237
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
238
+ # Optional. The list of fields that you want to update.
239
+ #
240
+ # @yield [response, operation] Access the result along with the RPC operation
241
+ # @yieldparam response [::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollment]
242
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
243
+ #
244
+ # @return [::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollment]
245
+ #
246
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
247
+ #
248
+ # @example Basic example
249
+ # require "google/cloud/cloud_security_compliance/v1"
250
+ #
251
+ # # Create a client object. The client can be reused for multiple calls.
252
+ # client = Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client.new
253
+ #
254
+ # # Create a request. To set request fields, pass in keyword arguments.
255
+ # request = Google::Cloud::CloudSecurityCompliance::V1::UpdateCmEnrollmentRequest.new
256
+ #
257
+ # # Call the update_cm_enrollment method.
258
+ # result = client.update_cm_enrollment request
259
+ #
260
+ # # The returned object is of type Google::Cloud::CloudSecurityCompliance::V1::CmEnrollment.
261
+ # p result
262
+ #
263
+ def update_cm_enrollment request, options = nil
264
+ raise ::ArgumentError, "request must be provided" if request.nil?
265
+
266
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudSecurityCompliance::V1::UpdateCmEnrollmentRequest
267
+
268
+ # Converts hash and nil to an options object
269
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
270
+
271
+ # Customize the options with defaults
272
+ metadata = @config.rpcs.update_cm_enrollment.metadata.to_h
273
+
274
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
275
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
276
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
277
+ gapic_version: ::Google::Cloud::CloudSecurityCompliance::V1::VERSION
278
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
279
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
280
+
281
+ header_params = {}
282
+ if request.cm_enrollment&.name
283
+ header_params["cm_enrollment.name"] = request.cm_enrollment.name
284
+ end
285
+
286
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
287
+ metadata[:"x-goog-request-params"] ||= request_params_header
288
+
289
+ options.apply_defaults timeout: @config.rpcs.update_cm_enrollment.timeout,
290
+ metadata: metadata,
291
+ retry_policy: @config.rpcs.update_cm_enrollment.retry_policy
292
+
293
+ options.apply_defaults timeout: @config.timeout,
294
+ metadata: @config.metadata,
295
+ retry_policy: @config.retry_policy
296
+
297
+ @cm_enrollment_service_stub.call_rpc :update_cm_enrollment, request, options: options do |response, operation|
298
+ yield response, operation if block_given?
299
+ end
300
+ rescue ::GRPC::BadStatus => e
301
+ raise ::Google::Cloud::Error.from_error(e)
302
+ end
303
+
304
+ ##
305
+ # Calculates the effective Compliance Manager enrollment for a resource.
306
+ # An effective enrollment is either a direct enrollment of a
307
+ # resource (if it exists), or an enrollment of the closest parent of a
308
+ # resource that's enrolled in Compliance Manager.
309
+ #
310
+ # @overload calculate_effective_cm_enrollment(request, options = nil)
311
+ # Pass arguments to `calculate_effective_cm_enrollment` via a request object, either of type
312
+ # {::Google::Cloud::CloudSecurityCompliance::V1::CalculateEffectiveCmEnrollmentRequest} or an equivalent Hash.
313
+ #
314
+ # @param request [::Google::Cloud::CloudSecurityCompliance::V1::CalculateEffectiveCmEnrollmentRequest, ::Hash]
315
+ # A request object representing the call parameters. Required. To specify no
316
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
317
+ # @param options [::Gapic::CallOptions, ::Hash]
318
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
319
+ #
320
+ # @overload calculate_effective_cm_enrollment(name: nil)
321
+ # Pass arguments to `calculate_effective_cm_enrollment` via keyword arguments. Note that at
322
+ # least one keyword argument is required. To specify no parameters, or to keep all
323
+ # the default parameter values, pass an empty Hash as a request object (see above).
324
+ #
325
+ # @param name [::String]
326
+ # Required. The name of the Compliance Manager enrollment to calculate.
327
+ #
328
+ # Supported formats are the following:
329
+ #
330
+ # * `organizations/{organization_id}/locations/{location}/cmEnrollment`
331
+ # * `folders/{folder_id}/locations/{location}/cmEnrollment`
332
+ # * `projects/{project_id}/locations/{location}/cmEnrollment`
333
+ #
334
+ # @yield [response, operation] Access the result along with the RPC operation
335
+ # @yieldparam response [::Google::Cloud::CloudSecurityCompliance::V1::CalculateEffectiveCmEnrollmentResponse]
336
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
337
+ #
338
+ # @return [::Google::Cloud::CloudSecurityCompliance::V1::CalculateEffectiveCmEnrollmentResponse]
339
+ #
340
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
341
+ #
342
+ # @example Basic example
343
+ # require "google/cloud/cloud_security_compliance/v1"
344
+ #
345
+ # # Create a client object. The client can be reused for multiple calls.
346
+ # client = Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client.new
347
+ #
348
+ # # Create a request. To set request fields, pass in keyword arguments.
349
+ # request = Google::Cloud::CloudSecurityCompliance::V1::CalculateEffectiveCmEnrollmentRequest.new
350
+ #
351
+ # # Call the calculate_effective_cm_enrollment method.
352
+ # result = client.calculate_effective_cm_enrollment request
353
+ #
354
+ # # The returned object is of type Google::Cloud::CloudSecurityCompliance::V1::CalculateEffectiveCmEnrollmentResponse.
355
+ # p result
356
+ #
357
+ def calculate_effective_cm_enrollment request, options = nil
358
+ raise ::ArgumentError, "request must be provided" if request.nil?
359
+
360
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudSecurityCompliance::V1::CalculateEffectiveCmEnrollmentRequest
361
+
362
+ # Converts hash and nil to an options object
363
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
364
+
365
+ # Customize the options with defaults
366
+ metadata = @config.rpcs.calculate_effective_cm_enrollment.metadata.to_h
367
+
368
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
369
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
370
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
371
+ gapic_version: ::Google::Cloud::CloudSecurityCompliance::V1::VERSION
372
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
373
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
374
+
375
+ header_params = {}
376
+ if request.name
377
+ header_params["name"] = request.name
378
+ end
379
+
380
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
381
+ metadata[:"x-goog-request-params"] ||= request_params_header
382
+
383
+ options.apply_defaults timeout: @config.rpcs.calculate_effective_cm_enrollment.timeout,
384
+ metadata: metadata,
385
+ retry_policy: @config.rpcs.calculate_effective_cm_enrollment.retry_policy
386
+
387
+ options.apply_defaults timeout: @config.timeout,
388
+ metadata: @config.metadata,
389
+ retry_policy: @config.retry_policy
390
+
391
+ @cm_enrollment_service_stub.call_rpc :calculate_effective_cm_enrollment, request, options: options do |response, operation|
392
+ yield response, operation if block_given?
393
+ end
394
+ rescue ::GRPC::BadStatus => e
395
+ raise ::Google::Cloud::Error.from_error(e)
396
+ end
397
+
398
+ ##
399
+ # Configuration class for the CmEnrollmentService API.
400
+ #
401
+ # This class represents the configuration for CmEnrollmentService,
402
+ # providing control over timeouts, retry behavior, logging, transport
403
+ # parameters, and other low-level controls. Certain parameters can also be
404
+ # applied individually to specific RPCs. See
405
+ # {::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client::Configuration::Rpcs}
406
+ # for a list of RPCs that can be configured independently.
407
+ #
408
+ # Configuration can be applied globally to all clients, or to a single client
409
+ # on construction.
410
+ #
411
+ # @example
412
+ #
413
+ # # Modify the global config, setting the timeout for
414
+ # # update_cm_enrollment to 20 seconds,
415
+ # # and all remaining timeouts to 10 seconds.
416
+ # ::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client.configure do |config|
417
+ # config.timeout = 10.0
418
+ # config.rpcs.update_cm_enrollment.timeout = 20.0
419
+ # end
420
+ #
421
+ # # Apply the above configuration only to a new client.
422
+ # client = ::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client.new do |config|
423
+ # config.timeout = 10.0
424
+ # config.rpcs.update_cm_enrollment.timeout = 20.0
425
+ # end
426
+ #
427
+ # @!attribute [rw] endpoint
428
+ # A custom service endpoint, as a hostname or hostname:port. The default is
429
+ # nil, indicating to use the default endpoint in the current universe domain.
430
+ # @return [::String,nil]
431
+ # @!attribute [rw] credentials
432
+ # Credentials to send with calls. You may provide any of the following types:
433
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
434
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
435
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
436
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
437
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
438
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
439
+ # * (`nil`) indicating no credentials
440
+ #
441
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
442
+ # is deprecated. Providing an unvalidated credential configuration to
443
+ # Google APIs can compromise the security of your systems and data.
444
+ #
445
+ # @example
446
+ #
447
+ # # The recommended way to provide credentials is to use the `make_creds` method
448
+ # # on the appropriate credentials class for your environment.
449
+ #
450
+ # require "googleauth"
451
+ #
452
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
453
+ # json_key_io: ::File.open("/path/to/keyfile.json")
454
+ # )
455
+ #
456
+ # client = ::Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Client.new do |config|
457
+ # config.credentials = credentials
458
+ # end
459
+ #
460
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
461
+ # external source for authentication to Google Cloud, you must validate it before
462
+ # providing it to a Google API client library. Providing an unvalidated credential
463
+ # configuration to Google APIs can compromise the security of your systems and data.
464
+ # For more information, refer to [Validate credential configurations from external
465
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
466
+ # @return [::Object]
467
+ # @!attribute [rw] scope
468
+ # The OAuth scopes
469
+ # @return [::Array<::String>]
470
+ # @!attribute [rw] lib_name
471
+ # The library name as recorded in instrumentation and logging
472
+ # @return [::String]
473
+ # @!attribute [rw] lib_version
474
+ # The library version as recorded in instrumentation and logging
475
+ # @return [::String]
476
+ # @!attribute [rw] channel_args
477
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
478
+ # `GRPC::Core::Channel` object is provided as the credential.
479
+ # @return [::Hash]
480
+ # @!attribute [rw] interceptors
481
+ # An array of interceptors that are run before calls are executed.
482
+ # @return [::Array<::GRPC::ClientInterceptor>]
483
+ # @!attribute [rw] timeout
484
+ # The call timeout in seconds.
485
+ # @return [::Numeric]
486
+ # @!attribute [rw] metadata
487
+ # Additional gRPC headers to be sent with the call.
488
+ # @return [::Hash{::Symbol=>::String}]
489
+ # @!attribute [rw] retry_policy
490
+ # The retry policy. The value is a hash with the following keys:
491
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
492
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
493
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
494
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
495
+ # trigger a retry.
496
+ # @return [::Hash]
497
+ # @!attribute [rw] quota_project
498
+ # A separate project against which to charge quota.
499
+ # @return [::String]
500
+ # @!attribute [rw] universe_domain
501
+ # The universe domain within which to make requests. This determines the
502
+ # default endpoint URL. The default value of nil uses the environment
503
+ # universe (usually the default "googleapis.com" universe).
504
+ # @return [::String,nil]
505
+ # @!attribute [rw] logger
506
+ # A custom logger to use for request/response debug logging, or the value
507
+ # `:default` (the default) to construct a default logger, or `nil` to
508
+ # explicitly disable logging.
509
+ # @return [::Logger,:default,nil]
510
+ #
511
+ class Configuration
512
+ extend ::Gapic::Config
513
+
514
+ # @private
515
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
516
+ DEFAULT_ENDPOINT = "cloudsecuritycompliance.googleapis.com"
517
+
518
+ config_attr :endpoint, nil, ::String, nil
519
+ config_attr :credentials, nil do |value|
520
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
521
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
522
+ allowed.any? { |klass| klass === value }
523
+ end
524
+ config_attr :scope, nil, ::String, ::Array, nil
525
+ config_attr :lib_name, nil, ::String, nil
526
+ config_attr :lib_version, nil, ::String, nil
527
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
528
+ config_attr :interceptors, nil, ::Array, nil
529
+ config_attr :timeout, nil, ::Numeric, nil
530
+ config_attr :metadata, nil, ::Hash, nil
531
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
532
+ config_attr :quota_project, nil, ::String, nil
533
+ config_attr :universe_domain, nil, ::String, nil
534
+ config_attr :logger, :default, ::Logger, nil, :default
535
+
536
+ # @private
537
+ def initialize parent_config = nil
538
+ @parent_config = parent_config unless parent_config.nil?
539
+
540
+ yield self if block_given?
541
+ end
542
+
543
+ ##
544
+ # Configurations for individual RPCs
545
+ # @return [Rpcs]
546
+ #
547
+ def rpcs
548
+ @rpcs ||= begin
549
+ parent_rpcs = nil
550
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
551
+ Rpcs.new parent_rpcs
552
+ end
553
+ end
554
+
555
+ ##
556
+ # Configuration for the channel pool
557
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
558
+ #
559
+ def channel_pool
560
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
561
+ end
562
+
563
+ ##
564
+ # Configuration RPC class for the CmEnrollmentService API.
565
+ #
566
+ # Includes fields providing the configuration for each RPC in this service.
567
+ # Each configuration object is of type `Gapic::Config::Method` and includes
568
+ # the following configuration fields:
569
+ #
570
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
571
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
572
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
573
+ # include the following keys:
574
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
575
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
576
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
577
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
578
+ # trigger a retry.
579
+ #
580
+ class Rpcs
581
+ ##
582
+ # RPC-specific configuration for `update_cm_enrollment`
583
+ # @return [::Gapic::Config::Method]
584
+ #
585
+ attr_reader :update_cm_enrollment
586
+ ##
587
+ # RPC-specific configuration for `calculate_effective_cm_enrollment`
588
+ # @return [::Gapic::Config::Method]
589
+ #
590
+ attr_reader :calculate_effective_cm_enrollment
591
+
592
+ # @private
593
+ def initialize parent_rpcs = nil
594
+ update_cm_enrollment_config = parent_rpcs.update_cm_enrollment if parent_rpcs.respond_to? :update_cm_enrollment
595
+ @update_cm_enrollment = ::Gapic::Config::Method.new update_cm_enrollment_config
596
+ calculate_effective_cm_enrollment_config = parent_rpcs.calculate_effective_cm_enrollment if parent_rpcs.respond_to? :calculate_effective_cm_enrollment
597
+ @calculate_effective_cm_enrollment = ::Gapic::Config::Method.new calculate_effective_cm_enrollment_config
598
+
599
+ yield self if block_given?
600
+ end
601
+ end
602
+ end
603
+ end
604
+ end
605
+ end
606
+ end
607
+ end
608
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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 CloudSecurityCompliance
24
+ module V1
25
+ module CmEnrollmentService
26
+ # Credentials for the CmEnrollmentService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "GOOGLE_CLOUD_CREDENTIALS",
33
+ "GOOGLE_CLOUD_KEYFILE",
34
+ "GCLOUD_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
36
+ "GOOGLE_CLOUD_KEYFILE_JSON",
37
+ "GCLOUD_KEYFILE_JSON"
38
+ ]
39
+ self.paths = [
40
+ "~/.config/google_cloud/application_default_credentials.json"
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end