Google Cloud Audit Manager V1 Client - Class AuditManagerClient (0.1.0)

Reference documentation and code samples for the Google Cloud Audit Manager V1 Client class AuditManagerClient.

Service Description: Service describing handlers for resources

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Cloud \ AuditManager \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array|Google\ApiCore\Options\ClientOptions

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials FetchAuthTokenInterface|CredentialsWrapper

This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\AuditManager\V1\AuditManagerClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new AuditManagerClient(['credentials' => $creds]); https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

↳ logger false|LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

↳ universeDomain string

The service domain for the client. Defaults to 'googleapis.com'.

enrollResource

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.

The async variant is AuditManagerClient::enrollResourceAsync() .

Parameters
Name Description
request Google\Cloud\AuditManager\V1\EnrollResourceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\AuditManager\V1\Enrollment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\AuditManager\V1\EnrollResourceRequest;
use Google\Cloud\AuditManager\V1\EnrollResourceRequest\EligibleDestination;
use Google\Cloud\AuditManager\V1\Enrollment;

/**
 * @param string $scope 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}
 */
function enroll_resource_sample(string $scope): void
{
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $destinations = [new EligibleDestination()];
    $request = (new EnrollResourceRequest())
        ->setScope($scope)
        ->setDestinations($destinations);

    // Call the API and handle any network failures.
    try {
        /** @var Enrollment $response */
        $response = $auditManagerClient->enrollResource($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $scope = '[SCOPE]';

    enroll_resource_sample($scope);
}

generateAuditReport

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

The async variant is AuditManagerClient::generateAuditReportAsync() .

Parameters
Name Description
request Google\Cloud\AuditManager\V1\GenerateAuditReportRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\AuditManager\V1\AuditReport>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AuditManager\V1\AuditReport;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\AuditManager\V1\GenerateAuditReportRequest;
use Google\Cloud\AuditManager\V1\GenerateAuditReportRequest\AuditReportFormat;
use Google\Rpc\Status;

/**
 * @param string $scope               Scope for which the AuditScopeReport is required. Must be of
 *                                    format resource_type/resource_identifier Eg:
 *                                    projects/{project}/locations/{location},
 *                                    folders/{folder}/locations/{location}
 * @param string $complianceStandard  Compliance Standard against which the Scope Report must be
 *                                    generated. Eg: FEDRAMP_MODERATE
 * @param int    $reportFormat        The format in which the audit report should be created.
 * @param string $complianceFramework Compliance framework against which the Report must be generated.
 */
function generate_audit_report_sample(
    string $scope,
    string $complianceStandard,
    int $reportFormat,
    string $complianceFramework
): void {
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = (new GenerateAuditReportRequest())
        ->setScope($scope)
        ->setComplianceStandard($complianceStandard)
        ->setReportFormat($reportFormat)
        ->setComplianceFramework($complianceFramework);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $auditManagerClient->generateAuditReport($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AuditReport $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $scope = '[SCOPE]';
    $complianceStandard = '[COMPLIANCE_STANDARD]';
    $reportFormat = AuditReportFormat::AUDIT_REPORT_FORMAT_UNSPECIFIED;
    $complianceFramework = '[COMPLIANCE_FRAMEWORK]';

    generate_audit_report_sample($scope, $complianceStandard, $reportFormat, $complianceFramework);
}

generateAuditScopeReport

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.

The async variant is AuditManagerClient::generateAuditScopeReportAsync() .

Parameters
Name Description
request Google\Cloud\AuditManager\V1\GenerateAuditScopeReportRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\AuditManager\V1\AuditScopeReport
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AuditManager\V1\AuditScopeReport;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\AuditManager\V1\GenerateAuditScopeReportRequest;
use Google\Cloud\AuditManager\V1\GenerateAuditScopeReportRequest\AuditScopeReportFormat;

/**
 * @param string $scope               Scope for which the AuditScopeReport is required. Must be of
 *                                    format resource_type/resource_identifier Eg:
 *                                    projects/{project}/locations/{location},
 *                                    folders/{folder}/locations/{location}
 * @param string $complianceStandard  Compliance Standard against which the Scope Report must be
 *                                    generated. Eg: FEDRAMP_MODERATE
 * @param int    $reportFormat        The format in which the Scope report bytes should be returned.
 * @param string $complianceFramework Compliance framework against which the Scope Report must be
 *                                    generated.
 */
function generate_audit_scope_report_sample(
    string $scope,
    string $complianceStandard,
    int $reportFormat,
    string $complianceFramework
): void {
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = (new GenerateAuditScopeReportRequest())
        ->setScope($scope)
        ->setComplianceStandard($complianceStandard)
        ->setReportFormat($reportFormat)
        ->setComplianceFramework($complianceFramework);

    // Call the API and handle any network failures.
    try {
        /** @var AuditScopeReport $response */
        $response = $auditManagerClient->generateAuditScopeReport($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $scope = '[SCOPE]';
    $complianceStandard = '[COMPLIANCE_STANDARD]';
    $reportFormat = AuditScopeReportFormat::AUDIT_SCOPE_REPORT_FORMAT_UNSPECIFIED;
    $complianceFramework = '[COMPLIANCE_FRAMEWORK]';

    generate_audit_scope_report_sample(
        $scope,
        $complianceStandard,
        $reportFormat,
        $complianceFramework
    );
}

getAuditReport

Get the overall audit report

The async variant is AuditManagerClient::getAuditReportAsync() .

Parameters
Name Description
request Google\Cloud\AuditManager\V1\GetAuditReportRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\AuditManager\V1\AuditReport
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AuditManager\V1\AuditReport;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\AuditManager\V1\GetAuditReportRequest;

/**
 * @param string $formattedName Format
 *                              projects/{project}/locations/{location}/auditReports/{audit_report},
 *                              folders/{folder}/locations/{location}/auditReports/{audit_report}
 *                              Please see {@see AuditManagerClient::auditReportName()} for help formatting this field.
 */
function get_audit_report_sample(string $formattedName): void
{
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = (new GetAuditReportRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AuditReport $response */
        $response = $auditManagerClient->getAuditReport($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AuditManagerClient::auditReportName('[PROJECT]', '[LOCATION]', '[AUDIT_REPORT]');

    get_audit_report_sample($formattedName);
}

getResourceEnrollmentStatus

Get a resource along with its enrollment status.

The async variant is AuditManagerClient::getResourceEnrollmentStatusAsync() .

Parameters
Name Description
request Google\Cloud\AuditManager\V1\GetResourceEnrollmentStatusRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\AuditManager\V1\GetResourceEnrollmentStatusRequest;
use Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus;

/**
 * @param string $formattedName 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}
 *                              Please see {@see AuditManagerClient::resourceEnrollmentStatusName()} for help formatting this field.
 */
function get_resource_enrollment_status_sample(string $formattedName): void
{
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = (new GetResourceEnrollmentStatusRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var ResourceEnrollmentStatus $response */
        $response = $auditManagerClient->getResourceEnrollmentStatus($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AuditManagerClient::resourceEnrollmentStatusName(
        '[FOLDER]',
        '[LOCATION]',
        '[RESOURCE_ENROLLMENT_STATUS]'
    );

    get_resource_enrollment_status_sample($formattedName);
}

listAuditReports

Lists audit reports in the selected parent scope

The async variant is AuditManagerClient::listAuditReportsAsync() .

Parameters
Name Description
request Google\Cloud\AuditManager\V1\ListAuditReportsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AuditManager\V1\AuditReport;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\AuditManager\V1\ListAuditReportsRequest;

/**
 * @param string $formattedParent The parent scope for which to list the reports. Please see
 *                                {@see AuditManagerClient::folderLocationName()} for help formatting this field.
 */
function list_audit_reports_sample(string $formattedParent): void
{
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = (new ListAuditReportsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $auditManagerClient->listAuditReports($request);

        /** @var AuditReport $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AuditManagerClient::folderLocationName('[FOLDER]', '[LOCATION]');

    list_audit_reports_sample($formattedParent);
}

listControls

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

The async variant is AuditManagerClient::listControlsAsync() .

Parameters
Name Description
request Google\Cloud\AuditManager\V1\ListControlsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\AuditManager\V1\Control;
use Google\Cloud\AuditManager\V1\ListControlsRequest;

/**
 * @param string $formattedParent Format
 *                                projects/{project}/locations/{location}/standards/{standard},
 *                                folders/{folder}/locations/{location}/standards/{standard}
 *                                Please see {@see AuditManagerClient::standardName()} for help formatting this field.
 */
function list_controls_sample(string $formattedParent): void
{
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = (new ListControlsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $auditManagerClient->listControls($request);

        /** @var Control $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AuditManagerClient::standardName('[PROJECT]', '[LOCATION]', '[STANDARD]');

    list_controls_sample($formattedParent);
}

listResourceEnrollmentStatuses

Fetches all resources under the parent along with their enrollment.

The async variant is AuditManagerClient::listResourceEnrollmentStatusesAsync() .

Parameters
Name Description
request Google\Cloud\AuditManager\V1\ListResourceEnrollmentStatusesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\AuditManager\V1\ListResourceEnrollmentStatusesRequest;
use Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus;

/**
 * @param string $formattedParent The parent scope for which the list of resources with enrollments
 *                                are required. Please see
 *                                {@see AuditManagerClient::enrollmentStatusScopeName()} for help formatting this field.
 */
function list_resource_enrollment_statuses_sample(string $formattedParent): void
{
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = (new ListResourceEnrollmentStatusesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $auditManagerClient->listResourceEnrollmentStatuses($request);

        /** @var ResourceEnrollmentStatus $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AuditManagerClient::enrollmentStatusScopeName('[FOLDER]', '[LOCATION]');

    list_resource_enrollment_statuses_sample($formattedParent);
}

getLocation

Gets information about a location.

The async variant is AuditManagerClient::getLocationAsync() .

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function get_location_sample(): void
{
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = new GetLocationRequest();

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $auditManagerClient->getLocation($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listLocations

Lists information about the supported locations for this service.

This method can be called in two ways:

List all public locations: Use the path GET /v1/locations. List project-visible locations: Use the path GET /v1/projects/{project_id}/locations. This may include public locations as well as private or other locations specifically visible to the project.

The async variant is AuditManagerClient::listLocationsAsync() .

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AuditManager\V1\Client\AuditManagerClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function list_locations_sample(): void
{
    // Create a client.
    $auditManagerClient = new AuditManagerClient();

    // Prepare the request message.
    $request = new ListLocationsRequest();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $auditManagerClient->listLocations($request);

        /** @var Location $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

enrollResourceAsync

Parameters
Name Description
request Google\Cloud\AuditManager\V1\EnrollResourceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AuditManager\V1\Enrollment>

generateAuditReportAsync

Parameters
Name Description
request Google\Cloud\AuditManager\V1\GenerateAuditReportRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

generateAuditScopeReportAsync

Parameters
Name Description
request Google\Cloud\AuditManager\V1\GenerateAuditScopeReportRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AuditManager\V1\AuditScopeReport>

getAuditReportAsync

Parameters
Name Description
request Google\Cloud\AuditManager\V1\GetAuditReportRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AuditManager\V1\AuditReport>

getResourceEnrollmentStatusAsync

Parameters
Name Description
request Google\Cloud\AuditManager\V1\GetResourceEnrollmentStatusRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AuditManager\V1\ResourceEnrollmentStatus>

listAuditReportsAsync

Parameters
Name Description
request Google\Cloud\AuditManager\V1\ListAuditReportsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listControlsAsync

Parameters
Name Description
request Google\Cloud\AuditManager\V1\ListControlsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listResourceEnrollmentStatusesAsync

Parameters
Name Description
request Google\Cloud\AuditManager\V1\ListResourceEnrollmentStatusesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

getLocationAsync

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location>

listLocationsAsync

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
Type Description
Google\LongRunning\Client\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse

static::auditReportName

Formats a string containing the fully-qualified path to represent a audit_report resource.

Parameters
Name Description
project string
location string
auditReport string
Returns
Type Description
string The formatted audit_report resource.

static::enrollmentStatusScopeName

Formats a string containing the fully-qualified path to represent a enrollment_status_scope resource.

Parameters
Name Description
folder string
location string
Returns
Type Description
string The formatted enrollment_status_scope resource.

static::folderLocationName

Formats a string containing the fully-qualified path to represent a folder_location resource.

Parameters
Name Description
folder string
location string
Returns
Type Description
string The formatted folder_location resource.

static::folderLocationAuditReportName

Formats a string containing the fully-qualified path to represent a folder_location_audit_report resource.

Parameters
Name Description
folder string
location string
auditReport string
Returns
Type Description
string The formatted folder_location_audit_report resource.

static::folderLocationResourceEnrollmentStatusName

Formats a string containing the fully-qualified path to represent a folder_location_resource_enrollment_status resource.

Parameters
Name Description
folder string
location string
resourceEnrollmentStatus string
Returns
Type Description
string The formatted folder_location_resource_enrollment_status resource.

static::folderLocationStandardName

Formats a string containing the fully-qualified path to represent a folder_location_standard resource.

Parameters
Name Description
folder string
location string
standard string
Returns
Type Description
string The formatted folder_location_standard resource.

static::locationName

Formats a string containing the fully-qualified path to represent a location resource.

Parameters
Name Description
project string
location string
Returns
Type Description
string The formatted location resource.

static::organizationLocationName

Formats a string containing the fully-qualified path to represent a organization_location resource.

Parameters
Name Description
organization string
location string
Returns
Type Description
string The formatted organization_location resource.

static::organizationLocationResourceEnrollmentStatusName

Formats a string containing the fully-qualified path to represent a organization_location_resource_enrollment_status resource.

Parameters
Name Description
organization string
location string
resourceEnrollmentStatus string
Returns
Type Description
string The formatted organization_location_resource_enrollment_status resource.

static::organizationLocationStandardName

Formats a string containing the fully-qualified path to represent a organization_location_standard resource.

Parameters
Name Description
organization string
location string
standard string
Returns
Type Description
string The formatted organization_location_standard resource.

static::projectLocationAuditReportName

Formats a string containing the fully-qualified path to represent a project_location_audit_report resource.

Parameters
Name Description
project string
location string
auditReport string
Returns
Type Description
string The formatted project_location_audit_report resource.

static::projectLocationResourceEnrollmentStatusName

Formats a string containing the fully-qualified path to represent a project_location_resource_enrollment_status resource.

Parameters
Name Description
project string
location string
resourceEnrollmentStatus string
Returns
Type Description
string The formatted project_location_resource_enrollment_status resource.

static::projectLocationStandardName

Formats a string containing the fully-qualified path to represent a project_location_standard resource.

Parameters
Name Description
project string
location string
standard string
Returns
Type Description
string The formatted project_location_standard resource.

static::resourceEnrollmentStatusName

Formats a string containing the fully-qualified path to represent a resource_enrollment_status resource.

Parameters
Name Description
folder string
location string
resourceEnrollmentStatus string
Returns
Type Description
string The formatted resource_enrollment_status resource.

static::standardName

Formats a string containing the fully-qualified path to represent a standard resource.

Parameters
Name Description
project string
location string
standard string
Returns
Type Description
string The formatted standard resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • auditReport: projects/{project}/locations/{location}/auditReports/{audit_report}
  • enrollmentStatusScope: folders/{folder}/locations/{location}
  • folderLocation: folders/{folder}/locations/{location}
  • folderLocationAuditReport: folders/{folder}/locations/{location}/auditReports/{audit_report}
  • folderLocationResourceEnrollmentStatus: folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}
  • folderLocationStandard: folders/{folder}/locations/{location}/standards/{standard}
  • location: projects/{project}/locations/{location}
  • organizationLocation: organizations/{organization}/locations/{location}
  • organizationLocationResourceEnrollmentStatus: organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}
  • organizationLocationStandard: organizations/{organization}/locations/{location}/standards/{standard}
  • projectLocationAuditReport: projects/{project}/locations/{location}/auditReports/{audit_report}
  • projectLocationResourceEnrollmentStatus: projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}
  • projectLocationStandard: projects/{project}/locations/{location}/standards/{standard}
  • resourceEnrollmentStatus: folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}
  • standard: projects/{project}/locations/{location}/standards/{standard}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
Name Description
formattedName string

The formatted name string

template ?string

Optional name of template to match

Returns
Type Description
array An associative array from name component IDs to component values.