Class DeploymentsApi

  • All Implemented Interfaces:
    Constants

    public class DeploymentsApi
    extends AbstractApi
    This class implements the client side API for the GitLab Deployments API calls. See https://docs.gitlab.com/ee/api/deployments.html
    • Constructor Detail

      • DeploymentsApi

        public DeploymentsApi​(GitLabApi gitLabApi)
    • Method Detail

      • getProjectDeployments

        public java.util.List<Deployment> getProjectDeployments​(java.lang.Object projectIdOrPath)
                                                         throws GitLabApiException
        Get a list of deployments for the specified project.
        GitLab Endpoint: GET /projects/:id/deployments
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a list of Deployments
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeployments

        public Pager<Deployment> getProjectDeployments​(java.lang.Object projectIdOrPath,
                                                       int itemsPerPage)
                                                throws GitLabApiException
        Get a Pager of all deployments for the specified project.
        GitLab Endpoint: GET /projects/:id/deployments
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        itemsPerPage - the number of Deployments instances that will be fetched per page
        Returns:
        a Pager of Deployment
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeployments

        public Pager<Deployment> getProjectDeployments​(java.lang.Object projectIdOrPath,
                                                       DeploymentFilter filter)
                                                throws GitLabApiException
        Get a Pager of all deployments for the specified project.
        GitLab Endpoint: GET /projects/:id/deployments
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        filter - DeploymentFilter a DeploymentFilter instance with the filter settings
        Returns:
        a Pager of Deployment
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeployments

        public Pager<Deployment> getProjectDeployments​(java.lang.Object projectIdOrPath,
                                                       DeploymentFilter filter,
                                                       int itemsPerPage)
                                                throws GitLabApiException
        Get a Pager of all deployments for the specified project.
        GitLab Endpoint: GET /projects/:id/deployments
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        filter - DeploymentFilter a DeploymentFilter instance with the filter settings
        itemsPerPage - the number of Deployments instances that will be fetched per page
        Returns:
        a Pager of Deployment
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeploymentsStream

        public java.util.stream.Stream<Deployment> getProjectDeploymentsStream​(java.lang.Object projectIdOrPath)
                                                                        throws GitLabApiException
        Get a Stream of all deployments for the specified project.
        GitLab Endpoint: GET /projects/:id/deployments
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a list of Deployment
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectDeploymentsStream

        public java.util.stream.Stream<Deployment> getProjectDeploymentsStream​(java.lang.Object projectIdOrPath,
                                                                               DeploymentFilter filter)
                                                                        throws GitLabApiException
        Get a Stream of all deployments for the specified project.
        GitLab Endpoint: GET /projects/:id/deployments
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        filter - DeploymentFilter a DeploymentFilter instance with the filter settings
        Returns:
        a list of Deployment
        Throws:
        GitLabApiException - if any exception occurs
      • getDeployment

        public Deployment getDeployment​(java.lang.Object projectIdOrPath,
                                        java.lang.Long deploymentId)
                                 throws GitLabApiException
        Get a specific deployment.
        GitLab Endpoint: GET /projects/:id/deployments/:deployment_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        deploymentId - the ID of a project's deployment
        Returns:
        the specified Deployment instance
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalDeployment

        public java.util.Optional<Deployment> getOptionalDeployment​(java.lang.Object projectIdOrPath,
                                                                    java.lang.Long deploymentId)
        Get a specific deployment as an Optional instance.
        GitLab Endpoint: GET /projects/:id/deployments/:deployment_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        deploymentId - the ID of a project's deployment
        Returns:
        the specified Deployment as an Optional instance
      • addDeployment

        public Deployment addDeployment​(java.lang.Object projectIdOrPath,
                                        java.lang.String environment,
                                        java.lang.String sha,
                                        java.lang.String ref,
                                        java.lang.Boolean tag,
                                        Constants.DeploymentStatus status)
                                 throws GitLabApiException
        Creates a new deployment for a project.
        GitLab Endpoint: POST /projects/:id/deployments
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        environment - The name of the environment to create the deployment for, required
        sha - The SHA of the commit that is deployed, required
        ref - The name of the branch or tag that is deployed, required
        tag - A boolean that indicates if the deployed ref is a tag (true) or not (false), required
        status - The status to filter deployments by, required
        Returns:
        a Deployment instance with info on the added deployment
        Throws:
        GitLabApiException - if any exception occurs
      • updateDeployment

        public Deployment updateDeployment​(java.lang.Object projectIdOrPath,
                                           java.lang.Long deploymentId,
                                           Constants.DeploymentStatus status)
                                    throws GitLabApiException
        Updates an existing project deploy key.
        GitLab Endpoint: PUT /projects/:id/deployments/:key_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        deploymentId - The ID of the deployment to update, required
        status - The new status of the deployment, required
        Returns:
        an updated Deployment instance
        Throws:
        GitLabApiException - if any exception occurs
      • getMergeRequests

        public java.util.List<MergeRequest> getMergeRequests​(java.lang.Object projectIdOrPath,
                                                             java.lang.Long deploymentId)
                                                      throws GitLabApiException
        Get a list of Merge Requests shipped with a given deployment.
        GitLab Endpoint: GET /projects/:id/deployments/:deployment_id/merge_requests
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        deploymentId - The ID of the deployment to update, required
        Returns:
        a list containing the MergeRequest instances shipped with a given deployment
        Throws:
        GitLabApiException - GitLabApiException if any exception occurs during execution
      • getMergeRequests

        public Pager<MergeRequest> getMergeRequests​(java.lang.Object projectIdOrPath,
                                                    java.lang.Long deploymentId,
                                                    int itemsPerPage)
                                             throws GitLabApiException
        Get a Pager of Merge Requests shipped with a given deployment.
        GitLab Endpoint: GET /projects/:id/deployments/:deployment_id/merge_requests
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        deploymentId - The ID of the deployment to update, required
        itemsPerPage - the number of Commit instances that will be fetched per page
        Returns:
        a Pager containing the MergeRequest instances shipped with a given deployment
        Throws:
        GitLabApiException - GitLabApiException if any exception occurs during execution
      • getMergeRequestsStream

        public java.util.stream.Stream<MergeRequest> getMergeRequestsStream​(java.lang.Object projectIdOrPath,
                                                                            java.lang.Long deploymentId)
                                                                     throws GitLabApiException
        Get a Stream of Merge Requests shipped with a given deployment.
        GitLab Endpoint: GET /projects/:id/deployments/:deployment_id/merge_requests
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        deploymentId - The ID of the deployment to update, required
        Returns:
        a Stream containing the MergeRequest instances shipped with a given deployment
        Throws:
        GitLabApiException - GitLabApiException if any exception occurs during execution