Class DeployKeysApi

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

    public class DeployKeysApi
    extends AbstractApi
    This class implements the client side API for the GitLab Deploy Keys API calls.
    • 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

      • DeployKeysApi

        public DeployKeysApi​(GitLabApi gitLabApi)
    • Method Detail

      • getDeployKeys

        public java.util.List<org.gitlab4j.api.models.DeployKey> getDeployKeys()
                                                                        throws GitLabApiException
        Get a list of all deploy keys across all projects of the GitLab instance. This method requires admin access.
        GitLab Endpoint: GET /deploy_keys
        Returns:
        a list of DeployKey
        Throws:
        GitLabApiException - if any exception occurs
      • getDeployKeys

        public java.util.List<org.gitlab4j.api.models.DeployKey> getDeployKeys​(int page,
                                                                               int perPage)
                                                                        throws GitLabApiException
        Get a list of all deploy keys across all projects of the GitLab instance using the specified page and per page settings. This method requires admin access.
        GitLab Endpoint: GET /deploy_keys
        Parameters:
        page - the page to get
        perPage - the number of deploy keys per page
        Returns:
        the list of DeployKey in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getDeployKeys

        public Pager<org.gitlab4j.api.models.DeployKey> getDeployKeys​(int itemsPerPage)
                                                               throws GitLabApiException
        Get a Pager of all deploy keys across all projects of the GitLab instance. This method requires admin access.
        GitLab Endpoint: GET /deploy_keys
        Parameters:
        itemsPerPage - the number of DeployKey instances that will be fetched per page
        Returns:
        a Pager of DeployKey
        Throws:
        GitLabApiException - if any exception occurs
      • getDeployKeysStream

        public java.util.stream.Stream<org.gitlab4j.api.models.DeployKey> getDeployKeysStream()
                                                                                       throws GitLabApiException
        Get a Stream of all deploy keys across all projects of the GitLab instance. This method requires admin access.
        GitLab Endpoint: GET /deploy_keys
        Returns:
        a list of DeployKey
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeployKeys

        public java.util.List<org.gitlab4j.api.models.DeployKey> getProjectDeployKeys​(java.lang.Object projectIdOrPath)
                                                                               throws GitLabApiException
        Get a list of the deploy keys for the specified project. This method requires admin access.
        GitLab Endpoint: GET /projects/:id/deploy_keys
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a list of DeployKey
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeployKeys

        public java.util.List<org.gitlab4j.api.models.DeployKey> getProjectDeployKeys​(java.lang.Object projectIdOrPath,
                                                                                      int page,
                                                                                      int perPage)
                                                                               throws GitLabApiException
        Get a list of the deploy keys for the specified project using the specified page and per page settings. This method requires admin access.
        GitLab Endpoint: GET /projects/:id/deploy_keys
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        page - the page to get
        perPage - the number of deploy keys per page
        Returns:
        the list of DeployKey in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeployKeys

        public Pager<org.gitlab4j.api.models.DeployKey> getProjectDeployKeys​(java.lang.Object projectIdOrPath,
                                                                             int itemsPerPage)
                                                                      throws GitLabApiException
        Get a Pager of the deploy keys for the specified project. This method requires admin access.
        GitLab Endpoint: GET /projects/:id/deploy_keys
        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 DeployKey instances that will be fetched per page
        Returns:
        a Pager of DeployKey
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeployKeysStream

        public java.util.stream.Stream<org.gitlab4j.api.models.DeployKey> getProjectDeployKeysStream​(java.lang.Object projectIdOrPath)
                                                                                              throws GitLabApiException
        Get a list of the deploy keys for the specified project. This method requires admin access.
        GitLab Endpoint: GET /projects/:id/deploy_keys
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a list of DeployKey
        Throws:
        GitLabApiException - if any exception occurs
      • getDeployKey

        public org.gitlab4j.api.models.DeployKey getDeployKey​(java.lang.Object projectIdOrPath,
                                                              java.lang.Long keyId)
                                                       throws GitLabApiException
        Get a single deploy key for the specified project.
        GitLab Endpoint: GET /projects/:id/deploy_keys/:key_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        keyId - the ID of the deploy key to delete
        Returns:
        the DeployKey instance for the specified project ID and key ID
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalDeployKey

        public java.util.Optional<org.gitlab4j.api.models.DeployKey> getOptionalDeployKey​(java.lang.Object projectIdOrPath,
                                                                                          java.lang.Long keyId)
        Get a single deploy key for the specified project as an Optional instance.
        GitLab Endpoint: GET /projects/:id/deploy_keys/:key_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        keyId - the ID of the deploy key to delete
        Returns:
        the DeployKey for the specified project ID and key ID as an Optional instance
      • addDeployKey

        public org.gitlab4j.api.models.DeployKey addDeployKey​(java.lang.Object projectIdOrPath,
                                                              java.lang.String title,
                                                              java.lang.String key,
                                                              java.lang.Boolean canPush)
                                                       throws GitLabApiException
        Creates a new deploy key for a project.
        GitLab Endpoint: POST /projects/:id/deploy_keys
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        title - the new deploy key's title, required
        key - the new deploy key, required
        canPush - can deploy key push to the project's repository, optional
        Returns:
        an DeployKey instance with info on the added deploy key
        Throws:
        GitLabApiException - if any exception occurs
      • updateDeployKey

        public org.gitlab4j.api.models.DeployKey updateDeployKey​(java.lang.Object projectIdOrPath,
                                                                 java.lang.Long deployKeyId,
                                                                 java.lang.String title,
                                                                 java.lang.Boolean canPush)
                                                          throws GitLabApiException
        Updates an existing project deploy key.
        GitLab Endpoint: PUT /projects/:id/deploy_keys/:key_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        deployKeyId - the ID of the deploy key to update, required
        title - the title for the deploy key, optional
        canPush - can deploy key push to the project's repository, optional
        Returns:
        an updated DeployKey instance
        Throws:
        GitLabApiException - if any exception occurs
      • deleteDeployKey

        public void deleteDeployKey​(java.lang.Object projectIdOrPath,
                                    java.lang.Long keyId)
                             throws GitLabApiException
        Removes a deploy key from the project. If the deploy key is used only for this project,it will be deleted from the system.
        GitLab Endpoint: DELETE /projects/:id/deploy_keys/:key_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        keyId - the ID of the deploy key to delete
        Throws:
        GitLabApiException - if any exception occurs
      • enableDeployKey

        public org.gitlab4j.api.models.DeployKey enableDeployKey​(java.lang.Object projectIdOrPath,
                                                                 java.lang.Long keyId)
                                                          throws GitLabApiException
        Enables a deploy key for a project so this can be used. Returns the enabled key when successful.
        GitLab Endpoint: POST /projects/:id/deploy_keys/:key_id/enable
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        keyId - the ID of the deploy key to enable
        Returns:
        an DeployKey instance with info on the enabled deploy key
        Throws:
        GitLabApiException - if any exception occurs