X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=enrichment-coordinator-service%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fenrichment%2Fcontrollers%2FStatusController.java;h=9e2154864d5b599b37e1a0df08c30ad4073ae905;hb=a28a4ad261601976c345425692116e5d7250b810;hp=a210aa5930204f8c163ef195b525887d0887c56c;hpb=b41c6e789ed381a31e2bd40d98e608d1d2dced50;p=nonrtric.git diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/StatusController.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/StatusController.java index a210aa59..9e215486 100644 --- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/StatusController.java +++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/StatusController.java @@ -1,9 +1,9 @@ /*- * ========================LICENSE_START================================= - * ONAP : ccsdk oran - * ====================================================================== - * Copyright (C) 2020 Nordix Foundation. All rights reserved. - * ====================================================================== + * O-RAN-SC + * %% + * Copyright (C) 2020 Nordix Foundation + * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,65 +20,68 @@ package org.oransc.enrichment.controllers; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.gson.annotations.SerializedName; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import org.immutables.gson.Gson; -import org.oransc.enrichment.repository.EiJobs; -import org.oransc.enrichment.repository.EiProducers; -import org.oransc.enrichment.repository.EiTypes; +import org.oransc.enrichment.repository.InfoJobs; +import org.oransc.enrichment.repository.InfoProducers; +import org.oransc.enrichment.repository.InfoTypes; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Mono; -import org.springframework.beans.factory.annotation.Autowired; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.gson.annotations.SerializedName; @RestController("StatusController") -@Api(tags = "Service status") +@Tag(name = StatusController.API_NAME) public class StatusController { + public static final String API_NAME = "Service status"; + public static final String API_DESCRIPTION = "API for monitoring of the service"; + @Autowired - private EiJobs eiJobs; + private InfoJobs infoJobs; @Autowired - private EiTypes eiTypes; + private InfoTypes infoTypes; @Autowired - private EiProducers eiProducers; + private InfoProducers infoProducers; @Gson.TypeAdapters - @ApiModel(value = "status_info") + @Schema(name = "service_status_info") public static class StatusInfo { - @ApiModelProperty(value = "status text") + @Schema(name = "status", description = "status text") @SerializedName("status") @JsonProperty(value = "status", required = true) public final String status; - @ApiModelProperty(value = "Number of EI producers") + @Schema(name = "no_of_producers", description = "Number of Information Producers") @SerializedName("no_of_producers") @JsonProperty(value = "no_of_producers", required = true) public final int noOfProducers; - @ApiModelProperty(value = "Number of EI types") + @Schema(name = "no_of_types", description = "Number of Information Types") @SerializedName("no_of_types") @JsonProperty(value = "no_of_types", required = true) public final int noOfTypes; - @ApiModelProperty(value = "Number of EI jobs") + @Schema(name = "no_of_jobs", description = "Number of Information Jobs") @SerializedName("no_of_jobs") @JsonProperty(value = "no_of_jobs", required = true) public final int noOfJobs; - public StatusInfo(String status, EiProducers producers, EiTypes types, EiJobs jobs) { + public StatusInfo(String status, InfoProducers producers, InfoTypes types, InfoJobs jobs) { this.status = status; this.noOfJobs = jobs.size(); this.noOfProducers = producers.size(); @@ -87,12 +90,16 @@ public class StatusController { } @GetMapping(path = "/status", produces = MediaType.APPLICATION_JSON_VALUE) - @ApiOperation(value = "Returns status and statistics of this service") - @ApiResponses(value = { // - @ApiResponse(code = 200, message = "Service is living", response = StatusInfo.class) // - }) + @Operation(summary = "Returns status and statistics of this service") + @ApiResponses( + value = { // + @ApiResponse( + responseCode = "200", + description = "Service is living", // + content = @Content(schema = @Schema(implementation = StatusInfo.class))) // + }) public Mono> getStatus() { - StatusInfo info = new StatusInfo("hunky dory", this.eiProducers, this.eiTypes, this.eiJobs); + StatusInfo info = new StatusInfo("hunky dory", this.infoProducers, this.infoTypes, this.infoJobs); return Mono.just(new ResponseEntity<>(info, HttpStatus.OK)); }