google-cloud-audit_manager-v1 0.a → 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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/audit_manager/v1/audit_manager/client.rb +1275 -0
  6. data/lib/google/cloud/audit_manager/v1/audit_manager/credentials.rb +47 -0
  7. data/lib/google/cloud/audit_manager/v1/audit_manager/operations.rb +843 -0
  8. data/lib/google/cloud/audit_manager/v1/audit_manager/paths.rb +265 -0
  9. data/lib/google/cloud/audit_manager/v1/audit_manager/rest/client.rb +1184 -0
  10. data/lib/google/cloud/audit_manager/v1/audit_manager/rest/operations.rb +956 -0
  11. data/lib/google/cloud/audit_manager/v1/audit_manager/rest/service_stub.rb +660 -0
  12. data/lib/google/cloud/audit_manager/v1/audit_manager/rest.rb +54 -0
  13. data/lib/google/cloud/audit_manager/v1/audit_manager.rb +56 -0
  14. data/lib/google/cloud/audit_manager/v1/bindings_override.rb +75 -0
  15. data/lib/google/cloud/audit_manager/v1/rest.rb +38 -0
  16. data/lib/google/cloud/audit_manager/v1/version.rb +7 -2
  17. data/lib/google/cloud/audit_manager/v1.rb +45 -0
  18. data/lib/google/cloud/auditmanager/v1/auditmanager_pb.rb +57 -0
  19. data/lib/google/cloud/auditmanager/v1/auditmanager_services_pb.rb +66 -0
  20. data/lib/google-cloud-audit_manager-v1.rb +21 -0
  21. data/proto_docs/README.md +4 -0
  22. data/proto_docs/google/api/client.rb +593 -0
  23. data/proto_docs/google/api/field_behavior.rb +85 -0
  24. data/proto_docs/google/api/launch_stage.rb +71 -0
  25. data/proto_docs/google/api/resource.rb +227 -0
  26. data/proto_docs/google/cloud/auditmanager/v1/auditmanager.rb +648 -0
  27. data/proto_docs/google/longrunning/operations.rb +191 -0
  28. data/proto_docs/google/protobuf/any.rb +145 -0
  29. data/proto_docs/google/protobuf/duration.rb +98 -0
  30. data/proto_docs/google/protobuf/empty.rb +34 -0
  31. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  32. data/proto_docs/google/rpc/status.rb +48 -0
  33. metadata +79 -9
@@ -0,0 +1,1275 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/auditmanager/v1/auditmanager_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module AuditManager
26
+ module V1
27
+ module AuditManager
28
+ ##
29
+ # Client for the AuditManager service.
30
+ #
31
+ # Service describing handlers for resources
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "auditmanager.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :audit_manager_stub
44
+
45
+ ##
46
+ # Configure the AuditManager Client class.
47
+ #
48
+ # See {::Google::Cloud::AuditManager::V1::AuditManager::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all AuditManager clients
54
+ # ::Google::Cloud::AuditManager::V1::AuditManager::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", "AuditManager", "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.enroll_resource.timeout = 60.0
75
+
76
+ default_config.rpcs.generate_audit_scope_report.timeout = 60.0
77
+
78
+ default_config.rpcs.generate_audit_report.timeout = 60.0
79
+
80
+ default_config.rpcs.list_audit_reports.timeout = 60.0
81
+ default_config.rpcs.list_audit_reports.retry_policy = {
82
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
83
+ }
84
+
85
+ default_config.rpcs.get_audit_report.timeout = 60.0
86
+ default_config.rpcs.get_audit_report.retry_policy = {
87
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
88
+ }
89
+
90
+ default_config.rpcs.get_resource_enrollment_status.timeout = 60.0
91
+ default_config.rpcs.get_resource_enrollment_status.retry_policy = {
92
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
93
+ }
94
+
95
+ default_config.rpcs.list_resource_enrollment_statuses.timeout = 60.0
96
+ default_config.rpcs.list_resource_enrollment_statuses.retry_policy = {
97
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
98
+ }
99
+
100
+ default_config.rpcs.list_controls.timeout = 60.0
101
+ default_config.rpcs.list_controls.retry_policy = {
102
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
103
+ }
104
+
105
+ default_config
106
+ end
107
+ yield @configure if block_given?
108
+ @configure
109
+ end
110
+
111
+ ##
112
+ # Configure the AuditManager Client instance.
113
+ #
114
+ # The configuration is set to the derived mode, meaning that values can be changed,
115
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
116
+ # should be made on {Client.configure}.
117
+ #
118
+ # See {::Google::Cloud::AuditManager::V1::AuditManager::Client::Configuration}
119
+ # for a description of the configuration fields.
120
+ #
121
+ # @yield [config] Configure the Client client.
122
+ # @yieldparam config [Client::Configuration]
123
+ #
124
+ # @return [Client::Configuration]
125
+ #
126
+ def configure
127
+ yield @config if block_given?
128
+ @config
129
+ end
130
+
131
+ ##
132
+ # The effective universe domain
133
+ #
134
+ # @return [String]
135
+ #
136
+ def universe_domain
137
+ @audit_manager_stub.universe_domain
138
+ end
139
+
140
+ ##
141
+ # Create a new AuditManager client object.
142
+ #
143
+ # @example
144
+ #
145
+ # # Create a client using the default configuration
146
+ # client = ::Google::Cloud::AuditManager::V1::AuditManager::Client.new
147
+ #
148
+ # # Create a client using a custom configuration
149
+ # client = ::Google::Cloud::AuditManager::V1::AuditManager::Client.new do |config|
150
+ # config.timeout = 10.0
151
+ # end
152
+ #
153
+ # @yield [config] Configure the AuditManager client.
154
+ # @yieldparam config [Client::Configuration]
155
+ #
156
+ def initialize
157
+ # These require statements are intentionally placed here to initialize
158
+ # the gRPC module only when it's required.
159
+ # See https://github.com/googleapis/toolkit/issues/446
160
+ require "gapic/grpc"
161
+ require "google/cloud/auditmanager/v1/auditmanager_services_pb"
162
+
163
+ # Create the configuration object
164
+ @config = Configuration.new Client.configure
165
+
166
+ # Yield the configuration if needed
167
+ yield @config if block_given?
168
+
169
+ # Create credentials
170
+ credentials = @config.credentials
171
+ # Use self-signed JWT if the endpoint is unchanged from default,
172
+ # but only if the default endpoint does not have a region prefix.
173
+ enable_self_signed_jwt = @config.endpoint.nil? ||
174
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
175
+ !@config.endpoint.split(".").first.include?("-"))
176
+ credentials ||= Credentials.default scope: @config.scope,
177
+ enable_self_signed_jwt: enable_self_signed_jwt
178
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
179
+ credentials = Credentials.new credentials, scope: @config.scope
180
+ end
181
+ @quota_project_id = @config.quota_project
182
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
183
+
184
+ @operations_client = Operations.new do |config|
185
+ config.credentials = credentials
186
+ config.quota_project = @quota_project_id
187
+ config.endpoint = @config.endpoint
188
+ config.universe_domain = @config.universe_domain
189
+ end
190
+
191
+ @audit_manager_stub = ::Gapic::ServiceStub.new(
192
+ ::Google::Cloud::AuditManager::V1::AuditManager::Stub,
193
+ credentials: credentials,
194
+ endpoint: @config.endpoint,
195
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
196
+ universe_domain: @config.universe_domain,
197
+ channel_args: @config.channel_args,
198
+ interceptors: @config.interceptors,
199
+ channel_pool_config: @config.channel_pool,
200
+ logger: @config.logger
201
+ )
202
+
203
+ @audit_manager_stub.stub_logger&.info do |entry|
204
+ entry.set_system_name
205
+ entry.set_service
206
+ entry.message = "Created client for #{entry.service}"
207
+ entry.set_credentials_fields credentials
208
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
209
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
210
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
211
+ end
212
+
213
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
214
+ config.credentials = credentials
215
+ config.quota_project = @quota_project_id
216
+ config.endpoint = @audit_manager_stub.endpoint
217
+ config.universe_domain = @audit_manager_stub.universe_domain
218
+ config.logger = @audit_manager_stub.logger if config.respond_to? :logger=
219
+ end
220
+ end
221
+
222
+ ##
223
+ # Get the associated client for long-running operations.
224
+ #
225
+ # @return [::Google::Cloud::AuditManager::V1::AuditManager::Operations]
226
+ #
227
+ attr_reader :operations_client
228
+
229
+ ##
230
+ # Get the associated client for mix-in of the Locations.
231
+ #
232
+ # @return [Google::Cloud::Location::Locations::Client]
233
+ #
234
+ attr_reader :location_client
235
+
236
+ ##
237
+ # The logger used for request/response debug logging.
238
+ #
239
+ # @return [Logger]
240
+ #
241
+ def logger
242
+ @audit_manager_stub.logger
243
+ end
244
+
245
+ # Service calls
246
+
247
+ ##
248
+ # Enrolls the customer resource(folder/project/organization) to the audit
249
+ # manager service by creating the audit managers Service Agent in customers
250
+ # workload and granting required permissions to the Service Agent. Please
251
+ # note that if enrollment request is made on the already enrolled workload
252
+ # then enrollment is executed overriding the existing set of destinations.
253
+ #
254
+ # @overload enroll_resource(request, options = nil)
255
+ # Pass arguments to `enroll_resource` via a request object, either of type
256
+ # {::Google::Cloud::AuditManager::V1::EnrollResourceRequest} or an equivalent Hash.
257
+ #
258
+ # @param request [::Google::Cloud::AuditManager::V1::EnrollResourceRequest, ::Hash]
259
+ # A request object representing the call parameters. Required. To specify no
260
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
261
+ # @param options [::Gapic::CallOptions, ::Hash]
262
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
263
+ #
264
+ # @overload enroll_resource(scope: nil, destinations: nil)
265
+ # Pass arguments to `enroll_resource` via keyword arguments. Note that at
266
+ # least one keyword argument is required. To specify no parameters, or to keep all
267
+ # the default parameter values, pass an empty Hash as a request object (see above).
268
+ #
269
+ # @param scope [::String]
270
+ # Required. The resource to be enrolled to the audit manager. Scope format
271
+ # should be resource_type/resource_identifier Eg:
272
+ # projects/\\{project}/locations/\\{location},
273
+ # folders/\\{folder}/locations/\\{location}
274
+ # organizations/\\{organization}/locations/\\{location}
275
+ # @param destinations [::Array<::Google::Cloud::AuditManager::V1::EnrollResourceRequest::EligibleDestination, ::Hash>]
276
+ # Required. List of destination among which customer can choose to upload
277
+ # their reports during the audit process. While enrolling at a
278
+ # organization/folder level, customer can choose Cloud storage bucket in any
279
+ # project. If the audit is triggered at project level using the service agent
280
+ # at organization/folder level, all the destination options associated with
281
+ # respective organization/folder level service agent will be available to
282
+ # auditing projects.
283
+ #
284
+ # @yield [response, operation] Access the result along with the RPC operation
285
+ # @yieldparam response [::Google::Cloud::AuditManager::V1::Enrollment]
286
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
287
+ #
288
+ # @return [::Google::Cloud::AuditManager::V1::Enrollment]
289
+ #
290
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
291
+ #
292
+ # @example Basic example
293
+ # require "google/cloud/audit_manager/v1"
294
+ #
295
+ # # Create a client object. The client can be reused for multiple calls.
296
+ # client = Google::Cloud::AuditManager::V1::AuditManager::Client.new
297
+ #
298
+ # # Create a request. To set request fields, pass in keyword arguments.
299
+ # request = Google::Cloud::AuditManager::V1::EnrollResourceRequest.new
300
+ #
301
+ # # Call the enroll_resource method.
302
+ # result = client.enroll_resource request
303
+ #
304
+ # # The returned object is of type Google::Cloud::AuditManager::V1::Enrollment.
305
+ # p result
306
+ #
307
+ def enroll_resource request, options = nil
308
+ raise ::ArgumentError, "request must be provided" if request.nil?
309
+
310
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AuditManager::V1::EnrollResourceRequest
311
+
312
+ # Converts hash and nil to an options object
313
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
314
+
315
+ # Customize the options with defaults
316
+ metadata = @config.rpcs.enroll_resource.metadata.to_h
317
+
318
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
319
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
320
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
321
+ gapic_version: ::Google::Cloud::AuditManager::V1::VERSION
322
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
323
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
324
+
325
+ header_params = {}
326
+ if request.scope
327
+ header_params["scope"] = request.scope
328
+ end
329
+
330
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
331
+ metadata[:"x-goog-request-params"] ||= request_params_header
332
+
333
+ options.apply_defaults timeout: @config.rpcs.enroll_resource.timeout,
334
+ metadata: metadata,
335
+ retry_policy: @config.rpcs.enroll_resource.retry_policy
336
+
337
+ options.apply_defaults timeout: @config.timeout,
338
+ metadata: @config.metadata,
339
+ retry_policy: @config.retry_policy
340
+
341
+ @audit_manager_stub.call_rpc :enroll_resource, request, options: options do |response, operation|
342
+ yield response, operation if block_given?
343
+ end
344
+ rescue ::GRPC::BadStatus => e
345
+ raise ::Google::Cloud::Error.from_error(e)
346
+ end
347
+
348
+ ##
349
+ # Generates a demo report highlighting different responsibilities
350
+ # (Google/Customer/ shared) required to be fulfilled for the customer's
351
+ # workload to be compliant with the given standard.
352
+ #
353
+ # @overload generate_audit_scope_report(request, options = nil)
354
+ # Pass arguments to `generate_audit_scope_report` via a request object, either of type
355
+ # {::Google::Cloud::AuditManager::V1::GenerateAuditScopeReportRequest} or an equivalent Hash.
356
+ #
357
+ # @param request [::Google::Cloud::AuditManager::V1::GenerateAuditScopeReportRequest, ::Hash]
358
+ # A request object representing the call parameters. Required. To specify no
359
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
360
+ # @param options [::Gapic::CallOptions, ::Hash]
361
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
362
+ #
363
+ # @overload generate_audit_scope_report(scope: nil, compliance_standard: nil, report_format: nil, compliance_framework: nil)
364
+ # Pass arguments to `generate_audit_scope_report` via keyword arguments. Note that at
365
+ # least one keyword argument is required. To specify no parameters, or to keep all
366
+ # the default parameter values, pass an empty Hash as a request object (see above).
367
+ #
368
+ # @param scope [::String]
369
+ # Required. Scope for which the AuditScopeReport is required. Must be of
370
+ # format resource_type/resource_identifier Eg:
371
+ # projects/\\{project}/locations/\\{location},
372
+ # folders/\\{folder}/locations/\\{location}
373
+ # @param compliance_standard [::String]
374
+ # Required. Compliance Standard against which the Scope Report must be
375
+ # generated. Eg: FEDRAMP_MODERATE
376
+ # @param report_format [::Google::Cloud::AuditManager::V1::GenerateAuditScopeReportRequest::AuditScopeReportFormat]
377
+ # Required. The format in which the Scope report bytes should be returned.
378
+ # @param compliance_framework [::String]
379
+ # Required. Compliance framework against which the Scope Report must be
380
+ # generated.
381
+ #
382
+ # @yield [response, operation] Access the result along with the RPC operation
383
+ # @yieldparam response [::Google::Cloud::AuditManager::V1::AuditScopeReport]
384
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
385
+ #
386
+ # @return [::Google::Cloud::AuditManager::V1::AuditScopeReport]
387
+ #
388
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
389
+ #
390
+ # @example Basic example
391
+ # require "google/cloud/audit_manager/v1"
392
+ #
393
+ # # Create a client object. The client can be reused for multiple calls.
394
+ # client = Google::Cloud::AuditManager::V1::AuditManager::Client.new
395
+ #
396
+ # # Create a request. To set request fields, pass in keyword arguments.
397
+ # request = Google::Cloud::AuditManager::V1::GenerateAuditScopeReportRequest.new
398
+ #
399
+ # # Call the generate_audit_scope_report method.
400
+ # result = client.generate_audit_scope_report request
401
+ #
402
+ # # The returned object is of type Google::Cloud::AuditManager::V1::AuditScopeReport.
403
+ # p result
404
+ #
405
+ def generate_audit_scope_report request, options = nil
406
+ raise ::ArgumentError, "request must be provided" if request.nil?
407
+
408
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AuditManager::V1::GenerateAuditScopeReportRequest
409
+
410
+ # Converts hash and nil to an options object
411
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
412
+
413
+ # Customize the options with defaults
414
+ metadata = @config.rpcs.generate_audit_scope_report.metadata.to_h
415
+
416
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
417
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
418
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
419
+ gapic_version: ::Google::Cloud::AuditManager::V1::VERSION
420
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
421
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
422
+
423
+ header_params = {}
424
+ if request.scope
425
+ header_params["scope"] = request.scope
426
+ end
427
+
428
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
429
+ metadata[:"x-goog-request-params"] ||= request_params_header
430
+
431
+ options.apply_defaults timeout: @config.rpcs.generate_audit_scope_report.timeout,
432
+ metadata: metadata,
433
+ retry_policy: @config.rpcs.generate_audit_scope_report.retry_policy
434
+
435
+ options.apply_defaults timeout: @config.timeout,
436
+ metadata: @config.metadata,
437
+ retry_policy: @config.retry_policy
438
+
439
+ @audit_manager_stub.call_rpc :generate_audit_scope_report, request, options: options do |response, operation|
440
+ yield response, operation if block_given?
441
+ end
442
+ rescue ::GRPC::BadStatus => e
443
+ raise ::Google::Cloud::Error.from_error(e)
444
+ end
445
+
446
+ ##
447
+ # Register the Audit Report generation requests and returns the OperationId
448
+ # using which the customer can track the report generation progress.
449
+ #
450
+ # @overload generate_audit_report(request, options = nil)
451
+ # Pass arguments to `generate_audit_report` via a request object, either of type
452
+ # {::Google::Cloud::AuditManager::V1::GenerateAuditReportRequest} or an equivalent Hash.
453
+ #
454
+ # @param request [::Google::Cloud::AuditManager::V1::GenerateAuditReportRequest, ::Hash]
455
+ # A request object representing the call parameters. Required. To specify no
456
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
457
+ # @param options [::Gapic::CallOptions, ::Hash]
458
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
459
+ #
460
+ # @overload generate_audit_report(gcs_uri: nil, scope: nil, compliance_standard: nil, report_format: nil, compliance_framework: nil)
461
+ # Pass arguments to `generate_audit_report` via keyword arguments. Note that at
462
+ # least one keyword argument is required. To specify no parameters, or to keep all
463
+ # the default parameter values, pass an empty Hash as a request object (see above).
464
+ #
465
+ # @param gcs_uri [::String]
466
+ # Destination Cloud storage bucket where report and evidence must be
467
+ # uploaded. The Cloud storage bucket provided here must be selected among
468
+ # the buckets entered during the enrollment process.
469
+ # @param scope [::String]
470
+ # Required. Scope for which the AuditScopeReport is required. Must be of
471
+ # format resource_type/resource_identifier Eg:
472
+ # projects/\\{project}/locations/\\{location},
473
+ # folders/\\{folder}/locations/\\{location}
474
+ # @param compliance_standard [::String]
475
+ # Required. Compliance Standard against which the Scope Report must be
476
+ # generated. Eg: FEDRAMP_MODERATE
477
+ # @param report_format [::Google::Cloud::AuditManager::V1::GenerateAuditReportRequest::AuditReportFormat]
478
+ # Required. The format in which the audit report should be created.
479
+ # @param compliance_framework [::String]
480
+ # Required. Compliance framework against which the Report must be generated.
481
+ #
482
+ # @yield [response, operation] Access the result along with the RPC operation
483
+ # @yieldparam response [::Gapic::Operation]
484
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
485
+ #
486
+ # @return [::Gapic::Operation]
487
+ #
488
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
489
+ #
490
+ # @example Basic example
491
+ # require "google/cloud/audit_manager/v1"
492
+ #
493
+ # # Create a client object. The client can be reused for multiple calls.
494
+ # client = Google::Cloud::AuditManager::V1::AuditManager::Client.new
495
+ #
496
+ # # Create a request. To set request fields, pass in keyword arguments.
497
+ # request = Google::Cloud::AuditManager::V1::GenerateAuditReportRequest.new
498
+ #
499
+ # # Call the generate_audit_report method.
500
+ # result = client.generate_audit_report request
501
+ #
502
+ # # The returned object is of type Gapic::Operation. You can use it to
503
+ # # check the status of an operation, cancel it, or wait for results.
504
+ # # Here is how to wait for a response.
505
+ # result.wait_until_done! timeout: 60
506
+ # if result.response?
507
+ # p result.response
508
+ # else
509
+ # puts "No response received."
510
+ # end
511
+ #
512
+ def generate_audit_report request, options = nil
513
+ raise ::ArgumentError, "request must be provided" if request.nil?
514
+
515
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AuditManager::V1::GenerateAuditReportRequest
516
+
517
+ # Converts hash and nil to an options object
518
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
519
+
520
+ # Customize the options with defaults
521
+ metadata = @config.rpcs.generate_audit_report.metadata.to_h
522
+
523
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
524
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
525
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
526
+ gapic_version: ::Google::Cloud::AuditManager::V1::VERSION
527
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
528
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
529
+
530
+ header_params = {}
531
+ if request.scope
532
+ header_params["scope"] = request.scope
533
+ end
534
+
535
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
536
+ metadata[:"x-goog-request-params"] ||= request_params_header
537
+
538
+ options.apply_defaults timeout: @config.rpcs.generate_audit_report.timeout,
539
+ metadata: metadata,
540
+ retry_policy: @config.rpcs.generate_audit_report.retry_policy
541
+
542
+ options.apply_defaults timeout: @config.timeout,
543
+ metadata: @config.metadata,
544
+ retry_policy: @config.retry_policy
545
+
546
+ @audit_manager_stub.call_rpc :generate_audit_report, request, options: options do |response, operation|
547
+ response = ::Gapic::Operation.new response, @operations_client, options: options
548
+ yield response, operation if block_given?
549
+ throw :response, response
550
+ end
551
+ rescue ::GRPC::BadStatus => e
552
+ raise ::Google::Cloud::Error.from_error(e)
553
+ end
554
+
555
+ ##
556
+ # Lists audit reports in the selected parent scope
557
+ #
558
+ # @overload list_audit_reports(request, options = nil)
559
+ # Pass arguments to `list_audit_reports` via a request object, either of type
560
+ # {::Google::Cloud::AuditManager::V1::ListAuditReportsRequest} or an equivalent Hash.
561
+ #
562
+ # @param request [::Google::Cloud::AuditManager::V1::ListAuditReportsRequest, ::Hash]
563
+ # A request object representing the call parameters. Required. To specify no
564
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
565
+ # @param options [::Gapic::CallOptions, ::Hash]
566
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
567
+ #
568
+ # @overload list_audit_reports(parent: nil, page_size: nil, page_token: nil)
569
+ # Pass arguments to `list_audit_reports` via keyword arguments. Note that at
570
+ # least one keyword argument is required. To specify no parameters, or to keep all
571
+ # the default parameter values, pass an empty Hash as a request object (see above).
572
+ #
573
+ # @param parent [::String]
574
+ # Required. The parent scope for which to list the reports.
575
+ # @param page_size [::Integer]
576
+ # Optional. The maximum number of resources to return.
577
+ # @param page_token [::String]
578
+ # Optional. The next_page_token value returned from a previous List request,
579
+ # if any.
580
+ #
581
+ # @yield [response, operation] Access the result along with the RPC operation
582
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::AuditReport>]
583
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
584
+ #
585
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::AuditReport>]
586
+ #
587
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
588
+ #
589
+ # @example Basic example
590
+ # require "google/cloud/audit_manager/v1"
591
+ #
592
+ # # Create a client object. The client can be reused for multiple calls.
593
+ # client = Google::Cloud::AuditManager::V1::AuditManager::Client.new
594
+ #
595
+ # # Create a request. To set request fields, pass in keyword arguments.
596
+ # request = Google::Cloud::AuditManager::V1::ListAuditReportsRequest.new
597
+ #
598
+ # # Call the list_audit_reports method.
599
+ # result = client.list_audit_reports request
600
+ #
601
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
602
+ # # over elements, and API calls will be issued to fetch pages as needed.
603
+ # result.each do |item|
604
+ # # Each element is of type ::Google::Cloud::AuditManager::V1::AuditReport.
605
+ # p item
606
+ # end
607
+ #
608
+ def list_audit_reports request, options = nil
609
+ raise ::ArgumentError, "request must be provided" if request.nil?
610
+
611
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AuditManager::V1::ListAuditReportsRequest
612
+
613
+ # Converts hash and nil to an options object
614
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
615
+
616
+ # Customize the options with defaults
617
+ metadata = @config.rpcs.list_audit_reports.metadata.to_h
618
+
619
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
620
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
621
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
622
+ gapic_version: ::Google::Cloud::AuditManager::V1::VERSION
623
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
624
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
625
+
626
+ header_params = {}
627
+ if request.parent
628
+ header_params["parent"] = request.parent
629
+ end
630
+
631
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
632
+ metadata[:"x-goog-request-params"] ||= request_params_header
633
+
634
+ options.apply_defaults timeout: @config.rpcs.list_audit_reports.timeout,
635
+ metadata: metadata,
636
+ retry_policy: @config.rpcs.list_audit_reports.retry_policy
637
+
638
+ options.apply_defaults timeout: @config.timeout,
639
+ metadata: @config.metadata,
640
+ retry_policy: @config.retry_policy
641
+
642
+ @audit_manager_stub.call_rpc :list_audit_reports, request, options: options do |response, operation|
643
+ response = ::Gapic::PagedEnumerable.new @audit_manager_stub, :list_audit_reports, request, response, operation, options
644
+ yield response, operation if block_given?
645
+ throw :response, response
646
+ end
647
+ rescue ::GRPC::BadStatus => e
648
+ raise ::Google::Cloud::Error.from_error(e)
649
+ end
650
+
651
+ ##
652
+ # Get the overall audit report
653
+ #
654
+ # @overload get_audit_report(request, options = nil)
655
+ # Pass arguments to `get_audit_report` via a request object, either of type
656
+ # {::Google::Cloud::AuditManager::V1::GetAuditReportRequest} or an equivalent Hash.
657
+ #
658
+ # @param request [::Google::Cloud::AuditManager::V1::GetAuditReportRequest, ::Hash]
659
+ # A request object representing the call parameters. Required. To specify no
660
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
661
+ # @param options [::Gapic::CallOptions, ::Hash]
662
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
663
+ #
664
+ # @overload get_audit_report(name: nil)
665
+ # Pass arguments to `get_audit_report` via keyword arguments. Note that at
666
+ # least one keyword argument is required. To specify no parameters, or to keep all
667
+ # the default parameter values, pass an empty Hash as a request object (see above).
668
+ #
669
+ # @param name [::String]
670
+ # Required. Format
671
+ # projects/\\{project}/locations/\\{location}/auditReports/\\{audit_report},
672
+ # folders/\\{folder}/locations/\\{location}/auditReports/\\{audit_report}
673
+ #
674
+ # @yield [response, operation] Access the result along with the RPC operation
675
+ # @yieldparam response [::Google::Cloud::AuditManager::V1::AuditReport]
676
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
677
+ #
678
+ # @return [::Google::Cloud::AuditManager::V1::AuditReport]
679
+ #
680
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
681
+ #
682
+ # @example Basic example
683
+ # require "google/cloud/audit_manager/v1"
684
+ #
685
+ # # Create a client object. The client can be reused for multiple calls.
686
+ # client = Google::Cloud::AuditManager::V1::AuditManager::Client.new
687
+ #
688
+ # # Create a request. To set request fields, pass in keyword arguments.
689
+ # request = Google::Cloud::AuditManager::V1::GetAuditReportRequest.new
690
+ #
691
+ # # Call the get_audit_report method.
692
+ # result = client.get_audit_report request
693
+ #
694
+ # # The returned object is of type Google::Cloud::AuditManager::V1::AuditReport.
695
+ # p result
696
+ #
697
+ def get_audit_report request, options = nil
698
+ raise ::ArgumentError, "request must be provided" if request.nil?
699
+
700
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AuditManager::V1::GetAuditReportRequest
701
+
702
+ # Converts hash and nil to an options object
703
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
704
+
705
+ # Customize the options with defaults
706
+ metadata = @config.rpcs.get_audit_report.metadata.to_h
707
+
708
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
709
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
710
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
711
+ gapic_version: ::Google::Cloud::AuditManager::V1::VERSION
712
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
713
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
714
+
715
+ header_params = {}
716
+ if request.name
717
+ header_params["name"] = request.name
718
+ end
719
+
720
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
721
+ metadata[:"x-goog-request-params"] ||= request_params_header
722
+
723
+ options.apply_defaults timeout: @config.rpcs.get_audit_report.timeout,
724
+ metadata: metadata,
725
+ retry_policy: @config.rpcs.get_audit_report.retry_policy
726
+
727
+ options.apply_defaults timeout: @config.timeout,
728
+ metadata: @config.metadata,
729
+ retry_policy: @config.retry_policy
730
+
731
+ @audit_manager_stub.call_rpc :get_audit_report, request, options: options do |response, operation|
732
+ yield response, operation if block_given?
733
+ end
734
+ rescue ::GRPC::BadStatus => e
735
+ raise ::Google::Cloud::Error.from_error(e)
736
+ end
737
+
738
+ ##
739
+ # Get a resource along with its enrollment status.
740
+ #
741
+ # @overload get_resource_enrollment_status(request, options = nil)
742
+ # Pass arguments to `get_resource_enrollment_status` via a request object, either of type
743
+ # {::Google::Cloud::AuditManager::V1::GetResourceEnrollmentStatusRequest} or an equivalent Hash.
744
+ #
745
+ # @param request [::Google::Cloud::AuditManager::V1::GetResourceEnrollmentStatusRequest, ::Hash]
746
+ # A request object representing the call parameters. Required. To specify no
747
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
748
+ # @param options [::Gapic::CallOptions, ::Hash]
749
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
750
+ #
751
+ # @overload get_resource_enrollment_status(name: nil)
752
+ # Pass arguments to `get_resource_enrollment_status` via keyword arguments. Note that at
753
+ # least one keyword argument is required. To specify no parameters, or to keep all
754
+ # the default parameter values, pass an empty Hash as a request object (see above).
755
+ #
756
+ # @param name [::String]
757
+ # Required. Format
758
+ # folders/\\{folder}/locations/\\{location}/resourceEnrollmentStatuses/\\{resource_enrollment_status},
759
+ # projects/\\{project}/locations/\\{location}/resourceEnrollmentStatuses/\\{resource_enrollment_status},
760
+ # organizations/\\{organization}/locations/\\{location}/resourceEnrollmentStatuses/\\{resource_enrollment_status}
761
+ #
762
+ # @yield [response, operation] Access the result along with the RPC operation
763
+ # @yieldparam response [::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus]
764
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
765
+ #
766
+ # @return [::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus]
767
+ #
768
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
769
+ #
770
+ # @example Basic example
771
+ # require "google/cloud/audit_manager/v1"
772
+ #
773
+ # # Create a client object. The client can be reused for multiple calls.
774
+ # client = Google::Cloud::AuditManager::V1::AuditManager::Client.new
775
+ #
776
+ # # Create a request. To set request fields, pass in keyword arguments.
777
+ # request = Google::Cloud::AuditManager::V1::GetResourceEnrollmentStatusRequest.new
778
+ #
779
+ # # Call the get_resource_enrollment_status method.
780
+ # result = client.get_resource_enrollment_status request
781
+ #
782
+ # # The returned object is of type Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus.
783
+ # p result
784
+ #
785
+ def get_resource_enrollment_status request, options = nil
786
+ raise ::ArgumentError, "request must be provided" if request.nil?
787
+
788
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AuditManager::V1::GetResourceEnrollmentStatusRequest
789
+
790
+ # Converts hash and nil to an options object
791
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
792
+
793
+ # Customize the options with defaults
794
+ metadata = @config.rpcs.get_resource_enrollment_status.metadata.to_h
795
+
796
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
797
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
798
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
799
+ gapic_version: ::Google::Cloud::AuditManager::V1::VERSION
800
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
801
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
802
+
803
+ header_params = {}
804
+ if request.name
805
+ header_params["name"] = request.name
806
+ end
807
+
808
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
809
+ metadata[:"x-goog-request-params"] ||= request_params_header
810
+
811
+ options.apply_defaults timeout: @config.rpcs.get_resource_enrollment_status.timeout,
812
+ metadata: metadata,
813
+ retry_policy: @config.rpcs.get_resource_enrollment_status.retry_policy
814
+
815
+ options.apply_defaults timeout: @config.timeout,
816
+ metadata: @config.metadata,
817
+ retry_policy: @config.retry_policy
818
+
819
+ @audit_manager_stub.call_rpc :get_resource_enrollment_status, request, options: options do |response, operation|
820
+ yield response, operation if block_given?
821
+ end
822
+ rescue ::GRPC::BadStatus => e
823
+ raise ::Google::Cloud::Error.from_error(e)
824
+ end
825
+
826
+ ##
827
+ # Fetches all resources under the parent along with their enrollment.
828
+ #
829
+ # @overload list_resource_enrollment_statuses(request, options = nil)
830
+ # Pass arguments to `list_resource_enrollment_statuses` via a request object, either of type
831
+ # {::Google::Cloud::AuditManager::V1::ListResourceEnrollmentStatusesRequest} or an equivalent Hash.
832
+ #
833
+ # @param request [::Google::Cloud::AuditManager::V1::ListResourceEnrollmentStatusesRequest, ::Hash]
834
+ # A request object representing the call parameters. Required. To specify no
835
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
836
+ # @param options [::Gapic::CallOptions, ::Hash]
837
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
838
+ #
839
+ # @overload list_resource_enrollment_statuses(parent: nil, page_size: nil, page_token: nil)
840
+ # Pass arguments to `list_resource_enrollment_statuses` via keyword arguments. Note that at
841
+ # least one keyword argument is required. To specify no parameters, or to keep all
842
+ # the default parameter values, pass an empty Hash as a request object (see above).
843
+ #
844
+ # @param parent [::String]
845
+ # Required. The parent scope for which the list of resources with enrollments
846
+ # are required.
847
+ # @param page_size [::Integer]
848
+ # Optional. The maximum number of resources to return.
849
+ # @param page_token [::String]
850
+ # Optional. The next_page_token value returned from a previous List request,
851
+ # if any.
852
+ #
853
+ # @yield [response, operation] Access the result along with the RPC operation
854
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus>]
855
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
856
+ #
857
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus>]
858
+ #
859
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
860
+ #
861
+ # @example Basic example
862
+ # require "google/cloud/audit_manager/v1"
863
+ #
864
+ # # Create a client object. The client can be reused for multiple calls.
865
+ # client = Google::Cloud::AuditManager::V1::AuditManager::Client.new
866
+ #
867
+ # # Create a request. To set request fields, pass in keyword arguments.
868
+ # request = Google::Cloud::AuditManager::V1::ListResourceEnrollmentStatusesRequest.new
869
+ #
870
+ # # Call the list_resource_enrollment_statuses method.
871
+ # result = client.list_resource_enrollment_statuses request
872
+ #
873
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
874
+ # # over elements, and API calls will be issued to fetch pages as needed.
875
+ # result.each do |item|
876
+ # # Each element is of type ::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus.
877
+ # p item
878
+ # end
879
+ #
880
+ def list_resource_enrollment_statuses request, options = nil
881
+ raise ::ArgumentError, "request must be provided" if request.nil?
882
+
883
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AuditManager::V1::ListResourceEnrollmentStatusesRequest
884
+
885
+ # Converts hash and nil to an options object
886
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
887
+
888
+ # Customize the options with defaults
889
+ metadata = @config.rpcs.list_resource_enrollment_statuses.metadata.to_h
890
+
891
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
892
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
893
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
894
+ gapic_version: ::Google::Cloud::AuditManager::V1::VERSION
895
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
896
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
897
+
898
+ header_params = {}
899
+ if request.parent
900
+ header_params["parent"] = request.parent
901
+ end
902
+
903
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
904
+ metadata[:"x-goog-request-params"] ||= request_params_header
905
+
906
+ options.apply_defaults timeout: @config.rpcs.list_resource_enrollment_statuses.timeout,
907
+ metadata: metadata,
908
+ retry_policy: @config.rpcs.list_resource_enrollment_statuses.retry_policy
909
+
910
+ options.apply_defaults timeout: @config.timeout,
911
+ metadata: @config.metadata,
912
+ retry_policy: @config.retry_policy
913
+
914
+ @audit_manager_stub.call_rpc :list_resource_enrollment_statuses, request, options: options do |response, operation|
915
+ response = ::Gapic::PagedEnumerable.new @audit_manager_stub, :list_resource_enrollment_statuses, request, response, operation, options
916
+ yield response, operation if block_given?
917
+ throw :response, response
918
+ end
919
+ rescue ::GRPC::BadStatus => e
920
+ raise ::Google::Cloud::Error.from_error(e)
921
+ end
922
+
923
+ ##
924
+ # Gets controls needed to be implemented to be compliant to a standard.
925
+ #
926
+ # @overload list_controls(request, options = nil)
927
+ # Pass arguments to `list_controls` via a request object, either of type
928
+ # {::Google::Cloud::AuditManager::V1::ListControlsRequest} or an equivalent Hash.
929
+ #
930
+ # @param request [::Google::Cloud::AuditManager::V1::ListControlsRequest, ::Hash]
931
+ # A request object representing the call parameters. Required. To specify no
932
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
933
+ # @param options [::Gapic::CallOptions, ::Hash]
934
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
935
+ #
936
+ # @overload list_controls(parent: nil, page_size: nil, page_token: nil)
937
+ # Pass arguments to `list_controls` via keyword arguments. Note that at
938
+ # least one keyword argument is required. To specify no parameters, or to keep all
939
+ # the default parameter values, pass an empty Hash as a request object (see above).
940
+ #
941
+ # @param parent [::String]
942
+ # Required. Format
943
+ # projects/\\{project}/locations/\\{location}/standards/\\{standard},
944
+ # folders/\\{folder}/locations/\\{location}/standards/\\{standard}
945
+ # @param page_size [::Integer]
946
+ # Optional. The maximum number of resources to return.
947
+ # @param page_token [::String]
948
+ # Optional. The next_page_token value returned from a previous List request,
949
+ # if any.
950
+ #
951
+ # @yield [response, operation] Access the result along with the RPC operation
952
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::Control>]
953
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
954
+ #
955
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::Control>]
956
+ #
957
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
958
+ #
959
+ # @example Basic example
960
+ # require "google/cloud/audit_manager/v1"
961
+ #
962
+ # # Create a client object. The client can be reused for multiple calls.
963
+ # client = Google::Cloud::AuditManager::V1::AuditManager::Client.new
964
+ #
965
+ # # Create a request. To set request fields, pass in keyword arguments.
966
+ # request = Google::Cloud::AuditManager::V1::ListControlsRequest.new
967
+ #
968
+ # # Call the list_controls method.
969
+ # result = client.list_controls request
970
+ #
971
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
972
+ # # over elements, and API calls will be issued to fetch pages as needed.
973
+ # result.each do |item|
974
+ # # Each element is of type ::Google::Cloud::AuditManager::V1::Control.
975
+ # p item
976
+ # end
977
+ #
978
+ def list_controls request, options = nil
979
+ raise ::ArgumentError, "request must be provided" if request.nil?
980
+
981
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AuditManager::V1::ListControlsRequest
982
+
983
+ # Converts hash and nil to an options object
984
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
985
+
986
+ # Customize the options with defaults
987
+ metadata = @config.rpcs.list_controls.metadata.to_h
988
+
989
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
990
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
991
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
992
+ gapic_version: ::Google::Cloud::AuditManager::V1::VERSION
993
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
994
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
995
+
996
+ header_params = {}
997
+ if request.parent
998
+ header_params["parent"] = request.parent
999
+ end
1000
+
1001
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1002
+ metadata[:"x-goog-request-params"] ||= request_params_header
1003
+
1004
+ options.apply_defaults timeout: @config.rpcs.list_controls.timeout,
1005
+ metadata: metadata,
1006
+ retry_policy: @config.rpcs.list_controls.retry_policy
1007
+
1008
+ options.apply_defaults timeout: @config.timeout,
1009
+ metadata: @config.metadata,
1010
+ retry_policy: @config.retry_policy
1011
+
1012
+ @audit_manager_stub.call_rpc :list_controls, request, options: options do |response, operation|
1013
+ response = ::Gapic::PagedEnumerable.new @audit_manager_stub, :list_controls, request, response, operation, options
1014
+ yield response, operation if block_given?
1015
+ throw :response, response
1016
+ end
1017
+ rescue ::GRPC::BadStatus => e
1018
+ raise ::Google::Cloud::Error.from_error(e)
1019
+ end
1020
+
1021
+ ##
1022
+ # Configuration class for the AuditManager API.
1023
+ #
1024
+ # This class represents the configuration for AuditManager,
1025
+ # providing control over timeouts, retry behavior, logging, transport
1026
+ # parameters, and other low-level controls. Certain parameters can also be
1027
+ # applied individually to specific RPCs. See
1028
+ # {::Google::Cloud::AuditManager::V1::AuditManager::Client::Configuration::Rpcs}
1029
+ # for a list of RPCs that can be configured independently.
1030
+ #
1031
+ # Configuration can be applied globally to all clients, or to a single client
1032
+ # on construction.
1033
+ #
1034
+ # @example
1035
+ #
1036
+ # # Modify the global config, setting the timeout for
1037
+ # # enroll_resource to 20 seconds,
1038
+ # # and all remaining timeouts to 10 seconds.
1039
+ # ::Google::Cloud::AuditManager::V1::AuditManager::Client.configure do |config|
1040
+ # config.timeout = 10.0
1041
+ # config.rpcs.enroll_resource.timeout = 20.0
1042
+ # end
1043
+ #
1044
+ # # Apply the above configuration only to a new client.
1045
+ # client = ::Google::Cloud::AuditManager::V1::AuditManager::Client.new do |config|
1046
+ # config.timeout = 10.0
1047
+ # config.rpcs.enroll_resource.timeout = 20.0
1048
+ # end
1049
+ #
1050
+ # @!attribute [rw] endpoint
1051
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1052
+ # nil, indicating to use the default endpoint in the current universe domain.
1053
+ # @return [::String,nil]
1054
+ # @!attribute [rw] credentials
1055
+ # Credentials to send with calls. You may provide any of the following types:
1056
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1057
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1058
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1059
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1060
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1061
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1062
+ # * (`nil`) indicating no credentials
1063
+ #
1064
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
1065
+ # is deprecated. Providing an unvalidated credential configuration to
1066
+ # Google APIs can compromise the security of your systems and data.
1067
+ #
1068
+ # @example
1069
+ #
1070
+ # # The recommended way to provide credentials is to use the `make_creds` method
1071
+ # # on the appropriate credentials class for your environment.
1072
+ #
1073
+ # require "googleauth"
1074
+ #
1075
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
1076
+ # json_key_io: ::File.open("/path/to/keyfile.json")
1077
+ # )
1078
+ #
1079
+ # client = ::Google::Cloud::AuditManager::V1::AuditManager::Client.new do |config|
1080
+ # config.credentials = credentials
1081
+ # end
1082
+ #
1083
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
1084
+ # external source for authentication to Google Cloud, you must validate it before
1085
+ # providing it to a Google API client library. Providing an unvalidated credential
1086
+ # configuration to Google APIs can compromise the security of your systems and data.
1087
+ # For more information, refer to [Validate credential configurations from external
1088
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1089
+ # @return [::Object]
1090
+ # @!attribute [rw] scope
1091
+ # The OAuth scopes
1092
+ # @return [::Array<::String>]
1093
+ # @!attribute [rw] lib_name
1094
+ # The library name as recorded in instrumentation and logging
1095
+ # @return [::String]
1096
+ # @!attribute [rw] lib_version
1097
+ # The library version as recorded in instrumentation and logging
1098
+ # @return [::String]
1099
+ # @!attribute [rw] channel_args
1100
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1101
+ # `GRPC::Core::Channel` object is provided as the credential.
1102
+ # @return [::Hash]
1103
+ # @!attribute [rw] interceptors
1104
+ # An array of interceptors that are run before calls are executed.
1105
+ # @return [::Array<::GRPC::ClientInterceptor>]
1106
+ # @!attribute [rw] timeout
1107
+ # The call timeout in seconds.
1108
+ # @return [::Numeric]
1109
+ # @!attribute [rw] metadata
1110
+ # Additional gRPC headers to be sent with the call.
1111
+ # @return [::Hash{::Symbol=>::String}]
1112
+ # @!attribute [rw] retry_policy
1113
+ # The retry policy. The value is a hash with the following keys:
1114
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1115
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1116
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1117
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
1118
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1119
+ # trigger a retry.
1120
+ # @return [::Hash]
1121
+ # @!attribute [rw] quota_project
1122
+ # A separate project against which to charge quota.
1123
+ # @return [::String]
1124
+ # @!attribute [rw] universe_domain
1125
+ # The universe domain within which to make requests. This determines the
1126
+ # default endpoint URL. The default value of nil uses the environment
1127
+ # universe (usually the default "googleapis.com" universe).
1128
+ # @return [::String,nil]
1129
+ # @!attribute [rw] logger
1130
+ # A custom logger to use for request/response debug logging, or the value
1131
+ # `:default` (the default) to construct a default logger, or `nil` to
1132
+ # explicitly disable logging.
1133
+ # @return [::Logger,:default,nil]
1134
+ #
1135
+ class Configuration
1136
+ extend ::Gapic::Config
1137
+
1138
+ # @private
1139
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1140
+ DEFAULT_ENDPOINT = "auditmanager.googleapis.com"
1141
+
1142
+ config_attr :endpoint, nil, ::String, nil
1143
+ config_attr :credentials, nil do |value|
1144
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1145
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
1146
+ allowed.any? { |klass| klass === value }
1147
+ end
1148
+ config_attr :scope, nil, ::String, ::Array, nil
1149
+ config_attr :lib_name, nil, ::String, nil
1150
+ config_attr :lib_version, nil, ::String, nil
1151
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1152
+ config_attr :interceptors, nil, ::Array, nil
1153
+ config_attr :timeout, nil, ::Numeric, nil
1154
+ config_attr :metadata, nil, ::Hash, nil
1155
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1156
+ config_attr :quota_project, nil, ::String, nil
1157
+ config_attr :universe_domain, nil, ::String, nil
1158
+ config_attr :logger, :default, ::Logger, nil, :default
1159
+
1160
+ # @private
1161
+ def initialize parent_config = nil
1162
+ @parent_config = parent_config unless parent_config.nil?
1163
+
1164
+ yield self if block_given?
1165
+ end
1166
+
1167
+ ##
1168
+ # Configurations for individual RPCs
1169
+ # @return [Rpcs]
1170
+ #
1171
+ def rpcs
1172
+ @rpcs ||= begin
1173
+ parent_rpcs = nil
1174
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1175
+ Rpcs.new parent_rpcs
1176
+ end
1177
+ end
1178
+
1179
+ ##
1180
+ # Configuration for the channel pool
1181
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1182
+ #
1183
+ def channel_pool
1184
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1185
+ end
1186
+
1187
+ ##
1188
+ # Configuration RPC class for the AuditManager API.
1189
+ #
1190
+ # Includes fields providing the configuration for each RPC in this service.
1191
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1192
+ # the following configuration fields:
1193
+ #
1194
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1195
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1196
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1197
+ # include the following keys:
1198
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1199
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1200
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1201
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
1202
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1203
+ # trigger a retry.
1204
+ #
1205
+ class Rpcs
1206
+ ##
1207
+ # RPC-specific configuration for `enroll_resource`
1208
+ # @return [::Gapic::Config::Method]
1209
+ #
1210
+ attr_reader :enroll_resource
1211
+ ##
1212
+ # RPC-specific configuration for `generate_audit_scope_report`
1213
+ # @return [::Gapic::Config::Method]
1214
+ #
1215
+ attr_reader :generate_audit_scope_report
1216
+ ##
1217
+ # RPC-specific configuration for `generate_audit_report`
1218
+ # @return [::Gapic::Config::Method]
1219
+ #
1220
+ attr_reader :generate_audit_report
1221
+ ##
1222
+ # RPC-specific configuration for `list_audit_reports`
1223
+ # @return [::Gapic::Config::Method]
1224
+ #
1225
+ attr_reader :list_audit_reports
1226
+ ##
1227
+ # RPC-specific configuration for `get_audit_report`
1228
+ # @return [::Gapic::Config::Method]
1229
+ #
1230
+ attr_reader :get_audit_report
1231
+ ##
1232
+ # RPC-specific configuration for `get_resource_enrollment_status`
1233
+ # @return [::Gapic::Config::Method]
1234
+ #
1235
+ attr_reader :get_resource_enrollment_status
1236
+ ##
1237
+ # RPC-specific configuration for `list_resource_enrollment_statuses`
1238
+ # @return [::Gapic::Config::Method]
1239
+ #
1240
+ attr_reader :list_resource_enrollment_statuses
1241
+ ##
1242
+ # RPC-specific configuration for `list_controls`
1243
+ # @return [::Gapic::Config::Method]
1244
+ #
1245
+ attr_reader :list_controls
1246
+
1247
+ # @private
1248
+ def initialize parent_rpcs = nil
1249
+ enroll_resource_config = parent_rpcs.enroll_resource if parent_rpcs.respond_to? :enroll_resource
1250
+ @enroll_resource = ::Gapic::Config::Method.new enroll_resource_config
1251
+ generate_audit_scope_report_config = parent_rpcs.generate_audit_scope_report if parent_rpcs.respond_to? :generate_audit_scope_report
1252
+ @generate_audit_scope_report = ::Gapic::Config::Method.new generate_audit_scope_report_config
1253
+ generate_audit_report_config = parent_rpcs.generate_audit_report if parent_rpcs.respond_to? :generate_audit_report
1254
+ @generate_audit_report = ::Gapic::Config::Method.new generate_audit_report_config
1255
+ list_audit_reports_config = parent_rpcs.list_audit_reports if parent_rpcs.respond_to? :list_audit_reports
1256
+ @list_audit_reports = ::Gapic::Config::Method.new list_audit_reports_config
1257
+ get_audit_report_config = parent_rpcs.get_audit_report if parent_rpcs.respond_to? :get_audit_report
1258
+ @get_audit_report = ::Gapic::Config::Method.new get_audit_report_config
1259
+ get_resource_enrollment_status_config = parent_rpcs.get_resource_enrollment_status if parent_rpcs.respond_to? :get_resource_enrollment_status
1260
+ @get_resource_enrollment_status = ::Gapic::Config::Method.new get_resource_enrollment_status_config
1261
+ list_resource_enrollment_statuses_config = parent_rpcs.list_resource_enrollment_statuses if parent_rpcs.respond_to? :list_resource_enrollment_statuses
1262
+ @list_resource_enrollment_statuses = ::Gapic::Config::Method.new list_resource_enrollment_statuses_config
1263
+ list_controls_config = parent_rpcs.list_controls if parent_rpcs.respond_to? :list_controls
1264
+ @list_controls = ::Gapic::Config::Method.new list_controls_config
1265
+
1266
+ yield self if block_given?
1267
+ end
1268
+ end
1269
+ end
1270
+ end
1271
+ end
1272
+ end
1273
+ end
1274
+ end
1275
+ end