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