Package org.gitlab4j.api
Class RunnersApi
- java.lang.Object
-
- org.gitlab4j.api.AbstractApi
-
- org.gitlab4j.api.RunnersApi
-
- All Implemented Interfaces:
Constants
public class RunnersApi extends AbstractApi
This class provides an entry point to all the GitLab API repository files calls.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.gitlab4j.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.CommitBuildState, Constants.Encoding, Constants.EpicOrderBy, Constants.GroupOrderBy, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestState, Constants.MilestoneState, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.SortOrder, Constants.StateEvent, Constants.TargetType, Constants.TokenType
-
-
Field Summary
-
Fields inherited from interface org.gitlab4j.api.Constants
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
-
-
Constructor Summary
Constructors Constructor Description RunnersApi(GitLabApi gitLabApi)
-
Method Summary
Modifier and Type Method Description void
deleteRunner(String token)
Deletes a registered Runner.Runner
disableRunner(Object projectIdOrPath, Integer runnerId)
Disable a specific runner from the project.Runner
enableRunner(Object projectIdOrPath, Integer runnerId)
Enable an available specific runner in the project.List<Runner>
getAllRunners()
Get a list of all runners in the GitLab instance (specific and shared).Pager<Runner>
getAllRunners(int itemsPerPage)
Get a list of all runners in the GitLab instance (specific and shared).List<Runner>
getAllRunners(int page, int perPage)
Get a list of all runners in the GitLab instance (specific and shared).List<Runner>
getAllRunners(Runner.RunnerStatus scope)
Get a list of all runners in the GitLab instance (specific and shared).Pager<Runner>
getAllRunners(Runner.RunnerStatus scope, int itemsPerPage)
Get a list of all runners in the GitLab instance (specific and shared).List<Runner>
getAllRunners(Runner.RunnerStatus scope, Integer page, Integer perPage)
Get a list of all runners in the GitLab instance (specific and shared).Stream<Runner>
getAllRunnersStream()
Get a Stream of all runners in the GitLab instance (specific and shared).Stream<Runner>
getAllRunnersStream(Runner.RunnerStatus scope)
Get a Stream of all runners in the GitLab instance (specific and shared).List<Job>
getJobs(Integer runnerId)
List jobs that are being processed or were processed by specified Runner.Pager<Job>
getJobs(Integer runnerId, int itemsPerPage)
List jobs that are being processed or were processed by specified Runner.List<Job>
getJobs(Integer runnerId, JobStatus status)
List jobs that are being processed or were processed by specified Runner.Pager<Job>
getJobs(Integer runnerId, JobStatus status, int itemsPerPage)
List jobs that are being processed or were processed by specified Runner.Stream<Job>
getJobsStream(Integer runnerId)
Get a Stream of jobs that are being processed or were processed by specified Runner.Stream<Job>
getJobsStream(Integer runnerId, JobStatus status)
Get a Stream of jobs that are being processed or were processed by specified Runner.List<Runner>
getProjectRunners(Object projectIdOrPath)
List all runners (specific and shared) available in the project.Pager<Runner>
getProjectRunners(Object projectIdOrPath, int itemsPerPage)
List all runners (specific and shared) available in the project.Stream<Runner>
getProjectRunnersStream(Object projectIdOrPath)
Get a Stream all runners (specific and shared) available in the project.RunnerDetail
getRunnerDetail(Integer runnerId)
Get details of a runner.List<Runner>
getRunners()
Get a list of all available runners available to the user.Pager<Runner>
getRunners(int itemsPerPage)
Get a list of all available runners available to the user.List<Runner>
getRunners(int page, int perPage)
Get a list of all available runners available to the user with pagination support.List<Runner>
getRunners(Runner.RunnerStatus scope)
Get a list of all available runners available to the user with pagination support.Pager<Runner>
getRunners(Runner.RunnerStatus scope, int itemsPerPage)
Get a list of specific runners available to the user.List<Runner>
getRunners(Runner.RunnerStatus scope, Integer page, Integer perPage)
Get a list of specific runners available to the user.Stream<Runner>
getRunnersStream()
Get a Stream of all available runners available to the user.Stream<Runner>
getRunnersStream(Runner.RunnerStatus scope)
Get a Stream of all available runners available to the user with pagination support.RunnerDetail
registerRunner(String token, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, Integer maximumTimeout)
Register a new runner for the gitlab instance.void
removeRunner(Integer runnerId)
Remove a runner.RunnerDetail
updateRunner(Integer runnerId, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, RunnerDetail.RunnerAccessLevel accessLevel)
Update details of a runner.-
Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, post, post, post, post, post, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, urlEncode, validate
-
-
-
-
Constructor Detail
-
RunnersApi
public RunnersApi(GitLabApi gitLabApi)
-
-
Method Detail
-
getRunners
public List<Runner> getRunners() throws GitLabApiException
Get a list of all available runners available to the user.GitLab Endpoint: GET /runners
- Returns:
- List of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getRunnersStream
public Stream<Runner> getRunnersStream() throws GitLabApiException
Get a Stream of all available runners available to the user.GitLab Endpoint: GET /runners
- Returns:
- Stream of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getRunners
public List<Runner> getRunners(Runner.RunnerStatus scope) throws GitLabApiException
Get a list of all available runners available to the user with pagination support.GitLab Endpoint: GET /runners
- Parameters:
scope
- The scope of specific runners to show, one of: active, paused, online; showing all runners null- Returns:
- List of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getRunnersStream
public Stream<Runner> getRunnersStream(Runner.RunnerStatus scope) throws GitLabApiException
Get a Stream of all available runners available to the user with pagination support.GitLab Endpoint: GET /runners
- Parameters:
scope
- The scope of specific runners to show, one of: active, paused, online; showing all runners null- Returns:
- Stream of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getRunners
public List<Runner> getRunners(int page, int perPage) throws GitLabApiException
Get a list of all available runners available to the user with pagination support.GitLab Endpoint: GET /runners
- Parameters:
page
- The page offset of runnersperPage
- The number of runners to get after the page offset- Returns:
- List of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getRunners
public List<Runner> getRunners(Runner.RunnerStatus scope, Integer page, Integer perPage) throws GitLabApiException
Get a list of specific runners available to the user.GitLab Endpoint: GET /runners
- Parameters:
scope
- The scope of specific runners to show, one of: active, paused, online; showing all runners nullpage
- The page offset of runnersperPage
- The number of runners to get after the page offset- Returns:
- List of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getRunners
public Pager<Runner> getRunners(int itemsPerPage) throws GitLabApiException
Get a list of all available runners available to the user.GitLab Endpoint: GET /runners
- Parameters:
itemsPerPage
- the number of Runner instances that will be fetched per page- Returns:
- a Pager containing the Runners for the user
- Throws:
GitLabApiException
- if any exception occurs
-
getRunners
public Pager<Runner> getRunners(Runner.RunnerStatus scope, int itemsPerPage) throws GitLabApiException
Get a list of specific runners available to the user.GitLab Endpoint: GET /runners
- Parameters:
scope
- the scope of specific runners to show, one of: active, paused, online; showing all runners nullitemsPerPage
- The number of Runner instances that will be fetched per page- Returns:
- a Pager containing the Runners for the user
- Throws:
GitLabApiException
- if any exception occurs
-
getAllRunners
public List<Runner> getAllRunners() throws GitLabApiException
Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.GitLab Endpoint: GET /runners/all
- Returns:
- a List of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getAllRunnersStream
public Stream<Runner> getAllRunnersStream() throws GitLabApiException
Get a Stream of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.GitLab Endpoint: GET /runners/all
- Returns:
- a Stream of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getAllRunners
public List<Runner> getAllRunners(Runner.RunnerStatus scope) throws GitLabApiException
Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.GitLab Endpoint: GET /runners/all
- Parameters:
scope
- The scope of specific runners to show, one of: active, paused, online; showing all runners null- Returns:
- a List of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getAllRunnersStream
public Stream<Runner> getAllRunnersStream(Runner.RunnerStatus scope) throws GitLabApiException
Get a Stream of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.GitLab Endpoint: GET /runners/all
- Parameters:
scope
- The scope of specific runners to show, one of: active, paused, online; showing all runners null- Returns:
- a Stream of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getAllRunners
public List<Runner> getAllRunners(int page, int perPage) throws GitLabApiException
Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.GitLab Endpoint: GET /runners/all
- Parameters:
page
- The page offset of runnersperPage
- The number of runners to get after the page offset- Returns:
- a list of all runners in the GitLab instance
- Throws:
GitLabApiException
- if any exception occurs
-
getAllRunners
public List<Runner> getAllRunners(Runner.RunnerStatus scope, Integer page, Integer perPage) throws GitLabApiException
Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.GitLab Endpoint: GET /runners/all
- Parameters:
scope
- The scope of specific runners to show, one of: active, paused, online; showing all runners nullpage
- The page offset of runnersperPage
- The number of runners to get after the page offset- Returns:
- List of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getAllRunners
public Pager<Runner> getAllRunners(int itemsPerPage) throws GitLabApiException
Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.GitLab Endpoint: GET /runners/all
- Parameters:
itemsPerPage
- The number of Runner instances that will be fetched per page- Returns:
- List of Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getAllRunners
public Pager<Runner> getAllRunners(Runner.RunnerStatus scope, int itemsPerPage) throws GitLabApiException
Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.GitLab Endpoint: GET /runners/all
- Parameters:
scope
- the scope of specific runners to show, one of: active, paused, online; showing all runners nullitemsPerPage
- The number of Runner instances that will be fetched per page- Returns:
- a Pager containing the Runners
- Throws:
GitLabApiException
- if any exception occurs
-
getRunnerDetail
public RunnerDetail getRunnerDetail(Integer runnerId) throws GitLabApiException
Get details of a runner.GitLab Endpoint: GET /runners/:id
- Parameters:
runnerId
- Runner id to get details for- Returns:
- RunnerDetail instance.
- Throws:
GitLabApiException
- if any exception occurs
-
updateRunner
public RunnerDetail updateRunner(Integer runnerId, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, RunnerDetail.RunnerAccessLevel accessLevel) throws GitLabApiException
Update details of a runner.GitLab Endpoint: PUT /runners/:id
- Parameters:
runnerId
- The ID of a runnerdescription
- The description of a runneractive
- The state of a runner; can be set to true or falsetagList
- The list of tags for a runner; put array of tags, that should be finally assigned to a runnerrunUntagged
- Flag indicating the runner can execute untagged jobslocked
- Flag indicating the runner is lockedaccessLevel
- The access_level of the runner; not_protected or ref_protected- Returns:
- RunnerDetail instance.
- Throws:
GitLabApiException
- if any exception occurs
-
removeRunner
public void removeRunner(Integer runnerId) throws GitLabApiException
Remove a runner.GitLab Endpoint: DELETE /runners/:id
- Parameters:
runnerId
- The ID of a runner- Throws:
GitLabApiException
- if any exception occurs
-
getJobs
public List<Job> getJobs(Integer runnerId) throws GitLabApiException
List jobs that are being processed or were processed by specified Runner.GitLab Endpoint: GET /runners/:id/jobs
- Parameters:
runnerId
- The ID of a runner- Returns:
- List jobs that are being processed or were processed by specified Runner
- Throws:
GitLabApiException
- if any exception occurs
-
getJobsStream
public Stream<Job> getJobsStream(Integer runnerId) throws GitLabApiException
Get a Stream of jobs that are being processed or were processed by specified Runner.GitLab Endpoint: GET /runners/:id/jobs
- Parameters:
runnerId
- The ID of a runner- Returns:
- a Stream of jobs that are being processed or were processed by specified Runner
- Throws:
GitLabApiException
- if any exception occurs
-
getJobs
public List<Job> getJobs(Integer runnerId, JobStatus status) throws GitLabApiException
List jobs that are being processed or were processed by specified Runner.GitLab Endpoint: GET /runners/:id/jobs
- Parameters:
runnerId
- The ID of a runnerstatus
- Status of the job; one of: running, success, failed, canceled- Returns:
- List jobs that are being processed or were processed by specified Runner
- Throws:
GitLabApiException
- if any exception occurs
-
getJobsStream
public Stream<Job> getJobsStream(Integer runnerId, JobStatus status) throws GitLabApiException
Get a Stream of jobs that are being processed or were processed by specified Runner.GitLab Endpoint: GET /runners/:id/jobs
- Parameters:
runnerId
- The ID of a runnerstatus
- Status of the job; one of: running, success, failed, canceled- Returns:
- a Stream of jobs that are being processed or were processed by specified Runner
- Throws:
GitLabApiException
- if any exception occurs
-
getJobs
public Pager<Job> getJobs(Integer runnerId, int itemsPerPage) throws GitLabApiException
List jobs that are being processed or were processed by specified Runner.GitLab Endpoint: GET /runners/:id/jobs
- Parameters:
runnerId
- The ID of a runneritemsPerPage
- The number of Runner instances that will be fetched per page- Returns:
- a Pager containing the Jobs for the Runner
- Throws:
GitLabApiException
- if any exception occurs
-
getJobs
public Pager<Job> getJobs(Integer runnerId, JobStatus status, int itemsPerPage) throws GitLabApiException
List jobs that are being processed or were processed by specified Runner.GitLab Endpoint: GET /runners/:id/jobs
- Parameters:
runnerId
- The ID of a runnerstatus
- Status of the job; one of: running, success, failed, canceleditemsPerPage
- The number of Runner instances that will be fetched per page- Returns:
- a Pager containing the Jobs for the Runner
- Throws:
GitLabApiException
- if any exception occurs
-
getProjectRunners
public List<Runner> getProjectRunners(Object projectIdOrPath) throws GitLabApiException
List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.GitLab Endpoint: GET /projects/:id/runners
- Parameters:
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instance- Returns:
- List of all Runner available in the project
- Throws:
GitLabApiException
- if any exception occurs
-
getProjectRunnersStream
public Stream<Runner> getProjectRunnersStream(Object projectIdOrPath) throws GitLabApiException
Get a Stream all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.GitLab Endpoint: GET /projects/:id/runners
- Parameters:
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instance- Returns:
- a Stream of all Runner available in the project
- Throws:
GitLabApiException
- if any exception occurs
-
getProjectRunners
public Pager<Runner> getProjectRunners(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.GitLab Endpoint: GET /projects/:id/runners
- Parameters:
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instanceitemsPerPage
- the number of Project instances that will be fetched per page- Returns:
- Pager of all Runner available in the project
- Throws:
GitLabApiException
- if any exception occurs
-
enableRunner
public Runner enableRunner(Object projectIdOrPath, Integer runnerId) throws GitLabApiException
Enable an available specific runner in the project.GitLab Endpoint: POST /projects/:id/runners
- Parameters:
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instancerunnerId
- The ID of a runner- Returns:
- Runner instance of the Runner enabled
- Throws:
GitLabApiException
- if any exception occurs
-
disableRunner
public Runner disableRunner(Object projectIdOrPath, Integer runnerId) throws GitLabApiException
Disable a specific runner from the project. It works only if the project isn't the only project associated with the specified runner. If so, an error is returned. Use theremoveRunner(Integer)
instead.GitLab Endpoint: DELETE /projects/:id/runners/:runner_id
- Parameters:
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instancerunnerId
- The ID of a runner- Returns:
- Runner instance of the Runner disabled
- Throws:
GitLabApiException
- if any exception occurs
-
registerRunner
public RunnerDetail registerRunner(String token, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, Integer maximumTimeout) throws GitLabApiException
Register a new runner for the gitlab instance.GitLab Endpoint: POST /runners/
- Parameters:
token
- the token of the project (for project specific runners) or the token from the admin pagedescription
- The description of a runneractive
- The state of a runner; can be set to true or falsetagList
- The list of tags for a runner; put array of tags, that should be finally assigned to a runnerrunUntagged
- Flag indicating the runner can execute untagged jobslocked
- Flag indicating the runner is lockedmaximumTimeout
- the maximum timeout set when this Runner will handle the job- Returns:
- RunnerDetail instance.
- Throws:
GitLabApiException
- if any exception occurs
-
deleteRunner
public void deleteRunner(String token) throws GitLabApiException
Deletes a registered Runner.GitLab Endpoint: DELETE /runners/
- Parameters:
token
- the runners authentication token- Throws:
GitLabApiException
- if any exception occurs
-
-