View Javadoc
1   package de.dlr.shepard.common.versionz;
2   
3   import de.dlr.shepard.common.util.Constants;
4   import jakarta.enterprise.context.ApplicationScoped;
5   import jakarta.inject.Inject;
6   import jakarta.ws.rs.GET;
7   import jakarta.ws.rs.Path;
8   import jakarta.ws.rs.Produces;
9   import jakarta.ws.rs.core.MediaType;
10  import jakarta.ws.rs.core.Response;
11  import org.eclipse.microprofile.config.inject.ConfigProperty;
12  import org.eclipse.microprofile.openapi.annotations.Operation;
13  import org.eclipse.microprofile.openapi.annotations.media.Content;
14  import org.eclipse.microprofile.openapi.annotations.media.Schema;
15  import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
16  import org.eclipse.microprofile.openapi.annotations.tags.Tag;
17  
18  @Path(Constants.VERSIONZ)
19  @Produces(MediaType.APPLICATION_JSON)
20  @ApplicationScoped
21  public class VersionzRest {
22  
23    @Inject
24    @ConfigProperty(name = "shepard.version")
25    String shepardVersion;
26  
27    @GET
28    @Tag(name = Constants.VERSIONZ)
29    @Operation(description = "Get shepard version")
30    @APIResponse(
31      description = "Version of the running shepard instance",
32      responseCode = "200",
33      content = @Content(schema = @Schema(implementation = VersionzIO.class))
34    )
35    public Response getShepardVersion() {
36      return Response.ok(new VersionzIO(shepardVersion)).build();
37    }
38  }