Class JobConfigResource
java.lang.Object
com.atlassian.bamboo.plugins.rest.plan.stage.job.JobConfigResource
@Path("config/plan/{planKey}/stage/{stageId}/job")
@Consumes("application/json")
@Produces("application/json")
@Internal
public class JobConfigResource
extends Object
Provides RESTful operations on jobs for the configuration of build plans.
For operations on a specific job, we'd need to identify the build and stage it belongs to. For using just the job key,
use
JobConfigShortcutResource
.- Since:
- 5.9
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RestJob
Used for REST documentation generation.static final RestPageModel<RestJob>
static final RestJob
static final RestWarnings
Used for REST documentation generation. -
Constructor Summary
ConstructorsConstructorDescriptionJobConfigResource
(BambooPermissionManager bambooPermissionManager, RestJobService restJobService, JobService jobService, InputParser inputParser, com.atlassian.sal.api.message.I18nResolver i18nResolver, PaginationService paginationService, JobConversionFunction jobConversionFunction) -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Response
addJob
(String planKeyString, long stageId, ExpansionParam expansion, javax.ws.rs.core.UriInfo uriInfo, RestJob restJob) Adds a job to the given stage.getAllJobsForStage
(String planKeyString, long stageId, PageRequest pageRequest, ExpansionParam expansion, javax.ws.rs.core.UriInfo uriInfo) Return all jobs for the given stage.getDeletionWarnings
(String planKeyString, long stageId, String jobKeyString, ExpansionParam expansion, javax.ws.rs.core.UriInfo uriInfo) Retrieves the warnings in relation to deleting a job.getJob
(String planKeyString, long stageId, String jobKeyString, ExpansionParam expansion, javax.ws.rs.core.UriInfo uriInfo) Retrieves the details of a specific job of a stage of a build plan.getMoveWarnings
(String planKeyString, long stageId, String jobKeyString, long targetStageId, ExpansionParam expansion, javax.ws.rs.core.UriInfo uriInfo) Retrieves the warnings in relation to moving a job.javax.ws.rs.core.Response
removeJob
(String planKeyString, long stageId, String jobKeyString, @Nullable ConfirmationToken confirmationToken, javax.ws.rs.core.UriInfo uriInfo) Deletes a specific job of a build plan.updateJob
(String planKeyString, long stageId, String jobKeyString, @Nullable ConfirmationToken confirmationToken, ExpansionParam expansion, javax.ws.rs.core.UriInfo uriInfo, RestJob restJob) Updates a job partially, not overriding any field that it's not specified.
-
Field Details
-
ADD_JOB
Used for REST documentation generation. -
JOB
-
ALL_JOBS
-
JOB_WARNINGS
Used for REST documentation generation.
-
-
Constructor Details
-
JobConfigResource
@Inject public JobConfigResource(BambooPermissionManager bambooPermissionManager, RestJobService restJobService, JobService jobService, InputParser inputParser, com.atlassian.sal.api.message.I18nResolver i18nResolver, PaginationService paginationService, JobConversionFunction jobConversionFunction)
-
-
Method Details
-
getAllJobsForStage
@GET public RestPageModel<RestJob> getAllJobsForStage(@PathParam("planKey") String planKeyString, @PathParam("stageId") long stageId, @BeanParam PageRequest pageRequest, @BeanParam ExpansionParam expansion, @Context javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Return all jobs for the given stage.- Parameters:
planKeyString
- plan to retrieve jobs forstageId
- stage to retrieve jobs forpageRequest
- represents the params that define which page the request is afterexpansion
- represents an expansion tree of additional information we want to retrieve- Returns:
- a paginated representation of a
RestJob
- Throws:
WebValidationException
-
getDeletionWarnings
@GET @Path("{jobKey}/deletionWarnings") public RestWarnings getDeletionWarnings(@PathParam("planKey") String planKeyString, @PathParam("stageId") long stageId, @PathParam("jobKey") String jobKeyString, @BeanParam ExpansionParam expansion, @Context javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Retrieves the warnings in relation to deleting a job. The resulting object contains all the details, including a list of jobs effected by the change.- Parameters:
planKeyString
- the key for the planstageId
- the stage idjobKeyString
- the job key to retrieve warnings when movingexpansion
- represents an expansion tree of additional information we want to retrieve- Returns:
RestWarnings
containing warnings if job cannot be removed- Throws:
WebValidationException
-
getMoveWarnings
@GET @Path("{jobKey}/moveWarnings") public RestWarnings getMoveWarnings(@PathParam("planKey") String planKeyString, @PathParam("stageId") long stageId, @PathParam("jobKey") String jobKeyString, @QueryParam("targetStageId") long targetStageId, @BeanParam ExpansionParam expansion, @Context javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Retrieves the warnings in relation to moving a job. The resulting object contains all the details, including a list of jobs effected by the change.- Parameters:
planKeyString
- the key for the planstageId
- the stage idjobKeyString
- the job key to retrieve warnings when movingtargetStageId
- stage id the job is going to be moved toexpansion
- represents an expansion tree of additional information we want to retrieve- Returns:
RestWarnings
containing warnings if job cannot be moved- Throws:
WebValidationException
-
addJob
@POST public javax.ws.rs.core.Response addJob(@PathParam("planKey") String planKeyString, @PathParam("stageId") long stageId, @BeanParam ExpansionParam expansion, @Context javax.ws.rs.core.UriInfo uriInfo, RestJob restJob) throws WebValidationException Adds a job to the given stage.- Parameters:
planKeyString
- key for the planstageId
- stage to add the job toexpansion
- represents an expansion tree of additional information we want to retrieveuriInfo
- provides access to application and request URI informationrestJob
- representation of the job to be added- Returns:
Response
a response pointing to the location of the added job- Throws:
WebValidationException
- if there's validation errors, which maps into a 400 Bad Request
-
getJob
@GET @Path("{jobKey}") public RestJob getJob(@PathParam("planKey") String planKeyString, @PathParam("stageId") long stageId, @PathParam("jobKey") String jobKeyString, @BeanParam ExpansionParam expansion, @Context javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Retrieves the details of a specific job of a stage of a build plan.- Parameters:
planKeyString
- the key of the planstageId
- unique identifier of the stage the job belongs tojobKeyString
- identifier of the job to retrieve details forexpansion
- represents an expansion tree of additional information we want to retrieve- Returns:
RestJob
- Throws:
WebValidationException
-
updateJob
@PUT @Path("{jobKey}") public RestJob updateJob(@PathParam("planKey") String planKeyString, @PathParam("stageId") long stageId, @PathParam("jobKey") String jobKeyString, @BeanParam @Nullable @Nullable ConfirmationToken confirmationToken, @BeanParam ExpansionParam expansion, @Context javax.ws.rs.core.UriInfo uriInfo, RestJob restJob) throws WebValidationException Updates a job partially, not overriding any field that it's not specified.- Parameters:
planKeyString
- the key of the plan the stage belongs tostageId
- the stage id of the stage the job belongs tojobKeyString
- identifier of the job to retrieve details forconfirmationToken
- token to validate that the job being updated has not been modified in the meantime, in which case the operation would be rejected. To get this validation token seegetMoveWarnings(String, long, String, long, ExpansionParam, UriInfo)
. This token in optional, if not specified it won't be checked and the operation will be forced.expansion
- represents an expansion tree of additional information we want to retrieverestJob
- representation of the job to update- Returns:
RestJob
- Throws:
WebValidationException
- if there's validation errors, which maps into a 400 Bad Request
-
removeJob
@DELETE @Path("{jobKey}") public javax.ws.rs.core.Response removeJob(@PathParam("planKey") String planKeyString, @PathParam("stageId") long stageId, @PathParam("jobKey") String jobKeyString, @BeanParam @Nullable @Nullable ConfirmationToken confirmationToken, @Context javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Deletes a specific job of a build plan.- Parameters:
planKeyString
- the key for the planstageId
- unique identifier of the stage the job belongs tojobKeyString
- identifier of the job to deleteconfirmationToken
- token to validate that the job being deleted has not been modified in the meantime, in which case the operation would be rejected. To get this validation token seegetDeletionWarnings(String, long, String, ExpansionParam, UriInfo)
. This token in optional, if not specified it won't be checked and the operation will be forced.uriInfo
- provides access to application and request URI information- Returns:
Response
an empty response- Throws:
WebValidationException
-