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,859 @@
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/audit_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module CloudSecurityCompliance
26
+ module V1
27
+ module Audit
28
+ ##
29
+ # Client for the Audit service.
30
+ #
31
+ # Service describing handlers for resources
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudsecuritycompliance.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :audit_stub
44
+
45
+ ##
46
+ # Configure the Audit Client class.
47
+ #
48
+ # See {::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all Audit clients
54
+ # ::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Cloud", "CloudSecurityCompliance", "V1"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.rpcs.generate_framework_audit_scope_report.timeout = 60.0
75
+
76
+ default_config.rpcs.create_framework_audit.timeout = 60.0
77
+
78
+ default_config.rpcs.list_framework_audits.timeout = 60.0
79
+ default_config.rpcs.list_framework_audits.retry_policy = {
80
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
81
+ }
82
+
83
+ default_config.rpcs.get_framework_audit.timeout = 60.0
84
+ default_config.rpcs.get_framework_audit.retry_policy = {
85
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
86
+ }
87
+
88
+ default_config
89
+ end
90
+ yield @configure if block_given?
91
+ @configure
92
+ end
93
+
94
+ ##
95
+ # Configure the Audit Client instance.
96
+ #
97
+ # The configuration is set to the derived mode, meaning that values can be changed,
98
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
99
+ # should be made on {Client.configure}.
100
+ #
101
+ # See {::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client::Configuration}
102
+ # for a description of the configuration fields.
103
+ #
104
+ # @yield [config] Configure the Client client.
105
+ # @yieldparam config [Client::Configuration]
106
+ #
107
+ # @return [Client::Configuration]
108
+ #
109
+ def configure
110
+ yield @config if block_given?
111
+ @config
112
+ end
113
+
114
+ ##
115
+ # The effective universe domain
116
+ #
117
+ # @return [String]
118
+ #
119
+ def universe_domain
120
+ @audit_stub.universe_domain
121
+ end
122
+
123
+ ##
124
+ # Create a new Audit client object.
125
+ #
126
+ # @example
127
+ #
128
+ # # Create a client using the default configuration
129
+ # client = ::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.new
130
+ #
131
+ # # Create a client using a custom configuration
132
+ # client = ::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.new do |config|
133
+ # config.timeout = 10.0
134
+ # end
135
+ #
136
+ # @yield [config] Configure the Audit client.
137
+ # @yieldparam config [Client::Configuration]
138
+ #
139
+ def initialize
140
+ # These require statements are intentionally placed here to initialize
141
+ # the gRPC module only when it's required.
142
+ # See https://github.com/googleapis/toolkit/issues/446
143
+ require "gapic/grpc"
144
+ require "google/cloud/cloudsecuritycompliance/v1/audit_services_pb"
145
+
146
+ # Create the configuration object
147
+ @config = Configuration.new Client.configure
148
+
149
+ # Yield the configuration if needed
150
+ yield @config if block_given?
151
+
152
+ # Create credentials
153
+ credentials = @config.credentials
154
+ # Use self-signed JWT if the endpoint is unchanged from default,
155
+ # but only if the default endpoint does not have a region prefix.
156
+ enable_self_signed_jwt = @config.endpoint.nil? ||
157
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
158
+ !@config.endpoint.split(".").first.include?("-"))
159
+ credentials ||= Credentials.default scope: @config.scope,
160
+ enable_self_signed_jwt: enable_self_signed_jwt
161
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
162
+ credentials = Credentials.new credentials, scope: @config.scope
163
+ end
164
+ @quota_project_id = @config.quota_project
165
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
166
+
167
+ @operations_client = Operations.new do |config|
168
+ config.credentials = credentials
169
+ config.quota_project = @quota_project_id
170
+ config.endpoint = @config.endpoint
171
+ config.universe_domain = @config.universe_domain
172
+ end
173
+
174
+ @audit_stub = ::Gapic::ServiceStub.new(
175
+ ::Google::Cloud::CloudSecurityCompliance::V1::Audit::Stub,
176
+ credentials: credentials,
177
+ endpoint: @config.endpoint,
178
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
179
+ universe_domain: @config.universe_domain,
180
+ channel_args: @config.channel_args,
181
+ interceptors: @config.interceptors,
182
+ channel_pool_config: @config.channel_pool,
183
+ logger: @config.logger
184
+ )
185
+
186
+ @audit_stub.stub_logger&.info do |entry|
187
+ entry.set_system_name
188
+ entry.set_service
189
+ entry.message = "Created client for #{entry.service}"
190
+ entry.set_credentials_fields credentials
191
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
192
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
193
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
194
+ end
195
+
196
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
197
+ config.credentials = credentials
198
+ config.quota_project = @quota_project_id
199
+ config.endpoint = @audit_stub.endpoint
200
+ config.universe_domain = @audit_stub.universe_domain
201
+ config.logger = @audit_stub.logger if config.respond_to? :logger=
202
+ end
203
+ end
204
+
205
+ ##
206
+ # Get the associated client for long-running operations.
207
+ #
208
+ # @return [::Google::Cloud::CloudSecurityCompliance::V1::Audit::Operations]
209
+ #
210
+ attr_reader :operations_client
211
+
212
+ ##
213
+ # Get the associated client for mix-in of the Locations.
214
+ #
215
+ # @return [Google::Cloud::Location::Locations::Client]
216
+ #
217
+ attr_reader :location_client
218
+
219
+ ##
220
+ # The logger used for request/response debug logging.
221
+ #
222
+ # @return [Logger]
223
+ #
224
+ def logger
225
+ @audit_stub.logger
226
+ end
227
+
228
+ # Service calls
229
+
230
+ ##
231
+ # Generates an audit scope report for a framework.
232
+ #
233
+ # @overload generate_framework_audit_scope_report(request, options = nil)
234
+ # Pass arguments to `generate_framework_audit_scope_report` via a request object, either of type
235
+ # {::Google::Cloud::CloudSecurityCompliance::V1::GenerateFrameworkAuditScopeReportRequest} or an equivalent Hash.
236
+ #
237
+ # @param request [::Google::Cloud::CloudSecurityCompliance::V1::GenerateFrameworkAuditScopeReportRequest, ::Hash]
238
+ # A request object representing the call parameters. Required. To specify no
239
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
240
+ # @param options [::Gapic::CallOptions, ::Hash]
241
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
242
+ #
243
+ # @overload generate_framework_audit_scope_report(scope: nil, report_format: nil, compliance_framework: nil)
244
+ # Pass arguments to `generate_framework_audit_scope_report` via keyword arguments. Note that at
245
+ # least one keyword argument is required. To specify no parameters, or to keep all
246
+ # the default parameter values, pass an empty Hash as a request object (see above).
247
+ #
248
+ # @param scope [::String]
249
+ # Required. The organization, folder or project for the audit report.
250
+ #
251
+ # Supported formats are the following:
252
+ #
253
+ # * `projects/{project_id}/locations/{location}`
254
+ # * `folders/{folder_id}/locations/{location}`
255
+ # * `organizations/{organization_id}/locations/{location}`
256
+ # @param report_format [::Google::Cloud::CloudSecurityCompliance::V1::GenerateFrameworkAuditScopeReportRequest::Format]
257
+ # Required. The format that the scope report bytes is returned in.
258
+ # @param compliance_framework [::String]
259
+ # Required. The compliance framework that the scope report is generated for.
260
+ #
261
+ # @yield [response, operation] Access the result along with the RPC operation
262
+ # @yieldparam response [::Google::Cloud::CloudSecurityCompliance::V1::GenerateFrameworkAuditScopeReportResponse]
263
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
264
+ #
265
+ # @return [::Google::Cloud::CloudSecurityCompliance::V1::GenerateFrameworkAuditScopeReportResponse]
266
+ #
267
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
268
+ #
269
+ # @example Basic example
270
+ # require "google/cloud/cloud_security_compliance/v1"
271
+ #
272
+ # # Create a client object. The client can be reused for multiple calls.
273
+ # client = Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.new
274
+ #
275
+ # # Create a request. To set request fields, pass in keyword arguments.
276
+ # request = Google::Cloud::CloudSecurityCompliance::V1::GenerateFrameworkAuditScopeReportRequest.new
277
+ #
278
+ # # Call the generate_framework_audit_scope_report method.
279
+ # result = client.generate_framework_audit_scope_report request
280
+ #
281
+ # # The returned object is of type Google::Cloud::CloudSecurityCompliance::V1::GenerateFrameworkAuditScopeReportResponse.
282
+ # p result
283
+ #
284
+ def generate_framework_audit_scope_report request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudSecurityCompliance::V1::GenerateFrameworkAuditScopeReportRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ metadata = @config.rpcs.generate_framework_audit_scope_report.metadata.to_h
294
+
295
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
296
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::CloudSecurityCompliance::V1::VERSION
299
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
300
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ header_params = {}
303
+ if request.scope
304
+ header_params["scope"] = request.scope
305
+ end
306
+
307
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
308
+ metadata[:"x-goog-request-params"] ||= request_params_header
309
+
310
+ options.apply_defaults timeout: @config.rpcs.generate_framework_audit_scope_report.timeout,
311
+ metadata: metadata,
312
+ retry_policy: @config.rpcs.generate_framework_audit_scope_report.retry_policy
313
+
314
+ options.apply_defaults timeout: @config.timeout,
315
+ metadata: @config.metadata,
316
+ retry_policy: @config.retry_policy
317
+
318
+ @audit_stub.call_rpc :generate_framework_audit_scope_report, request, options: options do |response, operation|
319
+ yield response, operation if block_given?
320
+ end
321
+ rescue ::GRPC::BadStatus => e
322
+ raise ::Google::Cloud::Error.from_error(e)
323
+ end
324
+
325
+ ##
326
+ # Creates an audit scope report for a framework.
327
+ #
328
+ # @overload create_framework_audit(request, options = nil)
329
+ # Pass arguments to `create_framework_audit` via a request object, either of type
330
+ # {::Google::Cloud::CloudSecurityCompliance::V1::CreateFrameworkAuditRequest} or an equivalent Hash.
331
+ #
332
+ # @param request [::Google::Cloud::CloudSecurityCompliance::V1::CreateFrameworkAuditRequest, ::Hash]
333
+ # A request object representing the call parameters. Required. To specify no
334
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
335
+ # @param options [::Gapic::CallOptions, ::Hash]
336
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
337
+ #
338
+ # @overload create_framework_audit(parent: nil, framework_audit_id: nil, framework_audit: nil)
339
+ # Pass arguments to `create_framework_audit` via keyword arguments. Note that at
340
+ # least one keyword argument is required. To specify no parameters, or to keep all
341
+ # the default parameter values, pass an empty Hash as a request object (see above).
342
+ #
343
+ # @param parent [::String]
344
+ # Required. The parent resource where this framework audit is created.
345
+ #
346
+ # Supported formats are the following:
347
+ #
348
+ # * `organizations/{organization_id}/locations/{location}`
349
+ # * `folders/{folder_id}/locations/{location}`
350
+ # * `projects/{project_id}/locations/{location}`
351
+ # @param framework_audit_id [::String]
352
+ # Optional. The ID to use for the framework audit. The ID becomes the final
353
+ # component of the framework audit's full resource name.
354
+ #
355
+ # The ID must be between 4-63 characters, and valid characters
356
+ # are `\[a-z][0-9]-\`.
357
+ # @param framework_audit [::Google::Cloud::CloudSecurityCompliance::V1::FrameworkAudit, ::Hash]
358
+ # Required. The framework audit to create.
359
+ #
360
+ # @yield [response, operation] Access the result along with the RPC operation
361
+ # @yieldparam response [::Gapic::Operation]
362
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
363
+ #
364
+ # @return [::Gapic::Operation]
365
+ #
366
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
367
+ #
368
+ # @example Basic example
369
+ # require "google/cloud/cloud_security_compliance/v1"
370
+ #
371
+ # # Create a client object. The client can be reused for multiple calls.
372
+ # client = Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.new
373
+ #
374
+ # # Create a request. To set request fields, pass in keyword arguments.
375
+ # request = Google::Cloud::CloudSecurityCompliance::V1::CreateFrameworkAuditRequest.new
376
+ #
377
+ # # Call the create_framework_audit method.
378
+ # result = client.create_framework_audit request
379
+ #
380
+ # # The returned object is of type Gapic::Operation. You can use it to
381
+ # # check the status of an operation, cancel it, or wait for results.
382
+ # # Here is how to wait for a response.
383
+ # result.wait_until_done! timeout: 60
384
+ # if result.response?
385
+ # p result.response
386
+ # else
387
+ # puts "No response received."
388
+ # end
389
+ #
390
+ def create_framework_audit request, options = nil
391
+ raise ::ArgumentError, "request must be provided" if request.nil?
392
+
393
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudSecurityCompliance::V1::CreateFrameworkAuditRequest
394
+
395
+ # Converts hash and nil to an options object
396
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
397
+
398
+ # Customize the options with defaults
399
+ metadata = @config.rpcs.create_framework_audit.metadata.to_h
400
+
401
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
402
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
403
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
404
+ gapic_version: ::Google::Cloud::CloudSecurityCompliance::V1::VERSION
405
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
406
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
407
+
408
+ header_params = {}
409
+ if request.parent
410
+ header_params["parent"] = request.parent
411
+ end
412
+
413
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
414
+ metadata[:"x-goog-request-params"] ||= request_params_header
415
+
416
+ options.apply_defaults timeout: @config.rpcs.create_framework_audit.timeout,
417
+ metadata: metadata,
418
+ retry_policy: @config.rpcs.create_framework_audit.retry_policy
419
+
420
+ options.apply_defaults timeout: @config.timeout,
421
+ metadata: @config.metadata,
422
+ retry_policy: @config.retry_policy
423
+
424
+ @audit_stub.call_rpc :create_framework_audit, request, options: options do |response, operation|
425
+ response = ::Gapic::Operation.new response, @operations_client, options: options
426
+ yield response, operation if block_given?
427
+ throw :response, response
428
+ end
429
+ rescue ::GRPC::BadStatus => e
430
+ raise ::Google::Cloud::Error.from_error(e)
431
+ end
432
+
433
+ ##
434
+ # Lists the framework audits for a given organization, folder, or project.
435
+ #
436
+ # @overload list_framework_audits(request, options = nil)
437
+ # Pass arguments to `list_framework_audits` via a request object, either of type
438
+ # {::Google::Cloud::CloudSecurityCompliance::V1::ListFrameworkAuditsRequest} or an equivalent Hash.
439
+ #
440
+ # @param request [::Google::Cloud::CloudSecurityCompliance::V1::ListFrameworkAuditsRequest, ::Hash]
441
+ # A request object representing the call parameters. Required. To specify no
442
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
443
+ # @param options [::Gapic::CallOptions, ::Hash]
444
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
445
+ #
446
+ # @overload list_framework_audits(parent: nil, page_size: nil, page_token: nil, filter: nil)
447
+ # Pass arguments to `list_framework_audits` via keyword arguments. Note that at
448
+ # least one keyword argument is required. To specify no parameters, or to keep all
449
+ # the default parameter values, pass an empty Hash as a request object (see above).
450
+ #
451
+ # @param parent [::String]
452
+ # Required. The parent resource where the framework audits are listed.
453
+ #
454
+ # Supported formats are the following:
455
+ #
456
+ # * `organizations/{organization_id}/locations/{location}`
457
+ # * `folders/{folder_id}/locations/{location}`
458
+ # * `projects/{project_id}/locations/{location}`
459
+ # @param page_size [::Integer]
460
+ # Optional. The maximum number of framework audits to return. The service
461
+ # might return fewer audits than this value. If unspecified, a maximum of 10
462
+ # framework audits are returned. The maximum value is 50; values above 50 are
463
+ # limited to 50.
464
+ # @param page_token [::String]
465
+ # Optional. The `next_page_token` value that's returned from a previous list
466
+ # request, if any.
467
+ # @param filter [::String]
468
+ # Optional. The filters to apply to the framework audits.
469
+ # Supported filters are `compliance_framework`, `compliance_state`,
470
+ # `create_time,` and `framework_audit_name`. If the filter is invalid, an
471
+ # invalid argument error is returned.
472
+ # For syntax details, see [AIP-160][https://google.aip.dev/160].
473
+ #
474
+ # @yield [response, operation] Access the result along with the RPC operation
475
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::CloudSecurityCompliance::V1::FrameworkAudit>]
476
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
477
+ #
478
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::CloudSecurityCompliance::V1::FrameworkAudit>]
479
+ #
480
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
481
+ #
482
+ # @example Basic example
483
+ # require "google/cloud/cloud_security_compliance/v1"
484
+ #
485
+ # # Create a client object. The client can be reused for multiple calls.
486
+ # client = Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.new
487
+ #
488
+ # # Create a request. To set request fields, pass in keyword arguments.
489
+ # request = Google::Cloud::CloudSecurityCompliance::V1::ListFrameworkAuditsRequest.new
490
+ #
491
+ # # Call the list_framework_audits method.
492
+ # result = client.list_framework_audits request
493
+ #
494
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
495
+ # # over elements, and API calls will be issued to fetch pages as needed.
496
+ # result.each do |item|
497
+ # # Each element is of type ::Google::Cloud::CloudSecurityCompliance::V1::FrameworkAudit.
498
+ # p item
499
+ # end
500
+ #
501
+ def list_framework_audits request, options = nil
502
+ raise ::ArgumentError, "request must be provided" if request.nil?
503
+
504
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudSecurityCompliance::V1::ListFrameworkAuditsRequest
505
+
506
+ # Converts hash and nil to an options object
507
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
508
+
509
+ # Customize the options with defaults
510
+ metadata = @config.rpcs.list_framework_audits.metadata.to_h
511
+
512
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
513
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
514
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
515
+ gapic_version: ::Google::Cloud::CloudSecurityCompliance::V1::VERSION
516
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
517
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
518
+
519
+ header_params = {}
520
+ if request.parent
521
+ header_params["parent"] = request.parent
522
+ end
523
+
524
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
525
+ metadata[:"x-goog-request-params"] ||= request_params_header
526
+
527
+ options.apply_defaults timeout: @config.rpcs.list_framework_audits.timeout,
528
+ metadata: metadata,
529
+ retry_policy: @config.rpcs.list_framework_audits.retry_policy
530
+
531
+ options.apply_defaults timeout: @config.timeout,
532
+ metadata: @config.metadata,
533
+ retry_policy: @config.retry_policy
534
+
535
+ @audit_stub.call_rpc :list_framework_audits, request, options: options do |response, operation|
536
+ response = ::Gapic::PagedEnumerable.new @audit_stub, :list_framework_audits, request, response, operation, options
537
+ yield response, operation if block_given?
538
+ throw :response, response
539
+ end
540
+ rescue ::GRPC::BadStatus => e
541
+ raise ::Google::Cloud::Error.from_error(e)
542
+ end
543
+
544
+ ##
545
+ # Gets the details for a framework audit.
546
+ #
547
+ # @overload get_framework_audit(request, options = nil)
548
+ # Pass arguments to `get_framework_audit` via a request object, either of type
549
+ # {::Google::Cloud::CloudSecurityCompliance::V1::GetFrameworkAuditRequest} or an equivalent Hash.
550
+ #
551
+ # @param request [::Google::Cloud::CloudSecurityCompliance::V1::GetFrameworkAuditRequest, ::Hash]
552
+ # A request object representing the call parameters. Required. To specify no
553
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
554
+ # @param options [::Gapic::CallOptions, ::Hash]
555
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
556
+ #
557
+ # @overload get_framework_audit(name: nil)
558
+ # Pass arguments to `get_framework_audit` via keyword arguments. Note that at
559
+ # least one keyword argument is required. To specify no parameters, or to keep all
560
+ # the default parameter values, pass an empty Hash as a request object (see above).
561
+ #
562
+ # @param name [::String]
563
+ # Required. The name of the framework audit to retrieve.
564
+ #
565
+ # Supported formats are the following:
566
+ #
567
+ # * `organizations/{organization_id}/locations/{location}/frameworkAudits/{frameworkAuditName}`
568
+ # * `folders/{folder_id}/locations/{location}/frameworkAudits/{frameworkAuditName}`
569
+ # * `projects/{project_id}/locations/{location}/frameworkAudits/{frameworkAuditName}`
570
+ #
571
+ # @yield [response, operation] Access the result along with the RPC operation
572
+ # @yieldparam response [::Google::Cloud::CloudSecurityCompliance::V1::FrameworkAudit]
573
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
574
+ #
575
+ # @return [::Google::Cloud::CloudSecurityCompliance::V1::FrameworkAudit]
576
+ #
577
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
578
+ #
579
+ # @example Basic example
580
+ # require "google/cloud/cloud_security_compliance/v1"
581
+ #
582
+ # # Create a client object. The client can be reused for multiple calls.
583
+ # client = Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.new
584
+ #
585
+ # # Create a request. To set request fields, pass in keyword arguments.
586
+ # request = Google::Cloud::CloudSecurityCompliance::V1::GetFrameworkAuditRequest.new
587
+ #
588
+ # # Call the get_framework_audit method.
589
+ # result = client.get_framework_audit request
590
+ #
591
+ # # The returned object is of type Google::Cloud::CloudSecurityCompliance::V1::FrameworkAudit.
592
+ # p result
593
+ #
594
+ def get_framework_audit request, options = nil
595
+ raise ::ArgumentError, "request must be provided" if request.nil?
596
+
597
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudSecurityCompliance::V1::GetFrameworkAuditRequest
598
+
599
+ # Converts hash and nil to an options object
600
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
601
+
602
+ # Customize the options with defaults
603
+ metadata = @config.rpcs.get_framework_audit.metadata.to_h
604
+
605
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
606
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
607
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
608
+ gapic_version: ::Google::Cloud::CloudSecurityCompliance::V1::VERSION
609
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
610
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
611
+
612
+ header_params = {}
613
+ if request.name
614
+ header_params["name"] = request.name
615
+ end
616
+
617
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
618
+ metadata[:"x-goog-request-params"] ||= request_params_header
619
+
620
+ options.apply_defaults timeout: @config.rpcs.get_framework_audit.timeout,
621
+ metadata: metadata,
622
+ retry_policy: @config.rpcs.get_framework_audit.retry_policy
623
+
624
+ options.apply_defaults timeout: @config.timeout,
625
+ metadata: @config.metadata,
626
+ retry_policy: @config.retry_policy
627
+
628
+ @audit_stub.call_rpc :get_framework_audit, request, options: options do |response, operation|
629
+ yield response, operation if block_given?
630
+ end
631
+ rescue ::GRPC::BadStatus => e
632
+ raise ::Google::Cloud::Error.from_error(e)
633
+ end
634
+
635
+ ##
636
+ # Configuration class for the Audit API.
637
+ #
638
+ # This class represents the configuration for Audit,
639
+ # providing control over timeouts, retry behavior, logging, transport
640
+ # parameters, and other low-level controls. Certain parameters can also be
641
+ # applied individually to specific RPCs. See
642
+ # {::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client::Configuration::Rpcs}
643
+ # for a list of RPCs that can be configured independently.
644
+ #
645
+ # Configuration can be applied globally to all clients, or to a single client
646
+ # on construction.
647
+ #
648
+ # @example
649
+ #
650
+ # # Modify the global config, setting the timeout for
651
+ # # generate_framework_audit_scope_report to 20 seconds,
652
+ # # and all remaining timeouts to 10 seconds.
653
+ # ::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.configure do |config|
654
+ # config.timeout = 10.0
655
+ # config.rpcs.generate_framework_audit_scope_report.timeout = 20.0
656
+ # end
657
+ #
658
+ # # Apply the above configuration only to a new client.
659
+ # client = ::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.new do |config|
660
+ # config.timeout = 10.0
661
+ # config.rpcs.generate_framework_audit_scope_report.timeout = 20.0
662
+ # end
663
+ #
664
+ # @!attribute [rw] endpoint
665
+ # A custom service endpoint, as a hostname or hostname:port. The default is
666
+ # nil, indicating to use the default endpoint in the current universe domain.
667
+ # @return [::String,nil]
668
+ # @!attribute [rw] credentials
669
+ # Credentials to send with calls. You may provide any of the following types:
670
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
671
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
672
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
673
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
674
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
675
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
676
+ # * (`nil`) indicating no credentials
677
+ #
678
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
679
+ # is deprecated. Providing an unvalidated credential configuration to
680
+ # Google APIs can compromise the security of your systems and data.
681
+ #
682
+ # @example
683
+ #
684
+ # # The recommended way to provide credentials is to use the `make_creds` method
685
+ # # on the appropriate credentials class for your environment.
686
+ #
687
+ # require "googleauth"
688
+ #
689
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
690
+ # json_key_io: ::File.open("/path/to/keyfile.json")
691
+ # )
692
+ #
693
+ # client = ::Google::Cloud::CloudSecurityCompliance::V1::Audit::Client.new do |config|
694
+ # config.credentials = credentials
695
+ # end
696
+ #
697
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
698
+ # external source for authentication to Google Cloud, you must validate it before
699
+ # providing it to a Google API client library. Providing an unvalidated credential
700
+ # configuration to Google APIs can compromise the security of your systems and data.
701
+ # For more information, refer to [Validate credential configurations from external
702
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
703
+ # @return [::Object]
704
+ # @!attribute [rw] scope
705
+ # The OAuth scopes
706
+ # @return [::Array<::String>]
707
+ # @!attribute [rw] lib_name
708
+ # The library name as recorded in instrumentation and logging
709
+ # @return [::String]
710
+ # @!attribute [rw] lib_version
711
+ # The library version as recorded in instrumentation and logging
712
+ # @return [::String]
713
+ # @!attribute [rw] channel_args
714
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
715
+ # `GRPC::Core::Channel` object is provided as the credential.
716
+ # @return [::Hash]
717
+ # @!attribute [rw] interceptors
718
+ # An array of interceptors that are run before calls are executed.
719
+ # @return [::Array<::GRPC::ClientInterceptor>]
720
+ # @!attribute [rw] timeout
721
+ # The call timeout in seconds.
722
+ # @return [::Numeric]
723
+ # @!attribute [rw] metadata
724
+ # Additional gRPC headers to be sent with the call.
725
+ # @return [::Hash{::Symbol=>::String}]
726
+ # @!attribute [rw] retry_policy
727
+ # The retry policy. The value is a hash with the following keys:
728
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
729
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
730
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
731
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
732
+ # trigger a retry.
733
+ # @return [::Hash]
734
+ # @!attribute [rw] quota_project
735
+ # A separate project against which to charge quota.
736
+ # @return [::String]
737
+ # @!attribute [rw] universe_domain
738
+ # The universe domain within which to make requests. This determines the
739
+ # default endpoint URL. The default value of nil uses the environment
740
+ # universe (usually the default "googleapis.com" universe).
741
+ # @return [::String,nil]
742
+ # @!attribute [rw] logger
743
+ # A custom logger to use for request/response debug logging, or the value
744
+ # `:default` (the default) to construct a default logger, or `nil` to
745
+ # explicitly disable logging.
746
+ # @return [::Logger,:default,nil]
747
+ #
748
+ class Configuration
749
+ extend ::Gapic::Config
750
+
751
+ # @private
752
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
753
+ DEFAULT_ENDPOINT = "cloudsecuritycompliance.googleapis.com"
754
+
755
+ config_attr :endpoint, nil, ::String, nil
756
+ config_attr :credentials, nil do |value|
757
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
758
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
759
+ allowed.any? { |klass| klass === value }
760
+ end
761
+ config_attr :scope, nil, ::String, ::Array, nil
762
+ config_attr :lib_name, nil, ::String, nil
763
+ config_attr :lib_version, nil, ::String, nil
764
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
765
+ config_attr :interceptors, nil, ::Array, nil
766
+ config_attr :timeout, nil, ::Numeric, nil
767
+ config_attr :metadata, nil, ::Hash, nil
768
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
769
+ config_attr :quota_project, nil, ::String, nil
770
+ config_attr :universe_domain, nil, ::String, nil
771
+ config_attr :logger, :default, ::Logger, nil, :default
772
+
773
+ # @private
774
+ def initialize parent_config = nil
775
+ @parent_config = parent_config unless parent_config.nil?
776
+
777
+ yield self if block_given?
778
+ end
779
+
780
+ ##
781
+ # Configurations for individual RPCs
782
+ # @return [Rpcs]
783
+ #
784
+ def rpcs
785
+ @rpcs ||= begin
786
+ parent_rpcs = nil
787
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
788
+ Rpcs.new parent_rpcs
789
+ end
790
+ end
791
+
792
+ ##
793
+ # Configuration for the channel pool
794
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
795
+ #
796
+ def channel_pool
797
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
798
+ end
799
+
800
+ ##
801
+ # Configuration RPC class for the Audit API.
802
+ #
803
+ # Includes fields providing the configuration for each RPC in this service.
804
+ # Each configuration object is of type `Gapic::Config::Method` and includes
805
+ # the following configuration fields:
806
+ #
807
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
808
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
809
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
810
+ # include the following keys:
811
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
812
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
813
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
814
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
815
+ # trigger a retry.
816
+ #
817
+ class Rpcs
818
+ ##
819
+ # RPC-specific configuration for `generate_framework_audit_scope_report`
820
+ # @return [::Gapic::Config::Method]
821
+ #
822
+ attr_reader :generate_framework_audit_scope_report
823
+ ##
824
+ # RPC-specific configuration for `create_framework_audit`
825
+ # @return [::Gapic::Config::Method]
826
+ #
827
+ attr_reader :create_framework_audit
828
+ ##
829
+ # RPC-specific configuration for `list_framework_audits`
830
+ # @return [::Gapic::Config::Method]
831
+ #
832
+ attr_reader :list_framework_audits
833
+ ##
834
+ # RPC-specific configuration for `get_framework_audit`
835
+ # @return [::Gapic::Config::Method]
836
+ #
837
+ attr_reader :get_framework_audit
838
+
839
+ # @private
840
+ def initialize parent_rpcs = nil
841
+ generate_framework_audit_scope_report_config = parent_rpcs.generate_framework_audit_scope_report if parent_rpcs.respond_to? :generate_framework_audit_scope_report
842
+ @generate_framework_audit_scope_report = ::Gapic::Config::Method.new generate_framework_audit_scope_report_config
843
+ create_framework_audit_config = parent_rpcs.create_framework_audit if parent_rpcs.respond_to? :create_framework_audit
844
+ @create_framework_audit = ::Gapic::Config::Method.new create_framework_audit_config
845
+ list_framework_audits_config = parent_rpcs.list_framework_audits if parent_rpcs.respond_to? :list_framework_audits
846
+ @list_framework_audits = ::Gapic::Config::Method.new list_framework_audits_config
847
+ get_framework_audit_config = parent_rpcs.get_framework_audit if parent_rpcs.respond_to? :get_framework_audit
848
+ @get_framework_audit = ::Gapic::Config::Method.new get_framework_audit_config
849
+
850
+ yield self if block_given?
851
+ end
852
+ end
853
+ end
854
+ end
855
+ end
856
+ end
857
+ end
858
+ end
859
+ end