# Google Cloud Build V2 Client - Class RepositoryManagerClient (1.1.2)

1.1.2 (latest) 1.1.1 1.0.4 0.16.3 0.15.0 0.14.0 0.13.2 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.3 0.6.1 0.5.1 0.4.0 0.3.8 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|https://docs.cloud.google.com/php/docs/reference/gax/latest/Options.ClientOptions.html` 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` | `https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html|https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html` This option should only be used with a pre-constructed [Google\\Auth\\FetchAuthTokenInterface](https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html) or [Google\\ApiCore\\CredentialsWrapper](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html) object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. **Important** : If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly `use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\Build\V2\RepositoryManagerClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new RepositoryManagerClient(['credentials' => $creds]);` <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> |
| `↳ credentialsConfig` | `array` Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see [Google\\ApiCore\\CredentialsWrapper::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html#_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|https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html) 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()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.GrpcTransport.html#_Google_ApiCore_Transport_GrpcTransport__build__) and [Google\\ApiCore\\Transport\\RestTransport::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.RestTransport.html#_Google_ApiCore_Transport_RestTransport__build__) methods for the supported options. |
| `↳ clientCertSource` | `callable` A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
| `↳ logger` | `false|Psr\Log\LoggerInterface` A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
| `↳ universeDomain` | `string` The service domain for the client. Defaults to 'googleapis.com'. |

### batchCreateRepositories

Creates multiple repositories inside a connection.

The async variant is
[RepositoryManagerClient::batchCreateRepositoriesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_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` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.BatchCreateRepositoriesResponse>` |   |

**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/&#42;/locations/&#42;/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
     *                                            -._~%!$&'()*+,;=&#64;.
     */
    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

Creates a Connection.

The async variant is [RepositoryManagerClient::createConnectionAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__createConnectionAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\CreateConnectionRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Connection>` |   |

**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/&#42;/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
     *                                -._~%!$&'()*+,;=&#64;.
     */
    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

Creates a Repository.

The async variant is [RepositoryManagerClient::createRepositoryAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__createRepositoryAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.CreateRepositoryRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Repository>` |   |

**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
     *                                    -._~%!$&'()*+,;=&#64;.
     */
    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 [RepositoryManagerClient::deleteConnectionAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_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` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<null>` |   |

**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/&#42;/locations/&#42;/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 [RepositoryManagerClient::deleteRepositoryAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_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` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<null>` |   |

**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/&#42;/locations/&#42;/connections/&#42;/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 [RepositoryManagerClient::fetchGitRefsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__fetchGitRefsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchGitRefsRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/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/&#42;/locations/&#42;/connections/&#42;/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
[RepositoryManagerClient::fetchLinkableRepositoriesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_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` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**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/&#42;/locations/&#42;/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 [RepositoryManagerClient::fetchReadTokenAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__fetchReadTokenAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchReadTokenRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/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/&#42;/locations/&#42;/connections/&#42;/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 [RepositoryManagerClient::fetchReadWriteTokenAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__fetchReadWriteTokenAsync__)
.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchReadWriteTokenRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/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/&#42;/locations/&#42;/connections/&#42;/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 [RepositoryManagerClient::getConnectionAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_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` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/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/&#42;/locations/&#42;/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 [RepositoryManagerClient::getRepositoryAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_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` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/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/&#42;/locations/&#42;/connections/&#42;/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 [RepositoryManagerClient::listConnectionsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_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` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**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/&#42;/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 [RepositoryManagerClient::listRepositoriesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_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` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**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/&#42;/locations/&#42;/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 [RepositoryManagerClient::updateConnectionAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__updateConnectionAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.UpdateConnectionRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Connection>` |   |

**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 [RepositoryManagerClient::getIamPolicyAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__getIamPolicyAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.GetIamPolicyRequest.html` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.Policy.html` |   |

**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 [RepositoryManagerClient::setIamPolicyAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__setIamPolicyAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.SetIamPolicyRequest.html` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.Policy.html` |   |

**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 [RepositoryManagerClient::testIamPermissionsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Client.RepositoryManagerClient#_Google_Cloud_Build_V2_Client_RepositoryManagerClient__testIamPermissionsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.TestIamPermissionsRequest.html` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.TestIamPermissionsResponse.html` |   |

**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** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### createConnectionAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\CreateConnectionRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### createRepositoryAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.CreateRepositoryRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### deleteConnectionAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\DeleteConnectionRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### deleteRepositoryAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\DeleteRepositoryRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### fetchGitRefsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchGitRefsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchGitRefsResponse>` |   |

### fetchLinkableRepositoriesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\FetchLinkableRepositoriesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### fetchReadTokenAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchReadTokenRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchReadTokenResponse>` |   |

### fetchReadWriteTokenAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchReadWriteTokenRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.FetchReadWriteTokenResponse>` |   |

### getConnectionAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\GetConnectionRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Connection>` |   |

### getRepositoryAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\GetRepositoryRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.Repository>` |   |

### listConnectionsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\ListConnectionsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### listRepositoriesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Cloud\Build\V2\ListRepositoriesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### updateConnectionAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-build/latest/V2.UpdateConnectionRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### getIamPolicyAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.GetIamPolicyRequest.html` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.Policy.html>` |   |

### setIamPolicyAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.SetIamPolicyRequest.html` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.Policy.html>` |   |

### testIamPermissionsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.TestIamPermissionsRequest.html` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Iam.V1.TestIamPermissionsResponse.html>` |   |

### 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** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html` |   |

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