Package org.gitlab4j.api
Class DeployTokensApi
java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.DeployTokensApi
- All Implemented Interfaces:
Constants
This class implements the client side API for the GitLab Deploy Tokens API calls.
See https://docs.gitlab.com/ee/api/deploy_tokens.html
Since GitLab 12.9
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddGroupDeployToken
(Object groupIdOrPath, String name, Date expiresAt, String username, List<Constants.DeployTokenScope> scopes) Creates a new deploy token for a group.addProjectDeployToken
(Object projectIdOrPath, String name, Date expiresAt, String username, List<Constants.DeployTokenScope> scopes) Creates a new deploy token for a project.void
deleteGroupDeployToken
(Object groupIdOrPath, Long tokenId) Removes a deploy token from the group.void
deleteProjectDeployToken
(Object projectIdOrPath, Long tokenId) Removes a deploy token from the group.Get a list of all deploy tokens across the GitLab instance.getDeployTokens
(int itemsPerPage) Get a Pager of all deploy tokens across all projects of the GitLab instance.Get a Stream of all deploy tokens across all projects of the GitLab instance.getGroupDeployTokens
(Object groupIdOrPath) Get a list of the deploy tokens for the specified group.getGroupDeployTokens
(Object groupIdOrPath, int itemsPerPage) Get a Pager of the deploy tokens for the specified group.getGroupDeployTokensStream
(Object groupIdOrPath) Get a list of the deploy tokens for the specified group.getProjectDeployTokens
(Object projectIdOrPath) Get a list of the deploy tokens for the specified project.getProjectDeployTokens
(Object projectIdOrPath, int itemsPerPage) Get a Pager of the deploy tokens for the specified project.getProjectDeployTokensStream
(Object projectIdOrPath) Get a list of the deploy tokens for the specified project.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
-
DeployTokensApi
-
-
Method Details
-
getDeployTokens
Get a list of all deploy tokens across the GitLab instance. This endpoint requires admin access.GitLab Endpoint: GET /deploy_tokens
- Returns:
- a list of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
getDeployTokens
Get a Pager of all deploy tokens across all projects of the GitLab instance. This method requires admin access.GitLab Endpoint: GET /deploy_tokens
- Parameters:
itemsPerPage
- the number of DeployToken instances that will be fetched per page- Returns:
- a Pager of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
getDeployTokensStream
Get a Stream of all deploy tokens across all projects of the GitLab instance. This method requires admin access.GitLab Endpoint: GET /deploy_tokens
- Returns:
- a list of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
getProjectDeployTokens
Get a list of the deploy tokens for the specified project. This method requires admin access.GitLab Endpoint: GET /projects/:id/deploy_tokens
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a list of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
getProjectDeployTokens
public Pager<DeployToken> getProjectDeployTokens(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException Get a Pager of the deploy tokens for the specified project. This method requires admin access.GitLab Endpoint: GET /projects/:id/deploy_tokens
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance@param projectId the ID of the projectitemsPerPage
- the number of DeployToken instances that will be fetched per page- Returns:
- a Pager of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
getProjectDeployTokensStream
public Stream<DeployToken> getProjectDeployTokensStream(Object projectIdOrPath) throws GitLabApiException Get a list of the deploy tokens for the specified project. This method requires admin access.GitLab Endpoint: GET /projects/:id/deploy_tokens
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a list of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
addProjectDeployToken
public DeployToken addProjectDeployToken(Object projectIdOrPath, String name, Date expiresAt, String username, List<Constants.DeployTokenScope> scopes) throws GitLabApiException Creates a new deploy token for a project.GitLab Endpoint: POST /projects/:id/deploy_tokens
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the new deploy token’s name, requiredexpiresAt
- expiration date for the deploy token. Currently documented as not required but api fails if not provided. Does not expire if no value is provided.username
- the username for deploy token. Currently documented as not required but api fails if not provided. Default is gitlab+deploy-token-{n}scopes
- indicates the deploy token scopes. Must be at least one ofConstants.DeployTokenScope
.- Returns:
- an DeployToken instance with info on the added deploy token
- Throws:
GitLabApiException
- if any exception occurs
-
deleteProjectDeployToken
public void deleteProjectDeployToken(Object projectIdOrPath, Long tokenId) throws GitLabApiException Removes a deploy token from the group.GitLab Endpoint: DELETE /projects/:id/deploy_tokens/:token_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancetokenId
- the ID of the deploy token to delete- Throws:
GitLabApiException
- if any exception occurs
-
getGroupDeployTokens
Get a list of the deploy tokens for the specified group. This method requires admin access.GitLab Endpoint: GET /groups/:id/deploy_tokens
- Parameters:
groupIdOrPath
- the group in the form of an Long(ID), String(path), or Group instance- Returns:
- a list of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
getGroupDeployTokens
public Pager<DeployToken> getGroupDeployTokens(Object groupIdOrPath, int itemsPerPage) throws GitLabApiException Get a Pager of the deploy tokens for the specified group. This method requires admin access.GitLab Endpoint: GET /groups/:id/deploy_tokens
- Parameters:
groupIdOrPath
- the group in the form of an Long(ID), String(path), or Group instance@param groupId the ID of the groupitemsPerPage
- the number of DeployToken instances that will be fetched per page- Returns:
- a Pager of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
getGroupDeployTokensStream
public Stream<DeployToken> getGroupDeployTokensStream(Object groupIdOrPath) throws GitLabApiException Get a list of the deploy tokens for the specified group. This method requires admin access.GitLab Endpoint: GET /groups/:id/deploy_tokens
- Parameters:
groupIdOrPath
- the group in the form of an Long(ID), String(path), or Group instance- Returns:
- a list of DeployToken
- Throws:
GitLabApiException
- if any exception occurs
-
addGroupDeployToken
public DeployToken addGroupDeployToken(Object groupIdOrPath, String name, Date expiresAt, String username, List<Constants.DeployTokenScope> scopes) throws GitLabApiException Creates a new deploy token for a group.GitLab Endpoint: POST /groups/:id/deploy_tokens
- Parameters:
groupIdOrPath
- the group in the form of an Long(ID), String(path), or Group instancename
- the new deploy token’s name, requiredexpiresAt
- expiration date for the deploy token. Currently documented as not required but api fails if not provided. Does not expire if no value is provided.username
- the username for deploy token. Currently documented as not required but api fails if not provided. Default is gitlab+deploy-token-{n}scopes
- indicates the deploy token scopes. Must be at least one ofConstants.DeployTokenScope
.- Returns:
- an DeployToken instance with info on the added deploy token
- Throws:
GitLabApiException
- if any exception occurs
-
deleteGroupDeployToken
Removes a deploy token from the group.GitLab Endpoint: DELETE /groups/:id/deploy_tokens/:token_id
- Parameters:
groupIdOrPath
- the group in the form of an Long(ID), String(path), or Group instancetokenId
- the ID of the deploy token to delete- Throws:
GitLabApiException
- if any exception occurs
-