Google Cloud Build V2 Client - Class RepositoryManagerClient (1.0.0-RC1)

Reference documentation and code samples for the Google Cloud Build V2 Client class RepositoryManagerClient.

Service Description: Manages connections to source code repositories.

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 \ Build \ V2 \ 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.

batchCreateRepositories

Creates multiple repositories inside a connection.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::batchCreateRepositoriesAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\BatchCreateRepositoriesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Build\V2\BatchCreateRepositoriesRequest;
use Google\Cloud\Build\V2\BatchCreateRepositoriesResponse;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\CreateRepositoryRequest;
use Google\Cloud\Build\V2\Repository;
use Google\Rpc\Status;

/**
 * @param string $formattedParent             The connection to contain all the repositories being created.
 *                                            Format: projects/*/locations/*/connections/*
 *                                            The parent field in the CreateRepositoryRequest messages
 *                                            must either be empty or match this field. Please see
 *                                            {@see RepositoryManagerClient::connectionName()} for help formatting this field.
 * @param string $formattedRequestsParent     The connection to contain the repository. If the request is part
 *                                            of a BatchCreateRepositoriesRequest, this field should be empty or match
 *                                            the parent specified there. Please see
 *                                            {@see RepositoryManagerClient::connectionName()} for help formatting this field.
 * @param string $requestsRepositoryRemoteUri Git Clone HTTPS URI.
 * @param string $requestsRepositoryId        The ID to use for the repository, which will become the final
 *                                            component of the repository's resource name. This ID should be unique in
 *                                            the connection. Allows alphanumeric characters and any of
 *                                            -._~%!$&'()*+,;=@.
 */
function batch_create_repositories_sample(
    string $formattedParent,
    string $formattedRequestsParent,
    string $requestsRepositoryRemoteUri,
    string $requestsRepositoryId
): void {
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $requestsRepository = (new Repository())
        ->setRemoteUri($requestsRepositoryRemoteUri);
    $createRepositoryRequest = (new CreateRepositoryRequest())
        ->setParent($formattedRequestsParent)
        ->setRepository($requestsRepository)
        ->setRepositoryId($requestsRepositoryId);
    $requests = [$createRepositoryRequest,];
    $request = (new BatchCreateRepositoriesRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

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

        if ($response->operationSucceeded()) {
            /** @var BatchCreateRepositoriesResponse $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 = RepositoryManagerClient::connectionName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]'
    );
    $formattedRequestsParent = RepositoryManagerClient::connectionName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]'
    );
    $requestsRepositoryRemoteUri = '[REMOTE_URI]';
    $requestsRepositoryId = '[REPOSITORY_ID]';

    batch_create_repositories_sample(
        $formattedParent,
        $formattedRequestsParent,
        $requestsRepositoryRemoteUri,
        $requestsRepositoryId
    );
}

createConnection

Parameters
Name Description
request Google\Cloud\Build\V2\CreateConnectionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\Connection;
use Google\Cloud\Build\V2\CreateConnectionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Project and location where the connection will be created.
 *                                Format: `projects/*/locations/*`. Please see
 *                                {@see RepositoryManagerClient::locationName()} for help formatting this field.
 * @param string $connectionId    The ID to use for the Connection, which will become the final
 *                                component of the Connection's resource name. Names must be unique
 *                                per-project per-location. Allows alphanumeric characters and any of
 *                                -._~%!$&'()*+,;=@.
 */
function create_connection_sample(string $formattedParent, string $connectionId): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $connection = new Connection();
    $request = (new CreateConnectionRequest())
        ->setParent($formattedParent)
        ->setConnection($connection)
        ->setConnectionId($connectionId);

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

        if ($response->operationSucceeded()) {
            /** @var Connection $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 = RepositoryManagerClient::locationName('[PROJECT]', '[LOCATION]');
    $connectionId = '[CONNECTION_ID]';

    create_connection_sample($formattedParent, $connectionId);
}

createRepository

Parameters
Name Description
request Google\Cloud\Build\V2\CreateRepositoryRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\CreateRepositoryRequest;
use Google\Cloud\Build\V2\Repository;
use Google\Rpc\Status;

/**
 * @param string $formattedParent     The connection to contain the repository. If the request is part
 *                                    of a BatchCreateRepositoriesRequest, this field should be empty or match
 *                                    the parent specified there. Please see
 *                                    {@see RepositoryManagerClient::connectionName()} for help formatting this field.
 * @param string $repositoryRemoteUri Git Clone HTTPS URI.
 * @param string $repositoryId        The ID to use for the repository, which will become the final
 *                                    component of the repository's resource name. This ID should be unique in
 *                                    the connection. Allows alphanumeric characters and any of
 *                                    -._~%!$&'()*+,;=@.
 */
function create_repository_sample(
    string $formattedParent,
    string $repositoryRemoteUri,
    string $repositoryId
): void {
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $repository = (new Repository())
        ->setRemoteUri($repositoryRemoteUri);
    $request = (new CreateRepositoryRequest())
        ->setParent($formattedParent)
        ->setRepository($repository)
        ->setRepositoryId($repositoryId);

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

        if ($response->operationSucceeded()) {
            /** @var Repository $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 = RepositoryManagerClient::connectionName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]'
    );
    $repositoryRemoteUri = '[REMOTE_URI]';
    $repositoryId = '[REPOSITORY_ID]';

    create_repository_sample($formattedParent, $repositoryRemoteUri, $repositoryId);
}

deleteConnection

Deletes a single connection.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::deleteConnectionAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\DeleteConnectionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\DeleteConnectionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the Connection to delete.
 *                              Format: `projects/*/locations/*/connections/*`. Please see
 *                              {@see RepositoryManagerClient::connectionName()} for help formatting this field.
 */
function delete_connection_sample(string $formattedName): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $repositoryManagerClient->deleteConnection($request);
        $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 = RepositoryManagerClient::connectionName('[PROJECT]', '[LOCATION]', '[CONNECTION]');

    delete_connection_sample($formattedName);
}

deleteRepository

Deletes a single repository.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::deleteRepositoryAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\DeleteRepositoryRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\DeleteRepositoryRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the Repository to delete.
 *                              Format: `projects/*/locations/*/connections/*/repositories/*`. Please see
 *                              {@see RepositoryManagerClient::repositoryName()} for help formatting this field.
 */
function delete_repository_sample(string $formattedName): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $repositoryManagerClient->deleteRepository($request);
        $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 = RepositoryManagerClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]',
        '[REPOSITORY]'
    );

    delete_repository_sample($formattedName);
}

fetchGitRefs

Fetch the list of branches or tags for a given repository.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::fetchGitRefsAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\FetchGitRefsRequest

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\Build\V2\FetchGitRefsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\FetchGitRefsRequest;
use Google\Cloud\Build\V2\FetchGitRefsResponse;

/**
 * @param string $formattedRepository The resource name of the repository in the format
 *                                    `projects/*/locations/*/connections/*/repositories/*`. Please see
 *                                    {@see RepositoryManagerClient::repositoryName()} for help formatting this field.
 */
function fetch_git_refs_sample(string $formattedRepository): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $request = (new FetchGitRefsRequest())
        ->setRepository($formattedRepository);

    // Call the API and handle any network failures.
    try {
        /** @var FetchGitRefsResponse $response */
        $response = $repositoryManagerClient->fetchGitRefs($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
{
    $formattedRepository = RepositoryManagerClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]',
        '[REPOSITORY]'
    );

    fetch_git_refs_sample($formattedRepository);
}

fetchLinkableRepositories

FetchLinkableRepositories get repositories from SCM that are accessible and could be added to the connection.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::fetchLinkableRepositoriesAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\FetchLinkableRepositoriesRequest

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\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\FetchLinkableRepositoriesRequest;
use Google\Cloud\Build\V2\Repository;

/**
 * @param string $formattedConnection The name of the Connection.
 *                                    Format: `projects/*/locations/*/connections/*`. Please see
 *                                    {@see RepositoryManagerClient::connectionName()} for help formatting this field.
 */
function fetch_linkable_repositories_sample(string $formattedConnection): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $request = (new FetchLinkableRepositoriesRequest())
        ->setConnection($formattedConnection);

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

        /** @var Repository $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
{
    $formattedConnection = RepositoryManagerClient::connectionName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]'
    );

    fetch_linkable_repositories_sample($formattedConnection);
}

fetchReadToken

Fetches read token of a given repository.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::fetchReadTokenAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\FetchReadTokenRequest

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\Build\V2\FetchReadTokenResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\FetchReadTokenRequest;
use Google\Cloud\Build\V2\FetchReadTokenResponse;

/**
 * @param string $formattedRepository The resource name of the repository in the format
 *                                    `projects/*/locations/*/connections/*/repositories/*`. Please see
 *                                    {@see RepositoryManagerClient::repositoryName()} for help formatting this field.
 */
function fetch_read_token_sample(string $formattedRepository): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $request = (new FetchReadTokenRequest())
        ->setRepository($formattedRepository);

    // Call the API and handle any network failures.
    try {
        /** @var FetchReadTokenResponse $response */
        $response = $repositoryManagerClient->fetchReadToken($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
{
    $formattedRepository = RepositoryManagerClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]',
        '[REPOSITORY]'
    );

    fetch_read_token_sample($formattedRepository);
}

fetchReadWriteToken

Fetches read/write token of a given repository.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::fetchReadWriteTokenAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\FetchReadWriteTokenRequest

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\Build\V2\FetchReadWriteTokenResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\FetchReadWriteTokenRequest;
use Google\Cloud\Build\V2\FetchReadWriteTokenResponse;

/**
 * @param string $formattedRepository The resource name of the repository in the format
 *                                    `projects/*/locations/*/connections/*/repositories/*`. Please see
 *                                    {@see RepositoryManagerClient::repositoryName()} for help formatting this field.
 */
function fetch_read_write_token_sample(string $formattedRepository): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $request = (new FetchReadWriteTokenRequest())
        ->setRepository($formattedRepository);

    // Call the API and handle any network failures.
    try {
        /** @var FetchReadWriteTokenResponse $response */
        $response = $repositoryManagerClient->fetchReadWriteToken($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
{
    $formattedRepository = RepositoryManagerClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]',
        '[REPOSITORY]'
    );

    fetch_read_write_token_sample($formattedRepository);
}

getConnection

Gets details of a single connection.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::getConnectionAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\GetConnectionRequest

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\Build\V2\Connection
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\Connection;
use Google\Cloud\Build\V2\GetConnectionRequest;

/**
 * @param string $formattedName The name of the Connection to retrieve.
 *                              Format: `projects/*/locations/*/connections/*`. Please see
 *                              {@see RepositoryManagerClient::connectionName()} for help formatting this field.
 */
function get_connection_sample(string $formattedName): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Connection $response */
        $response = $repositoryManagerClient->getConnection($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 = RepositoryManagerClient::connectionName('[PROJECT]', '[LOCATION]', '[CONNECTION]');

    get_connection_sample($formattedName);
}

getRepository

Gets details of a single repository.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::getRepositoryAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\GetRepositoryRequest

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\Build\V2\Repository
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\GetRepositoryRequest;
use Google\Cloud\Build\V2\Repository;

/**
 * @param string $formattedName The name of the Repository to retrieve.
 *                              Format: `projects/*/locations/*/connections/*/repositories/*`. Please see
 *                              {@see RepositoryManagerClient::repositoryName()} for help formatting this field.
 */
function get_repository_sample(string $formattedName): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Repository $response */
        $response = $repositoryManagerClient->getRepository($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 = RepositoryManagerClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]',
        '[REPOSITORY]'
    );

    get_repository_sample($formattedName);
}

listConnections

Lists Connections in a given project and location.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::listConnectionsAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\ListConnectionsRequest

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\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\Connection;
use Google\Cloud\Build\V2\ListConnectionsRequest;

/**
 * @param string $formattedParent The parent, which owns this collection of Connections.
 *                                Format: `projects/*/locations/*`. Please see
 *                                {@see RepositoryManagerClient::locationName()} for help formatting this field.
 */
function list_connections_sample(string $formattedParent): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

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

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

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

    list_connections_sample($formattedParent);
}

listRepositories

Lists Repositories in a given connection.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::listRepositoriesAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\ListRepositoriesRequest

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\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\ListRepositoriesRequest;
use Google\Cloud\Build\V2\Repository;

/**
 * @param string $formattedParent The parent, which owns this collection of Repositories.
 *                                Format: `projects/*/locations/*/connections/*`. Please see
 *                                {@see RepositoryManagerClient::connectionName()} for help formatting this field.
 */
function list_repositories_sample(string $formattedParent): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

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

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

        /** @var Repository $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 = RepositoryManagerClient::connectionName(
        '[PROJECT]',
        '[LOCATION]',
        '[CONNECTION]'
    );

    list_repositories_sample($formattedParent);
}

updateConnection

Updates a single connection.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::updateConnectionAsync() .

Parameters
Name Description
request Google\Cloud\Build\V2\UpdateConnectionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Build\V2\Connection;
use Google\Cloud\Build\V2\UpdateConnectionRequest;
use Google\Rpc\Status;

/**
 * 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_connection_sample(): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $connection = new Connection();
    $request = (new UpdateConnectionRequest())
        ->setConnection($connection);

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

        if ($response->operationSucceeded()) {
            /** @var Connection $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());
    }
}

getIamPolicy

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::getIamPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\GetIamPolicyRequest

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\Iam\V1\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;

/**
 * @param string $resource REQUIRED: The resource for which the policy is being requested.
 *                         See the operation documentation for the appropriate value for this field.
 */
function get_iam_policy_sample(string $resource): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $request = (new GetIamPolicyRequest())
        ->setResource($resource);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $repositoryManagerClient->getIamPolicy($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
{
    $resource = '[RESOURCE]';

    get_iam_policy_sample($resource);
}

setIamPolicy

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::setIamPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\SetIamPolicyRequest

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\Iam\V1\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;

/**
 * @param string $resource REQUIRED: The resource for which the policy is being specified.
 *                         See the operation documentation for the appropriate value for this field.
 */
function set_iam_policy_sample(string $resource): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $policy = new Policy();
    $request = (new SetIamPolicyRequest())
        ->setResource($resource)
        ->setPolicy($policy);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $repositoryManagerClient->setIamPolicy($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
{
    $resource = '[RESOURCE]';

    set_iam_policy_sample($resource);
}

testIamPermissions

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

The async variant is Google\Cloud\Build\V2\Client\RepositoryManagerClient::testIamPermissionsAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\TestIamPermissionsRequest

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\Iam\V1\TestIamPermissionsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Build\V2\Client\RepositoryManagerClient;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;

/**
 * @param string $resource           REQUIRED: The resource for which the policy detail is being requested.
 *                                   See the operation documentation for the appropriate value for this field.
 * @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
 *                                   wildcards (such as '*' or 'storage.*') are not allowed. For more
 *                                   information see
 *                                   [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
 */
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
    // Create a client.
    $repositoryManagerClient = new RepositoryManagerClient();

    // Prepare the request message.
    $permissions = [$permissionsElement,];
    $request = (new TestIamPermissionsRequest())
        ->setResource($resource)
        ->setPermissions($permissions);

    // Call the API and handle any network failures.
    try {
        /** @var TestIamPermissionsResponse $response */
        $response = $repositoryManagerClient->testIamPermissions($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
{
    $resource = '[RESOURCE]';
    $permissionsElement = '[PERMISSIONS]';

    test_iam_permissions_sample($resource, $permissionsElement);
}

batchCreateRepositoriesAsync

Parameters
Name Description
request Google\Cloud\Build\V2\BatchCreateRepositoriesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createConnectionAsync

Parameters
Name Description
request Google\Cloud\Build\V2\CreateConnectionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createRepositoryAsync

Parameters
Name Description
request Google\Cloud\Build\V2\CreateRepositoryRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteConnectionAsync

Parameters
Name Description
request Google\Cloud\Build\V2\DeleteConnectionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteRepositoryAsync

Parameters
Name Description
request Google\Cloud\Build\V2\DeleteRepositoryRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

fetchGitRefsAsync

Parameters
Name Description
request Google\Cloud\Build\V2\FetchGitRefsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

fetchLinkableRepositoriesAsync

Parameters
Name Description
request Google\Cloud\Build\V2\FetchLinkableRepositoriesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

fetchReadTokenAsync

Parameters
Name Description
request Google\Cloud\Build\V2\FetchReadTokenRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

fetchReadWriteTokenAsync

Parameters
Name Description
request Google\Cloud\Build\V2\FetchReadWriteTokenRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getConnectionAsync

Parameters
Name Description
request Google\Cloud\Build\V2\GetConnectionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getRepositoryAsync

Parameters
Name Description
request Google\Cloud\Build\V2\GetRepositoryRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listConnectionsAsync

Parameters
Name Description
request Google\Cloud\Build\V2\ListConnectionsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listRepositoriesAsync

Parameters
Name Description
request Google\Cloud\Build\V2\ListRepositoriesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateConnectionAsync

Parameters
Name Description
request Google\Cloud\Build\V2\UpdateConnectionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getIamPolicyAsync

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

setIamPolicyAsync

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

testIamPermissionsAsync

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

getOperationsClient

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

Returns
Type Description
Google\LongRunning\Client\OperationsClient

resumeOperation

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

Parameters
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse

static::connectionName

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

Parameters
Name Description
project string
location string
connection string
Returns
Type Description
string The formatted connection 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::repositoryName

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

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

static::secretVersionName

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

Parameters
Name Description
project string
secret string
version string
Returns
Type Description
string The formatted secret_version resource.

static::serviceName

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

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

  • connection: projects/{project}/locations/{location}/connections/{connection}
  • location: projects/{project}/locations/{location}
  • repository: projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}
  • secretVersion: projects/{project}/secrets/{secret}/versions/{version}
  • service: projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}

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.