- 1.54.0 (latest)
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.36.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.9
- 1.1.1
- 0.5.0
- 0.4.0
public class ArtifactRegistryClient implements BackgroundResource
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:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
RepositoryName name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]");
Repository response = artifactRegistryClient.getRepository(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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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:
ArtifactRegistrySettings artifactRegistrySettings =
ArtifactRegistrySettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ArtifactRegistryClient artifactRegistryClient =
ArtifactRegistryClient.create(artifactRegistrySettings);
To customize the endpoint:
ArtifactRegistrySettings artifactRegistrySettings =
ArtifactRegistrySettings.newBuilder().setEndpoint(myEndpoint).build();
ArtifactRegistryClient artifactRegistryClient =
ArtifactRegistryClient.create(artifactRegistrySettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceConstructors
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.
Name | Description |
settings | ArtifactRegistrySettings |
ArtifactRegistryClient(ArtifactRegistryStub stub)
protected ArtifactRegistryClient(ArtifactRegistryStub stub)
Name | Description |
stub | ArtifactRegistryStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
create()
public static final ArtifactRegistryClient create()
Constructs an instance of ArtifactRegistryClient with default settings.
Type | Description |
ArtifactRegistryClient |
Type | Description |
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.
Name | Description |
settings | ArtifactRegistrySettings |
Type | Description |
ArtifactRegistryClient |
Type | Description |
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).
Name | Description |
stub | ArtifactRegistryStub |
Type | Description |
ArtifactRegistryClient |
getRepository(GetRepositoryRequest request)
public final Repository getRepository(GetRepositoryRequest request)
Gets a repository.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
GetRepositoryRequest request =
GetRepositoryRequest.newBuilder()
.setName(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
.build();
Repository response = artifactRegistryClient.getRepository(request);
}
Name | Description |
request | GetRepositoryRequest The request object containing all of the parameters for the API call. |
Type | Description |
Repository |
getRepository(RepositoryName name)
public final Repository getRepository(RepositoryName name)
Gets a repository.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
RepositoryName name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]");
Repository response = artifactRegistryClient.getRepository(name);
}
Name | Description |
name | RepositoryName Required. The name of the repository to retrieve. |
Type | Description |
Repository |
getRepository(String name)
public final Repository getRepository(String name)
Gets a repository.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
String name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString();
Repository response = artifactRegistryClient.getRepository(name);
}
Name | Description |
name | String Required. The name of the repository to retrieve. |
Type | Description |
Repository |
getRepositoryCallable()
public final UnaryCallable<GetRepositoryRequest,Repository> getRepositoryCallable()
Gets a repository.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
GetRepositoryRequest request =
GetRepositoryRequest.newBuilder()
.setName(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
.build();
ApiFuture<Repository> future =
artifactRegistryClient.getRepositoryCallable().futureCall(request);
// Do something.
Repository response = future.get();
}
Type | Description |
UnaryCallable<GetRepositoryRequest,Repository> |
getSettings()
public final ArtifactRegistrySettings getSettings()
Type | Description |
ArtifactRegistrySettings |
getStub()
public ArtifactRegistryStub getStub()
Type | Description |
ArtifactRegistryStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listDockerImages(ListDockerImagesRequest request)
public final ArtifactRegistryClient.ListDockerImagesPagedResponse listDockerImages(ListDockerImagesRequest request)
Lists docker images.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
ListDockerImagesRequest request =
ListDockerImagesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (DockerImage element : artifactRegistryClient.listDockerImages(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListDockerImagesRequest The request object containing all of the parameters for the API call. |
Type | Description |
ArtifactRegistryClient.ListDockerImagesPagedResponse |
listDockerImages(String parent)
public final ArtifactRegistryClient.ListDockerImagesPagedResponse listDockerImages(String parent)
Lists docker images.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
String parent = "parent-995424086";
for (DockerImage element : artifactRegistryClient.listDockerImages(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The name of the parent resource whose docker images will be listed. |
Type | Description |
ArtifactRegistryClient.ListDockerImagesPagedResponse |
listDockerImagesCallable()
public final UnaryCallable<ListDockerImagesRequest,ListDockerImagesResponse> listDockerImagesCallable()
Lists docker images.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
ListDockerImagesRequest request =
ListDockerImagesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListDockerImagesResponse response =
artifactRegistryClient.listDockerImagesCallable().call(request);
for (DockerImage element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListDockerImagesRequest,ListDockerImagesResponse> |
listDockerImagesPagedCallable()
public final UnaryCallable<ListDockerImagesRequest,ArtifactRegistryClient.ListDockerImagesPagedResponse> listDockerImagesPagedCallable()
Lists docker images.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
ListDockerImagesRequest request =
ListDockerImagesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture
Type | Description |
UnaryCallable<ListDockerImagesRequest,ListDockerImagesPagedResponse> |
listRepositories(ListRepositoriesRequest request)
public final ArtifactRegistryClient.ListRepositoriesPagedResponse listRepositories(ListRepositoriesRequest request)
Lists repositories.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
ListRepositoriesRequest request =
ListRepositoriesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Repository element : artifactRegistryClient.listRepositories(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListRepositoriesRequest The request object containing all of the parameters for the API call. |
Type | Description |
ArtifactRegistryClient.ListRepositoriesPagedResponse |
listRepositories(LocationName parent)
public final ArtifactRegistryClient.ListRepositoriesPagedResponse listRepositories(LocationName parent)
Lists repositories.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Repository element : artifactRegistryClient.listRepositories(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | LocationName Required. The name of the parent resource whose repositories will be listed. |
Type | Description |
ArtifactRegistryClient.ListRepositoriesPagedResponse |
listRepositories(String parent)
public final ArtifactRegistryClient.ListRepositoriesPagedResponse listRepositories(String parent)
Lists repositories.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Repository element : artifactRegistryClient.listRepositories(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The name of the parent resource whose repositories will be listed. |
Type | Description |
ArtifactRegistryClient.ListRepositoriesPagedResponse |
listRepositoriesCallable()
public final UnaryCallable<ListRepositoriesRequest,ListRepositoriesResponse> listRepositoriesCallable()
Lists repositories.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
ListRepositoriesRequest request =
ListRepositoriesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListRepositoriesResponse response =
artifactRegistryClient.listRepositoriesCallable().call(request);
for (Repository element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListRepositoriesRequest,ListRepositoriesResponse> |
listRepositoriesPagedCallable()
public final UnaryCallable<ListRepositoriesRequest,ArtifactRegistryClient.ListRepositoriesPagedResponse> listRepositoriesPagedCallable()
Lists repositories.
Sample code:
try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
ListRepositoriesRequest request =
ListRepositoriesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Repository> future =
artifactRegistryClient.listRepositoriesPagedCallable().futureCall(request);
// Do something.
for (Repository element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListRepositoriesRequest,ListRepositoriesPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()