Class ArtifactRegistryClient (1.35.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

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. Sample code to get started:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DockerImageName name =
       DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]");
   DockerImage response = artifactRegistryClient.getDockerImage(name);
 }
 

Note: close() needs to be called on the ArtifactRegistryClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
MethodDescriptionMethod Variants

ListDockerImages

Lists docker images.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listDockerImages(ListDockerImagesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listDockerImages(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listDockerImagesPagedCallable()

  • listDockerImagesCallable()

GetDockerImage

Gets a docker image.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getDockerImage(GetDockerImageRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getDockerImage(DockerImageName name)

  • getDockerImage(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getDockerImageCallable()

ListMavenArtifacts

Lists maven artifacts.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listMavenArtifacts(ListMavenArtifactsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listMavenArtifacts(RepositoryName parent)

  • listMavenArtifacts(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listMavenArtifactsPagedCallable()

  • listMavenArtifactsCallable()

GetMavenArtifact

Gets a maven artifact.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getMavenArtifact(GetMavenArtifactRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getMavenArtifact(MavenArtifactName name)

  • getMavenArtifact(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getMavenArtifactCallable()

ListNpmPackages

Lists npm packages.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listNpmPackages(ListNpmPackagesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listNpmPackages(RepositoryName parent)

  • listNpmPackages(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listNpmPackagesPagedCallable()

  • listNpmPackagesCallable()

GetNpmPackage

Gets a npm package.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getNpmPackage(GetNpmPackageRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getNpmPackage(NpmPackageName name)

  • getNpmPackage(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getNpmPackageCallable()

ListPythonPackages

Lists python packages.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listPythonPackages(ListPythonPackagesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listPythonPackages(RepositoryName parent)

  • listPythonPackages(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPythonPackagesPagedCallable()

  • listPythonPackagesCallable()

GetPythonPackage

Gets a python package.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getPythonPackage(GetPythonPackageRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getPythonPackage(PythonPackageName name)

  • getPythonPackage(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getPythonPackageCallable()

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • importAptArtifactsAsync(ImportAptArtifactsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • importAptArtifactsOperationCallable()

  • importAptArtifactsCallable()

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • importYumArtifactsAsync(ImportYumArtifactsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • importYumArtifactsOperationCallable()

  • importYumArtifactsCallable()

ListRepositories

Lists repositories.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listRepositories(ListRepositoriesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listRepositories(LocationName parent)

  • listRepositories(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listRepositoriesPagedCallable()

  • listRepositoriesCallable()

GetRepository

Gets a repository.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getRepository(GetRepositoryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getRepository(RepositoryName name)

  • getRepository(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getRepositoryCallable()

CreateRepository

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

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createRepositoryAsync(CreateRepositoryRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createRepositoryAsync(LocationName parent, Repository repository, String repositoryId)

  • createRepositoryAsync(String parent, Repository repository, String repositoryId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createRepositoryOperationCallable()

  • createRepositoryCallable()

UpdateRepository

Updates a repository.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateRepository(UpdateRepositoryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateRepository(Repository repository, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateRepositoryCallable()

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteRepositoryAsync(DeleteRepositoryRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteRepositoryAsync(RepositoryName name)

  • deleteRepositoryAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteRepositoryOperationCallable()

  • deleteRepositoryCallable()

ListPackages

Lists packages.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listPackages(ListPackagesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listPackages(RepositoryName parent)

  • listPackages(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPackagesPagedCallable()

  • listPackagesCallable()

GetPackage

Gets a package.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getPackage(GetPackageRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getPackage(PackageName name)

  • getPackage(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getPackageCallable()

DeletePackage

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

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deletePackageAsync(DeletePackageRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deletePackageAsync(PackageName name)

  • deletePackageAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deletePackageOperationCallable()

  • deletePackageCallable()

ListVersions

Lists versions.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listVersions(ListVersionsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listVersions(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listVersionsPagedCallable()

  • listVersionsCallable()

GetVersion

Gets a version

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getVersion(GetVersionRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getVersion(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getVersionCallable()

DeleteVersion

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

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteVersionAsync(DeleteVersionRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteVersionAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteVersionOperationCallable()

  • deleteVersionCallable()

BatchDeleteVersions

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

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchDeleteVersionsAsync(BatchDeleteVersionsRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • batchDeleteVersionsAsync(PackageName parent, List<String> names)

  • batchDeleteVersionsAsync(String parent, List<String> names)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchDeleteVersionsOperationCallable()

  • batchDeleteVersionsCallable()

ListFiles

Lists files.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listFiles(ListFilesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listFiles(RepositoryName parent)

  • listFiles(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listFilesPagedCallable()

  • listFilesCallable()

GetFile

Gets a file.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getFile(GetFileRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getFile(FileName name)

  • getFile(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getFileCallable()

ListTags

Lists tags.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listTags(ListTagsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listTags(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listTagsPagedCallable()

  • listTagsCallable()

GetTag

Gets a tag.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getTag(GetTagRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getTag(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getTagCallable()

CreateTag

Creates a tag.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createTag(CreateTagRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createTag(String parent, Tag tag, String tagId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createTagCallable()

UpdateTag

Updates a tag.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateTag(UpdateTagRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateTag(Tag tag, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateTagCallable()

DeleteTag

Deletes a tag.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteTag(DeleteTagRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteTag(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteTagCallable()

SetIamPolicy

Updates the IAM policy for a given resource.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • setIamPolicy(SetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setIamPolicyCallable()

GetIamPolicy

Gets the IAM policy for a given resource.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getIamPolicy(GetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIamPolicyCallable()

TestIamPermissions

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

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • testIamPermissions(TestIamPermissionsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • testIamPermissionsCallable()

GetProjectSettings

Retrieves the Settings for the Project.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getProjectSettings(GetProjectSettingsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getProjectSettings(ProjectSettingsName name)

  • getProjectSettings(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getProjectSettingsCallable()

UpdateProjectSettings

Updates the Settings for the Project.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateProjectSettings(UpdateProjectSettingsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateProjectSettings(ProjectSettings projectSettings, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateProjectSettingsCallable()

GetVPCSCConfig

Retrieves the VPCSC Config for the Project.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getVPCSCConfig(GetVPCSCConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getVPCSCConfig(VpcscConfigName name)

  • getVPCSCConfig(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getVPCSCConfigCallable()

UpdateVPCSCConfig

Updates the VPCSC Config for the Project.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateVPCSCConfig(UpdateVPCSCConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateVPCSCConfig(VPCSCConfig vpcscConfig, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateVPCSCConfigCallable()

ListLocations

Lists information about the supported locations for this service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

See the individual methods for example code.

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 parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ArtifactRegistrySettings to create(). For example:

To customize credentials:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ArtifactRegistrySettings artifactRegistrySettings =
     ArtifactRegistrySettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ArtifactRegistryClient artifactRegistryClient =
     ArtifactRegistryClient.create(artifactRegistrySettings);
 

To customize the endpoint:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ArtifactRegistrySettings artifactRegistrySettings =
     ArtifactRegistrySettings.newBuilder().setEndpoint(myEndpoint).build();
 ArtifactRegistryClient artifactRegistryClient =
     ArtifactRegistryClient.create(artifactRegistrySettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ArtifactRegistrySettings artifactRegistrySettings =
     ArtifactRegistrySettings.newHttpJsonBuilder().build();
 ArtifactRegistryClient artifactRegistryClient =
     ArtifactRegistryClient.create(artifactRegistrySettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > ArtifactRegistryClient

Static Methods

create()

public static final ArtifactRegistryClient create()

Constructs an instance of ArtifactRegistryClient with default settings.

Returns
TypeDescription
ArtifactRegistryClient
Exceptions
TypeDescription
IOException

create(ArtifactRegistrySettings settings)

public static final ArtifactRegistryClient create(ArtifactRegistrySettings settings)

Constructs an instance of ArtifactRegistryClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsArtifactRegistrySettings
Returns
TypeDescription
ArtifactRegistryClient
Exceptions
TypeDescription
IOException

create(ArtifactRegistryStub stub)

public static final ArtifactRegistryClient create(ArtifactRegistryStub stub)

Constructs an instance of ArtifactRegistryClient, using the given stub for making calls. This is for advanced usage - prefer using create(ArtifactRegistrySettings).

Parameter
NameDescription
stubArtifactRegistryStub
Returns
TypeDescription
ArtifactRegistryClient

Constructors

ArtifactRegistryClient(ArtifactRegistrySettings settings)

protected ArtifactRegistryClient(ArtifactRegistrySettings settings)

Constructs an instance of ArtifactRegistryClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsArtifactRegistrySettings

ArtifactRegistryClient(ArtifactRegistryStub stub)

protected ArtifactRegistryClient(ArtifactRegistryStub stub)
Parameter
NameDescription
stubArtifactRegistryStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

batchDeleteVersionsAsync(BatchDeleteVersionsRequest request)

public final OperationFuture<Empty,BatchDeleteVersionsMetadata> batchDeleteVersionsAsync(BatchDeleteVersionsRequest request)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   BatchDeleteVersionsRequest request =
       BatchDeleteVersionsRequest.newBuilder()
           .setParent(
               PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]").toString())
           .addAllNames(new ArrayList<String>())
           .setValidateOnly(true)
           .build();
   artifactRegistryClient.batchDeleteVersionsAsync(request).get();
 }
 
Parameter
NameDescription
requestBatchDeleteVersionsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,BatchDeleteVersionsMetadata>

batchDeleteVersionsAsync(PackageName parent, List<String> names)

public final OperationFuture<Empty,BatchDeleteVersionsMetadata> batchDeleteVersionsAsync(PackageName parent, List<String> names)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   PackageName parent = PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]");
   List<String> names = new ArrayList<>();
   artifactRegistryClient.batchDeleteVersionsAsync(parent, names).get();
 }
 
Parameters
NameDescription
parentPackageName

The name of the repository holding all requested versions.

namesList<String>

Required. The names of the versions to delete. A maximum of 10000 versions can be deleted in a batch.

Returns
TypeDescription
OperationFuture<Empty,BatchDeleteVersionsMetadata>

batchDeleteVersionsAsync(String parent, List<String> names)

public final OperationFuture<Empty,BatchDeleteVersionsMetadata> batchDeleteVersionsAsync(String parent, List<String> names)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String parent =
       PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]").toString();
   List<String> names = new ArrayList<>();
   artifactRegistryClient.batchDeleteVersionsAsync(parent, names).get();
 }
 
Parameters
NameDescription
parentString

The name of the repository holding all requested versions.

namesList<String>

Required. The names of the versions to delete. A maximum of 10000 versions can be deleted in a batch.

Returns
TypeDescription
OperationFuture<Empty,BatchDeleteVersionsMetadata>

batchDeleteVersionsCallable()

public final UnaryCallable<BatchDeleteVersionsRequest,Operation> batchDeleteVersionsCallable()

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   BatchDeleteVersionsRequest request =
       BatchDeleteVersionsRequest.newBuilder()
           .setParent(
               PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]").toString())
           .addAllNames(new ArrayList<String>())
           .setValidateOnly(true)
           .build();
   ApiFuture<Operation> future =
       artifactRegistryClient.batchDeleteVersionsCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<BatchDeleteVersionsRequest,Operation>

batchDeleteVersionsOperationCallable()

public final OperationCallable<BatchDeleteVersionsRequest,Empty,BatchDeleteVersionsMetadata> batchDeleteVersionsOperationCallable()

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   BatchDeleteVersionsRequest request =
       BatchDeleteVersionsRequest.newBuilder()
           .setParent(
               PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]").toString())
           .addAllNames(new ArrayList<String>())
           .setValidateOnly(true)
           .build();
   OperationFuture<Empty, BatchDeleteVersionsMetadata> future =
       artifactRegistryClient.batchDeleteVersionsOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<BatchDeleteVersionsRequest,Empty,BatchDeleteVersionsMetadata>

close()

public final void close()

createRepositoryAsync(CreateRepositoryRequest request)

public final OperationFuture<Repository,OperationMetadata> createRepositoryAsync(CreateRepositoryRequest request)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   CreateRepositoryRequest request =
       CreateRepositoryRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setRepositoryId("repositoryId2113747461")
           .setRepository(Repository.newBuilder().build())
           .build();
   Repository response = artifactRegistryClient.createRepositoryAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateRepositoryRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Repository,OperationMetadata>

createRepositoryAsync(LocationName parent, Repository repository, String repositoryId)

public final OperationFuture<Repository,OperationMetadata> createRepositoryAsync(LocationName parent, Repository repository, String repositoryId)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Repository repository = Repository.newBuilder().build();
   String repositoryId = "repositoryId2113747461";
   Repository response =
       artifactRegistryClient.createRepositoryAsync(parent, repository, repositoryId).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The name of the parent resource where the repository will be created.

repositoryRepository

Required. The repository to be created.

repositoryIdString

Required. The repository id to use for this repository.

Returns
TypeDescription
OperationFuture<Repository,OperationMetadata>

createRepositoryAsync(String parent, Repository repository, String repositoryId)

public final OperationFuture<Repository,OperationMetadata> createRepositoryAsync(String parent, Repository repository, String repositoryId)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Repository repository = Repository.newBuilder().build();
   String repositoryId = "repositoryId2113747461";
   Repository response =
       artifactRegistryClient.createRepositoryAsync(parent, repository, repositoryId).get();
 }
 
Parameters
NameDescription
parentString

Required. The name of the parent resource where the repository will be created.

repositoryRepository

Required. The repository to be created.

repositoryIdString

Required. The repository id to use for this repository.

Returns
TypeDescription
OperationFuture<Repository,OperationMetadata>

createRepositoryCallable()

public final UnaryCallable<CreateRepositoryRequest,Operation> createRepositoryCallable()

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   CreateRepositoryRequest request =
       CreateRepositoryRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setRepositoryId("repositoryId2113747461")
           .setRepository(Repository.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       artifactRegistryClient.createRepositoryCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateRepositoryRequest,Operation>

createRepositoryOperationCallable()

public final OperationCallable<CreateRepositoryRequest,Repository,OperationMetadata> createRepositoryOperationCallable()

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   CreateRepositoryRequest request =
       CreateRepositoryRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setRepositoryId("repositoryId2113747461")
           .setRepository(Repository.newBuilder().build())
           .build();
   OperationFuture<Repository, OperationMetadata> future =
       artifactRegistryClient.createRepositoryOperationCallable().futureCall(request);
   // Do something.
   Repository response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateRepositoryRequest,Repository,OperationMetadata>

createTag(CreateTagRequest request)

public final Tag createTag(CreateTagRequest request)

Creates a tag.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   CreateTagRequest request =
       CreateTagRequest.newBuilder()
           .setParent("parent-995424086")
           .setTagId("tagId110119509")
           .setTag(Tag.newBuilder().build())
           .build();
   Tag response = artifactRegistryClient.createTag(request);
 }
 
Parameter
NameDescription
requestCreateTagRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Tag

createTag(String parent, Tag tag, String tagId)

public final Tag createTag(String parent, Tag tag, String tagId)

Creates a tag.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String parent = "parent-995424086";
   Tag tag = Tag.newBuilder().build();
   String tagId = "tagId110119509";
   Tag response = artifactRegistryClient.createTag(parent, tag, tagId);
 }
 
Parameters
NameDescription
parentString

The name of the parent resource where the tag will be created.

tagTag

The tag to be created.

tagIdString

The tag id to use for this repository.

Returns
TypeDescription
Tag

createTagCallable()

public final UnaryCallable<CreateTagRequest,Tag> createTagCallable()

Creates a tag.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   CreateTagRequest request =
       CreateTagRequest.newBuilder()
           .setParent("parent-995424086")
           .setTagId("tagId110119509")
           .setTag(Tag.newBuilder().build())
           .build();
   ApiFuture<Tag> future = artifactRegistryClient.createTagCallable().futureCall(request);
   // Do something.
   Tag response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateTagRequest,Tag>

deletePackageAsync(DeletePackageRequest request)

public final OperationFuture<Empty,OperationMetadata> deletePackageAsync(DeletePackageRequest request)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeletePackageRequest request =
       DeletePackageRequest.newBuilder()
           .setName(
               PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]").toString())
           .build();
   artifactRegistryClient.deletePackageAsync(request).get();
 }
 
Parameter
NameDescription
requestDeletePackageRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deletePackageAsync(PackageName name)

public final OperationFuture<Empty,OperationMetadata> deletePackageAsync(PackageName name)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   PackageName name = PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]");
   artifactRegistryClient.deletePackageAsync(name).get();
 }
 
Parameter
NameDescription
namePackageName

Required. The name of the package to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deletePackageAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deletePackageAsync(String name)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String name =
       PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]").toString();
   artifactRegistryClient.deletePackageAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. The name of the package to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deletePackageCallable()

public final UnaryCallable<DeletePackageRequest,Operation> deletePackageCallable()

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeletePackageRequest request =
       DeletePackageRequest.newBuilder()
           .setName(
               PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]").toString())
           .build();
   ApiFuture<Operation> future =
       artifactRegistryClient.deletePackageCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeletePackageRequest,Operation>

deletePackageOperationCallable()

public final OperationCallable<DeletePackageRequest,Empty,OperationMetadata> deletePackageOperationCallable()

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeletePackageRequest request =
       DeletePackageRequest.newBuilder()
           .setName(
               PackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[PACKAGE]").toString())
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       artifactRegistryClient.deletePackageOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeletePackageRequest,Empty,OperationMetadata>

deleteRepositoryAsync(DeleteRepositoryRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteRepositoryAsync(DeleteRepositoryRequest request)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeleteRepositoryRequest request =
       DeleteRepositoryRequest.newBuilder()
           .setName(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
           .build();
   artifactRegistryClient.deleteRepositoryAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteRepositoryRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteRepositoryAsync(RepositoryName name)

public final OperationFuture<Empty,OperationMetadata> deleteRepositoryAsync(RepositoryName name)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   RepositoryName name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]");
   artifactRegistryClient.deleteRepositoryAsync(name).get();
 }
 
Parameter
NameDescription
nameRepositoryName

Required. The name of the repository to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteRepositoryAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteRepositoryAsync(String name)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString();
   artifactRegistryClient.deleteRepositoryAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. The name of the repository to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteRepositoryCallable()

public final UnaryCallable<DeleteRepositoryRequest,Operation> deleteRepositoryCallable()

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeleteRepositoryRequest request =
       DeleteRepositoryRequest.newBuilder()
           .setName(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
           .build();
   ApiFuture<Operation> future =
       artifactRegistryClient.deleteRepositoryCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteRepositoryRequest,Operation>

deleteRepositoryOperationCallable()

public final OperationCallable<DeleteRepositoryRequest,Empty,OperationMetadata> deleteRepositoryOperationCallable()

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeleteRepositoryRequest request =
       DeleteRepositoryRequest.newBuilder()
           .setName(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       artifactRegistryClient.deleteRepositoryOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteRepositoryRequest,Empty,OperationMetadata>

deleteTag(DeleteTagRequest request)

public final void deleteTag(DeleteTagRequest request)

Deletes a tag.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeleteTagRequest request = DeleteTagRequest.newBuilder().setName("name3373707").build();
   artifactRegistryClient.deleteTag(request);
 }
 
Parameter
NameDescription
requestDeleteTagRequest

The request object containing all of the parameters for the API call.

deleteTag(String name)

public final void deleteTag(String name)

Deletes a tag.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String name = "name3373707";
   artifactRegistryClient.deleteTag(name);
 }
 
Parameter
NameDescription
nameString

The name of the tag to delete.

deleteTagCallable()

public final UnaryCallable<DeleteTagRequest,Empty> deleteTagCallable()

Deletes a tag.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeleteTagRequest request = DeleteTagRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Empty> future = artifactRegistryClient.deleteTagCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteTagRequest,Empty>

deleteVersionAsync(DeleteVersionRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteVersionAsync(DeleteVersionRequest request)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeleteVersionRequest request =
       DeleteVersionRequest.newBuilder().setName("name3373707").setForce(true).build();
   artifactRegistryClient.deleteVersionAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteVersionRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteVersionAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteVersionAsync(String name)

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String name = "name3373707";
   artifactRegistryClient.deleteVersionAsync(name).get();
 }
 
Parameter
NameDescription
nameString

The name of the version to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteVersionCallable()

public final UnaryCallable<DeleteVersionRequest,Operation> deleteVersionCallable()

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeleteVersionRequest request =
       DeleteVersionRequest.newBuilder().setName("name3373707").setForce(true).build();
   ApiFuture<Operation> future =
       artifactRegistryClient.deleteVersionCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteVersionRequest,Operation>

deleteVersionOperationCallable()

public final OperationCallable<DeleteVersionRequest,Empty,OperationMetadata> deleteVersionOperationCallable()

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

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DeleteVersionRequest request =
       DeleteVersionRequest.newBuilder().setName("name3373707").setForce(true).build();
   OperationFuture<Empty, OperationMetadata> future =
       artifactRegistryClient.deleteVersionOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteVersionRequest,Empty,OperationMetadata>

getDockerImage(DockerImageName name)

public final DockerImage getDockerImage(DockerImageName name)

Gets a docker image.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   DockerImageName name =
       DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]");
   DockerImage response = artifactRegistryClient.getDockerImage(name);
 }
 
Parameter
NameDescription
nameDockerImageName

Required. The name of the docker images.

Returns
TypeDescription
DockerImage

getDockerImage(GetDockerImageRequest request)

public final DockerImage getDockerImage(GetDockerImageRequest request)

Gets a docker image.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetDockerImageRequest request =
       GetDockerImageRequest.newBuilder()
           .setName(
               DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
                   .toString())
           .build();
   DockerImage response = artifactRegistryClient.getDockerImage(request);
 }
 
Parameter
NameDescription
requestGetDockerImageRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
DockerImage

getDockerImage(String name)

public final DockerImage getDockerImage(String name)

Gets a docker image.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String name =
       DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
           .toString();
   DockerImage response = artifactRegistryClient.getDockerImage(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the docker images.

Returns
TypeDescription
DockerImage

getDockerImageCallable()

public final UnaryCallable<GetDockerImageRequest,DockerImage> getDockerImageCallable()

Gets a docker image.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetDockerImageRequest request =
       GetDockerImageRequest.newBuilder()
           .setName(
               DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
                   .toString())
           .build();
   ApiFuture<DockerImage> future =
       artifactRegistryClient.getDockerImageCallable().futureCall(request);
   // Do something.
   DockerImage response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetDockerImageRequest,DockerImage>

getFile(FileName name)

public final File getFile(FileName name)

Gets a file.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   FileName name = FileName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[FILE]");
   File response = artifactRegistryClient.getFile(name);
 }
 
Parameter
NameDescription
nameFileName

Required. The name of the file to retrieve.

Returns
TypeDescription
File

getFile(GetFileRequest request)

public final File getFile(GetFileRequest request)

Gets a file.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetFileRequest request =
       GetFileRequest.newBuilder()
           .setName(FileName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[FILE]").toString())
           .build();
   File response = artifactRegistryClient.getFile(request);
 }
 
Parameter
NameDescription
requestGetFileRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
File

getFile(String name)

public final File getFile(String name)

Gets a file.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String name = FileName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[FILE]").toString();
   File response = artifactRegistryClient.getFile(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the file to retrieve.

Returns
TypeDescription
File

getFileCallable()

public final UnaryCallable<GetFileRequest,File> getFileCallable()

Gets a file.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetFileRequest request =
       GetFileRequest.newBuilder()
           .setName(FileName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[FILE]").toString())
           .build();
   ApiFuture<File> future = artifactRegistryClient.getFileCallable().futureCall(request);
   // Do something.
   File response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetFileRequest,File>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getIamPolicy(GetIamPolicyRequest request)

public final Policy getIamPolicy(GetIamPolicyRequest request)

Gets the IAM policy for a given resource.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   Policy response = artifactRegistryClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.GetIamPolicyRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
com.google.iam.v1.Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()

Gets the IAM policy for a given resource.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   ApiFuture<Policy> future = artifactRegistryClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = artifactRegistryClient.getLocation(request);
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = artifactRegistryClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getMavenArtifact(GetMavenArtifactRequest request)

public final MavenArtifact getMavenArtifact(GetMavenArtifactRequest request)

Gets a maven artifact.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetMavenArtifactRequest request =
       GetMavenArtifactRequest.newBuilder()
           .setName(
               MavenArtifactName.of(
                       "[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[MAVEN_ARTIFACT]")
                   .toString())
           .build();
   MavenArtifact response = artifactRegistryClient.getMavenArtifact(request);
 }
 
Parameter
NameDescription
requestGetMavenArtifactRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
MavenArtifact

getMavenArtifact(MavenArtifactName name)

public final MavenArtifact getMavenArtifact(MavenArtifactName name)

Gets a maven artifact.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   MavenArtifactName name =
       MavenArtifactName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[MAVEN_ARTIFACT]");
   MavenArtifact response = artifactRegistryClient.getMavenArtifact(name);
 }
 
Parameter
NameDescription
nameMavenArtifactName

Required. The name of the maven artifact.

Returns
TypeDescription
MavenArtifact

getMavenArtifact(String name)

public final MavenArtifact getMavenArtifact(String name)

Gets a maven artifact.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String name =
       MavenArtifactName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[MAVEN_ARTIFACT]")
           .toString();
   MavenArtifact response = artifactRegistryClient.getMavenArtifact(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the maven artifact.

Returns
TypeDescription
MavenArtifact

getMavenArtifactCallable()

public final UnaryCallable<GetMavenArtifactRequest,MavenArtifact> getMavenArtifactCallable()

Gets a maven artifact.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetMavenArtifactRequest request =
       GetMavenArtifactRequest.newBuilder()
           .setName(
               MavenArtifactName.of(
                       "[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[MAVEN_ARTIFACT]")
                   .toString())
           .build();
   ApiFuture<MavenArtifact> future =
       artifactRegistryClient.getMavenArtifactCallable().futureCall(request);
   // Do something.
   MavenArtifact response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetMavenArtifactRequest,MavenArtifact>

getNpmPackage(GetNpmPackageRequest request)

public final NpmPackage getNpmPackage(GetNpmPackageRequest request)

Gets a npm package.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetNpmPackageRequest request =
       GetNpmPackageRequest.newBuilder()
           .setName(
               NpmPackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[NPM_PACKAGE]")
                   .toString())
           .build();
   NpmPackage response = artifactRegistryClient.getNpmPackage(request);
 }
 
Parameter
NameDescription
requestGetNpmPackageRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
NpmPackage

getNpmPackage(NpmPackageName name)

public final NpmPackage getNpmPackage(NpmPackageName name)

Gets a npm package.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   NpmPackageName name =
       NpmPackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[NPM_PACKAGE]");
   NpmPackage response = artifactRegistryClient.getNpmPackage(name);
 }
 
Parameter
NameDescription
nameNpmPackageName

Required. The name of the npm package.

Returns
TypeDescription
NpmPackage

getNpmPackage(String name)

public final NpmPackage getNpmPackage(String name)

Gets a npm package.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   String name =
       NpmPackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[NPM_PACKAGE]").toString();
   NpmPackage response = artifactRegistryClient.getNpmPackage(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the npm package.

Returns
TypeDescription
NpmPackage

getNpmPackageCallable()

public final UnaryCallable<GetNpmPackageRequest,NpmPackage> getNpmPackageCallable()

Gets a npm package.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
   GetNpmPackageRequest request =
       GetNpmPackageRequest.newBuilder()
           .setName(
               NpmPackageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[NPM_PACKAGE]")
                   .toString())
           .build();
   ApiFuture<NpmPackage> future =
       artifactRegistryClient.getNpmPackageCallable().futureCall(request);
   // Do something.
   NpmPackage response = future.get();