Package org.gitlab4j.api
Class ContainerRegistryApi
java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.ContainerRegistryApi
- All Implemented Interfaces:
Constants
public class ContainerRegistryApi extends AbstractApi
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.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, 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.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
Constructors Constructor Description ContainerRegistryApi(GitLabApi gitLabApi)
-
Method Summary
Modifier and Type Method Description void
deleteRepository(Object projectIdOrPath, Integer repositoryId)
Delete a repository in registry.void
deleteRepositoryTag(Object projectIdOrPath, Integer repositoryId, String tagName)
Delete a registry repository tag.void
deleteRepositoryTags(Object projectIdOrPath, Integer repositoryId, String nameRegex, Integer keepN, String olderThan)
Delete repository tags in bulk based on given criteria.Optional<RegistryRepositoryTag>
getOptionalRepositoryTag(Object projectIdOrPath, Integer repositoryId, String tagName)
Get details of a registry repository tag as the value of an Optional.List<RegistryRepository>
getRepositories(Object projectIdOrPath)
Get a list of registry repositories in a project.Pager<RegistryRepository>
getRepositories(Object projectIdOrPath, int itemsPerPage)
Get a Pager of registry repositories in a project.List<RegistryRepository>
getRepositories(Object projectIdOrPath, int page, int perPage)
Get a list of registry repositories in a project that fall within the specified page parameters.Stream<RegistryRepository>
getRepositoriesStream(Object projectIdOrPath)
Get a Stream of registry repositories in a project.RegistryRepositoryTag
getRepositoryTag(Object projectIdOrPath, Integer repositoryId, String tagName)
Get details of a registry repository tag.List<RegistryRepositoryTag>
getRepositoryTags(Object projectIdOrPath, Integer repositoryId)
Get a list of tags for given registry repository.Pager<RegistryRepositoryTag>
getRepositoryTags(Object projectIdOrPath, Integer repositoryId, int itemsPerPage)
Get a Pager of tags for given registry repository.Stream<RegistryRepositoryTag>
getRepositoryTagsStream(Object projectIdOrPath, Integer 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, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, 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 Integer(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 GitLabApiExceptionGet 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 Integer(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 GitLabApiExceptionGet a Pager of registry repositories in a project.GitLab Endpoint: GET /projects/:id/registry/repositories
- Parameters:
projectIdOrPath
- the project in the form of an Integer(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 GitLabApiExceptionGet a Stream of registry repositories in a project.GitLab Endpoint: GET /projects/:id/registry/repositories
- Parameters:
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instance- Returns:
- a Stream of pages in the project's registry repositories
- Throws:
GitLabApiException
- if any exception occurs
-
deleteRepository
public void deleteRepository(Object projectIdOrPath, Integer repositoryId) throws GitLabApiExceptionDelete 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 Integer(ID), String(path), or Project instancerepositoryId
- the ID of registry repository- Throws:
GitLabApiException
- if any exception occurs
-
getRepositoryTags
public List<RegistryRepositoryTag> getRepositoryTags(Object projectIdOrPath, Integer repositoryId) throws GitLabApiExceptionGet 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 Integer(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, Integer repositoryId, int itemsPerPage) throws GitLabApiExceptionGet 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 Integer(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, Integer repositoryId) throws GitLabApiExceptionGet 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 Integer(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, Integer repositoryId, String tagName) throws GitLabApiExceptionGet 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 Integer(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, Integer 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 Integer(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, Integer repositoryId, String tagName) throws GitLabApiExceptionDelete 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 Integer(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, Integer repositoryId, String nameRegex, Integer keepN, String olderThan) throws GitLabApiExceptionDelete 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 Integer(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
-