Class EnvironmentsApi

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

    public class EnvironmentsApi
    extends AbstractApi
    This class provides an entry point to all the GitLab API Environments API calls.
    See Also:
    Environments API
    • 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

      • EnvironmentsApi

        public EnvironmentsApi​(GitLabApi gitLabApi)
    • Method Detail

      • getEnvironments

        public java.util.List<org.gitlab4j.api.models.Environment> getEnvironments​(java.lang.Object projectIdOrPath)
                                                                            throws GitLabApiException
        Get all environments for a given project.
        GitLab Endpoint: GET /projects/:id/environments
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Returns:
        a List of Environment instances
        Throws:
        GitLabApiException - if any exception occurs
      • getEnvironmentsStream

        public java.util.stream.Stream<org.gitlab4j.api.models.Environment> getEnvironmentsStream​(java.lang.Object projectIdOrPath)
                                                                                           throws GitLabApiException
        Get a Stream of all environments for a given project.
        GitLab Endpoint: GET /projects/:id/environments
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Returns:
        a Stream of Environment instances
        Throws:
        GitLabApiException - if any exception occurs
      • getEnvironments

        public Pager<org.gitlab4j.api.models.Environment> getEnvironments​(java.lang.Object projectIdOrPath,
                                                                          int itemsPerPage)
                                                                   throws GitLabApiException
        Get a Pager of all environments for a given project.
        GitLab Endpoint: GET /projects/:id/environments
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        itemsPerPage - the number of Environment instances that will be fetched per page
        Returns:
        a Pager of Environment instances
        Throws:
        GitLabApiException - if any exception occurs
      • getEnvironment

        public org.gitlab4j.api.models.Environment getEnvironment​(java.lang.Object projectIdOrPath,
                                                                  java.lang.Long environmentId)
                                                           throws GitLabApiException
        Get a specific environment.
        GitLab Endpoint: GET /projects/:id/environments/:environment_id
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        environmentId - the ID of the environment to get
        Returns:
        an Environment instance
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalEnvironment

        public java.util.Optional<org.gitlab4j.api.models.Environment> getOptionalEnvironment​(java.lang.Object projectIdOrPath,
                                                                                              java.lang.Long environmentId)
        Get a specific environment. as an Optional instance.
        GitLab Endpoint: GET /projects/:id/environments/:environment_id
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        environmentId - the ID of the environment to get
        Returns:
        the Environment as an Optional instance
      • createEnvironment

        public org.gitlab4j.api.models.Environment createEnvironment​(java.lang.Object projectIdOrPath,
                                                                     java.lang.String name,
                                                                     java.lang.String externalUrl,
                                                                     java.lang.String tier)
                                                              throws GitLabApiException
        Create a new environment with the given name, external_url and tier.
        GitLab Endpoint:POST /projects/:id/environments
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        name - the name of the environment
        externalUrl - the place to link to for this environment
        tier - the tier of the environment
        Returns:
        the created Environment instance
        Throws:
        GitLabApiException - if any exception occurs
      • updateEnvironment

        public org.gitlab4j.api.models.Environment updateEnvironment​(java.lang.Object projectIdOrPath,
                                                                     java.lang.Long environmentId,
                                                                     java.lang.String name,
                                                                     java.lang.String externalUrl,
                                                                     java.lang.String tier)
                                                              throws GitLabApiException
        Update an existing environment.
        GitLab Endpoint:POST /projects/:id/environments
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        environmentId - the ID of the environment to update
        name - the name of the environment
        externalUrl - the place to link to for this environment
        tier - the tier of the environment
        Returns:
        the created Environment instance
        Throws:
        GitLabApiException - if any exception occurs
      • stopEnvironment

        public org.gitlab4j.api.models.Environment stopEnvironment​(java.lang.Object projectIdOrPath,
                                                                   java.lang.Long environmentId)
                                                            throws GitLabApiException
        Stop an environment.
        GitLab Endpoint: POST /projects/:id/environments/:environment_id/stop
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        environmentId - the ID of the environment to stop
        Returns:
        the stopped Environment instance
        Throws:
        GitLabApiException - if any exception occurs
      • deleteEnvironment

        public void deleteEnvironment​(java.lang.Object projectIdOrPath,
                                      java.lang.Long environmentId)
                               throws GitLabApiException
        Delete an environment.
        GitLab Endpoint: DELETE /projects/:id/environments/:environment_id
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        environmentId - the ID of the environment to delete
        Throws:
        GitLabApiException - if any exception occurs
      • createEnvironment

        public org.gitlab4j.api.models.Environment createEnvironment​(java.lang.Object projectIdOrPath,
                                                                     java.lang.Long environmentId)
                                                              throws GitLabApiException
        Stop an environment.
        GitLab Endpoint:POST /projects/:id/environments/:environment_id/stop
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        environmentId - the ID of the environment to stop
        Returns:
        the Environment instance of the stopped environment
        Throws:
        GitLabApiException - if any exception occurs