Package org.gitlab4j.api
Class DeployKeysApi
- java.lang.Object
-
- org.gitlab4j.api.AbstractApi
-
- org.gitlab4j.api.DeployKeysApi
-
- All Implemented Interfaces:
Constants
public class DeployKeysApi extends AbstractApi
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.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 DeployKeysApi(GitLabApi gitLabApi)
-
Method Summary
Modifier and Type Method Description DeployKey
addDeployKey(Object projectIdOrPath, String title, String key, Boolean canPush)
Creates a new deploy key for a project.void
deleteDeployKey(Object projectIdOrPath, Integer keyId)
Removes a deploy key from the project.DeployKey
enableDeployKey(Object projectIdOrPath, Integer keyId)
Enables a deploy key for a project so this can be used.DeployKey
getDeployKey(Object projectIdOrPath, Integer keyId)
Get a single deploy key for the specified project.List<DeployKey>
getDeployKeys()
Get a list of all deploy keys across all projects of the GitLab instance.Pager<DeployKey>
getDeployKeys(int itemsPerPage)
Get a Pager of all deploy keys across all projects of the GitLab instance.List<DeployKey>
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.Stream<DeployKey>
getDeployKeysStream()
Get a Stream of all deploy keys across all projects of the GitLab instance.Optional<DeployKey>
getOptionalDeployKey(Object projectIdOrPath, Integer keyId)
Get a single deploy key for the specified project as an Optional instance.List<DeployKey>
getProjectDeployKeys(Object projectIdOrPath)
Get a list of the deploy keys for the specified project.Pager<DeployKey>
getProjectDeployKeys(Object projectIdOrPath, int itemsPerPage)
Get a Pager of the deploy keys for the specified project.List<DeployKey>
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.Stream<DeployKey>
getProjectDeployKeysStream(Object projectIdOrPath)
Get a list of the deploy keys for the specified project.-
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
-
DeployKeysApi
public DeployKeysApi(GitLabApi gitLabApi)
-
-
Method Detail
-
getDeployKeys
public List<DeployKey> getDeployKeys() throws GitLabApiException
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
public List<DeployKey> getDeployKeys(int page, int perPage) throws GitLabApiException
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
public Pager<DeployKey> getDeployKeys(int itemsPerPage) throws GitLabApiException
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
public Stream<DeployKey> getDeployKeysStream() throws GitLabApiException
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
public List<DeployKey> getProjectDeployKeys(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 Integer(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 Integer(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 Integer(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 Integer(ID), String(path), or Project instance- Returns:
- a list of DeployKey
- Throws:
GitLabApiException
- if any exception occurs
-
getDeployKey
public DeployKey getDeployKey(Object projectIdOrPath, Integer keyId) throws GitLabApiException
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 Integer(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
public Optional<DeployKey> getOptionalDeployKey(Object projectIdOrPath, Integer keyId)
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 Integer(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 Integer(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
-
deleteDeployKey
public void deleteDeployKey(Object projectIdOrPath, Integer keyId) throws GitLabApiException
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 Integer(ID), String(path), or Project instancekeyId
- the ID of the deploy key to delete- Throws:
GitLabApiException
- if any exception occurs
-
enableDeployKey
public DeployKey enableDeployKey(Object projectIdOrPath, Integer keyId) throws GitLabApiException
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 Integer(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
-
-