Search in sources :

Example 1 with HiddenResourceSupport

use of org.opentosca.toscana.api.docs.HiddenResourceSupport in project TOSCAna by StuPro-TOSCAna.

the class CommonController method getStatusIndex.

@RequestMapping(value = { "/status/", "/status" }, method = RequestMethod.GET, produces = "application/hal+json")
@ApiOperation(value = "Hypermedia endpoint to get all supported Status operations", notes = "Status operations are based on Spring Boot Actuator", produces = "application/hal+json", response = ResourceSupport.class)
public ResourceSupport getStatusIndex(HttpServletRequest request) throws Exception {
    String baseURL = request.getRequestURL().toString().replace("/api/status", "").replace("/api/status/", "");
    ResourceSupport support = new HiddenResourceSupport();
    support.add(new Link(baseURL + actuatorHealthPath, "health"));
    support.add(new Link(baseURL + actuatorMetricsPath, "metrics"));
    if (actuatorMappingsActive)
        support.add(new Link(baseURL + actuatorMappingsPath, "mappings"));
    support.add(linkTo(methodOn(CommonController.class).getStatusIndex(null)).withSelfRel());
    return support;
}
Also used : HiddenResourceSupport(org.opentosca.toscana.api.docs.HiddenResourceSupport) HiddenResourceSupport(org.opentosca.toscana.api.docs.HiddenResourceSupport) ResourceSupport(org.springframework.hateoas.ResourceSupport) Link(org.springframework.hateoas.Link) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with HiddenResourceSupport

use of org.opentosca.toscana.api.docs.HiddenResourceSupport in project TOSCAna by StuPro-TOSCAna.

the class CommonController method getIndex.

@RequestMapping(value = { "/", "" }, method = RequestMethod.GET, produces = "application/hal+json")
@ApiOperation(value = "Hypermedia endpoint to get all resource endpoints", notes = "The retuned links to the endpoints are: Csars, platforms and status", produces = "application/hal+json", response = ResourceSupport.class)
public ResourceSupport getIndex() throws Exception {
    ResourceSupport support = new HiddenResourceSupport();
    support.add(linkTo(methodOn(CommonController.class).getIndex()).withSelfRel());
    support.add(linkTo(methodOn(CommonController.class).getStatusIndex(null)).withRel("status"));
    support.add(linkTo(methodOn(PlatformController.class).getPlatforms()).withRel("platforms"));
    support.add(linkTo(methodOn(CsarController.class).listCSARs()).withRel("csars"));
    return support;
}
Also used : HiddenResourceSupport(org.opentosca.toscana.api.docs.HiddenResourceSupport) HiddenResourceSupport(org.opentosca.toscana.api.docs.HiddenResourceSupport) ResourceSupport(org.springframework.hateoas.ResourceSupport) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)2 HiddenResourceSupport (org.opentosca.toscana.api.docs.HiddenResourceSupport)2 ResourceSupport (org.springframework.hateoas.ResourceSupport)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Link (org.springframework.hateoas.Link)1