Package org.gitlab4j.api
Class DeployKeysApi
java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.DeployKeysApi
- All Implemented Interfaces:
Constants
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.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.AutoDevopsDeployStrategy, Constants.BuildGitStrategy, Constants.CommitBuildState, Constants.ContributorOrderBy, Constants.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, Constants.EventScope, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PackageOrderBy, Constants.PackageStatus, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.SquashOption, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
-
Field Summary
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
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
-
Method Summary
Modifier and TypeMethodDescriptionaddDeployKey
(Object projectIdOrPath, String title, String key, Boolean canPush) Creates a new deploy key for a project.void
deleteDeployKey
(Object projectIdOrPath, Long keyId) Removes a deploy key from the project.enableDeployKey
(Object projectIdOrPath, Long keyId) Enables a deploy key for a project so this can be used.getDeployKey
(Object projectIdOrPath, Long keyId) Get a single deploy key for the specified project.Get a list of all deploy keys across all projects of the GitLab instance.getDeployKeys
(int itemsPerPage) Get a Pager of all deploy keys across all projects of the GitLab instance.getDeployKeys
(int page, int perPage) Get a list of all deploy keys across all projects of the GitLab instance using the specified page and per page settings.Get a Stream of all deploy keys across all projects of the GitLab instance.getOptionalDeployKey
(Object projectIdOrPath, Long keyId) Get a single deploy key for the specified project as an Optional instance.getProjectDeployKeys
(Object projectIdOrPath) Get a list of the deploy keys for the specified project.getProjectDeployKeys
(Object projectIdOrPath, int itemsPerPage) Get a Pager of the deploy keys for the specified project.getProjectDeployKeys
(Object projectIdOrPath, int page, int perPage) Get a list of the deploy keys for the specified project using the specified page and per page settings.getProjectDeployKeysStream
(Object projectIdOrPath) Get a list of the deploy keys for the specified project.updateDeployKey
(Object projectIdOrPath, Long deployKeyId, String title, Boolean canPush) Updates an existing project deploy key.Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
Constructor Details
-
DeployKeysApi
-
-
Method Details
-
getDeployKeys
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
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 getperPage
- the number of deploy keys per page- Returns:
- the list of DeployKey in the specified range
- Throws:
GitLabApiException
- if any exception occurs
-
getDeployKeys
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
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
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 List<DeployKey> getProjectDeployKeys(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 instancepage
- the page to getperPage
- 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<DeployKey> getProjectDeployKeys(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 projectitemsPerPage
- the number of DeployKey instances that will be fetched per page- Returns:
- a Pager of DeployKey
- Throws:
GitLabApiException
- if any exception occurs
-
getProjectDeployKeysStream
public Stream<DeployKey> getProjectDeployKeysStream(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
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 instancekeyId
- 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
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 instancekeyId
- 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 DeployKey addDeployKey(Object projectIdOrPath, String title, String key, 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 instancetitle
- the new deploy key's title, requiredkey
- the new deploy key, requiredcanPush
- 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 DeployKey updateDeployKey(Object projectIdOrPath, Long deployKeyId, String title, 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 instancedeployKeyId
- the ID of the deploy key to update, requiredtitle
- the title for the deploy key, optionalcanPush
- can deploy key push to the project's repository, optional- Returns:
- an updated DeployKey instance
- Throws:
GitLabApiException
- if any exception occurs
-
deleteDeployKey
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 instancekeyId
- the ID of the deploy key to delete- Throws:
GitLabApiException
- if any exception occurs
-
enableDeployKey
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 instancekeyId
- 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
-