Search in sources :

Example 1 with GetInputsResponse

use of org.opentosca.toscana.api.model.GetInputsResponse in project TOSCAna by StuPro-TOSCAna.

the class TransformationController method getInputs.

/**
 *     Returns a list of inputs that might have to be set (if they are required) in order to start
 *     the transformation <p>
 *     Accessed with http call <code>GET /csars/{csar}/transformations/{platform}/inputs</code>
 *     <table summary="">
 *     <tr>
 *     <td>HTTP-Code</td>
 *     <td>Mime-Type</td>
 *     <td>Description (Returned if)</td>
 *     </tr>
 *     <tr>
 *     <td>200</td>
 *     <td>application/hal+json</td>
 *     <td>Returned with content body (See samples.md) if the operation was successful</td>
 *     </tr>
 *     <tr>
 *     <td>404</td>
 *     <td>application/json</td>
 *     <td>Returns a error message if the csar is not found or if the csar does not have a transformation for the given
 *     name (see returned error message for details)</td>
 *     </tr>
 *     </table>
 */
@RequestMapping(path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json")
@ApiOperation(value = "Retrieve the inputs of this transformation", tags = { "transformations" }, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned")
@ApiResponses({ @ApiResponse(code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class), @ApiResponse(code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class) })
public ResponseEntity<GetInputsResponse> getInputs(@ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId) {
    Csar csar = findByCsarId(csarId);
    Transformation transformation = findTransformationByPlatform(csar, platformId);
    List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null);
    GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList);
    return ResponseEntity.ok(response);
}
Also used : Csar(org.opentosca.toscana.core.csar.Csar) Transformation(org.opentosca.toscana.core.transformation.Transformation) InputWrap(org.opentosca.toscana.api.model.InputWrap) GetInputsResponse(org.opentosca.toscana.api.model.GetInputsResponse) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 GetInputsResponse (org.opentosca.toscana.api.model.GetInputsResponse)1 InputWrap (org.opentosca.toscana.api.model.InputWrap)1 Csar (org.opentosca.toscana.core.csar.Csar)1 Transformation (org.opentosca.toscana.core.transformation.Transformation)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1