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