Package org.gitlab4j.api
Class ContainerRegistryApi
java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.ContainerRegistryApi
- All Implemented Interfaces:
Constants
This class implements the client side API for the GitLab Container Registry API. See Container Registry API at GitLab for more information.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gitlab4j.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.AutoDevopsDeployStrategy, Constants.BuildGitStrategy, Constants.CommitBuildState, Constants.ContributorOrderBy, Constants.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, Constants.EventScope, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PackageOrderBy, Constants.PackageStatus, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.SquashOption, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
-
Field Summary
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
Fields inherited from interface org.gitlab4j.api.Constants
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteRepository
(Object projectIdOrPath, Long repositoryId) Delete a repository in registry.void
deleteRepositoryTag
(Object projectIdOrPath, Long repositoryId, String tagName) Delete a registry repository tag.void
deleteRepositoryTags
(Object projectIdOrPath, Long repositoryId, String nameRegex, Integer keepN, String olderThan) Delete repository tags in bulk based on given criteria.getOptionalRepositoryTag
(Object projectIdOrPath, Long repositoryId, String tagName) Get details of a registry repository tag as the value of an Optional.getRepositories
(Object projectIdOrPath) Get a list of registry repositories in a project.getRepositories
(Object projectIdOrPath, int itemsPerPage) Get a Pager of registry repositories in a project.getRepositories
(Object projectIdOrPath, int page, int perPage) Get a list of registry repositories in a project that fall within the specified page parameters.getRepositoriesStream
(Object projectIdOrPath) Get a Stream of registry repositories in a project.getRepositoryTag
(Object projectIdOrPath, Long repositoryId, String tagName) Get details of a registry repository tag.getRepositoryTags
(Object projectIdOrPath, Long repositoryId) Get a list of tags for given registry repository.getRepositoryTags
(Object projectIdOrPath, Long repositoryId, int itemsPerPage) Get a Pager of tags for given registry repository.getRepositoryTagsStream
(Object projectIdOrPath, Long repositoryId) Get a Stream of tags for given registry repository.Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
Constructor Details
-
ContainerRegistryApi
-
-
Method Details
-
getRepositories
Get a list of registry repositories in a project.GitLab Endpoint: GET /projects/:id/registry/repositories
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a list of pages in the project's registry repositories
- Throws:
GitLabApiException
- if any exception occurs
-
getRepositories
public List<RegistryRepository> getRepositories(Object projectIdOrPath, int page, int perPage) throws GitLabApiException Get a list of registry repositories in a project that fall within the specified page parameters.GitLab Endpoint: GET /projects/:id/registry/repositories
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancepage
- the page to getperPage
- the number of Package instances per page- Returns:
- a list of registry repositories for the specified range
- Throws:
GitLabApiException
- if any exception occurs
-
getRepositories
public Pager<RegistryRepository> getRepositories(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException Get a Pager of registry repositories in a project.GitLab Endpoint: GET /projects/:id/registry/repositories
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceitemsPerPage
- the number of RegistryRepository instances per page- Returns:
- a Pager of registry repositories for the specified range
- Throws:
GitLabApiException
- if any exception occurs
-
getRepositoriesStream
public Stream<RegistryRepository> getRepositoriesStream(Object projectIdOrPath) throws GitLabApiException Get a Stream of registry repositories in a project.GitLab Endpoint: GET /projects/:id/registry/repositories
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a Stream of pages in the project's registry repositories
- Throws:
GitLabApiException
- if any exception occurs
-
deleteRepository
Delete a repository in registry.This operation is executed asynchronously and might take some time to get executed.
GitLab Endpoint: DELETE /projects/:id/registry/repositories/:repository_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancerepositoryId
- the ID of registry repository- Throws:
GitLabApiException
- if any exception occurs
-
getRepositoryTags
public List<RegistryRepositoryTag> getRepositoryTags(Object projectIdOrPath, Long repositoryId) throws GitLabApiException Get a list of tags for given registry repository.GitLab Endpoint: GET /projects/:id/registry/repositories/:repository_id/tags
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancerepositoryId
- the ID of registry repository- Returns:
- a list of Repository Tags for the specified repository ID
- Throws:
GitLabApiException
- if any exception occurs
-
getRepositoryTags
public Pager<RegistryRepositoryTag> getRepositoryTags(Object projectIdOrPath, Long repositoryId, int itemsPerPage) throws GitLabApiException Get a Pager of tags for given registry repository.GitLab Endpoint: GET /projects/:id/registry/repositories/:repository_id/tags
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancerepositoryId
- the ID of registry repositoryitemsPerPage
- the number of RegistryRepositoryTag instances per page- Returns:
- a Pager of Repository Tags for the specified repository ID
- Throws:
GitLabApiException
- if any exception occurs
-
getRepositoryTagsStream
public Stream<RegistryRepositoryTag> getRepositoryTagsStream(Object projectIdOrPath, Long repositoryId) throws GitLabApiException Get a Stream of tags for given registry repository.GitLab Endpoint: GET /projects/:id/registry/repositories/:repository_id/tags
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancerepositoryId
- the ID of registry repository- Returns:
- a list of Repository Tags for the specified repository ID
- Throws:
GitLabApiException
- if any exception occurs
-
getRepositoryTag
public RegistryRepositoryTag getRepositoryTag(Object projectIdOrPath, Long repositoryId, String tagName) throws GitLabApiException Get details of a registry repository tag.GitLab Endpoint: GET /projects/:id/registry/repositories/:repository_id/tags/:tag_name
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancerepositoryId
- the ID of registry repositorytagName
- the name of tag- Returns:
- the Repository Tag for the specified repository ID
- Throws:
GitLabApiException
- if any exception occurs
-
getOptionalRepositoryTag
public Optional<RegistryRepositoryTag> getOptionalRepositoryTag(Object projectIdOrPath, Long repositoryId, String tagName) Get details of a registry repository tag as the value of an Optional.GitLab Endpoint: GET /projects/:id/registry/repositories/:repository_id/tags/:tag_name
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancerepositoryId
- the ID of registry repositorytagName
- the name of tag- Returns:
- the Repository Tag for the specified repository ID as the value of the Optional
-
deleteRepositoryTag
public void deleteRepositoryTag(Object projectIdOrPath, Long repositoryId, String tagName) throws GitLabApiException Delete a registry repository tag.GitLab Endpoint: DELETE /projects/:id/registry/repositories/:repository_id/tags/:tag_name
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancerepositoryId
- the ID of registry repositorytagName
- the name of the tag to delete- Throws:
GitLabApiException
- if any exception occurs
-
deleteRepositoryTags
public void deleteRepositoryTags(Object projectIdOrPath, Long repositoryId, String nameRegex, Integer keepN, String olderThan) throws GitLabApiException Delete repository tags in bulk based on given criteria.GitLab Endpoint: DELETE /projects/:id/registry/repositories/:repository_id/tags
This API call performs the following operations:
- It orders all tags by creation date. The creation date is the time of the manifest creation, not the time of tag push.
- It removes only the tags matching the given name_regex.
- It never removes the tag named latest.
- It keeps N latest matching tags (if keep_n is specified).
- It only removes tags that are older than X amount of time (if older_than is specified).
- It schedules the asynchronous job to be executed in the background.
These operations are executed asynchronously and it might take time to get executed. You can run this at most once an hour for a given container repository.
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancerepositoryId
- the ID of registry repositorynameRegex
- the regex of the name to delete. To delete all tags specify.*
.keepN
- the amount of latest tags of given name to keep.olderThan
- tags to delete that are older than the given time, written in human readable form1h
,1d
,1month
.- Throws:
GitLabApiException
- if any exception occurs
-