Audit Manager V1 API - Class Google::Cloud::AuditManager::V1::AuditManager::Client (v0.1.0)

Reference documentation and code samples for the Audit Manager V1 API class Google::Cloud::AuditManager::V1::AuditManager::Client.

Client for the AuditManager service.

Service describing handlers for resources

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the AuditManager Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all AuditManager clients
::Google::Cloud::AuditManager::V1::AuditManager::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the AuditManager Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#enroll_resource

def enroll_resource(request, options = nil) -> ::Google::Cloud::AuditManager::V1::Enrollment
def enroll_resource(scope: nil, destinations: nil) -> ::Google::Cloud::AuditManager::V1::Enrollment

Enrolls the customer resource(folder/project/organization) to the audit manager service by creating the audit managers Service Agent in customers workload and granting required permissions to the Service Agent. Please note that if enrollment request is made on the already enrolled workload then enrollment is executed overriding the existing set of destinations.

Overloads
def enroll_resource(request, options = nil) -> ::Google::Cloud::AuditManager::V1::Enrollment
Pass arguments to enroll_resource via a request object, either of type EnrollResourceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AuditManager::V1::EnrollResourceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def enroll_resource(scope: nil, destinations: nil) -> ::Google::Cloud::AuditManager::V1::Enrollment
Pass arguments to enroll_resource via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • scope (::String) — Required. The resource to be enrolled to the audit manager. Scope format should be resource_type/resource_identifier Eg: projects/{project}/locations/{location}, folders/{folder}/locations/{location} organizations/{organization}/locations/{location}
  • destinations (::Array<::Google::Cloud::AuditManager::V1::EnrollResourceRequest::EligibleDestination, ::Hash>) — Required. List of destination among which customer can choose to upload their reports during the audit process. While enrolling at a organization/folder level, customer can choose Cloud storage bucket in any project. If the audit is triggered at project level using the service agent at organization/folder level, all the destination options associated with respective organization/folder level service agent will be available to auditing projects.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/audit_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AuditManager::V1::EnrollResourceRequest.new

# Call the enroll_resource method.
result = client.enroll_resource request

# The returned object is of type Google::Cloud::AuditManager::V1::Enrollment.
p result

#generate_audit_report

def generate_audit_report(request, options = nil) -> ::Gapic::Operation
def generate_audit_report(gcs_uri: nil, scope: nil, compliance_standard: nil, report_format: nil, compliance_framework: nil) -> ::Gapic::Operation

Register the Audit Report generation requests and returns the OperationId using which the customer can track the report generation progress.

Overloads
def generate_audit_report(request, options = nil) -> ::Gapic::Operation
Pass arguments to generate_audit_report via a request object, either of type GenerateAuditReportRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AuditManager::V1::GenerateAuditReportRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def generate_audit_report(gcs_uri: nil, scope: nil, compliance_standard: nil, report_format: nil, compliance_framework: nil) -> ::Gapic::Operation
Pass arguments to generate_audit_report via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • gcs_uri (::String) — Destination Cloud storage bucket where report and evidence must be uploaded. The Cloud storage bucket provided here must be selected among the buckets entered during the enrollment process.
  • scope (::String) — Required. Scope for which the AuditScopeReport is required. Must be of format resource_type/resource_identifier Eg: projects/{project}/locations/{location}, folders/{folder}/locations/{location}
  • compliance_standard (::String) — Required. Compliance Standard against which the Scope Report must be generated. Eg: FEDRAMP_MODERATE
  • report_format (::Google::Cloud::AuditManager::V1::GenerateAuditReportRequest::AuditReportFormat) — Required. The format in which the audit report should be created.
  • compliance_framework (::String) — Required. Compliance framework against which the Report must be generated.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/audit_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AuditManager::V1::GenerateAuditReportRequest.new

# Call the generate_audit_report method.
result = client.generate_audit_report request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#generate_audit_scope_report

def generate_audit_scope_report(request, options = nil) -> ::Google::Cloud::AuditManager::V1::AuditScopeReport
def generate_audit_scope_report(scope: nil, compliance_standard: nil, report_format: nil, compliance_framework: nil) -> ::Google::Cloud::AuditManager::V1::AuditScopeReport

Generates a demo report highlighting different responsibilities (Google/Customer/ shared) required to be fulfilled for the customer's workload to be compliant with the given standard.

Overloads
def generate_audit_scope_report(request, options = nil) -> ::Google::Cloud::AuditManager::V1::AuditScopeReport
Pass arguments to generate_audit_scope_report via a request object, either of type GenerateAuditScopeReportRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AuditManager::V1::GenerateAuditScopeReportRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def generate_audit_scope_report(scope: nil, compliance_standard: nil, report_format: nil, compliance_framework: nil) -> ::Google::Cloud::AuditManager::V1::AuditScopeReport
Pass arguments to generate_audit_scope_report via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • scope (::String) — Required. Scope for which the AuditScopeReport is required. Must be of format resource_type/resource_identifier Eg: projects/{project}/locations/{location}, folders/{folder}/locations/{location}
  • compliance_standard (::String) — Required. Compliance Standard against which the Scope Report must be generated. Eg: FEDRAMP_MODERATE
  • report_format (::Google::Cloud::AuditManager::V1::GenerateAuditScopeReportRequest::AuditScopeReportFormat) — Required. The format in which the Scope report bytes should be returned.
  • compliance_framework (::String) — Required. Compliance framework against which the Scope Report must be generated.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/audit_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AuditManager::V1::GenerateAuditScopeReportRequest.new

# Call the generate_audit_scope_report method.
result = client.generate_audit_scope_report request

# The returned object is of type Google::Cloud::AuditManager::V1::AuditScopeReport.
p result

#get_audit_report

def get_audit_report(request, options = nil) -> ::Google::Cloud::AuditManager::V1::AuditReport
def get_audit_report(name: nil) -> ::Google::Cloud::AuditManager::V1::AuditReport

Get the overall audit report

Overloads
def get_audit_report(request, options = nil) -> ::Google::Cloud::AuditManager::V1::AuditReport
Pass arguments to get_audit_report via a request object, either of type GetAuditReportRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AuditManager::V1::GetAuditReportRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_audit_report(name: nil) -> ::Google::Cloud::AuditManager::V1::AuditReport
Pass arguments to get_audit_report via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Format projects/{project}/locations/{location}/auditReports/{audit_report}, folders/{folder}/locations/{location}/auditReports/{audit_report}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/audit_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AuditManager::V1::GetAuditReportRequest.new

# Call the get_audit_report method.
result = client.get_audit_report request

# The returned object is of type Google::Cloud::AuditManager::V1::AuditReport.
p result

#get_resource_enrollment_status

def get_resource_enrollment_status(request, options = nil) -> ::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus
def get_resource_enrollment_status(name: nil) -> ::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus

Get a resource along with its enrollment status.

Overloads
def get_resource_enrollment_status(request, options = nil) -> ::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus
Pass arguments to get_resource_enrollment_status via a request object, either of type GetResourceEnrollmentStatusRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AuditManager::V1::GetResourceEnrollmentStatusRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_resource_enrollment_status(name: nil) -> ::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus
Pass arguments to get_resource_enrollment_status via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Format folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/audit_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AuditManager::V1::GetResourceEnrollmentStatusRequest.new

# Call the get_resource_enrollment_status method.
result = client.get_resource_enrollment_status request

# The returned object is of type Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new AuditManager client object.

Yields
  • (config) — Configure the AuditManager client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::AuditManager::V1::AuditManager::Client.new do |config|
  config.timeout = 10.0
end

#list_audit_reports

def list_audit_reports(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::AuditReport>
def list_audit_reports(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::AuditReport>

Lists audit reports in the selected parent scope

Overloads
def list_audit_reports(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::AuditReport>
Pass arguments to list_audit_reports via a request object, either of type ListAuditReportsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AuditManager::V1::ListAuditReportsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_audit_reports(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::AuditReport>
Pass arguments to list_audit_reports via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The parent scope for which to list the reports.
  • page_size (::Integer) — Optional. The maximum number of resources to return.
  • page_token (::String) — Optional. The next_page_token value returned from a previous List request, if any.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/audit_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AuditManager::V1::ListAuditReportsRequest.new

# Call the list_audit_reports method.
result = client.list_audit_reports request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::AuditManager::V1::AuditReport.
  p item
end

#list_controls

def list_controls(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::Control>
def list_controls(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::Control>

Gets controls needed to be implemented to be compliant to a standard.

Overloads
def list_controls(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::Control>
Pass arguments to list_controls via a request object, either of type ListControlsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AuditManager::V1::ListControlsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_controls(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::Control>
Pass arguments to list_controls via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. Format projects/{project}/locations/{location}/standards/{standard}, folders/{folder}/locations/{location}/standards/{standard}
  • page_size (::Integer) — Optional. The maximum number of resources to return.
  • page_token (::String) — Optional. The next_page_token value returned from a previous List request, if any.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/audit_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AuditManager::V1::ListControlsRequest.new

# Call the list_controls method.
result = client.list_controls request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::AuditManager::V1::Control.
  p item
end

#list_resource_enrollment_statuses

def list_resource_enrollment_statuses(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus>
def list_resource_enrollment_statuses(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus>

Fetches all resources under the parent along with their enrollment.

Overloads
def list_resource_enrollment_statuses(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus>
Pass arguments to list_resource_enrollment_statuses via a request object, either of type ListResourceEnrollmentStatusesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AuditManager::V1::ListResourceEnrollmentStatusesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_resource_enrollment_statuses(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus>
Pass arguments to list_resource_enrollment_statuses via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The parent scope for which the list of resources with enrollments are required.
  • page_size (::Integer) — Optional. The maximum number of resources to return.
  • page_token (::String) — Optional. The next_page_token value returned from a previous List request, if any.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/audit_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AuditManager::V1::AuditManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AuditManager::V1::ListResourceEnrollmentStatusesRequest.new

# Call the list_resource_enrollment_statuses method.
result = client.list_resource_enrollment_statuses request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::AuditManager::V1::ResourceEnrollmentStatus.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Client)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#operations_client

def operations_client() -> ::Google::Cloud::AuditManager::V1::AuditManager::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)