Interface PluginBuildServerClient
public interface PluginBuildServerClient
An interface for Bitbucket to interact with the remote CI tool in order to perform actions (e.g. run build) and
authorization.
- Since:
- 7.8
-
Method Summary
Modifier and TypeMethodDescriptionGet and action by ID.The URI that can be used for the current user to authorize Bitbucket to act with the requested build server on their behalf.getAuthorizationUrl
(URI callback) The URI that can be used for the current user to authorize Bitbucket to act with the requested build server on their behalf.getOperations
(com.atlassian.bitbucket.build.status.RepositoryBuildStatus buildStatus) A collection containing the actions that can be performed by the currently authenticated user.boolean
Check whether or not Bitbucket has been authorized to act on this build server on the current user's behalf.performAction
(BuildStatusActionRequest request) Start the action.
-
Method Details
-
getAction
@Nonnull Optional<BuildStatusAction> getAction(@Nonnull com.atlassian.bitbucket.build.status.RepositoryBuildStatus buildStatus, @Nonnull String actionId) Get and action by ID. Given the ID return the Action it corresponds to orOptional.empty()
if the ID does not correspond to any action this client is aware of. It is strongly advised to not issue any requests to external systems as part of this method call. Authorisation and credential checks should not be performed as part of this method call.- Parameters:
buildStatus
- the build status that the action relates toactionId
- the ID of the action that should be returned- Returns:
- the
BuildStatusAction
for the provided ID, orOptional.empty()
if no action with the provided ID is available for the provided build status
-
getOperations
@Nonnull BuildOperations getOperations(@Nonnull com.atlassian.bitbucket.build.status.RepositoryBuildStatus buildStatus) A collection containing the actions that can be performed by the currently authenticated user.- Parameters:
buildStatus
- the build status to run the actions on.- Returns:
- a collection containing the allowed actions for the current user
-
getAuthorizationUrl
The URI that can be used for the current user to authorize Bitbucket to act with the requested build server on their behalf. The URI should be returned regardless of the current user's need to authorize.- Parameters:
callback
- the Web UI URI to redirect to after authorization is complete- Returns:
- the URL that can be used to provide the user the opportunity to authorize Bitbucket Server to access the build server on behalf of the user (i.e. typically OAuth style authorization)
-
getAuthorizationUrl
The URI that can be used for the current user to authorize Bitbucket to act with the requested build server on their behalf. The URI should be returned regardless of the current user's need to authorize.- Returns:
- the URI that can be used to provide the user the opportunity to authorize Bitbucket Server to access the build server on behalf of the user (i.e. typically OAuth style authorization)
-
isAuthorizationRequired
boolean isAuthorizationRequired()Check whether or not Bitbucket has been authorized to act on this build server on the current user's behalf. This may require reaching out to the remote system to validate that credentials still work.- Returns:
true
if the current user needs to authorize, orfalse
if they are already authorized
-
performAction
Start the action. Typically implementations wait for the remote system to acknowledge the request but not to complete the requested action. No exceptions are expected from this, rather catch relevant exception and map them to relevant fields in theActionResult
.- Parameters:
request
- the request containing the information to perform the action- Returns:
- result of the action.
-