Class DeployTokensApi

  • All Implemented Interfaces:
    org.gitlab4j.models.Constants

    public class DeployTokensApi
    extends AbstractApi
    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.models.Constants

        org.gitlab4j.models.Constants.ActionType, org.gitlab4j.models.Constants.ApplicationScope, org.gitlab4j.models.Constants.ArchiveFormat, org.gitlab4j.models.Constants.AutoDevopsDeployStrategy, org.gitlab4j.models.Constants.BuildGitStrategy, org.gitlab4j.models.Constants.CommitBuildState, org.gitlab4j.models.Constants.ContributorOrderBy, org.gitlab4j.models.Constants.DefaultBranchProtectionLevel, org.gitlab4j.models.Constants.DeploymentOrderBy, org.gitlab4j.models.Constants.DeploymentStatus, org.gitlab4j.models.Constants.DeployTokenScope, org.gitlab4j.models.Constants.Encoding, org.gitlab4j.models.Constants.EpicOrderBy, org.gitlab4j.models.Constants.EventScope, org.gitlab4j.models.Constants.GroupOrderBy, org.gitlab4j.models.Constants.GroupSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.ImpersonationState, org.gitlab4j.models.Constants.IssueOrderBy, org.gitlab4j.models.Constants.IssueScope, org.gitlab4j.models.Constants.IssueState, org.gitlab4j.models.Constants.JobScope, org.gitlab4j.models.Constants.LineType, org.gitlab4j.models.Constants.MergeRequestOrderBy, org.gitlab4j.models.Constants.MergeRequestScope, org.gitlab4j.models.Constants.MergeRequestSearchIn, org.gitlab4j.models.Constants.MergeRequestState, org.gitlab4j.models.Constants.MilestoneState, org.gitlab4j.models.Constants.PackageOrderBy, org.gitlab4j.models.Constants.PackageStatus, org.gitlab4j.models.Constants.PipelineOrderBy, org.gitlab4j.models.Constants.PipelineScope, org.gitlab4j.models.Constants.PipelineSource, org.gitlab4j.models.Constants.ProjectAccessTokenScope, org.gitlab4j.models.Constants.ProjectCreationLevel, org.gitlab4j.models.Constants.ProjectOrderBy, org.gitlab4j.models.Constants.ProjectSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SortOrder, org.gitlab4j.models.Constants.SquashOption, org.gitlab4j.models.Constants.StateEvent, org.gitlab4j.models.Constants.SubgroupCreationLevel, org.gitlab4j.models.Constants.TagOrderBy, org.gitlab4j.models.Constants.TargetType, org.gitlab4j.models.Constants.TodoAction, org.gitlab4j.models.Constants.TodoState, org.gitlab4j.models.Constants.TodoType, org.gitlab4j.models.Constants.TokenType
    • Field Summary

      • Fields inherited from interface org.gitlab4j.models.Constants

        NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
    • Constructor Detail

      • DeployTokensApi

        public DeployTokensApi​(GitLabApi gitLabApi)
    • Method Detail

      • getDeployTokens

        public java.util.List<org.gitlab4j.api.models.DeployToken> getDeployTokens()
                                                                            throws GitLabApiException
        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

        public Pager<org.gitlab4j.api.models.DeployToken> getDeployTokens​(int itemsPerPage)
                                                                   throws GitLabApiException
        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

        public java.util.stream.Stream<org.gitlab4j.api.models.DeployToken> getDeployTokensStream()
                                                                                           throws GitLabApiException
        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

        public java.util.List<org.gitlab4j.api.models.DeployToken> getProjectDeployTokens​(java.lang.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
      • getProjectDeployTokens

        public Pager<org.gitlab4j.api.models.DeployToken> getProjectDeployTokens​(java.lang.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 project
        itemsPerPage - the number of DeployToken instances that will be fetched per page
        Returns:
        a Pager of DeployToken
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeployTokensStream

        public java.util.stream.Stream<org.gitlab4j.api.models.DeployToken> getProjectDeployTokensStream​(java.lang.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 org.gitlab4j.api.models.DeployToken addProjectDeployToken​(java.lang.Object projectIdOrPath,
                                                                         java.lang.String name,
                                                                         java.util.Date expiresAt,
                                                                         java.lang.String username,
                                                                         java.util.List<org.gitlab4j.models.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 instance
        name - the new deploy token’s name, required
        expiresAt - 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 of Constants.DeployTokenScope.
        Returns:
        an DeployToken instance with info on the added deploy token
        Throws:
        GitLabApiException - if any exception occurs
      • deleteProjectDeployToken

        public void deleteProjectDeployToken​(java.lang.Object projectIdOrPath,
                                             java.lang.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 instance
        tokenId - the ID of the deploy token to delete
        Throws:
        GitLabApiException - if any exception occurs
      • getGroupDeployTokens

        public java.util.List<org.gitlab4j.api.models.DeployToken> getGroupDeployTokens​(java.lang.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
      • getGroupDeployTokens

        public Pager<org.gitlab4j.api.models.DeployToken> getGroupDeployTokens​(java.lang.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 group
        itemsPerPage - the number of DeployToken instances that will be fetched per page
        Returns:
        a Pager of DeployToken
        Throws:
        GitLabApiException - if any exception occurs
      • getGroupDeployTokensStream

        public java.util.stream.Stream<org.gitlab4j.api.models.DeployToken> getGroupDeployTokensStream​(java.lang.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 org.gitlab4j.api.models.DeployToken addGroupDeployToken​(java.lang.Object groupIdOrPath,
                                                                       java.lang.String name,
                                                                       java.util.Date expiresAt,
                                                                       java.lang.String username,
                                                                       java.util.List<org.gitlab4j.models.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 instance
        name - the new deploy token’s name, required
        expiresAt - 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 of Constants.DeployTokenScope.
        Returns:
        an DeployToken instance with info on the added deploy token
        Throws:
        GitLabApiException - if any exception occurs
      • deleteGroupDeployToken

        public void deleteGroupDeployToken​(java.lang.Object groupIdOrPath,
                                           java.lang.Long tokenId)
                                    throws GitLabApiException
        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 instance
        tokenId - the ID of the deploy token to delete
        Throws:
        GitLabApiException - if any exception occurs