Stackdriver Logging V2 Client - Class ConfigServiceV2Client (1.28.4)

Reference documentation and code samples for the Stackdriver Logging V2 Client class ConfigServiceV2Client.

Service Description: Service for configuring sinks used to route log entries.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

$configServiceV2Client = new ConfigServiceV2Client();
try {
    $name = 'name';
    $destination = 'destination';
    $operationResponse = $configServiceV2Client->copyLogEntries($name, $destination);
    $operationResponse->pollUntilComplete();
    if ($operationResponse->operationSucceeded()) {
        $result = $operationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $operationResponse->getError();
        // handleError($error)
    }
    // Alternatively:
    // start the operation, keep the operation name, and resume later
    $operationResponse = $configServiceV2Client->copyLogEntries($name, $destination);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $configServiceV2Client->resumeOperation($operationName, 'copyLogEntries');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $configServiceV2Client->close();
}

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.

This service has a new (beta) implementation. See Google\Cloud\Logging\V2\Client\ConfigServiceV2Client to use the new surface.

Namespace

Google \ Cloud \ Logging \ V2

Methods

__construct

Constructor.

Parameters
NameDescription
options array

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 string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ 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.

copyLogEntries

Copies a set of log entries from a log bucket to a Cloud Storage bucket.

Parameters
NameDescription
name string

Required. Log bucket from which to copy log entries.

For example:

"projects/my-project/locations/global/buckets/my-source-bucket"

destination string

Required. Destination to which to copy log entries.

optionalArgs array

Optional.

↳ filter string

Optional. A filter specifying which log entries to copy. The filter must be no more than 20k characters. An empty filter matches all log entries.

↳ 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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\CopyLogEntriesResponse;
use Google\Rpc\Status;

/**
 * @param string $name        Log bucket from which to copy log entries.
 *
 *                            For example:
 *
 *                            `"projects/my-project/locations/global/buckets/my-source-bucket"`
 * @param string $destination Destination to which to copy log entries.
 */
function copy_log_entries_sample(string $name, string $destination): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $configServiceV2Client->copyLogEntries($name, $destination);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var CopyLogEntriesResponse $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
{
    $name = '[NAME]';
    $destination = '[DESTINATION]';

    copy_log_entries_sample($name, $destination);
}

createBucket

Creates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.

Parameters
NameDescription
parent string

Required. The resource in which to create the log bucket:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]"

For example:

"projects/my-project/locations/global"

bucketId string

Required. A client-assigned identifier such as "my-bucket". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods.

bucket Google\Cloud\Logging\V2\LogBucket

Required. The new bucket. The region specified in the new bucket must be compliant with any Location Restriction Org Policy. The name field in the bucket is ignored.

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogBucket
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogBucket;

/**
 * @param string $formattedParent The resource in which to create the log bucket:
 *
 *                                "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
 *
 *                                For example:
 *
 *                                `"projects/my-project/locations/global"`
 *                                Please see {@see ConfigServiceV2Client::organizationLocationName()} for help formatting this field.
 * @param string $bucketId        A client-assigned identifier such as `"my-bucket"`. Identifiers
 *                                are limited to 100 characters and can include only letters, digits,
 *                                underscores, hyphens, and periods.
 */
function create_bucket_sample(string $formattedParent, string $bucketId): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $bucket = new LogBucket();

    // Call the API and handle any network failures.
    try {
        /** @var LogBucket $response */
        $response = $configServiceV2Client->createBucket($formattedParent, $bucketId, $bucket);
        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
{
    $formattedParent = ConfigServiceV2Client::organizationLocationName('[ORGANIZATION]', '[LOCATION]');
    $bucketId = '[BUCKET_ID]';

    create_bucket_sample($formattedParent, $bucketId);
}

createBucketAsync

Creates a log bucket asynchronously that can be used to store log entries.

After a bucket has been created, the bucket's location cannot be changed.

Parameters
NameDescription
parent string

Required. The resource in which to create the log bucket:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]"

For example:

"projects/my-project/locations/global"

bucketId string

Required. A client-assigned identifier such as "my-bucket". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods.

bucket Google\Cloud\Logging\V2\LogBucket

Required. The new bucket. The region specified in the new bucket must be compliant with any Location Restriction Org Policy. The name field in the bucket is ignored.

optionalArgs 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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogBucket;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The resource in which to create the log bucket:
 *
 *                                "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
 *
 *                                For example:
 *
 *                                `"projects/my-project/locations/global"`
 *                                Please see {@see ConfigServiceV2Client::organizationLocationName()} for help formatting this field.
 * @param string $bucketId        A client-assigned identifier such as `"my-bucket"`. Identifiers
 *                                are limited to 100 characters and can include only letters, digits,
 *                                underscores, hyphens, and periods.
 */
function create_bucket_async_sample(string $formattedParent, string $bucketId): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $bucket = new LogBucket();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $configServiceV2Client->createBucketAsync($formattedParent, $bucketId, $bucket);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var LogBucket $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
{
    $formattedParent = ConfigServiceV2Client::organizationLocationName('[ORGANIZATION]', '[LOCATION]');
    $bucketId = '[BUCKET_ID]';

    create_bucket_async_sample($formattedParent, $bucketId);
}

createExclusion

Creates a new exclusion in the _Default sink in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.

Parameters
NameDescription
parent string

Required. The parent resource in which to create the exclusion:

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"

For examples:

"projects/my-logging-project" "organizations/123456789"

exclusion Google\Cloud\Logging\V2\LogExclusion

Required. The new exclusion, whose name parameter is an exclusion name that is not already used in the parent resource.

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogExclusion
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogExclusion;

/**
 * @param string $formattedParent The parent resource in which to create the exclusion:
 *
 *                                "projects/[PROJECT_ID]"
 *                                "organizations/[ORGANIZATION_ID]"
 *                                "billingAccounts/[BILLING_ACCOUNT_ID]"
 *                                "folders/[FOLDER_ID]"
 *
 *                                For examples:
 *
 *                                `"projects/my-logging-project"`
 *                                `"organizations/123456789"`
 *                                Please see {@see ConfigServiceV2Client::projectName()} for help formatting this field.
 * @param string $exclusionName   A client-assigned identifier, such as
 *                                `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and
 *                                can include only letters, digits, underscores, hyphens, and periods. First
 *                                character has to be alphanumeric.
 * @param string $exclusionFilter An [advanced logs
 *                                filter](https://cloud.google.com/logging/docs/view/advanced-queries) that
 *                                matches the log entries to be excluded. By using the [sample
 *                                function](https://cloud.google.com/logging/docs/view/advanced-queries#sample),
 *                                you can exclude less than 100% of the matching log entries.
 *
 *                                For example, the following query matches 99% of low-severity log entries
 *                                from Google Cloud Storage buckets:
 *
 *                                `resource.type=gcs_bucket severity<ERROR sample(insertId, 0.99)`
 */
function create_exclusion_sample(
    string $formattedParent,
    string $exclusionName,
    string $exclusionFilter
): void {
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $exclusion = (new LogExclusion())
        ->setName($exclusionName)
        ->setFilter($exclusionFilter);

    // Call the API and handle any network failures.
    try {
        /** @var LogExclusion $response */
        $response = $configServiceV2Client->createExclusion($formattedParent, $exclusion);
        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
{
    $formattedParent = ConfigServiceV2Client::projectName('[PROJECT]');
    $exclusionName = '[NAME]';
    $exclusionFilter = '[FILTER]';

    create_exclusion_sample($formattedParent, $exclusionName, $exclusionFilter);
}

Asynchronously creates a linked dataset in BigQuery which makes it possible to use BigQuery to read the logs stored in the log bucket. A log bucket may currently only contain one link.

Parameters
NameDescription
parent string

Required. The full resource name of the bucket to create a link for.

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"

link Google\Cloud\Logging\V2\Link

Required. The new link.

linkId string

Required. The ID to use for the link. The link_id can have up to 100 characters. A valid link_id must only have alphanumeric characters and underscores within it.

optionalArgs 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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\Link;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The full resource name of the bucket to create a link for.
 *
 *                                "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                                "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                                "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                                "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                                Please see {@see ConfigServiceV2Client::logBucketName()} for help formatting this field.
 * @param string $linkId          The ID to use for the link. The link_id can have up to 100
 *                                characters. A valid link_id must only have alphanumeric characters and
 *                                underscores within it.
 */
function create_link_sample(string $formattedParent, string $linkId): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $link = new Link();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $configServiceV2Client->createLink($formattedParent, $link, $linkId);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Link $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
{
    $formattedParent = ConfigServiceV2Client::logBucketName('[PROJECT]', '[LOCATION]', '[BUCKET]');
    $linkId = '[LINK_ID]';

    create_link_sample($formattedParent, $linkId);
}

createSink

Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.

Parameters
NameDescription
parent string

Required. The resource in which to create the sink:

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"

For examples:

"projects/my-project" "organizations/123456789"

sink Google\Cloud\Logging\V2\LogSink

Required. The new sink, whose name parameter is a sink identifier that is not already in use.

optionalArgs array

Optional.

↳ uniqueWriterIdentity bool

Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Cloud Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself. If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.

↳ 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
TypeDescription
Google\Cloud\Logging\V2\LogSink
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogSink;

/**
 * @param string $formattedParent The resource in which to create the sink:
 *
 *                                "projects/[PROJECT_ID]"
 *                                "organizations/[ORGANIZATION_ID]"
 *                                "billingAccounts/[BILLING_ACCOUNT_ID]"
 *                                "folders/[FOLDER_ID]"
 *
 *                                For examples:
 *
 *                                `"projects/my-project"`
 *                                `"organizations/123456789"`
 *                                Please see {@see ConfigServiceV2Client::projectName()} for help formatting this field.
 * @param string $sinkName        The client-assigned sink identifier, unique within the project.
 *
 *                                For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited
 *                                to 100 characters and can include only the following characters: upper and
 *                                lower-case alphanumeric characters, underscores, hyphens, and periods.
 *                                First character has to be alphanumeric.
 * @param string $sinkDestination The export destination:
 *
 *                                "storage.googleapis.com/[GCS_BUCKET]"
 *                                "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
 *                                "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
 *
 *                                The sink's `writer_identity`, set when the sink is created, must have
 *                                permission to write to the destination or else the log entries are not
 *                                exported. For more information, see
 *                                [Exporting Logs with
 *                                Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
 */
function create_sink_sample(
    string $formattedParent,
    string $sinkName,
    string $sinkDestination
): void {
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $sink = (new LogSink())
        ->setName($sinkName)
        ->setDestination($sinkDestination);

    // Call the API and handle any network failures.
    try {
        /** @var LogSink $response */
        $response = $configServiceV2Client->createSink($formattedParent, $sink);
        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
{
    $formattedParent = ConfigServiceV2Client::projectName('[PROJECT]');
    $sinkName = '[NAME]';
    $sinkDestination = '[DESTINATION]';

    create_sink_sample($formattedParent, $sinkName, $sinkDestination);
}

createView

Creates a view over log entries in a log bucket. A bucket may contain a maximum of 30 views.

Parameters
NameDescription
parent string

Required. The bucket in which to create the view

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket"

viewId string

Required. A client-assigned identifier such as "my-view". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods.

view Google\Cloud\Logging\V2\LogView

Required. The new view.

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogView
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogView;

/**
 * @param string $parent The bucket in which to create the view
 *
 *                       `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"`
 *
 *                       For example:
 *
 *                       `"projects/my-project/locations/global/buckets/my-bucket"`
 * @param string $viewId A client-assigned identifier such as `"my-view"`. Identifiers are
 *                       limited to 100 characters and can include only letters, digits,
 *                       underscores, hyphens, and periods.
 */
function create_view_sample(string $parent, string $viewId): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $view = new LogView();

    // Call the API and handle any network failures.
    try {
        /** @var LogView $response */
        $response = $configServiceV2Client->createView($parent, $viewId, $view);
        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
{
    $parent = '[PARENT]';
    $viewId = '[VIEW_ID]';

    create_view_sample($parent, $viewId);
}

deleteBucket

Deletes a log bucket.

Changes the bucket's lifecycle_state to the DELETE_REQUESTED state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.

Parameters
NameDescription
name string

Required. The full resource name of the bucket to delete.

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket"

optionalArgs 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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;

/**
 * @param string $formattedName The full resource name of the bucket to delete.
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/locations/global/buckets/my-bucket"`
 *                              Please see {@see ConfigServiceV2Client::logBucketName()} for help formatting this field.
 */
function delete_bucket_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        $configServiceV2Client->deleteBucket($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } 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 = ConfigServiceV2Client::logBucketName('[PROJECT]', '[LOCATION]', '[BUCKET]');

    delete_bucket_sample($formattedName);
}

deleteExclusion

Deletes an exclusion in the _Default sink.

Parameters
NameDescription
name string

Required. The resource name of an existing exclusion to delete:

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"

For example:

"projects/my-project/exclusions/my-exclusion"

optionalArgs 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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;

/**
 * @param string $formattedName The resource name of an existing exclusion to delete:
 *
 *                              "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
 *                              "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
 *                              "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/exclusions/my-exclusion"`
 *                              Please see {@see ConfigServiceV2Client::logExclusionName()} for help formatting this field.
 */
function delete_exclusion_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        $configServiceV2Client->deleteExclusion($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } 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 = ConfigServiceV2Client::logExclusionName('[PROJECT]', '[EXCLUSION]');

    delete_exclusion_sample($formattedName);
}

Deletes a link. This will also delete the corresponding BigQuery linked dataset.

Parameters
NameDescription
name string

Required. The full resource name of the link to delete.

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"

optionalArgs 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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Rpc\Status;

/**
 * @param string $formattedName The full resource name of the link to delete.
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
 *                              "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
 *                              "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
 *                              Please see {@see ConfigServiceV2Client::linkName()} for help formatting this field.
 */
function delete_link_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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
{
    $formattedName = ConfigServiceV2Client::linkName('[PROJECT]', '[LOCATION]', '[BUCKET]', '[LINK]');

    delete_link_sample($formattedName);
}

deleteSink

Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.

Parameters
NameDescription
sinkName string

Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:

"projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]"

For example:

"projects/my-project/sinks/my-sink"

optionalArgs 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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;

/**
 * @param string $formattedSinkName The full resource name of the sink to delete, including the
 *                                  parent resource and the sink identifier:
 *
 *                                  "projects/[PROJECT_ID]/sinks/[SINK_ID]"
 *                                  "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
 *                                  "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
 *                                  "folders/[FOLDER_ID]/sinks/[SINK_ID]"
 *
 *                                  For example:
 *
 *                                  `"projects/my-project/sinks/my-sink"`
 *                                  Please see {@see ConfigServiceV2Client::logSinkName()} for help formatting this field.
 */
function delete_sink_sample(string $formattedSinkName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        $configServiceV2Client->deleteSink($formattedSinkName);
        printf('Call completed successfully.' . PHP_EOL);
    } 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
{
    $formattedSinkName = ConfigServiceV2Client::logSinkName('[PROJECT]', '[SINK]');

    delete_sink_sample($formattedSinkName);
}

deleteView

Deletes a view on a log bucket.

If an UNAVAILABLE error is returned, this indicates that system is not in a state where it can delete the view. If this occurs, please try again in a few minutes.

Parameters
NameDescription
name string

Required. The full resource name of the view to delete:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket/views/my-view"

optionalArgs 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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;

/**
 * @param string $formattedName The full resource name of the view to delete:
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
 *                              Please see {@see ConfigServiceV2Client::logViewName()} for help formatting this field.
 */
function delete_view_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        $configServiceV2Client->deleteView($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } 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 = ConfigServiceV2Client::logViewName(
        '[PROJECT]',
        '[LOCATION]',
        '[BUCKET]',
        '[VIEW]'
    );

    delete_view_sample($formattedName);
}

getBucket

Gets a log bucket.

Parameters
NameDescription
name string

Required. The resource name of the bucket:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket"

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogBucket
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogBucket;

/**
 * @param string $formattedName The resource name of the bucket:
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/locations/global/buckets/my-bucket"`
 *                              Please see {@see ConfigServiceV2Client::logBucketName()} for help formatting this field.
 */
function get_bucket_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        /** @var LogBucket $response */
        $response = $configServiceV2Client->getBucket($formattedName);
        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 = ConfigServiceV2Client::logBucketName('[PROJECT]', '[LOCATION]', '[BUCKET]');

    get_bucket_sample($formattedName);
}

getCmekSettings

Gets the Logging CMEK settings for the given resource.

Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization.

See Enabling CMEK for Log Router for more information.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Required. The resource for which to retrieve CMEK settings. "projects/[PROJECT_ID]/cmekSettings" "organizations/[ORGANIZATION_ID]/cmekSettings" "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" "folders/[FOLDER_ID]/cmekSettings" For example: "organizations/12345/cmekSettings" Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization.

↳ 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
TypeDescription
Google\Cloud\Logging\V2\CmekSettings
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\CmekSettings;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;

/**
 * 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_cmek_settings_sample(): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

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

getExclusion

Gets the description of an exclusion in the _Default sink.

Parameters
NameDescription
name string

Required. The resource name of an existing exclusion:

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"

For example:

"projects/my-project/exclusions/my-exclusion"

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogExclusion
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogExclusion;

/**
 * @param string $formattedName The resource name of an existing exclusion:
 *
 *                              "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
 *                              "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
 *                              "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/exclusions/my-exclusion"`
 *                              Please see {@see ConfigServiceV2Client::logExclusionName()} for help formatting this field.
 */
function get_exclusion_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        /** @var LogExclusion $response */
        $response = $configServiceV2Client->getExclusion($formattedName);
        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 = ConfigServiceV2Client::logExclusionName('[PROJECT]', '[EXCLUSION]');

    get_exclusion_sample($formattedName);
}

Gets a link.

Parameters
NameDescription
name string

Required. The resource name of the link:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\Link
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\Link;

/**
 * @param string $formattedName The resource name of the link:
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
 *                              "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
 *                              "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]
 *                              Please see {@see ConfigServiceV2Client::linkName()} for help formatting this field.
 */
function get_link_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        /** @var Link $response */
        $response = $configServiceV2Client->getLink($formattedName);
        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 = ConfigServiceV2Client::linkName('[PROJECT]', '[LOCATION]', '[BUCKET]', '[LINK]');

    get_link_sample($formattedName);
}

getSettings

Gets the Log Router settings for the given resource.

Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization.

See Enabling CMEK for Log Router for more information.

Parameters
NameDescription
name string

Required. The resource for which to retrieve settings.

"projects/[PROJECT_ID]/settings" "organizations/[ORGANIZATION_ID]/settings" "billingAccounts/[BILLING_ACCOUNT_ID]/settings" "folders/[FOLDER_ID]/settings"

For example:

"organizations/12345/settings"

Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization.

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\Settings
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\Settings;

/**
 * @param string $formattedName The resource for which to retrieve settings.
 *
 *                              "projects/[PROJECT_ID]/settings"
 *                              "organizations/[ORGANIZATION_ID]/settings"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/settings"
 *                              "folders/[FOLDER_ID]/settings"
 *
 *                              For example:
 *
 *                              `"organizations/12345/settings"`
 *
 *                              Note: Settings for the Log Router can be get for Google Cloud projects,
 *                              folders, organizations and billing accounts. Currently it can only be
 *                              configured for organizations. Once configured for an organization, it
 *                              applies to all projects and folders in the Google Cloud organization. Please see
 *                              {@see ConfigServiceV2Client::settingsName()} for help formatting this field.
 */
function get_settings_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        /** @var Settings $response */
        $response = $configServiceV2Client->getSettings($formattedName);
        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 = ConfigServiceV2Client::settingsName('[PROJECT]');

    get_settings_sample($formattedName);
}

getSink

Gets a sink.

Parameters
NameDescription
sinkName string

Required. The resource name of the sink:

"projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]"

For example:

"projects/my-project/sinks/my-sink"

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogSink
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogSink;

/**
 * @param string $formattedSinkName The resource name of the sink:
 *
 *                                  "projects/[PROJECT_ID]/sinks/[SINK_ID]"
 *                                  "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
 *                                  "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
 *                                  "folders/[FOLDER_ID]/sinks/[SINK_ID]"
 *
 *                                  For example:
 *
 *                                  `"projects/my-project/sinks/my-sink"`
 *                                  Please see {@see ConfigServiceV2Client::logSinkName()} for help formatting this field.
 */
function get_sink_sample(string $formattedSinkName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        /** @var LogSink $response */
        $response = $configServiceV2Client->getSink($formattedSinkName);
        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
{
    $formattedSinkName = ConfigServiceV2Client::logSinkName('[PROJECT]', '[SINK]');

    get_sink_sample($formattedSinkName);
}

getView

Gets a view on a log bucket..

Parameters
NameDescription
name string

Required. The resource name of the policy:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket/views/my-view"

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogView
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogView;

/**
 * @param string $formattedName The resource name of the policy:
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
 *                              Please see {@see ConfigServiceV2Client::logViewName()} for help formatting this field.
 */
function get_view_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        /** @var LogView $response */
        $response = $configServiceV2Client->getView($formattedName);
        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 = ConfigServiceV2Client::logViewName(
        '[PROJECT]',
        '[LOCATION]',
        '[BUCKET]',
        '[VIEW]'
    );

    get_view_sample($formattedName);
}

listBuckets

Lists log buckets.

Parameters
NameDescription
parent string

Required. The parent resource whose buckets are to be listed:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]"

Note: The locations portion of the resource must be specified, but supplying the character - in place of [LOCATION_ID] will return all buckets.

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogBucket;

/**
 * @param string $formattedParent The parent resource whose buckets are to be listed:
 *
 *                                "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
 *                                "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
 *                                "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
 *                                "folders/[FOLDER_ID]/locations/[LOCATION_ID]"
 *
 *                                Note: The locations portion of the resource must be specified, but
 *                                supplying the character `-` in place of [LOCATION_ID] will return all
 *                                buckets. Please see
 *                                {@see ConfigServiceV2Client::organizationLocationName()} for help formatting this field.
 */
function list_buckets_sample(string $formattedParent): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

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

        /** @var LogBucket $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 = ConfigServiceV2Client::organizationLocationName('[ORGANIZATION]', '[LOCATION]');

    list_buckets_sample($formattedParent);
}

listExclusions

Lists all the exclusions on the _Default sink in a parent resource.

Parameters
NameDescription
parent string

Required. The parent resource whose exclusions are to be listed.

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogExclusion;

/**
 * @param string $formattedParent The parent resource whose exclusions are to be listed.
 *
 *                                "projects/[PROJECT_ID]"
 *                                "organizations/[ORGANIZATION_ID]"
 *                                "billingAccounts/[BILLING_ACCOUNT_ID]"
 *                                "folders/[FOLDER_ID]"
 *                                Please see {@see ConfigServiceV2Client::projectName()} for help formatting this field.
 */
function list_exclusions_sample(string $formattedParent): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

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

        /** @var LogExclusion $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 = ConfigServiceV2Client::projectName('[PROJECT]');

    list_exclusions_sample($formattedParent);
}

Lists links.

Parameters
NameDescription
parent string

Required. The parent resource whose links are to be listed:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\Link;

/**
 * @param string $formattedParent The parent resource whose links are to be listed:
 *
 *                                "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/"
 *                                "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/"
 *                                "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/"
 *                                "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/
 *                                Please see {@see ConfigServiceV2Client::logBucketName()} for help formatting this field.
 */
function list_links_sample(string $formattedParent): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

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

        /** @var Link $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 = ConfigServiceV2Client::logBucketName('[PROJECT]', '[LOCATION]', '[BUCKET]');

    list_links_sample($formattedParent);
}

listSinks

Lists sinks.

Parameters
NameDescription
parent string

Required. The parent resource whose sinks are to be listed:

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogSink;

/**
 * @param string $formattedParent The parent resource whose sinks are to be listed:
 *
 *                                "projects/[PROJECT_ID]"
 *                                "organizations/[ORGANIZATION_ID]"
 *                                "billingAccounts/[BILLING_ACCOUNT_ID]"
 *                                "folders/[FOLDER_ID]"
 *                                Please see {@see ConfigServiceV2Client::projectName()} for help formatting this field.
 */
function list_sinks_sample(string $formattedParent): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

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

        /** @var LogSink $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 = ConfigServiceV2Client::projectName('[PROJECT]');

    list_sinks_sample($formattedParent);
}

listViews

Lists views on a log bucket.

Parameters
NameDescription
parent string

Required. The bucket whose views are to be listed:

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogView;

/**
 * @param string $parent The bucket whose views are to be listed:
 *
 *                       "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 */
function list_views_sample(string $parent): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

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

        /** @var LogView $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
{
    $parent = '[PARENT]';

    list_views_sample($parent);
}

undeleteBucket

Undeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.

Parameters
NameDescription
name string

Required. The full resource name of the bucket to undelete.

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket"

optionalArgs 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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;

/**
 * @param string $formattedName The full resource name of the bucket to undelete.
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/locations/global/buckets/my-bucket"`
 *                              Please see {@see ConfigServiceV2Client::logBucketName()} for help formatting this field.
 */
function undelete_bucket_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Call the API and handle any network failures.
    try {
        $configServiceV2Client->undeleteBucket($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } 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 = ConfigServiceV2Client::logBucketName('[PROJECT]', '[LOCATION]', '[BUCKET]');

    undelete_bucket_sample($formattedName);
}

updateBucket

Updates a log bucket.

If the bucket has a lifecycle_state of DELETE_REQUESTED, then FAILED_PRECONDITION will be returned.

After a bucket has been created, the bucket's location cannot be changed.

Parameters
NameDescription
name string

Required. The full resource name of the bucket to update.

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket"

bucket Google\Cloud\Logging\V2\LogBucket

Required. The updated bucket.

updateMask Google\Protobuf\FieldMask

Required. Field mask that specifies the fields in bucket that need an update. A bucket field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.

For a detailed FieldMask definition, see: https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask

For example: updateMask=retention_days

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogBucket
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogBucket;
use Google\Protobuf\FieldMask;

/**
 * @param string $formattedName The full resource name of the bucket to update.
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/locations/global/buckets/my-bucket"`
 *                              Please see {@see ConfigServiceV2Client::logBucketName()} for help formatting this field.
 */
function update_bucket_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $bucket = new LogBucket();
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var LogBucket $response */
        $response = $configServiceV2Client->updateBucket($formattedName, $bucket, $updateMask);
        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 = ConfigServiceV2Client::logBucketName('[PROJECT]', '[LOCATION]', '[BUCKET]');

    update_bucket_sample($formattedName);
}

updateBucketAsync

Updates a log bucket asynchronously.

If the bucket has a lifecycle_state of DELETE_REQUESTED, then FAILED_PRECONDITION will be returned.

After a bucket has been created, the bucket's location cannot be changed.

Parameters
NameDescription
name string

Required. The full resource name of the bucket to update.

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket"

bucket Google\Cloud\Logging\V2\LogBucket

Required. The updated bucket.

updateMask Google\Protobuf\FieldMask

Required. Field mask that specifies the fields in bucket that need an update. A bucket field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.

For a detailed FieldMask definition, see: https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask

For example: updateMask=retention_days

optionalArgs 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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogBucket;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $formattedName The full resource name of the bucket to update.
 *
 *                              "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *                              "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
 *
 *                              For example:
 *
 *                              `"projects/my-project/locations/global/buckets/my-bucket"`
 *                              Please see {@see ConfigServiceV2Client::logBucketName()} for help formatting this field.
 */
function update_bucket_async_sample(string $formattedName): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $bucket = new LogBucket();
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $configServiceV2Client->updateBucketAsync($formattedName, $bucket, $updateMask);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var LogBucket $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
{
    $formattedName = ConfigServiceV2Client::logBucketName('[PROJECT]', '[LOCATION]', '[BUCKET]');

    update_bucket_async_sample($formattedName);
}

updateCmekSettings

Updates the Log Router CMEK settings for the given resource.

Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization.

UpdateCmekSettings will fail if 1) kms_key_name is invalid, or 2) the associated service account does not have the required roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) access to the key is disabled.

See Enabling CMEK for Log Router for more information.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Required. The resource name for the CMEK settings to update. "projects/[PROJECT_ID]/cmekSettings" "organizations/[ORGANIZATION_ID]/cmekSettings" "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" "folders/[FOLDER_ID]/cmekSettings" For example: "organizations/12345/cmekSettings" Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization.

↳ cmekSettings CmekSettings

Required. The CMEK settings to update. See Enabling CMEK for Log Router for more information.

↳ updateMask FieldMask

Optional. Field mask identifying which fields from cmek_settings should be updated. A field will be overwritten if and only if it is in the update mask. Output only fields cannot be updated. See FieldMask for more information. For example: "updateMask=kmsKeyName"

↳ 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
TypeDescription
Google\Cloud\Logging\V2\CmekSettings
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\CmekSettings;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;

/**
 * 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 update_cmek_settings_sample(): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

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

updateExclusion

Changes one or more properties of an existing exclusion in the _Default sink.

Parameters
NameDescription
name string

Required. The resource name of the exclusion to update:

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"

For example:

"projects/my-project/exclusions/my-exclusion"

exclusion Google\Cloud\Logging\V2\LogExclusion

Required. New values for the existing exclusion. Only the fields specified in update_mask are relevant.

updateMask Google\Protobuf\FieldMask

Required. A non-empty list of fields to change in the existing exclusion. New values for the fields are taken from the corresponding fields in the LogExclusion included in this request. Fields not mentioned in update_mask are not changed and are ignored in the request.

For example, to change the filter and description of an exclusion, specify an update_mask of "filter,description".

optionalArgs 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
TypeDescription
Google\Cloud\Logging\V2\LogExclusion
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogExclusion;
use Google\Protobuf\FieldMask;

/**
 * @param string $formattedName   The resource name of the exclusion to update:
 *
 *                                "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
 *                                "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
 *                                "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
 *                                "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
 *
 *                                For example:
 *
 *                                `"projects/my-project/exclusions/my-exclusion"`
 *                                Please see {@see ConfigServiceV2Client::logExclusionName()} for help formatting this field.
 * @param string $exclusionName   A client-assigned identifier, such as
 *                                `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and
 *                                can include only letters, digits, underscores, hyphens, and periods. First
 *                                character has to be alphanumeric.
 * @param string $exclusionFilter An [advanced logs
 *                                filter](https://cloud.google.com/logging/docs/view/advanced-queries) that
 *                                matches the log entries to be excluded. By using the [sample
 *                                function](https://cloud.google.com/logging/docs/view/advanced-queries#sample),
 *                                you can exclude less than 100% of the matching log entries.
 *
 *                                For example, the following query matches 99% of low-severity log entries
 *                                from Google Cloud Storage buckets:
 *
 *                                `resource.type=gcs_bucket severity<ERROR sample(insertId, 0.99)`
 */
function update_exclusion_sample(
    string $formattedName,
    string $exclusionName,
    string $exclusionFilter
): void {
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $exclusion = (new LogExclusion())
        ->setName($exclusionName)
        ->setFilter($exclusionFilter);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var LogExclusion $response */
        $response = $configServiceV2Client->updateExclusion($formattedName, $exclusion, $updateMask);
        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 = ConfigServiceV2Client::logExclusionName('[PROJECT]', '[EXCLUSION]');
    $exclusionName = '[NAME]';
    $exclusionFilter = '[FILTER]';

    update_exclusion_sample($formattedName, $exclusionName, $exclusionFilter);
}

updateSettings

Updates the Log Router settings for the given resource.

Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization.

UpdateSettings will fail if 1) kms_key_name is invalid, or 2) the associated service account does not have the required roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) access to the key is disabled. 4) location_id is not supported by Logging. 5) location_id violate OrgPolicy.

See Enabling CMEK for Log Router for more information.

Parameters
NameDescription
name string

Required. The resource name for the settings to update.

"organizations/[ORGANIZATION_ID]/settings"

For example:

"organizations/12345/settings"

Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization.

settings Google\Cloud\Logging\V2\Settings

Required. The settings to update.

See Enabling CMEK for Log Router for more information.

optionalArgs array

Optional.

↳ updateMask FieldMask

Optional. Field mask identifying which fields from settings should be updated. A field will be overwritten if and only if it is in the update mask. Output only fields cannot be updated. See FieldMask for more information. For example: "updateMask=kmsKeyName"

↳ 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
TypeDescription
Google\Cloud\Logging\V2\Settings
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\Settings;

/**
 * @param string $name The resource name for the settings to update.
 *
 *                     "organizations/[ORGANIZATION_ID]/settings"
 *
 *                     For example:
 *
 *                     `"organizations/12345/settings"`
 *
 *                     Note: Settings for the Log Router can currently only be configured for
 *                     Google Cloud organizations. Once configured, it applies to all projects and
 *                     folders in the Google Cloud organization.
 */
function update_settings_sample(string $name): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $settings = new Settings();

    // Call the API and handle any network failures.
    try {
        /** @var Settings $response */
        $response = $configServiceV2Client->updateSettings($name, $settings);
        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
{
    $name = '[NAME]';

    update_settings_sample($name);
}

updateSink

Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.

The updated sink might also have a new writer_identity; see the unique_writer_identity field.

Parameters
NameDescription
sinkName string

Required. The full resource name of the sink to update, including the parent resource and the sink identifier:

"projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]"

For example:

"projects/my-project/sinks/my-sink"

sink Google\Cloud\Logging\V2\LogSink

Required. The updated sink, whose name is the same identifier that appears as part of sink_name.

optionalArgs array

Optional.

↳ uniqueWriterIdentity bool

Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field: + If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity. + If the old value is false and the new value is true, then writer_identity is changed to a unique service account. + It is an error if the old value is true and the new value is set to false or defaulted to false.

↳ updateMask FieldMask

Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated. An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error. For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask For example: updateMask=filter

↳ 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
TypeDescription
Google\Cloud\Logging\V2\LogSink
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogSink;

/**
 * @param string $formattedSinkName The full resource name of the sink to update, including the
 *                                  parent resource and the sink identifier:
 *
 *                                  "projects/[PROJECT_ID]/sinks/[SINK_ID]"
 *                                  "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
 *                                  "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
 *                                  "folders/[FOLDER_ID]/sinks/[SINK_ID]"
 *
 *                                  For example:
 *
 *                                  `"projects/my-project/sinks/my-sink"`
 *                                  Please see {@see ConfigServiceV2Client::logSinkName()} for help formatting this field.
 * @param string $sinkName          The client-assigned sink identifier, unique within the project.
 *
 *                                  For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited
 *                                  to 100 characters and can include only the following characters: upper and
 *                                  lower-case alphanumeric characters, underscores, hyphens, and periods.
 *                                  First character has to be alphanumeric.
 * @param string $sinkDestination   The export destination:
 *
 *                                  "storage.googleapis.com/[GCS_BUCKET]"
 *                                  "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
 *                                  "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
 *
 *                                  The sink's `writer_identity`, set when the sink is created, must have
 *                                  permission to write to the destination or else the log entries are not
 *                                  exported. For more information, see
 *                                  [Exporting Logs with
 *                                  Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
 */
function update_sink_sample(
    string $formattedSinkName,
    string $sinkName,
    string $sinkDestination
): void {
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $sink = (new LogSink())
        ->setName($sinkName)
        ->setDestination($sinkDestination);

    // Call the API and handle any network failures.
    try {
        /** @var LogSink $response */
        $response = $configServiceV2Client->updateSink($formattedSinkName, $sink);
        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
{
    $formattedSinkName = ConfigServiceV2Client::logSinkName('[PROJECT]', '[SINK]');
    $sinkName = '[NAME]';
    $sinkDestination = '[DESTINATION]';

    update_sink_sample($formattedSinkName, $sinkName, $sinkDestination);
}

updateView

Updates a view on a log bucket. This method replaces the following fields in the existing view with values from the new view: filter.

If an UNAVAILABLE error is returned, this indicates that system is not in a state where it can update the view. If this occurs, please try again in a few minutes.

Parameters
NameDescription
name string

Required. The full resource name of the view to update

"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"

For example:

"projects/my-project/locations/global/buckets/my-bucket/views/my-view"

view Google\Cloud\Logging\V2\LogView

Required. The updated view.

optionalArgs array

Optional.

↳ updateMask FieldMask

Optional. Field mask that specifies the fields in view that need an update. A field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated. For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask For example: updateMask=filter

↳ 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
TypeDescription
Google\Cloud\Logging\V2\LogView
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Logging\V2\ConfigServiceV2Client;
use Google\Cloud\Logging\V2\LogView;

/**
 * @param string $name The full resource name of the view to update
 *
 *                     "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
 *
 *                     For example:
 *
 *                     `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
 */
function update_view_sample(string $name): void
{
    // Create a client.
    $configServiceV2Client = new ConfigServiceV2Client();

    // Prepare any non-scalar elements to be passed along with the request.
    $view = new LogView();

    // Call the API and handle any network failures.
    try {
        /** @var LogView $response */
        $response = $configServiceV2Client->updateView($name, $view);
        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
{
    $name = '[NAME]';

    update_view_sample($name);
}

getOperationsClient

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

Returns
TypeDescription
Google\ApiCore\LongRunning\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
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::billingAccountName

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

Parameter
NameDescription
billingAccount string
Returns
TypeDescription
stringThe formatted billing_account resource.

static::billingAccountCmekSettingsName

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

Parameter
NameDescription
billingAccount string
Returns
TypeDescription
stringThe formatted billing_account_cmekSettings resource.

static::billingAccountExclusionName

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

Parameters
NameDescription
billingAccount string
exclusion string
Returns
TypeDescription
stringThe formatted billing_account_exclusion resource.

static::billingAccountLocationName

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

Parameters
NameDescription
billingAccount string
location string
Returns
TypeDescription
stringThe formatted billing_account_location resource.

static::billingAccountLocationBucketName

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

Parameters
NameDescription
billingAccount string
location string
bucket string
Returns
TypeDescription
stringThe formatted billing_account_location_bucket resource.

static::billingAccountLocationBucketLinkName

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

Parameters
NameDescription
billingAccount string
location string
bucket string
link string
Returns
TypeDescription
stringThe formatted billing_account_location_bucket_link resource.

static::billingAccountLocationBucketViewName

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

Parameters
NameDescription
billingAccount string
location string
bucket string
view string
Returns
TypeDescription
stringThe formatted billing_account_location_bucket_view resource.

static::billingAccountSettingsName

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

Parameter
NameDescription
billingAccount string
Returns
TypeDescription
stringThe formatted billing_account_settings resource.

static::billingAccountSinkName

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

Parameters
NameDescription
billingAccount string
sink string
Returns
TypeDescription
stringThe formatted billing_account_sink resource.

static::cmekSettingsName

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

Parameter
NameDescription
project string
Returns
TypeDescription
stringThe formatted cmek_settings resource.

static::folderName

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

Parameter
NameDescription
folder string
Returns
TypeDescription
stringThe formatted folder resource.

static::folderCmekSettingsName

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

Parameter
NameDescription
folder string
Returns
TypeDescription
stringThe formatted folder_cmekSettings resource.

static::folderExclusionName

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

Parameters
NameDescription
folder string
exclusion string
Returns
TypeDescription
stringThe formatted folder_exclusion resource.

static::folderLocationName

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

Parameters
NameDescription
folder string
location string
Returns
TypeDescription
stringThe formatted folder_location resource.

static::folderLocationBucketName

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

Parameters
NameDescription
folder string
location string
bucket string
Returns
TypeDescription
stringThe formatted folder_location_bucket resource.

static::folderLocationBucketLinkName

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

Parameters
NameDescription
folder string
location string
bucket string
link string
Returns
TypeDescription
stringThe formatted folder_location_bucket_link resource.

static::folderLocationBucketViewName

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

Parameters
NameDescription
folder string
location string
bucket string
view string
Returns
TypeDescription
stringThe formatted folder_location_bucket_view resource.

static::folderSettingsName

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

Parameter
NameDescription
folder string
Returns
TypeDescription
stringThe formatted folder_settings resource.

static::folderSinkName

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

Parameters
NameDescription
folder string
sink string
Returns
TypeDescription
stringThe formatted folder_sink resource.

static::linkName

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

Parameters
NameDescription
project string
location string
bucket string
link string
Returns
TypeDescription
stringThe formatted link resource.

static::locationName

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

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

static::logBucketName

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

Parameters
NameDescription
project string
location string
bucket string
Returns
TypeDescription
stringThe formatted log_bucket resource.

static::logExclusionName

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

Parameters
NameDescription
project string
exclusion string
Returns
TypeDescription
stringThe formatted log_exclusion resource.

static::logSinkName

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

Parameters
NameDescription
project string
sink string
Returns
TypeDescription
stringThe formatted log_sink resource.

static::logViewName

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

Parameters
NameDescription
project string
location string
bucket string
view string
Returns
TypeDescription
stringThe formatted log_view resource.

static::organizationName

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

Parameter
NameDescription
organization string
Returns
TypeDescription
stringThe formatted organization resource.

static::organizationCmekSettingsName

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

Parameter
NameDescription
organization string
Returns
TypeDescription
stringThe formatted organization_cmekSettings resource.

static::organizationExclusionName

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

Parameters
NameDescription
organization string
exclusion string
Returns
TypeDescription
stringThe formatted organization_exclusion resource.

static::organizationLocationName

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

Parameters
NameDescription
organization string
location string
Returns
TypeDescription
stringThe formatted organization_location resource.

static::organizationLocationBucketName

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

Parameters
NameDescription
organization string
location string
bucket string
Returns
TypeDescription
stringThe formatted organization_location_bucket resource.

static::organizationLocationBucketLinkName

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

Parameters
NameDescription
organization string
location string
bucket string
link string
Returns
TypeDescription
stringThe formatted organization_location_bucket_link resource.

static::organizationLocationBucketViewName

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

Parameters
NameDescription
organization string
location string
bucket string
view string
Returns
TypeDescription
stringThe formatted organization_location_bucket_view resource.

static::organizationSettingsName

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

Parameter
NameDescription
organization string
Returns
TypeDescription
stringThe formatted organization_settings resource.

static::organizationSinkName

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

Parameters
NameDescription
organization string
sink string
Returns
TypeDescription
stringThe formatted organization_sink resource.

static::projectName

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

Parameter
NameDescription
project string
Returns
TypeDescription
stringThe formatted project resource.

static::projectCmekSettingsName

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

Parameter
NameDescription
project string
Returns
TypeDescription
stringThe formatted project_cmekSettings resource.

static::projectExclusionName

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

Parameters
NameDescription
project string
exclusion string
Returns
TypeDescription
stringThe formatted project_exclusion resource.

static::projectLocationBucketName

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

Parameters
NameDescription
project string
location string
bucket string
Returns
TypeDescription
stringThe formatted project_location_bucket resource.

static::projectLocationBucketLinkName

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

Parameters
NameDescription
project string
location string
bucket string
link string
Returns
TypeDescription
stringThe formatted project_location_bucket_link resource.

static::projectLocationBucketViewName

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

Parameters
NameDescription
project string
location string
bucket string
view string
Returns
TypeDescription
stringThe formatted project_location_bucket_view resource.

static::projectSettingsName

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

Parameter
NameDescription
project string
Returns
TypeDescription
stringThe formatted project_settings resource.

static::projectSinkName

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

Parameters
NameDescription
project string
sink string
Returns
TypeDescription
stringThe formatted project_sink resource.

static::settingsName

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

Parameter
NameDescription
project string
Returns
TypeDescription
stringThe formatted settings 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

  • billingAccount: billingAccounts/{billing_account}
  • billingAccountCmekSettings: billingAccounts/{billing_account}/cmekSettings
  • billingAccountExclusion: billingAccounts/{billing_account}/exclusions/{exclusion}
  • billingAccountLocation: billingAccounts/{billing_account}/locations/{location}
  • billingAccountLocationBucket: billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}
  • billingAccountLocationBucketLink: billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}
  • billingAccountLocationBucketView: billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}
  • billingAccountSettings: billingAccounts/{billing_account}/settings
  • billingAccountSink: billingAccounts/{billing_account}/sinks/{sink}
  • cmekSettings: projects/{project}/cmekSettings
  • folder: folders/{folder}
  • folderCmekSettings: folders/{folder}/cmekSettings
  • folderExclusion: folders/{folder}/exclusions/{exclusion}
  • folderLocation: folders/{folder}/locations/{location}
  • folderLocationBucket: folders/{folder}/locations/{location}/buckets/{bucket}
  • folderLocationBucketLink: folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}
  • folderLocationBucketView: folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}
  • folderSettings: folders/{folder}/settings
  • folderSink: folders/{folder}/sinks/{sink}
  • link: projects/{project}/locations/{location}/buckets/{bucket}/links/{link}
  • location: projects/{project}/locations/{location}
  • logBucket: projects/{project}/locations/{location}/buckets/{bucket}
  • logExclusion: projects/{project}/exclusions/{exclusion}
  • logSink: projects/{project}/sinks/{sink}
  • logView: projects/{project}/locations/{location}/buckets/{bucket}/views/{view}
  • organization: organizations/{organization}
  • organizationCmekSettings: organizations/{organization}/cmekSettings
  • organizationExclusion: organizations/{organization}/exclusions/{exclusion}
  • organizationLocation: organizations/{organization}/locations/{location}
  • organizationLocationBucket: organizations/{organization}/locations/{location}/buckets/{bucket}
  • organizationLocationBucketLink: organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}
  • organizationLocationBucketView: organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}
  • organizationSettings: organizations/{organization}/settings
  • organizationSink: organizations/{organization}/sinks/{sink}
  • project: projects/{project}
  • projectCmekSettings: projects/{project}/cmekSettings
  • projectExclusion: projects/{project}/exclusions/{exclusion}
  • projectLocationBucket: projects/{project}/locations/{location}/buckets/{bucket}
  • projectLocationBucketLink: projects/{project}/locations/{location}/buckets/{bucket}/links/{link}
  • projectLocationBucketView: projects/{project}/locations/{location}/buckets/{bucket}/views/{view}
  • projectSettings: projects/{project}/settings
  • projectSink: projects/{project}/sinks/{sink}
  • settings: projects/{project}/settings

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
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

Constants

SERVICE_NAME

Value: 'google.logging.v2.ConfigServiceV2'

The name of the service.

SERVICE_ADDRESS

Value: 'logging.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.