use of org.eclipse.che.api.core.rest.annotations.GenerateLink in project che by eclipse.
the class SshService method createPair.
@POST
@Consumes(APPLICATION_JSON)
@GenerateLink(rel = Constants.LINK_REL_CREATE_PAIR)
@ApiOperation(value = "Create a new ssh pair", notes = "This operation can be performed only by authorized user," + "this user will be the owner of the created ssh pair")
@ApiResponses({ @ApiResponse(code = 204, message = "The ssh pair successfully created"), @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"), @ApiResponse(code = 409, message = "Conflict error occurred during the ssh pair creation" + "(e.g. The Ssh pair with such name and service already exists)"), @ApiResponse(code = 500, message = "Internal server error occurred") })
public void createPair(@ApiParam(value = "The ssh pair to create", required = true) SshPairDto sshPair) throws BadRequestException, ServerException, ConflictException {
requiredNotNull(sshPair, "Ssh pair required");
requiredNotNull(sshPair.getService(), "Service name required");
requiredNotNull(sshPair.getName(), "Name required");
if (sshPair.getPublicKey() == null && sshPair.getPrivateKey() == null) {
throw new BadRequestException("Key content was not provided.");
}
sshManager.createPair(new SshPairImpl(getCurrentUserId(), sshPair));
}
Aggregations