Cloud Scheduler V1 Client - Class CloudSchedulerClient (1.10.5)

Reference documentation and code samples for the Cloud Scheduler V1 Client class CloudSchedulerClient.

Service Description: The Cloud Scheduler API allows external entities to reliably schedule asynchronous jobs.

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

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

Namespace

Google \ Cloud \ Scheduler \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
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.

createJob

Parameters
Name Description
request Google\Cloud\Scheduler\V1\CreateJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\Scheduler\V1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;
use Google\Cloud\Scheduler\V1\CreateJobRequest;
use Google\Cloud\Scheduler\V1\Job;

/**
 * @param string $formattedParent The location name. For example:
 *                                `projects/PROJECT_ID/locations/LOCATION_ID`. Please see
 *                                {@see CloudSchedulerClient::locationName()} for help formatting this field.
 */
function create_job_sample(string $formattedParent): void
{
    // Create a client.
    $cloudSchedulerClient = new CloudSchedulerClient();

    // Prepare the request message.
    $job = new Job();
    $request = (new CreateJobRequest())
        ->setParent($formattedParent)
        ->setJob($job);

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

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

    create_job_sample($formattedParent);
}

deleteJob

Parameters
Name Description
request Google\Cloud\Scheduler\V1\DeleteJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;
use Google\Cloud\Scheduler\V1\DeleteJobRequest;

/**
 * @param string $formattedName The job name. For example:
 *                              `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. Please see
 *                              {@see CloudSchedulerClient::jobName()} for help formatting this field.
 */
function delete_job_sample(string $formattedName): void
{
    // Create a client.
    $cloudSchedulerClient = new CloudSchedulerClient();

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

    // Call the API and handle any network failures.
    try {
        $cloudSchedulerClient->deleteJob($request);
        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 = CloudSchedulerClient::jobName('[PROJECT]', '[LOCATION]', '[JOB]');

    delete_job_sample($formattedName);
}

getJob

Parameters
Name Description
request Google\Cloud\Scheduler\V1\GetJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\Scheduler\V1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;
use Google\Cloud\Scheduler\V1\GetJobRequest;
use Google\Cloud\Scheduler\V1\Job;

/**
 * @param string $formattedName The job name. For example:
 *                              `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. Please see
 *                              {@see CloudSchedulerClient::jobName()} for help formatting this field.
 */
function get_job_sample(string $formattedName): void
{
    // Create a client.
    $cloudSchedulerClient = new CloudSchedulerClient();

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

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

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

    get_job_sample($formattedName);
}

listJobs

Parameters
Name Description
request Google\Cloud\Scheduler\V1\ListJobsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;
use Google\Cloud\Scheduler\V1\Job;
use Google\Cloud\Scheduler\V1\ListJobsRequest;

/**
 * @param string $formattedParent The location name. For example:
 *                                `projects/PROJECT_ID/locations/LOCATION_ID`. Please see
 *                                {@see CloudSchedulerClient::locationName()} for help formatting this field.
 */
function list_jobs_sample(string $formattedParent): void
{
    // Create a client.
    $cloudSchedulerClient = new CloudSchedulerClient();

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

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

        /** @var Job $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 = CloudSchedulerClient::locationName('[PROJECT]', '[LOCATION]');

    list_jobs_sample($formattedParent);
}

pauseJob

Pauses a job.

If a job is paused then the system will stop executing the job until it is re-enabled via ResumeJob. The state of the job is stored in state; if paused it will be set to Job.State.PAUSED. A job must be in Job.State.ENABLED to be paused.

The async variant is Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient::pauseJobAsync() .

Parameters
Name Description
request Google\Cloud\Scheduler\V1\PauseJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\Scheduler\V1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;
use Google\Cloud\Scheduler\V1\Job;
use Google\Cloud\Scheduler\V1\PauseJobRequest;

/**
 * @param string $formattedName The job name. For example:
 *                              `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. Please see
 *                              {@see CloudSchedulerClient::jobName()} for help formatting this field.
 */
function pause_job_sample(string $formattedName): void
{
    // Create a client.
    $cloudSchedulerClient = new CloudSchedulerClient();

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

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

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

    pause_job_sample($formattedName);
}

resumeJob

Resume a job.

This method reenables a job after it has been Job.State.PAUSED. The state of a job is stored in Job.state; after calling this method it will be set to Job.State.ENABLED. A job must be in Job.State.PAUSED to be resumed.

The async variant is Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient::resumeJobAsync() .

Parameters
Name Description
request Google\Cloud\Scheduler\V1\ResumeJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\Scheduler\V1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;
use Google\Cloud\Scheduler\V1\Job;
use Google\Cloud\Scheduler\V1\ResumeJobRequest;

/**
 * @param string $formattedName The job name. For example:
 *                              `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. Please see
 *                              {@see CloudSchedulerClient::jobName()} for help formatting this field.
 */
function resume_job_sample(string $formattedName): void
{
    // Create a client.
    $cloudSchedulerClient = new CloudSchedulerClient();

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

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

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

    resume_job_sample($formattedName);
}

runJob

Forces a job to run now.

When this method is called, Cloud Scheduler will dispatch the job, even if the job is already running.

The async variant is Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient::runJobAsync() .

Parameters
Name Description
request Google\Cloud\Scheduler\V1\RunJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\Scheduler\V1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;
use Google\Cloud\Scheduler\V1\Job;
use Google\Cloud\Scheduler\V1\RunJobRequest;

/**
 * @param string $formattedName The job name. For example:
 *                              `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. Please see
 *                              {@see CloudSchedulerClient::jobName()} for help formatting this field.
 */
function run_job_sample(string $formattedName): void
{
    // Create a client.
    $cloudSchedulerClient = new CloudSchedulerClient();

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

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

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

    run_job_sample($formattedName);
}

updateJob

Updates a job.

If successful, the updated Job is returned. If the job does not exist, NOT_FOUND is returned.

If UpdateJob does not successfully return, it is possible for the job to be in an Job.State.UPDATE_FAILED state. A job in this state may not be executed. If this happens, retry the UpdateJob request until a successful response is received.

The async variant is Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient::updateJobAsync() .

Parameters
Name Description
request Google\Cloud\Scheduler\V1\UpdateJobRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\Scheduler\V1\Job
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;
use Google\Cloud\Scheduler\V1\Job;
use Google\Cloud\Scheduler\V1\UpdateJobRequest;
use Google\Protobuf\FieldMask;

/**
 * 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_job_sample(): void
{
    // Create a client.
    $cloudSchedulerClient = new CloudSchedulerClient();

    // Prepare the request message.
    $job = new Job();
    $updateMask = new FieldMask();
    $request = (new UpdateJobRequest())
        ->setJob($job)
        ->setUpdateMask($updateMask);

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

getLocation

Gets information about a location.

The async variant is Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient::getLocationAsync() .

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient;

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

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

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

listLocations

Lists information about the supported locations for this service.

The async variant is Google\Cloud\Scheduler\V1\Client\CloudSchedulerClient::listLocationsAsync() .

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

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

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

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

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

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

createJobAsync

Parameters
Name Description
request Google\Cloud\Scheduler\V1\CreateJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteJobAsync

Parameters
Name Description
request Google\Cloud\Scheduler\V1\DeleteJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getJobAsync

Parameters
Name Description
request Google\Cloud\Scheduler\V1\GetJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listJobsAsync

Parameters
Name Description
request Google\Cloud\Scheduler\V1\ListJobsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

pauseJobAsync

Parameters
Name Description
request Google\Cloud\Scheduler\V1\PauseJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

resumeJobAsync

Parameters
Name Description
request Google\Cloud\Scheduler\V1\ResumeJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

runJobAsync

Parameters
Name Description
request Google\Cloud\Scheduler\V1\RunJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateJobAsync

Parameters
Name Description
request Google\Cloud\Scheduler\V1\UpdateJobRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getLocationAsync

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listLocationsAsync

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

static::jobName

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

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

static::locationName

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

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

static::topicName

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

Parameters
Name Description
project string
topic string
Returns
Type Description
string The formatted topic 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

  • job: projects/{project}/locations/{location}/jobs/{job}
  • location: projects/{project}/locations/{location}
  • topic: projects/{project}/topics/{topic}

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

Parameters
Name Description
formattedName string

The formatted name string

template string

Optional name of template to match

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