Google Cloud Artifact Registry V1 Client - Class ArtifactRegistryClient (1.1.0)

Reference documentation and code samples for the Google Cloud Artifact Registry V1 Client class ArtifactRegistryClient.

Service Description: The Artifact Registry API service.

Artifact Registry is an artifact management system for storing artifacts from different package management systems.

The resources managed by this API are:

  • Repositories, which group packages and their data.
  • Packages, which group versions and their tags.
  • Versions, which are specific forms of a package.
  • Tags, which represent alternative names for versions.
  • Files, which contain content and are optionally associated with a Package or Version.

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 \ ArtifactRegistry \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

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

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

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

↳ credentialsConfig array

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

↳ disableRetries bool

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

↳ clientConfig string|array

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

↳ transport string|TransportInterface

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

↳ transportConfig array

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

↳ clientCertSource callable

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

batchDeleteVersions

Deletes multiple versions across a repository. The returned operation will complete once the versions have been deleted.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::batchDeleteVersionsAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\BatchDeleteVersionsRequest

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\ArtifactRegistry\V1\BatchDeleteVersionsRequest;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Rpc\Status;

/**
 * @param string $formattedNamesElement The names of the versions to delete.
 *                                      A maximum of 10000 versions can be deleted in a batch. Please see
 *                                      {@see ArtifactRegistryClient::versionName()} for help formatting this field.
 */
function batch_delete_versions_sample(string $formattedNamesElement): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

    // Prepare the request message.
    $formattedNames = [$formattedNamesElement,];
    $request = (new BatchDeleteVersionsRequest())
        ->setNames($formattedNames);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $artifactRegistryClient->batchDeleteVersions($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
{
    $formattedNamesElement = ArtifactRegistryClient::versionName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[PACKAGE]',
        '[VERSION]'
    );

    batch_delete_versions_sample($formattedNamesElement);
}

createAttachment

Creates an attachment. The returned Operation will finish once the attachment has been created. Its response will be the created attachment.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::createAttachmentAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\CreateAttachmentRequest

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\ArtifactRegistry\V1\Attachment;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\CreateAttachmentRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                 The name of the parent resource where the attachment will be
 *                                                created. Please see
 *                                                {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 * @param string $attachmentId                    The attachment id to use for this attachment.
 * @param string $attachmentTarget                The target the attachment is for, can be a Version, Package or
 *                                                Repository. E.g.
 *                                                `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`.
 * @param string $formattedAttachmentFilesElement The files that belong to this attachment.
 *                                                If the file ID part contains slashes, they are escaped. E.g.
 *                                                `projects/p1/locations/us-central1/repositories/repo1/files/sha:<sha-of-file>`. Please see
 *                                                {@see ArtifactRegistryClient::fileName()} for help formatting this field.
 */
function create_attachment_sample(
    string $formattedParent,
    string $attachmentId,
    string $attachmentTarget,
    string $formattedAttachmentFilesElement
): void {
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

    // Prepare the request message.
    $formattedAttachmentFiles = [$formattedAttachmentFilesElement,];
    $attachment = (new Attachment())
        ->setTarget($attachmentTarget)
        ->setFiles($formattedAttachmentFiles);
    $request = (new CreateAttachmentRequest())
        ->setParent($formattedParent)
        ->setAttachmentId($attachmentId)
        ->setAttachment($attachment);

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

        if ($response->operationSucceeded()) {
            /** @var Attachment $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 = ArtifactRegistryClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]'
    );
    $attachmentId = '[ATTACHMENT_ID]';
    $attachmentTarget = '[TARGET]';
    $formattedAttachmentFilesElement = ArtifactRegistryClient::fileName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[FILE]'
    );

    create_attachment_sample(
        $formattedParent,
        $attachmentId,
        $attachmentTarget,
        $formattedAttachmentFilesElement
    );
}

createRepository

Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::createRepositoryAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\CreateRepositoryRequest;
use Google\Cloud\ArtifactRegistry\V1\Repository;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The name of the parent resource where the repository will be
 *                                created. Please see
 *                                {@see ArtifactRegistryClient::locationName()} for help formatting this field.
 */
function create_repository_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

    create_repository_sample($formattedParent);
}

createRule

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\CreateRuleRequest

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\ArtifactRegistry\V1\Rule
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\CreateRuleRequest;
use Google\Cloud\ArtifactRegistry\V1\Rule;

/**
 * @param string $formattedParent The name of the parent resource where the rule will be created. Please see
 *                                {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function create_rule_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

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

    create_rule_sample($formattedParent);
}

createTag

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\CreateTagRequest

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\ArtifactRegistry\V1\Tag
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\CreateTagRequest;
use Google\Cloud\ArtifactRegistry\V1\Tag;

/**
 * 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 create_tag_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

deleteAttachment

Deletes an attachment. The returned Operation will finish once the attachments has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::deleteAttachmentAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\DeleteAttachmentRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DeleteAttachmentRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the attachment to delete. Please see
 *                              {@see ArtifactRegistryClient::attachmentName()} for help formatting this field.
 */
function delete_attachment_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $artifactRegistryClient->deleteAttachment($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 = ArtifactRegistryClient::attachmentName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[ATTACHMENT]'
    );

    delete_attachment_sample($formattedName);
}

deleteFile

Deletes a file and all of its content. It is only allowed on generic repositories. The returned operation will complete once the file has been deleted.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::deleteFileAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\DeleteFileRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DeleteFileRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the file to delete. Please see
 *                              {@see ArtifactRegistryClient::fileName()} for help formatting this field.
 */
function delete_file_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $artifactRegistryClient->deleteFile($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 = ArtifactRegistryClient::fileName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[FILE]'
    );

    delete_file_sample($formattedName);
}

deletePackage

Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::deletePackageAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\DeletePackageRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DeletePackageRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the package to delete. Please see
 *                              {@see ArtifactRegistryClient::packageName()} for help formatting this field.
 */
function delete_package_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $artifactRegistryClient->deletePackage($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 = ArtifactRegistryClient::packageName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[PACKAGE]'
    );

    delete_package_sample($formattedName);
}

deleteRepository

Deletes a repository and all of its contents. The returned Operation will finish once the repository has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::deleteRepositoryAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DeleteRepositoryRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the repository to delete. Please see
 *                              {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function delete_repository_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

    delete_repository_sample($formattedName);
}

deleteRule

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\DeleteRuleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DeleteRuleRequest;

/**
 * @param string $formattedName The name of the rule to delete. Please see
 *                              {@see ArtifactRegistryClient::ruleName()} for help formatting this field.
 */
function delete_rule_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        $artifactRegistryClient->deleteRule($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

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

    delete_rule_sample($formattedName);
}

deleteTag

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\DeleteTagRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DeleteTagRequest;

/**
 * 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 delete_tag_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        $artifactRegistryClient->deleteTag($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

deleteVersion

Deletes a version and all of its content. The returned operation will complete once the version has been deleted.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::deleteVersionAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\DeleteVersionRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DeleteVersionRequest;
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 delete_version_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $artifactRegistryClient->deleteVersion($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());
    }
}

getAttachment

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetAttachmentRequest

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\ArtifactRegistry\V1\Attachment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Attachment;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetAttachmentRequest;

/**
 * @param string $formattedName The name of the attachment to retrieve. Please see
 *                              {@see ArtifactRegistryClient::attachmentName()} for help formatting this field.
 */
function get_attachment_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Attachment $response */
        $response = $artifactRegistryClient->getAttachment($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 = ArtifactRegistryClient::attachmentName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[ATTACHMENT]'
    );

    get_attachment_sample($formattedName);
}

getDockerImage

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetDockerImageRequest

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\ArtifactRegistry\V1\DockerImage
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DockerImage;
use Google\Cloud\ArtifactRegistry\V1\GetDockerImageRequest;

/**
 * @param string $formattedName The name of the docker images. Please see
 *                              {@see ArtifactRegistryClient::dockerImageName()} for help formatting this field.
 */
function get_docker_image_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var DockerImage $response */
        $response = $artifactRegistryClient->getDockerImage($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 = ArtifactRegistryClient::dockerImageName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[DOCKER_IMAGE]'
    );

    get_docker_image_sample($formattedName);
}

getFile

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetFileRequest

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\ArtifactRegistry\V1\File
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\File;
use Google\Cloud\ArtifactRegistry\V1\GetFileRequest;

/**
 * @param string $formattedName The name of the file to retrieve. Please see
 *                              {@see ArtifactRegistryClient::fileName()} for help formatting this field.
 */
function get_file_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var File $response */
        $response = $artifactRegistryClient->getFile($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 = ArtifactRegistryClient::fileName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[FILE]'
    );

    get_file_sample($formattedName);
}

getIamPolicy

Gets the IAM policy for a given resource.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
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.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $artifactRegistryClient->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);
}

getMavenArtifact

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetMavenArtifactRequest

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\ArtifactRegistry\V1\MavenArtifact
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetMavenArtifactRequest;
use Google\Cloud\ArtifactRegistry\V1\MavenArtifact;

/**
 * @param string $formattedName The name of the maven artifact. Please see
 *                              {@see ArtifactRegistryClient::mavenArtifactName()} for help formatting this field.
 */
function get_maven_artifact_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var MavenArtifact $response */
        $response = $artifactRegistryClient->getMavenArtifact($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 = ArtifactRegistryClient::mavenArtifactName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[MAVEN_ARTIFACT]'
    );

    get_maven_artifact_sample($formattedName);
}

getNpmPackage

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetNpmPackageRequest

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\ArtifactRegistry\V1\NpmPackage
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetNpmPackageRequest;
use Google\Cloud\ArtifactRegistry\V1\NpmPackage;

/**
 * @param string $formattedName The name of the npm package. Please see
 *                              {@see ArtifactRegistryClient::npmPackageName()} for help formatting this field.
 */
function get_npm_package_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var NpmPackage $response */
        $response = $artifactRegistryClient->getNpmPackage($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 = ArtifactRegistryClient::npmPackageName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[NPM_PACKAGE]'
    );

    get_npm_package_sample($formattedName);
}

getPackage

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetPackageRequest

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\ArtifactRegistry\V1\Package
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetPackageRequest;
use Google\Cloud\ArtifactRegistry\V1\Package;

/**
 * @param string $formattedName The name of the package to retrieve. Please see
 *                              {@see ArtifactRegistryClient::packageName()} for help formatting this field.
 */
function get_package_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Package $response */
        $response = $artifactRegistryClient->getPackage($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 = ArtifactRegistryClient::packageName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[PACKAGE]'
    );

    get_package_sample($formattedName);
}

getProjectSettings

Retrieves the Settings for the Project.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::getProjectSettingsAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetProjectSettingsRequest

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\ArtifactRegistry\V1\ProjectSettings
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetProjectSettingsRequest;
use Google\Cloud\ArtifactRegistry\V1\ProjectSettings;

/**
 * @param string $formattedName The name of the projectSettings resource. Please see
 *                              {@see ArtifactRegistryClient::projectSettingsName()} for help formatting this field.
 */
function get_project_settings_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var ProjectSettings $response */
        $response = $artifactRegistryClient->getProjectSettings($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 = ArtifactRegistryClient::projectSettingsName('[PROJECT]');

    get_project_settings_sample($formattedName);
}

getPythonPackage

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetPythonPackageRequest

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\ArtifactRegistry\V1\PythonPackage
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetPythonPackageRequest;
use Google\Cloud\ArtifactRegistry\V1\PythonPackage;

/**
 * @param string $formattedName The name of the python package. Please see
 *                              {@see ArtifactRegistryClient::pythonPackageName()} for help formatting this field.
 */
function get_python_package_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var PythonPackage $response */
        $response = $artifactRegistryClient->getPythonPackage($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 = ArtifactRegistryClient::pythonPackageName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[PYTHON_PACKAGE]'
    );

    get_python_package_sample($formattedName);
}

getRepository

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\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\ArtifactRegistry\V1\Repository
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetRepositoryRequest;
use Google\Cloud\ArtifactRegistry\V1\Repository;

/**
 * @param string $formattedName The name of the repository to retrieve. Please see
 *                              {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function get_repository_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

    get_repository_sample($formattedName);
}

getRule

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetRuleRequest

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\ArtifactRegistry\V1\Rule
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetRuleRequest;
use Google\Cloud\ArtifactRegistry\V1\Rule;

/**
 * @param string $formattedName The name of the rule to retrieve. Please see
 *                              {@see ArtifactRegistryClient::ruleName()} for help formatting this field.
 */
function get_rule_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Rule $response */
        $response = $artifactRegistryClient->getRule($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 = ArtifactRegistryClient::ruleName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]',
        '[RULE]'
    );

    get_rule_sample($formattedName);
}

getTag

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetTagRequest

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\ArtifactRegistry\V1\Tag
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetTagRequest;
use Google\Cloud\ArtifactRegistry\V1\Tag;

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

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

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

getVPCSCConfig

Retrieves the VPCSC Config for the Project.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::getVPCSCConfigAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetVPCSCConfigRequest

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\ArtifactRegistry\V1\VPCSCConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetVPCSCConfigRequest;
use Google\Cloud\ArtifactRegistry\V1\VPCSCConfig;

/**
 * @param string $formattedName The name of the VPCSCConfig resource. Please see
 *                              {@see ArtifactRegistryClient::vpcscConfigName()} for help formatting this field.
 */
function get_vpcsc_config_sample(string $formattedName): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var VPCSCConfig $response */
        $response = $artifactRegistryClient->getVPCSCConfig($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 = ArtifactRegistryClient::vpcscConfigName('[PROJECT]', '[LOCATION]');

    get_vpcsc_config_sample($formattedName);
}

getVersion

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetVersionRequest

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\ArtifactRegistry\V1\Version
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\GetVersionRequest;
use Google\Cloud\ArtifactRegistry\V1\Version;

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

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

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

importAptArtifacts

Imports Apt artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::importAptArtifactsAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ImportAptArtifactsRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ImportAptArtifactsRequest;
use Google\Cloud\ArtifactRegistry\V1\ImportAptArtifactsResponse;
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 import_apt_artifacts_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

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

importYumArtifacts

Imports Yum (RPM) artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::importYumArtifactsAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ImportYumArtifactsRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ImportYumArtifactsRequest;
use Google\Cloud\ArtifactRegistry\V1\ImportYumArtifactsResponse;
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 import_yum_artifacts_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

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

listAttachments

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListAttachmentsRequest

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\ArtifactRegistry\V1\Attachment;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListAttachmentsRequest;

/**
 * @param string $formattedParent The name of the parent resource whose attachments will be listed. Please see
 *                                {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function list_attachments_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

        /** @var Attachment $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 = ArtifactRegistryClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]'
    );

    list_attachments_sample($formattedParent);
}

listDockerImages

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListDockerImagesRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\DockerImage;
use Google\Cloud\ArtifactRegistry\V1\ListDockerImagesRequest;

/**
 * @param string $parent The name of the parent resource whose docker images will be
 *                       listed.
 */
function list_docker_images_sample(string $parent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

    // Prepare the request message.
    $request = (new ListDockerImagesRequest())
        ->setParent($parent);

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

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

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

    list_docker_images_sample($parent);
}

listFiles

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListFilesRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\File;
use Google\Cloud\ArtifactRegistry\V1\ListFilesRequest;

/**
 * @param string $formattedParent The name of the repository whose files will be listed. For
 *                                example: "projects/p1/locations/us-central1/repositories/repo1
 *                                Please see {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function list_files_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

        /** @var File $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 = ArtifactRegistryClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]'
    );

    list_files_sample($formattedParent);
}

listMavenArtifacts

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListMavenArtifactsRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListMavenArtifactsRequest;
use Google\Cloud\ArtifactRegistry\V1\MavenArtifact;

/**
 * @param string $formattedParent The name of the parent resource whose maven artifacts will be
 *                                listed. Please see
 *                                {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function list_maven_artifacts_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

        /** @var MavenArtifact $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 = ArtifactRegistryClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]'
    );

    list_maven_artifacts_sample($formattedParent);
}

listNpmPackages

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListNpmPackagesRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListNpmPackagesRequest;
use Google\Cloud\ArtifactRegistry\V1\NpmPackage;

/**
 * @param string $formattedParent The name of the parent resource whose npm packages will be
 *                                listed. Please see
 *                                {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function list_npm_packages_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

        /** @var NpmPackage $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 = ArtifactRegistryClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]'
    );

    list_npm_packages_sample($formattedParent);
}

listPackages

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListPackagesRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListPackagesRequest;
use Google\Cloud\ArtifactRegistry\V1\Package;

/**
 * @param string $formattedParent The name of the parent resource whose packages will be listed. Please see
 *                                {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function list_packages_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

        /** @var Package $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 = ArtifactRegistryClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]'
    );

    list_packages_sample($formattedParent);
}

listPythonPackages

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListPythonPackagesRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListPythonPackagesRequest;
use Google\Cloud\ArtifactRegistry\V1\PythonPackage;

/**
 * @param string $formattedParent The name of the parent resource whose python packages will be
 *                                listed. Please see
 *                                {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function list_python_packages_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

        /** @var PythonPackage $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 = ArtifactRegistryClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]'
    );

    list_python_packages_sample($formattedParent);
}

listRepositories

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListRepositoriesRequest;
use Google\Cloud\ArtifactRegistry\V1\Repository;

/**
 * @param string $formattedParent The name of the parent resource whose repositories will be
 *                                listed. Please see
 *                                {@see ArtifactRegistryClient::locationName()} for help formatting this field.
 */
function list_repositories_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $artifactRegistryClient->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 = ArtifactRegistryClient::locationName('[PROJECT]', '[LOCATION]');

    list_repositories_sample($formattedParent);
}

listRules

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListRulesRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListRulesRequest;
use Google\Cloud\ArtifactRegistry\V1\Rule;

/**
 * @param string $formattedParent The name of the parent repository whose rules will be listed.
 *                                For example:
 *                                `projects/p1/locations/us-central1/repositories/repo1`. Please see
 *                                {@see ArtifactRegistryClient::repositoryName()} for help formatting this field.
 */
function list_rules_sample(string $formattedParent): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

        /** @var Rule $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 = ArtifactRegistryClient::repositoryName(
        '[PROJECT]',
        '[LOCATION]',
        '[REPOSITORY]'
    );

    list_rules_sample($formattedParent);
}

listTags

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListTagsRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListTagsRequest;
use Google\Cloud\ArtifactRegistry\V1\Tag;

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

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

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

        /** @var Tag $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());
    }
}

listVersions

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListVersionsRequest

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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ListVersionsRequest;
use Google\Cloud\ArtifactRegistry\V1\Version;

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

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

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

        /** @var Version $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());
    }
}

setIamPolicy

Updates the IAM policy for a given resource.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
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.
    $artifactRegistryClient = new ArtifactRegistryClient();

    // 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 = $artifactRegistryClient->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

Tests if the caller has a list of permissions on a resource.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::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\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
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.
    $artifactRegistryClient = new ArtifactRegistryClient();

    // 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 = $artifactRegistryClient->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);
}

updateFile

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\UpdateFileRequest

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\ArtifactRegistry\V1\File
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\File;
use Google\Cloud\ArtifactRegistry\V1\UpdateFileRequest;
use Google\Protobuf\FieldMask;

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

    // Prepare the request message.
    $file = new File();
    $updateMask = new FieldMask();
    $request = (new UpdateFileRequest())
        ->setFile($file)
        ->setUpdateMask($updateMask);

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

updatePackage

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\UpdatePackageRequest

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\ArtifactRegistry\V1\Package
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\Package;
use Google\Cloud\ArtifactRegistry\V1\UpdatePackageRequest;

/**
 * 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_package_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

updateProjectSettings

Updates the Settings for the Project.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::updateProjectSettingsAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\UpdateProjectSettingsRequest

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\ArtifactRegistry\V1\ProjectSettings
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\ProjectSettings;
use Google\Cloud\ArtifactRegistry\V1\UpdateProjectSettingsRequest;

/**
 * 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_project_settings_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

updateRepository

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\UpdateRepositoryRequest

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\ArtifactRegistry\V1\Repository
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\Repository;
use Google\Cloud\ArtifactRegistry\V1\UpdateRepositoryRequest;

/**
 * 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_repository_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

updateRule

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\UpdateRuleRequest

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\ArtifactRegistry\V1\Rule
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\Rule;
use Google\Cloud\ArtifactRegistry\V1\UpdateRuleRequest;

/**
 * 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_rule_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

updateTag

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\UpdateTagRequest

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\ArtifactRegistry\V1\Tag
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\Tag;
use Google\Cloud\ArtifactRegistry\V1\UpdateTagRequest;

/**
 * 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_tag_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

updateVPCSCConfig

Updates the VPCSC Config for the Project.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::updateVPCSCConfigAsync() .

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\UpdateVPCSCConfigRequest

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\ArtifactRegistry\V1\VPCSCConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\UpdateVPCSCConfigRequest;
use Google\Cloud\ArtifactRegistry\V1\VPCSCConfig;

/**
 * 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_vpcsc_config_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

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

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

updateVersion

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\UpdateVersionRequest

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\ArtifactRegistry\V1\Version
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\ArtifactRegistry\V1\UpdateVersionRequest;
use Google\Cloud\ArtifactRegistry\V1\Version;

/**
 * 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_version_sample(): void
{
    // Create a client.
    $artifactRegistryClient = new ArtifactRegistryClient();

    // Prepare the request message.
    $version = new Version();
    $request = (new UpdateVersionRequest())
        ->setVersion($version);

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

getLocation

Gets information about a location.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::getLocationAsync() .

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;

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

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

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

listLocations

Lists information about the supported locations for this service.

The async variant is Google\Cloud\ArtifactRegistry\V1\Client\ArtifactRegistryClient::listLocationsAsync() .

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

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

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

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

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

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

batchDeleteVersionsAsync

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

createAttachmentAsync

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

createRepositoryAsync

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

createRuleAsync

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

createTagAsync

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

deleteAttachmentAsync

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

deleteFileAsync

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

deletePackageAsync

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

deleteRepositoryAsync

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

deleteRuleAsync

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

deleteTagAsync

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

deleteVersionAsync

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

getAttachmentAsync

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

getDockerImageAsync

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

getFileAsync

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\GetFileRequest
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

getMavenArtifactAsync

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

getNpmPackageAsync

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

getPackageAsync

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

getProjectSettingsAsync

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

getPythonPackageAsync

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

getRepositoryAsync

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

getRuleAsync

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

getTagAsync

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

getVPCSCConfigAsync

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

getVersionAsync

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

importAptArtifactsAsync

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

importYumArtifactsAsync

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

listAttachmentsAsync

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

listDockerImagesAsync

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

listFilesAsync

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

listMavenArtifactsAsync

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

listNpmPackagesAsync

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

listPackagesAsync

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

listPythonPackagesAsync

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

listRepositoriesAsync

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

listRulesAsync

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

listTagsAsync

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

listVersionsAsync

Parameters
Name Description
request Google\Cloud\ArtifactRegistry\V1\ListVersionsRequest
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

updateFileAsync

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

updatePackageAsync

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

updateProjectSettingsAsync

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

updateRepositoryAsync

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

updateRuleAsync

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

updateTagAsync

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

updateVPCSCConfigAsync

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

updateVersionAsync

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

getLocationAsync

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

listLocationsAsync

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

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::attachmentName

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

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

static::dockerImageName

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

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

static::fileName

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

Parameters
Name Description
project string
location string
repository string
file string
Returns
Type Description
string The formatted file 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::mavenArtifactName

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

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

static::npmPackageName

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

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

static::packageName

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

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

static::projectSettingsName

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

Parameter
Name Description
project string
Returns
Type Description
string The formatted project_settings resource.

static::pythonPackageName

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

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

static::repositoryName

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

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

static::ruleName

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

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

static::secretVersionName

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

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

static::tagName

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

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

static::versionName

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

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

static::vpcscConfigName

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

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

  • attachment: projects/{project}/locations/{location}/repositories/{repository}/attachments/{attachment}
  • dockerImage: projects/{project}/locations/{location}/repositories/{repository}/dockerImages/{docker_image}
  • file: projects/{project}/locations/{location}/repositories/{repository}/files/{file}
  • location: projects/{project}/locations/{location}
  • mavenArtifact: projects/{project}/locations/{location}/repositories/{repository}/mavenArtifacts/{maven_artifact}
  • npmPackage: projects/{project}/locations/{location}/repositories/{repository}/npmPackages/{npm_package}
  • package: projects/{project}/locations/{location}/repositories/{repository}/packages/{package}
  • projectSettings: projects/{project}/projectSettings
  • pythonPackage: projects/{project}/locations/{location}/repositories/{repository}/pythonPackages/{python_package}
  • repository: projects/{project}/locations/{location}/repositories/{repository}
  • rule: projects/{project}/locations/{location}/repositories/{repository}/rules/{rule}
  • secretVersion: projects/{project}/secrets/{secret}/versions/{secret_version}
  • tag: projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}
  • version: projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}
  • vpcscConfig: projects/{project}/locations/{location}/vpcscConfig

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.