Search in sources :

Example 16 with Platform

use of org.opentosca.toscana.core.transformation.platform.Platform in project TOSCAna by StuPro-TOSCAna.

the class PlatformController method getPlatform.

/**
 *     Returns the information for a specific platform.
 *     <p>
 *     This method handles the <code>/platforms/{id}</code> request
 *     <p>
 *     jResponds with Http code 200 normally (application/hal+json) and with code 404 (application/hal+json, standard
 *     error message) if the platform with the given name (case sensitive) does not exist.
 *
 *     @param id the <code>id</code> (identifier) of the platform (HTTP Path Parameter)
 */
@ApiOperation(value = "Get the Details for a specific Platform", notes = "Returns the resource object for one specific plugin (platform)", code = 200)
@ApiResponses({ @ApiResponse(code = 200, message = "The request has been executed with no error!", response = PlatformResponse.class), @ApiResponse(code = 404, message = "There is no platform with the given name", response = RestErrorResponse.class) })
@RequestMapping(path = "/{id}", method = RequestMethod.GET, produces = "application/hal+json")
public ResponseEntity<PlatformResponse> getPlatform(@ApiParam(name = "id", value = "The Platform identifier", required = true) @PathVariable(name = "id") String id) {
    Optional<Platform> optionalPlatform = platformService.findPlatformById(id);
    Platform p = optionalPlatform.orElseThrow(PlatformNotFoundException::new);
    return ResponseEntity.ok(getPlatformResource(p));
}
Also used : Platform(org.opentosca.toscana.core.transformation.platform.Platform) PlatformNotFoundException(org.opentosca.toscana.api.exceptions.PlatformNotFoundException) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Platform (org.opentosca.toscana.core.transformation.platform.Platform)16 HashSet (java.util.HashSet)9 File (java.io.File)7 Csar (org.opentosca.toscana.core.csar.Csar)6 CsarImpl (org.opentosca.toscana.core.csar.CsarImpl)5 PlatformInput (org.opentosca.toscana.core.transformation.properties.PlatformInput)5 TransformationImpl (org.opentosca.toscana.core.transformation.TransformationImpl)4 ApiOperation (io.swagger.annotations.ApiOperation)3 Before (org.junit.Before)3 Test (org.junit.Test)3 Transformation (org.opentosca.toscana.core.transformation.Transformation)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ApiResponses (io.swagger.annotations.ApiResponses)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 PlatformNotFoundException (org.opentosca.toscana.api.exceptions.PlatformNotFoundException)2 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)2 AWSCredentials (com.amazonaws.auth.AWSCredentials)1 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1