Class DeploymentsApi

java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.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 Details

    • DeploymentsApi

      public DeploymentsApi(GitLabApi gitLabApi)
  • Method Details

    • getProjectDeployments

      public List<Deployment> getProjectDeployments(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(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(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(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 Stream<Deployment> getProjectDeploymentsStream(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 Stream<Deployment> getProjectDeploymentsStream(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(Object projectIdOrPath, 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 Optional<Deployment> getOptionalDeployment(Object projectIdOrPath, 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(Object projectIdOrPath, String environment, String sha, String ref, 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(Object projectIdOrPath, 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 List<MergeRequest> getMergeRequests(Object projectIdOrPath, 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(Object projectIdOrPath, 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 Stream<MergeRequest> getMergeRequestsStream(Object projectIdOrPath, 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