From f4cfce1c2155765b5d91b38a46e27aa1c26beb61 Mon Sep 17 00:00:00 2001 From: Jason McIntosh Date: Mon, 29 Jul 2024 16:53:10 -0700 Subject: [PATCH] chore(upgrade): Migrate to openapi swagger spec --- .../controllers/AtlasFetchController.java | 16 ++--- kayenta-core/kayenta-core.gradle | 3 +- .../canary/CanaryClassifierConfig.java | 11 ++- .../CanaryClassifierThresholdsConfig.java | 14 ++-- .../kayenta/canary/CanaryJudgeConfig.java | 13 ++-- .../controller/DatadogFetchController.java | 18 +++-- .../controller/GraphiteFetchController.java | 20 +++--- .../controller/InfluxDbFetchController.java | 18 ++--- .../controller/NewRelicFetchController.java | 22 +++--- .../controller/NewRelicFetchRequest.java | 7 +- kayenta-orca/kayenta-orca.gradle | 1 + .../orca/controllers/PipelineController.java | 12 ++-- .../PrometheusFetchController.java | 30 ++++---- .../StackdriverFetchController.java | 36 +++++----- .../StandaloneCanaryAnalysisController.java | 72 ++++++++++--------- .../CanaryAnalysisAdhocExecutionRequest.java | 9 ++- .../CanaryAnalysisExecutionRequest.java | 33 +++++---- .../CanaryAnalysisExecutionRequestScope.java | 43 ++++++----- .../CanaryAnalysisExecutionResponse.java | 7 +- .../domain/CanaryAnalysisExecutionResult.java | 30 ++++---- ...CanaryAnalysisExecutionStatusResponse.java | 70 +++++++++--------- .../domain/CanaryExecutionResult.java | 67 +++++++++-------- .../domain/StageMetadata.java | 13 ++-- .../controller/WavefrontFetchController.java | 20 +++--- .../controllers/CanaryConfigController.java | 12 ++-- .../kayenta/controllers/CanaryController.java | 16 ++--- .../controllers/CanaryJudgesController.java | 24 ++++--- .../CanaryResultArchiveController.java | 18 ++--- .../controllers/CredentialsController.java | 4 +- .../controllers/MetricSetListController.java | 10 +-- .../MetricSetPairListController.java | 14 ++-- .../MetricsServiceMetadataController.java | 4 +- .../MetricsServicesController.java | 4 +- 33 files changed, 349 insertions(+), 342 deletions(-) diff --git a/kayenta-atlas/src/main/java/com/netflix/kayenta/atlas/controllers/AtlasFetchController.java b/kayenta-atlas/src/main/java/com/netflix/kayenta/atlas/controllers/AtlasFetchController.java index 894b60be2..b41f24e2f 100644 --- a/kayenta-atlas/src/main/java/com/netflix/kayenta/atlas/controllers/AtlasFetchController.java +++ b/kayenta-atlas/src/main/java/com/netflix/kayenta/atlas/controllers/AtlasFetchController.java @@ -23,7 +23,7 @@ import com.netflix.kayenta.metrics.SynchronousQueryProcessor; import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; import java.io.IOException; import java.time.Instant; import java.util.Collections; @@ -55,14 +55,14 @@ public AtlasFetchController( public Map queryMetrics( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam(defaultValue = "name,CpuRawUser,:eq,:sum") @RequestParam String q, - @ApiParam(defaultValue = "cpu") @RequestParam String metricSetName, - @ApiParam(defaultValue = "cluster") @RequestParam String type, + @Parameter(example = "name,CpuRawUser,:eq,:sum") @RequestParam String q, + @Parameter(example = "cpu") @RequestParam String metricSetName, + @Parameter(example = "cluster") @RequestParam String type, @RequestParam String scope, - @ApiParam(defaultValue = "us-east-1") @RequestParam String location, - @ApiParam(defaultValue = "2000-01-01T00:00:00Z") @RequestParam Instant start, - @ApiParam(defaultValue = "2000-01-01T04:00:00Z") @RequestParam Instant end, - @ApiParam(defaultValue = "300") @RequestParam Long step) + @Parameter(example = "us-east-1") @RequestParam String location, + @Parameter(example = "2000-01-01T00:00:00Z") @RequestParam Instant start, + @Parameter(example = "2000-01-01T04:00:00Z") @RequestParam Instant end, + @Parameter(example = "300") @RequestParam Long step) throws IOException { String resolvedMetricsAccountName = accountCredentialsRepository diff --git a/kayenta-core/kayenta-core.gradle b/kayenta-core/kayenta-core.gradle index 39b83d38f..4bf4286fd 100644 --- a/kayenta-core/kayenta-core.gradle +++ b/kayenta-core/kayenta-core.gradle @@ -5,8 +5,6 @@ dependencies { api "io.spinnaker.kork:kork-retrofit" api "com.netflix.spectator:spectator-api" - api "io.swagger:swagger-annotations" - api "io.spinnaker.orca:orca-core" api "io.spinnaker.orca:orca-retrofit" @@ -16,6 +14,7 @@ dependencies { api "net.logstash.logback:logstash-logback-encoder" api "javax.validation:validation-api" + api "io.swagger.core.v3:swagger-annotations" testImplementation "io.spinnaker.kork:kork-jedis-test" } diff --git a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java index 2a47d5ace..92408f9e7 100644 --- a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java +++ b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java @@ -17,8 +17,7 @@ package com.netflix.kayenta.canary; import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Map; import javax.validation.constraints.NotNull; import lombok.*; @@ -28,11 +27,11 @@ @NoArgsConstructor @AllArgsConstructor @JsonInclude(JsonInclude.Include.NON_NULL) -@ApiModel(description = "The classification configuration, such as group weights.") +@Schema(description = "The classification configuration, such as group weights.") public class CanaryClassifierConfig { - @ApiModelProperty( - value = + @Schema( + description = "List of each metrics group along with its corresponding weight. Weights must total 100.", example = "{\"pod-group\": 70, \"app-group\": 30}") @NotNull @@ -40,7 +39,7 @@ public class CanaryClassifierConfig { @Getter private Map groupWeights; - @ApiModelProperty(hidden = true) + @Schema(hidden = true) @Getter private CanaryClassifierThresholdsConfig scoreThresholds; } diff --git a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java index 6fbf3f6b0..7eb85077a 100644 --- a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java +++ b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java @@ -17,8 +17,7 @@ package com.netflix.kayenta.canary; import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.constraints.NotNull; import lombok.*; @@ -27,18 +26,19 @@ @NoArgsConstructor @AllArgsConstructor @JsonInclude(JsonInclude.Include.NON_NULL) -@ApiModel(description = "Sets thresholds for canary score.") +@Schema(description = "Sets thresholds for canary score.") public class CanaryClassifierThresholdsConfig { - @ApiModelProperty( - value = "If canary score is higher than this value -- canary is considered successful.", + @Schema( + description = "If canary score is higher than this value -- canary is considered successful.", example = "75.0") @NotNull @Getter private Double pass; - @ApiModelProperty( - value = "If canary score is lower than this value -- canary is considered marginal (failed).", + @Schema( + description = + "If canary score is lower than this value -- canary is considered marginal (failed).", example = "50.0") @NotNull @Getter diff --git a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java index ecb386087..626b21953 100644 --- a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java +++ b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java @@ -17,8 +17,7 @@ package com.netflix.kayenta.canary; import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Map; import javax.validation.constraints.NotNull; import lombok.*; @@ -28,19 +27,19 @@ @NoArgsConstructor @AllArgsConstructor @JsonInclude(JsonInclude.Include.NON_NULL) -@ApiModel(description = "Judge configuration.") +@Schema(description = "Judge configuration.") public class CanaryJudgeConfig { - @ApiModelProperty( - value = "Judge to use, as of right now there is only `NetflixACAJudge-v1.0`.", + @Schema( + description = "Judge to use, as of right now there is only `NetflixACAJudge-v1.0`.", example = "NetflixACAJudge-v1.0", required = true) @NotNull @Getter private String name; - @ApiModelProperty( - value = + @Schema( + description = "Additional judgement configuration. As of right now, this should always be an empty object.", example = "{}", required = true) diff --git a/kayenta-datadog/src/main/java/com/netflix/kayenta/datadog/controller/DatadogFetchController.java b/kayenta-datadog/src/main/java/com/netflix/kayenta/datadog/controller/DatadogFetchController.java index bfdf02950..1c9c7798e 100644 --- a/kayenta-datadog/src/main/java/com/netflix/kayenta/datadog/controller/DatadogFetchController.java +++ b/kayenta-datadog/src/main/java/com/netflix/kayenta/datadog/controller/DatadogFetchController.java @@ -25,7 +25,8 @@ import com.netflix.kayenta.metrics.SynchronousQueryProcessor; import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.IOException; import java.time.Instant; import java.util.Map; @@ -61,18 +62,21 @@ public DatadogFetchController( public Map queryMetrics( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam(defaultValue = "cpu") @RequestParam String metricSetName, - @ApiParam(defaultValue = "avg:system.cpu.user") @RequestParam String metricName, - @ApiParam(value = "The scope of the Datadog query. e.g. autoscaling_group:myapp-prod-v002") + @Parameter(example = "cpu") @RequestParam String metricSetName, + @Parameter(example = "avg:system.cpu.user") @RequestParam String metricName, + @Parameter( + description = + "The scope of the Datadog query. e.g. autoscaling_group:myapp-prod-v002") @RequestParam(required = false) String scope, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam(required = false) String start, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam(required = false) String end, - @ApiParam(defaultValue = "false") @RequestParam(required = false) final boolean dryRun) + @Parameter(schema = @Schema(defaultValue = "false")) @RequestParam(required = false) + final boolean dryRun) throws IOException { // Apply defaults. scope = diff --git a/kayenta-graphite/src/main/java/com/netflix/kayenta/graphite/controller/GraphiteFetchController.java b/kayenta-graphite/src/main/java/com/netflix/kayenta/graphite/controller/GraphiteFetchController.java index 7a45ba1c9..2e2945403 100644 --- a/kayenta-graphite/src/main/java/com/netflix/kayenta/graphite/controller/GraphiteFetchController.java +++ b/kayenta-graphite/src/main/java/com/netflix/kayenta/graphite/controller/GraphiteFetchController.java @@ -25,7 +25,7 @@ import com.netflix.kayenta.metrics.SynchronousQueryProcessor; import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; import java.io.IOException; import java.time.Instant; import java.util.Collections; @@ -63,25 +63,25 @@ public GraphiteFetchController( public Map queryMetrics( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam(defaultValue = "cpu") @RequestParam String metricSetName, - @ApiParam(defaultValue = "system.$location.$scope") @RequestParam String metricName, - @ApiParam( - value = + @Parameter(example = "cpu") @RequestParam String metricSetName, + @Parameter(example = "system.$location.$scope") @RequestParam String metricName, + @Parameter( + description = "The name of the resource to use when scoping the query. " + "This parameter will replace $scope in metricName") @RequestParam(required = false) String scope, - @ApiParam( - value = + @Parameter( + description = "The name of the resource to use when locating the query. " + "This parameter will replace $location in metricName") @RequestParam(required = false) String location, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam String start, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam String end, - @ApiParam(defaultValue = "false") @RequestParam(required = false) final boolean dryRun) + @Parameter(example = "false") @RequestParam(required = false) final boolean dryRun) throws IOException { start = diff --git a/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/controller/InfluxDbFetchController.java b/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/controller/InfluxDbFetchController.java index 3fb7c6148..2513a932f 100644 --- a/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/controller/InfluxDbFetchController.java +++ b/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/controller/InfluxDbFetchController.java @@ -27,7 +27,7 @@ import com.netflix.kayenta.metrics.SynchronousQueryProcessor; import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; import java.io.IOException; import java.time.Instant; import java.util.Collections; @@ -64,21 +64,23 @@ public InfluxDbFetchController( public Map queryMetrics( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam(defaultValue = "cpu") @RequestParam String metricSetName, - @ApiParam(defaultValue = "temperature") @RequestParam String metricName, - @ApiParam(value = "Fields that are being queried. e.g. internal, external") + @Parameter(example = "cpu") @RequestParam String metricSetName, + @Parameter(example = "temperature") @RequestParam String metricName, + @Parameter(description = "Fields that are being queried. e.g. internal, external") @RequestParam(required = false) List fields, - @ApiParam(value = "The scope of the Influxdb query. e.g. autoscaling_group:myapp-prod-v002") + @Parameter( + description = + "The scope of the Influxdb query. e.g. autoscaling_group:myapp-prod-v002") @RequestParam(required = false) String scope, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam(required = false) String start, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam(required = false) String end, - @ApiParam(defaultValue = "60", value = "seconds") @RequestParam Long step) + @Parameter(example = "60", description = "seconds") @RequestParam Long step) throws IOException { // Apply defaults. scope = diff --git a/kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchController.java b/kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchController.java index 87af14282..a9324c8f3 100644 --- a/kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchController.java +++ b/kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchController.java @@ -25,7 +25,8 @@ import com.netflix.kayenta.newrelic.config.NewRelicConfigurationTestControllerDefaultProperties; import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.IOException; import java.time.Instant; import java.util.Map; @@ -62,22 +63,25 @@ public NewRelicFetchController( public Map queryMetrics( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam(required = true) @Valid @RequestBody NewRelicFetchRequest newRelicFetchRequest, - @ApiParam(value = "The scope of the NewRelic query. e.g. autoscaling_group:myapp-prod-v002") + @Parameter(required = true) @Valid @RequestBody NewRelicFetchRequest newRelicFetchRequest, + @Parameter( + description = + "The scope of the NewRelic query. e.g. autoscaling_group:myapp-prod-v002") @RequestParam(required = false) String scope, - @ApiParam(value = "The location of the NewRelic query. e.g. us-west-2") + @Parameter(description = "The location of the NewRelic query. e.g. us-west-2") @RequestParam(required = false) String location, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam String start, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam String end, - @ApiParam(defaultValue = "60", value = "seconds") @RequestParam Long step, - @ApiParam(defaultValue = "0", value = "canary config metrics index") + @Parameter(example = "60", description = "seconds") @RequestParam Long step, + @Parameter(schema = @Schema(defaultValue = "0"), description = "canary config metrics index") @RequestParam(required = false) Integer metricIndex, - @ApiParam(defaultValue = "false") @RequestParam(required = false) final boolean dryRun) + @Parameter(schema = @Schema(defaultValue = "false")) @RequestParam(required = false) + final boolean dryRun) throws IOException { // Apply defaults. diff --git a/kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchRequest.java b/kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchRequest.java index 9543f5d09..38ee9957a 100644 --- a/kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchRequest.java +++ b/kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchRequest.java @@ -18,8 +18,7 @@ import com.netflix.kayenta.canary.CanaryConfig; import com.netflix.kayenta.canary.CanaryMetricConfig; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.HashMap; import java.util.Map; import javax.annotation.Nullable; @@ -31,10 +30,10 @@ @ToString @AllArgsConstructor @NoArgsConstructor -@ApiModel(description = "Request body for using the New Relic Fetch controller") +@Schema(description = "Request body for using the New Relic Fetch controller") class NewRelicFetchRequest { @NotNull - @ApiModelProperty(value = "The metric config to query New Relic insights for") + @Schema(description = "The metric config to query New Relic insights for") CanaryMetricConfig canaryMetricConfig; @NotNull @Builder.Default Map extendedScopeParams = new HashMap<>(); diff --git a/kayenta-orca/kayenta-orca.gradle b/kayenta-orca/kayenta-orca.gradle index 6b55a0e09..bbaf5df68 100644 --- a/kayenta-orca/kayenta-orca.gradle +++ b/kayenta-orca/kayenta-orca.gradle @@ -5,6 +5,7 @@ dependencies { api "io.spinnaker.orca:orca-redis" api "org.springframework.boot:spring-boot-starter-actuator" api "org.springframework.cloud:spring-cloud-commons" + api "io.swagger.core.v3:swagger-annotations" // TODO(duftler): Move these to spinnaker-dependencies. testImplementation "io.spinnaker.orca:orca-test" diff --git a/kayenta-orca/src/main/java/com/netflix/kayenta/orca/controllers/PipelineController.java b/kayenta-orca/src/main/java/com/netflix/kayenta/orca/controllers/PipelineController.java index 3ff9f7298..032f8bbd5 100644 --- a/kayenta-orca/src/main/java/com/netflix/kayenta/orca/controllers/PipelineController.java +++ b/kayenta-orca/src/main/java/com/netflix/kayenta/orca/controllers/PipelineController.java @@ -27,7 +27,7 @@ import com.netflix.spinnaker.orca.api.pipeline.models.PipelineExecution; import com.netflix.spinnaker.orca.pipeline.ExecutionLauncher; import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Map; import lombok.extern.slf4j.Slf4j; @@ -97,19 +97,19 @@ void startOrcaQueueProcessing() { } } - @ApiOperation(value = "Initiate a pipeline execution") + @Operation(summary = "Initiate a pipeline execution") @RequestMapping(value = "/start", method = RequestMethod.POST) String start(@RequestBody Map map) throws Exception { return startPipeline(map); } - @ApiOperation(value = "Retrieve a pipeline execution") + @Operation(summary = "Retrieve a pipeline execution") @RequestMapping(value = "/{executionId}", method = RequestMethod.GET) PipelineExecution getPipeline(@PathVariable String executionId) { return executionRepository.retrieve(PIPELINE, executionId); } - @ApiOperation(value = "Cancel a pipeline execution") + @Operation(summary = "Cancel a pipeline execution") @RequestMapping(value = "/{executionId}/cancel", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.ACCEPTED) void cancel(@PathVariable String executionId) { @@ -126,7 +126,7 @@ void cancel(@PathVariable String executionId) { executionRepository.updateStatus(PIPELINE, executionId, ExecutionStatus.CANCELED); } - @ApiOperation(value = "Delete a pipeline execution") + @Operation(summary = "Delete a pipeline execution") @RequestMapping(value = "/{executionId}", method = RequestMethod.DELETE) ResponseEntity delete(@PathVariable String executionId) { log.info("Deleting pipeline execution {}...", executionId); @@ -139,7 +139,7 @@ ResponseEntity delete(@PathVariable String executionId) { return new ResponseEntity(HttpStatus.OK); } - @ApiOperation(value = "List all pipeline IDs") + @Operation(summary = "List all pipeline IDs") @RequestMapping(method = RequestMethod.GET) List list() { return executionRepository.retrieveAllExecutionIds(PIPELINE); diff --git a/kayenta-prometheus/src/main/java/com/netflix/kayenta/prometheus/controllers/PrometheusFetchController.java b/kayenta-prometheus/src/main/java/com/netflix/kayenta/prometheus/controllers/PrometheusFetchController.java index 0eb26897a..33a65c321 100644 --- a/kayenta-prometheus/src/main/java/com/netflix/kayenta/prometheus/controllers/PrometheusFetchController.java +++ b/kayenta-prometheus/src/main/java/com/netflix/kayenta/prometheus/controllers/PrometheusFetchController.java @@ -25,7 +25,8 @@ import com.netflix.kayenta.prometheus.config.PrometheusConfigurationTestControllerDefaultProperties; import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.IOException; import java.time.Instant; import java.util.List; @@ -64,39 +65,40 @@ public PrometheusFetchController( public Map queryMetrics( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam(defaultValue = "cpu") @RequestParam String metricSetName, - @ApiParam(defaultValue = "node_cpu") @RequestParam String metricName, + @Parameter(example = "cpu") @RequestParam String metricSetName, + @Parameter(example = "node_cpu") @RequestParam String metricName, @RequestParam(required = false) List groupByFields, @RequestParam(required = false) String project, - @ApiParam( - value = + @Parameter( + description = "Used to identify the type of the resource being queried, " + "e.g. aws_ec2_instance, gce_instance.") @RequestParam(required = false) String resourceType, - @ApiParam( - value = + @Parameter( + description = "The location to use when scoping the query. Valid choices depend on what cloud " + "platform the query relates to (could be a region, a namespace, or something else).") @RequestParam(required = false) String location, - @ApiParam( - value = + @Parameter( + description = "The name of the resource to use when scoping the query. " + "The most common use-case is to provide a server group name.") @RequestParam(required = false) String scope, - @ApiParam(defaultValue = "mode=~\"user|system\"") @RequestParam(required = false) + @Parameter(example = "mode=~\"user|system\"") @RequestParam(required = false) List labelBindings, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-08T01:02:53Z") + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-08T01:02:53Z") @RequestParam(required = false) String start, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-08T01:12:22Z") + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-08T01:12:22Z") @RequestParam(required = false) String end, - @ApiParam(example = "60", value = "seconds") @RequestParam Long step, + @Parameter(example = "60", description = "seconds") @RequestParam Long step, @RequestParam(required = false) final String customFilter, - @ApiParam(defaultValue = "false") @RequestParam(required = false) final boolean dryRun) + @Parameter(schema = @Schema(defaultValue = "false")) @RequestParam(required = false) + final boolean dryRun) throws IOException { // Apply defaults. project = diff --git a/kayenta-stackdriver/src/main/java/com/netflix/kayenta/stackdriver/controllers/StackdriverFetchController.java b/kayenta-stackdriver/src/main/java/com/netflix/kayenta/stackdriver/controllers/StackdriverFetchController.java index 5b546847b..e0565524f 100644 --- a/kayenta-stackdriver/src/main/java/com/netflix/kayenta/stackdriver/controllers/StackdriverFetchController.java +++ b/kayenta-stackdriver/src/main/java/com/netflix/kayenta/stackdriver/controllers/StackdriverFetchController.java @@ -26,8 +26,9 @@ import com.netflix.kayenta.security.AccountCredentialsRepository; import com.netflix.kayenta.stackdriver.canary.StackdriverCanaryScopeFactory; import com.netflix.kayenta.stackdriver.config.StackdriverConfigurationTestControllerDefaultProperties; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; import java.io.IOException; import java.time.Instant; import java.util.List; @@ -64,46 +65,47 @@ public StackdriverFetchController( stackdriverConfigurationTestControllerDefaultProperties; } - @ApiOperation( - value = + @Operation( + summary = "Exercise the Stackdriver Metrics Service directly, without any orchestration or judging") @RequestMapping(value = "/query", method = RequestMethod.POST) public Map queryMetrics( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam(defaultValue = "cpu") @RequestParam String metricSetName, - @ApiParam(defaultValue = "compute.googleapis.com/instance/cpu/utilization") @RequestParam + @Parameter(example = "cpu") @RequestParam String metricSetName, + @Parameter(example = "compute.googleapis.com/instance/cpu/utilization") @RequestParam String metricType, @RequestParam(required = false) List groupByFields, // metric.label.instance_name @RequestParam(required = false) String project, - @ApiParam( - value = + @Parameter( + description = "Used to identify the type of the resource being queried, " + "e.g. aws_ec2_instance, gce_instance.") @RequestParam(required = false) String resourceType, - @ApiParam( - value = + @Parameter( + description = "The location to use when scoping the query. Valid choices depend on what cloud " + "platform the query relates to (could be a region, a namespace, or something else).") @RequestParam(required = false) String location, - @ApiParam( - value = + @Parameter( + description = "The name of the resource to use when scoping the query. " + "The most common use-case is to provide a server group name.") @RequestParam(required = false) String scope, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-02-21T12:48:00Z") + @Parameter(description = "An ISO format timestamp, e.g.: 2018-02-21T12:48:00Z") @RequestParam(required = false) String startTimeIso, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-02-21T12:51:00Z") + @Parameter(description = "An ISO format timestamp, e.g.: 2018-02-21T12:51:00Z") @RequestParam(required = false) String endTimeIso, - @ApiParam(example = "60", value = "seconds") @RequestParam Long step, + @Parameter(example = "60", description = "seconds") @RequestParam Long step, @RequestParam(required = false) final String customFilter, - @ApiParam @RequestBody final Map extendedScopeParams, - @ApiParam(defaultValue = "false") @RequestParam(required = false) final boolean dryRun) + @Parameter @RequestBody final Map extendedScopeParams, + @Parameter(schema = @Schema(defaultValue = "false")) @RequestParam(required = false) + final boolean dryRun) throws IOException { // Apply defaults. project = diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/controller/StandaloneCanaryAnalysisController.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/controller/StandaloneCanaryAnalysisController.java index 1637d3505..32122a66a 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/controller/StandaloneCanaryAnalysisController.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/controller/StandaloneCanaryAnalysisController.java @@ -32,8 +32,9 @@ import com.netflix.kayenta.storage.ObjectType; import com.netflix.kayenta.storage.StorageService; import com.netflix.kayenta.storage.StorageServiceRepository; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Optional; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -86,44 +87,45 @@ public StandaloneCanaryAnalysisController( * @param canaryConfigId The id for the canary configuration to use for the analysis execution * @return Object with the execution id */ - @ApiOperation( - value = + @Operation( + summary = "Initiate a canary analysis execution with multiple canary judgements using a stored canary config") @RequestMapping(value = "/{canaryConfigId:.+}", consumes = "application/json", method = POST) public CanaryAnalysisExecutionResponse initiateCanaryAnalysis( - @ApiParam( - value = "The initiating user", - defaultValue = "anonymous", + @Parameter( + description = "The initiating user", + schema = @Schema(defaultValue = "anonymous"), example = "justin.field@example.com") @RequestParam(required = false) final String user, - @ApiParam(value = "The application under test", example = "examplecanarymicroservice") + @Parameter(description = "The application under test", example = "examplecanarymicroservice") @RequestParam(required = false) final String application, - @ApiParam( - value = + @Parameter( + description = "The parent pipeline execution id, if this is being executed as a StageExecution in another pipeline", example = "01CYZCD53RBX2KR2Q9GY0218UI") @RequestParam(required = false) final String parentPipelineExecutionId, - @ApiParam( - value = "The account that has the metrics for the application under test", + @Parameter( + description = "The account that has the metrics for the application under test", example = "some-metrics-account") @RequestParam(required = false) final String metricsAccountName, - @ApiParam( - value = "The account that has the supplied canary config id", + @Parameter( + description = "The account that has the supplied canary config id", example = "some-config-account") @RequestParam(required = false) final String configurationAccountName, - @ApiParam( - value = "The account that will be used to store results", + @Parameter( + description = "The account that will be used to store results", example = "some-storage-account") @RequestParam(required = false) final String storageAccountName, - @ApiParam(required = true) @RequestBody + @Parameter(required = true) @RequestBody final CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest, - @ApiParam(value = "The id for the canary configuration to use for the analysis execution") + @Parameter( + description = "The id for the canary configuration to use for the analysis execution") @PathVariable String canaryConfigId) { @@ -173,37 +175,37 @@ public CanaryAnalysisExecutionResponse initiateCanaryAnalysis( * that configures how the analysis will be performed and the canary config * @return Object with the execution id */ - @ApiOperation( - value = + @Operation( + summary = "Initiate an canary analysis execution with multiple canary judgements with the CanaryConfig provided in the request body") @RequestMapping(consumes = "application/json", method = POST) public CanaryAnalysisExecutionResponse initiateCanaryAnalysisExecutionWithConfig( - @ApiParam( - value = "The initiating user", - defaultValue = "anonymous", + @Parameter( + description = "The initiating user", + schema = @Schema(defaultValue = "anonymous"), example = "justin.field@example.com") @RequestParam(required = false) final String user, - @ApiParam(value = "The application under test", example = "examplecanarymicroservice") + @Parameter(description = "The application under test", example = "examplecanarymicroservice") @RequestParam(required = false) final String application, - @ApiParam( - value = + @Parameter( + description = "The parent pipeline execution id, if this is being executed as a StageExecution in another pipeline", example = "01CYZCD53RBX2KR2Q9GY0218UI") @RequestParam(required = false) final String parentPipelineExecutionId, - @ApiParam( - value = "The account that has the metrics for the application under test", + @Parameter( + description = "The account that has the metrics for the application under test", example = "some-metrics-account") @RequestParam(required = false) final String metricsAccountName, - @ApiParam( - value = "The account that will be used to store results", + @Parameter( + description = "The account that will be used to store results", example = "some-storage-account") @RequestParam(required = false) final String storageAccountName, - @ApiParam(required = true) @RequestBody + @Parameter(required = true) @RequestBody final CanaryAnalysisAdhocExecutionRequest canaryAnalysisAdhocExecutionRequest) { String resolvedMetricsAccountName = @@ -242,13 +244,13 @@ public CanaryAnalysisExecutionResponse initiateCanaryAnalysisExecutionWithConfig * @param canaryAnalysisExecutionId The id for the Canary Analysis Execution * @return The canary analysis execution object that will have the results and status. */ - @ApiOperation(value = "Retrieve status and results for a canary analysis execution") + @Operation(summary = "Retrieve status and results for a canary analysis execution") @RequestMapping(value = "/{canaryAnalysisExecutionId:.+}", method = GET) public CanaryAnalysisExecutionStatusResponse getCanaryAnalysisExecution( - @ApiParam(value = "The id for the Canary Analysis Execution") @PathVariable + @Parameter(description = "The id for the Canary Analysis Execution") @PathVariable final String canaryAnalysisExecutionId, - @ApiParam( - value = + @Parameter( + description = "The account to use to try and find the execution if not found in the execution repo", example = "some-storage-account") @RequestParam(required = false) diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisAdhocExecutionRequest.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisAdhocExecutionRequest.java index b1d26eff8..84c682bf8 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisAdhocExecutionRequest.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisAdhocExecutionRequest.java @@ -17,22 +17,21 @@ package com.netflix.kayenta.standalonecanaryanalysis.domain; import com.netflix.kayenta.canary.CanaryConfig; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.constraints.NotNull; import lombok.Data; @Data -@ApiModel( +@Schema( description = "Wrapper object around canary config and execution request for the ad-hoc endpoint.") public class CanaryAnalysisAdhocExecutionRequest { @NotNull - @ApiModelProperty(value = "The canary configuration to use for the canary analysis execution.") + @Schema(description = "The canary configuration to use for the canary analysis execution.") protected CanaryConfig canaryConfig; @NotNull - @ApiModelProperty(value = "The canary analysis configuration request object.") + @Schema(description = "The canary analysis configuration request object.") protected CanaryAnalysisExecutionRequest executionRequest; } diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionRequest.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionRequest.java index 7ecd694ae..d53ffdab0 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionRequest.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionRequest.java @@ -18,8 +18,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.netflix.kayenta.canary.CanaryClassifierThresholdsConfig; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.Duration; import java.time.Instant; import java.util.List; @@ -36,37 +35,37 @@ @ToString @AllArgsConstructor @NoArgsConstructor -@ApiModel( +@Schema( description = "The canary analysis configuration request object for initiating a canary analysis execution.") public class CanaryAnalysisExecutionRequest { @NotNull - @ApiModelProperty( - value = + @Schema( + description = "This is a list of Canary Analysis Execution Request scopes. " + "This directs the Canary Analysis Execution where to find the experiment and control metrics in the metrics source. " + "The list must have at least one value.") private List scopes; @NotNull - @ApiModelProperty( - value = + @Schema( + description = "The thresholds that will be used for the canary judgements. " + "When multiple judgements are occurring during the lifetime of this execution, the last judgement must have a score " + "that meets or exceeds the pass threshold, all previous judgement scores must meet or exceed the marginal score.") private CanaryClassifierThresholdsConfig thresholds; - @ApiModelProperty( - value = + @Schema( + description = "This is the amount of time in minutes the analysis phase of the canary analysis execution will last. " + "Either this value or endTimeIso (in scopes) must be set. ") private Long lifetimeDurationMins; @NotNull @Builder.Default - @ApiModelProperty( - value = + @Schema( + description = "This is how long the canary analysis execution will wait before beginning the analysis phase. " + "This can be useful in a continuous integration situation where the canary analysis execution is triggered asynchronously " + "and metrics are ready for consumption after a time period.") @@ -74,8 +73,8 @@ public class CanaryAnalysisExecutionRequest { @NotNull @Builder.Default - @ApiModelProperty( - value = + @Schema( + description = "If this optional value is supplied, then the canary analysis execution will perform judgements on a sliding time window. " + "The judgements will be from endTime - lookbackMins to startTime + (judgementNumber * interval). " + "If lookbackMins is not exactly equal to interval, then the metrics analyzed will be overlapping or discontinuous.\n" @@ -83,15 +82,15 @@ public class CanaryAnalysisExecutionRequest { + "from startTime + to startTime + (judgementNumber * interval).\n") private Long lookbackMins = 0L; - @ApiModelProperty( - value = + @Schema( + description = "The value of analysisIntervalMins is used to calculate how many judgements will occur over the lifetime of the canary analysis execution.\n" + "If this field is omitted then it will default to lifetime.\n" + "If this field is set to a value greater than lifetime, it will be reset to lifetime.") private Long analysisIntervalMins; - @ApiModelProperty( - value = + @Schema( + description = "A map of customizable data that among other things can be used in org-specific external modules such as event " + "listeners to handle notifications such as Slack, email, async http callbacks, etc.\n" + "The contents of this field don't have an effect on the actual canary analysis execution.") diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionRequestScope.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionRequestScope.java index 3e3acd858..e0986fc7a 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionRequestScope.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionRequestScope.java @@ -17,8 +17,7 @@ package com.netflix.kayenta.standalonecanaryanalysis.domain; import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.Instant; import java.util.HashMap; import java.util.Map; @@ -33,68 +32,68 @@ @ToString @AllArgsConstructor @NoArgsConstructor -@ApiModel( +@Schema( description = "Defines where to find the metrics for the experiment and control in the metrics source.") public class CanaryAnalysisExecutionRequestScope { @Builder.Default - @ApiModelProperty(value = "Specifies unique name of the metrics scope.", example = "default") + @Schema(description = "Specifies unique name of the metrics scope.", example = "default") String scopeName = "default"; - @ApiModelProperty( - value = + @Schema( + description = "This value is used to fetch the data for the control from the metrics service. " + "It is often a server group name (e.g. ASG on EC2 or MIG on GCE).", example = "examplemicroservice--control-v001") String controlScope; - @ApiModelProperty( - value = + @Schema( + description = "This is the location of the control which is used by some metrics sources to further differentiate metrics." + "Examples include a region or zone.", example = "us-west-2") String controlLocation; - @ApiModelProperty( - value = + @Schema( + description = "The time offset in minutes to be subtracted from the control start and end time. If none is provided, the control is " + "evaluated at the same time as the experiment.", example = "10") @Builder.Default Long controlOffsetInMinutes = 0L; - @ApiModelProperty( - value = + @Schema( + description = "This value is used to fetch the data for the experiment from the metrics service. " + "It is often a server group name (e.g. ASG on EC2 or MIG on GCE).", example = "examplemicroservice--experiment-v001") String experimentScope; - @ApiModelProperty( - value = + @Schema( + description = "This is the location of the experiment which is used by some metrics sources to further differentiate metrics." + "Examples include a region or zone.", example = "us-west-2") String experimentLocation; - @ApiModelProperty( - value = + @Schema( + description = "This optional value indicates the start time for looking up metrics. " + "If this value is omitted, the current time at execution will be used instead.", example = "2018-12-17T20:56:39.689Z") String startTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "This value will be used to calculate the length of time of the analysis execution.\n" + "Either this value or lifetime (in the parent object) must be supplied. " + "This field takes precedence over lifetime.", example = "2018-12-17T21:56:39.689Z") String endTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "This indicates the period in seconds for how often data points will be requested from the metrics sources when querying for metrics.\n" + "The value defaults to 60 which means a data point will be requested every 60 seconds from the data source.\n" + "The resulting resolution (data points per the calculated interval) needs to be at least 50 " @@ -103,8 +102,8 @@ public class CanaryAnalysisExecutionRequestScope { @Builder.Default Long step = 60L; - @ApiModelProperty( - value = + @Schema( + description = "This is an additional scope to define key values as some metric sources require additional scope params. " + "For example New Relic and SignalFx require _scope_key to be supplied.") @Builder.Default diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionResponse.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionResponse.java index ad6d08940..a77da0c00 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionResponse.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionResponse.java @@ -16,18 +16,17 @@ package com.netflix.kayenta.standalonecanaryanalysis.domain; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @Data @Builder @AllArgsConstructor @NoArgsConstructor -@ApiModel(description = "Wrapper object around the canary analysis execution id.") +@Schema(description = "Wrapper object around the canary analysis execution id.") public class CanaryAnalysisExecutionResponse { @NonNull - @ApiModelProperty(value = "The id of the execution", example = "01CYZCD53RBX2KR2Q9GY0218TV") + @Schema(description = "The id of the execution", example = "01CYZCD53RBX2KR2Q9GY0218TV") protected String canaryAnalysisExecutionId; } diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionResult.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionResult.java index 29130fa2b..6c6e1bcfa 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionResult.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionResult.java @@ -16,8 +16,7 @@ package com.netflix.kayenta.standalonecanaryanalysis.domain; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.LinkedList; import java.util.List; import lombok.AllArgsConstructor; @@ -30,44 +29,43 @@ @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel(description = "The canary analysis execution results.") +@Schema(description = "The canary analysis execution results.") public class CanaryAnalysisExecutionResult { - @ApiModelProperty( - value = "This boolean represents whether the canary passed the defined thresholds.") + @Schema(description = "This boolean represents whether the canary passed the defined thresholds.") protected boolean didPassThresholds; - @ApiModelProperty(value = "This boolean is set to true if any of the judgements had warnings.") + @Schema(description = "This boolean is set to true if any of the judgements had warnings.") protected boolean hasWarnings; - @ApiModelProperty(value = "This string describes the aggregated judgement results.") + @Schema(description = "This string describes the aggregated judgement results.") protected String canaryScoreMessage; @NonNull @Builder.Default - @ApiModelProperty( - value = + @Schema( + description = "This is an ordered list of the individual judgement scores. " + "The last score is used for determining the final result.") protected List canaryScores = new LinkedList<>(); @NonNull @Builder.Default - @ApiModelProperty(value = "This is a list of canary execution summaries.") + @Schema(description = "This is a list of canary execution summaries.") protected List canaryExecutionResults = new LinkedList<>(); - @ApiModelProperty( - value = + @Schema( + description = "buildTimeIso is an ISO 8061 string and refers to the time the pipeline was first created.") protected String buildTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "startTimeIso is an ISO 8061 string and refers to the time the pipeline started running.") protected String startTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "endTimeIso is an ISO 8061 string and refers to the time the pipeline ended, either successfully or unsuccessfully.") protected String endTimeIso; } diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionStatusResponse.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionStatusResponse.java index de6eb84be..41c663652 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionStatusResponse.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryAnalysisExecutionStatusResponse.java @@ -19,8 +19,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.netflix.kayenta.canary.CanaryConfig; import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; @@ -32,105 +31,104 @@ @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel(description = "The canary analysis execution status response.") +@Schema(description = "The canary analysis execution status response.") public class CanaryAnalysisExecutionStatusResponse { @NotNull - @ApiModelProperty(value = "The application under test.") + @Schema(description = "The application under test.") protected String application; @NotNull - @ApiModelProperty( - value = "This is the initiating user. If none was supplied this will be anonymous.") + @Schema(description = "This is the initiating user. If none was supplied this will be anonymous.") protected String user; - @ApiModelProperty(value = "This is the parent pipeline execution id if one was provided.") + @Schema(description = "This is the parent pipeline execution id if one was provided.") protected String parentPipelineExecutionId; @NotNull - @ApiModelProperty(value = "This is the pipeline id of this execution.") + @Schema(description = "This is the pipeline id of this execution.") protected String pipelineId; @NotNull - @ApiModelProperty( - value = + @Schema( + description = "This is a map of StageExecution statuses which is useful for gaining insight into progress of the execution.") protected List stageStatus; @NotNull - @ApiModelProperty( - value = + @Schema( + description = "This indicates that the task/stage/pipeline has finished its work, independent of whether it was successful.") protected Boolean complete; @NotNull - @ApiModelProperty( - value = "This is the Orca Execution Status for the Canary Analysis Pipeline Execution.") + @Schema( + description = "This is the Orca Execution Status for the Canary Analysis Pipeline Execution.") protected ExecutionStatus executionStatus; @JsonProperty("status") - @ApiModelProperty( - value = + @Schema( + description = "This is the lowercased serialized Orca status which is similar to the status in the /canary endpoints.") public String status() { return executionStatus.toString().toLowerCase(); } - @ApiModelProperty(value = "This shows the first exception if any occurred.") + @Schema(description = "This shows the first exception if any occurred.") protected Object exception; - @ApiModelProperty( - value = + @Schema( + description = "This is the actual result of the canary analysis execution which will be present when complete is true.") protected CanaryAnalysisExecutionResult canaryAnalysisExecutionResult; - @ApiModelProperty(value = "The supplied request configuration.") + @Schema(description = "The supplied request configuration.") protected CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest; - @ApiModelProperty(value = "The supplied or retrieved canary configuration used.") + @Schema(description = "The supplied or retrieved canary configuration used.") protected CanaryConfig canaryConfig; - @ApiModelProperty(value = "This is the supplied canary config id if one was provided.") + @Schema(description = "This is the supplied canary config id if one was provided.") protected String canaryConfigId; // (startTime - buildTime) should indicate the time it was in the queue before starting. // (endTime - buildTime) should indicate the total time it took from request to result. // (endTime - startTime) should be the amount of time the canary was actually running. - @ApiModelProperty( - value = + @Schema( + description = "buildTimeMillis is in epoch millis time and refers to the time the pipeline was first created.") protected Long buildTimeMillis; - @ApiModelProperty( - value = + @Schema( + description = "buildTimeIso is an ISO 8061 string and refers to the time the pipeline was first created.") protected String buildTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "startTimeIso is an ISO 8061 string and refers to the time the pipeline started running.") protected Long startTimeMillis; - @ApiModelProperty( - value = + @Schema( + description = "startTimeIso is an ISO 8061 string and refers to the time the pipeline started running.") protected String startTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "endTimeMillis is in epoch millis time and refers to the time the pipeline ended, either successfully or unsuccessfully.") protected Long endTimeMillis; - @ApiModelProperty( - value = + @Schema( + description = "endTimeIso is an ISO 8061 string and refers to the time the pipeline ended, either successfully or unsuccessfully.") protected String endTimeIso; @NotNull - @ApiModelProperty(value = "The resolved storage account name.") + @Schema(description = "The resolved storage account name.") protected String storageAccountName; @NotNull - @ApiModelProperty(value = "The resolved metrics account name.") + @Schema(description = "The resolved metrics account name.") protected String metricsAccountName; } diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryExecutionResult.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryExecutionResult.java index 95fdd74e7..6578934da 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryExecutionResult.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/CanaryExecutionResult.java @@ -19,8 +19,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.netflix.kayenta.canary.results.CanaryResult; import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.LinkedList; import java.util.List; import javax.validation.constraints.NotNull; @@ -35,94 +34,94 @@ @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties(ignoreUnknown = true) -@ApiModel( +@Schema( description = "Summary Result of the Judgement Executions. See GET /canary/${this.executionId} for full result.") public class CanaryExecutionResult { @NotNull - @ApiModelProperty( - value = + @Schema( + description = "This is the execution id of the canary judgement which can be used in the canary controller APIs to fetch the full result.") protected String executionId; @NotNull - @ApiModelProperty(value = "This is the Orca Execution Status for the Canary Judgement Execution.") + @Schema(description = "This is the Orca Execution Status for the Canary Judgement Execution.") protected ExecutionStatus executionStatus; - @ApiModelProperty( - value = "This shows the first exception in the Judgement Execution if any occurred.") + @Schema( + description = "This shows the first exception in the Judgement Execution if any occurred.") protected Object exception; - @ApiModelProperty(value = "The result of the canary judgement execution.") + @Schema(description = "The result of the canary judgement execution.") protected CanaryResult result; - @ApiModelProperty( - value = + @Schema( + description = "judgementStartTimeIso is an ISO 8061 string and is the start time used to query the metric source for this judgement.") protected String judgementStartTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "judgementStartTimeMillis is in epoch millis time and is the start time used to query the metric source for this judgement.") protected Long judgementStartTimeMillis; - @ApiModelProperty( - value = + @Schema( + description = "judgementEndTimeIso is an ISO 8061 string and is the end time used to query the metric source for this judgement.") protected String judgementEndTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "judgementEndTimeMillis is in epoch millis time and is the end time used to query the metric source for this judgement.") protected Long judgementEndTimeMillis; @NonNull @Builder.Default - @ApiModelProperty(value = "This shows any warnings that occurred during the canary judgement.") + @Schema(description = "This shows any warnings that occurred during the canary judgement.") List warnings = new LinkedList<>(); - @ApiModelProperty( - value = + @Schema( + description = "This is the metric set pair list id for this canary judgement execution which can be used for obtaining the raw metrics via the API.") protected String metricSetPairListId; // (startTime - buildTime) should indicate the time it was in the queue before starting. // (endTime - buildTime) should indicate the total time it took from request to result. // (endTime - startTime) should be the amount of time the canary was actually running. - @ApiModelProperty( - value = + @Schema( + description = "buildTimeMillis is in epoch millis time and refers to the time the pipeline was first created.") protected Long buildTimeMillis; - @ApiModelProperty( - value = + @Schema( + description = "buildTimeIso is an ISO 8061 string and refers to the time the pipeline was first created.") protected String buildTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "startTimeMillis is in epoch millis time and refers to the time the pipeline started running.") protected Long startTimeMillis; - @ApiModelProperty( - value = + @Schema( + description = "startTimeIso is an ISO 8061 string and refers to the time the pipeline started running.") protected String startTimeIso; - @ApiModelProperty( - value = + @Schema( + description = "endTimeMillis is in epoch millis time and refers to the time the pipeline ended, either successfully or unsuccessfully.") protected Long endTimeMillis; - @ApiModelProperty( - value = + @Schema( + description = "endTimeIso is an ISO 8061 string and refers to the time the pipeline ended, either successfully or unsuccessfully.") protected String endTimeIso; - @ApiModelProperty(value = "If set, these are the account names used for this run.") + @Schema(description = "If set, these are the account names used for this run.") protected String storageAccountName; - @ApiModelProperty(value = "If set, these are the account names used for this run.") + @Schema(description = "If set, these are the account names used for this run.") protected String configurationAccountName; } diff --git a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/StageMetadata.java b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/StageMetadata.java index 9027998e3..8c11e13dc 100644 --- a/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/StageMetadata.java +++ b/kayenta-standalone-canary-analysis/src/main/java/com/netflix/kayenta/standalonecanaryanalysis/domain/StageMetadata.java @@ -17,8 +17,7 @@ package com.netflix.kayenta.standalonecanaryanalysis.domain; import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; @@ -31,22 +30,22 @@ @NoArgsConstructor @AllArgsConstructor @ToString -@ApiModel( +@Schema( description = "Metadata around an Orca StageExecution of the canary analysis pipeline execution") public class StageMetadata { @NotNull - @ApiModelProperty(value = "The StageExecution type") + @Schema(description = "The StageExecution type") String type; @NotNull - @ApiModelProperty(value = "The StageExecution name") + @Schema(description = "The StageExecution name") String name; @NotNull - @ApiModelProperty(value = "The Orca execution status of the stage") + @Schema(description = "The Orca execution status of the stage") ExecutionStatus status; - @ApiModelProperty(value = "The execution id if the StageExecution is a runCanary stage") + @Schema(description = "The execution id if the StageExecution is a runCanary stage") String executionId; } diff --git a/kayenta-wavefront/src/main/java/com/netflix/kayenta/wavefront/controller/WavefrontFetchController.java b/kayenta-wavefront/src/main/java/com/netflix/kayenta/wavefront/controller/WavefrontFetchController.java index 858d1bbc1..48c72dcd5 100644 --- a/kayenta-wavefront/src/main/java/com/netflix/kayenta/wavefront/controller/WavefrontFetchController.java +++ b/kayenta-wavefront/src/main/java/com/netflix/kayenta/wavefront/controller/WavefrontFetchController.java @@ -21,7 +21,7 @@ import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; import com.netflix.kayenta.wavefront.canary.WavefrontCanaryScope; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; import java.io.IOException; import java.time.Instant; import java.util.Map; @@ -52,24 +52,26 @@ public WavefrontFetchController( public Map queryMetrics( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam(defaultValue = "cpu") @RequestParam String metricSetName, - @ApiParam(defaultValue = "system.cpu.user") @RequestParam String metricName, - @ApiParam(value = "An aggregate function, e.g.: avg, min, max") + @Parameter(example = "cpu") @RequestParam String metricSetName, + @Parameter(example = "system.cpu.user") @RequestParam String metricName, + @Parameter(description = "An aggregate function, e.g.: avg, min, max") @RequestParam(defaultValue = "") String aggregate, - @ApiParam(value = "Summarization strategy to use when bucketing points together") + @Parameter(description = "Summarization strategy to use when bucketing points together") @RequestParam( defaultValue = "MEAN", value = "[MEAN, MEDIAN, MIN, MAX, SUM, COUNT, FIRST, LAST]") String summarization, - @ApiParam(value = "The scope of the Wavefront query. e.g. autoscaling_group=myapp-prd-v002") + @Parameter( + description = + "The scope of the Wavefront query. e.g. autoscaling_group=myapp-prd-v002") @RequestParam(defaultValue = "") String scope, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam String start, - @ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam + @Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam String end, - @ApiParam(defaultValue = "m", value = "[s, m, h, d]") @RequestParam String step, + @Parameter(example = "m", description = "[s, m, h, d]") @RequestParam String step, @RequestParam(required = false) final boolean dryRun) throws IOException { diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryConfigController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryConfigController.java index 014ef107d..6e605ecc6 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryConfigController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryConfigController.java @@ -25,7 +25,7 @@ import com.netflix.kayenta.storage.StorageService; import com.netflix.kayenta.storage.StorageServiceRepository; import com.netflix.spinnaker.kork.web.exceptions.NotFoundException; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.io.IOException; import java.time.Instant; import java.util.HashSet; @@ -70,7 +70,7 @@ public CanaryConfigController( this.disableMetricNameValidation = disableMetricNameValidation; } - @ApiOperation(value = "Retrieve a canary config from object storage") + @Operation(summary = "Retrieve a canary config from object storage") @RequestMapping(value = "/{canaryConfigId:.+}", method = RequestMethod.GET) public CanaryConfig loadCanaryConfig( @RequestParam(required = false) final String configurationAccountName, @@ -86,7 +86,7 @@ public CanaryConfig loadCanaryConfig( resolvedConfigurationAccountName, ObjectType.CANARY_CONFIG, canaryConfigId); } - @ApiOperation(value = "Write a canary config to object storage") + @Operation(summary = "Write a canary config to object storage") @RequestMapping(consumes = "application/json", method = RequestMethod.POST) public CanaryConfigUpdateResponse storeCanaryConfig( @RequestParam(required = false) final String configurationAccountName, @@ -140,7 +140,7 @@ public CanaryConfigUpdateResponse storeCanaryConfig( } } - @ApiOperation(value = "Update a canary config") + @Operation(summary = "Update a canary config") @RequestMapping( value = "/{canaryConfigId:.+}", consumes = "application/json", @@ -232,7 +232,7 @@ private void validateMetricConfigNames(CanaryConfig canaryConfig) { } } - @ApiOperation(value = "Delete a canary config") + @Operation(summary = "Delete a canary config") @RequestMapping(value = "/{canaryConfigId:.+}", method = RequestMethod.DELETE) public void deleteCanaryConfig( @RequestParam(required = false) final String configurationAccountName, @@ -251,7 +251,7 @@ public void deleteCanaryConfig( response.setStatus(HttpStatus.NO_CONTENT.value()); } - @ApiOperation(value = "Retrieve a list of canary config ids and timestamps") + @Operation(summary = "Retrieve a list of canary config ids and timestamps") @RequestMapping(method = RequestMethod.GET) public List> listAllCanaryConfigs( @RequestParam(required = false) final String configurationAccountName, diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryController.java index 7582fc8fb..003c69772 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryController.java @@ -28,8 +28,8 @@ import com.netflix.spinnaker.orca.api.pipeline.models.PipelineExecution; import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionNotFoundException; import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -66,7 +66,7 @@ public CanaryController( // Initiate a new canary run. // // TODO(duftler): Allow for user to be passed in. - @ApiOperation(value = "Initiate a canary pipeline") + @Operation(summary = "Initiate a canary pipeline") @RequestMapping( value = "/{canaryConfigId:.+}", consumes = "application/json", @@ -77,7 +77,7 @@ public CanaryExecutionResponse initiateCanary( @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String configurationAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam @RequestBody final CanaryExecutionRequest canaryExecutionRequest, + @Parameter @RequestBody final CanaryExecutionRequest canaryExecutionRequest, @PathVariable String canaryConfigId) throws JsonProcessingException { String resolvedMetricsAccountName = @@ -114,14 +114,14 @@ public CanaryExecutionResponse initiateCanary( // Initiate a new canary run, fully specifying the config and execution request // // TODO(duftler): Allow for user to be passed in. - @ApiOperation(value = "Initiate a canary pipeline with CanaryConfig provided") + @Operation(summary = "Initiate a canary pipeline with CanaryConfig provided") @RequestMapping(consumes = "application/json", method = RequestMethod.POST) public CanaryExecutionResponse initiateCanaryWithConfig( @RequestParam(required = false) final String application, @RequestParam(required = false) final String parentPipelineExecutionId, @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, - @ApiParam @RequestBody final CanaryAdhocExecutionRequest canaryAdhocExecutionRequest) + @Parameter @RequestBody final CanaryAdhocExecutionRequest canaryAdhocExecutionRequest) throws JsonProcessingException { String resolvedMetricsAccountName = @@ -154,7 +154,7 @@ public CanaryExecutionResponse initiateCanaryWithConfig( // // Get the results of a canary run by ID // - @ApiOperation(value = "Retrieve status and results for a canary run") + @Operation(summary = "Retrieve status and results for a canary run") @RequestMapping(value = "/{canaryExecutionId:.+}", method = RequestMethod.GET) public CanaryExecutionStatusResponse getCanaryResults( @RequestParam(required = false) final String storageAccountName, @@ -178,7 +178,7 @@ public CanaryExecutionStatusResponse getCanaryResults( } } - @ApiOperation(value = "Retrieve a list of an application's canary results") + @Operation(summary = "Retrieve a list of an application's canary results") @RequestMapping(value = "/executions", method = RequestMethod.GET) List getCanaryResultsByApplication( @RequestParam(required = false) String application, diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryJudgesController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryJudgesController.java index d0fd0920e..dbb2fdc9c 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryJudgesController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryJudgesController.java @@ -35,8 +35,8 @@ import com.netflix.spinnaker.orca.api.pipeline.models.PipelineExecution; import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution; import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -74,14 +74,14 @@ public CanaryJudgesController( this.canaryJudges = canaryJudges; } - @ApiOperation(value = "Retrieve a list of all configured canary judges") + @Operation(summary = "Retrieve a list of all configured canary judges") @GetMapping List list() { return canaryJudges; } - @ApiOperation( - value = + @Operation( + summary = "Exercise a judge directly, without any orchestration or querying of metrics services") @PostMapping(value = "/judge") public CanaryJudgeResult judge( @@ -141,18 +141,20 @@ public CanaryJudgeResult judge( return canaryJudge.judge(canaryConfig, canaryClassifierThresholdsConfig, metricSetPairList); } - @ApiOperation(value = "Apply a pair of judges to a canned set of data") + @Operation(summary = "Apply a pair of judges to a canned set of data") @PostMapping(value = "/comparison") public CanaryExecutionResponse initiateJudgeComparison( @RequestParam(required = false) final String configurationAccountName, @RequestParam(required = false) final String storageAccountName, @RequestParam final String canaryConfigId, - @ApiParam( - value = "The name of the first judge to use, e.g. NetflixACAJudge-v1.0, dredd-v1.0.") + @Parameter( + description = + "The name of the first judge to use, e.g. NetflixACAJudge-v1.0, dredd-v1.0.") @RequestParam(required = false) final String overrideCanaryJudge1, - @ApiParam( - value = "The name of the second judge to use, e.g. NetflixACAJudge-v1.0, dredd-v1.0.") + @Parameter( + description = + "The name of the second judge to use, e.g. NetflixACAJudge-v1.0, dredd-v1.0.") @RequestParam(required = false) final String overrideCanaryJudge2, @RequestParam final String metricSetPairListId, @@ -188,7 +190,7 @@ public CanaryExecutionResponse initiateJudgeComparison( resolvedStorageAccountName); } - @ApiOperation(value = "Retrieve the results of a judge comparison") + @Operation(summary = "Retrieve the results of a judge comparison") @GetMapping(value = "/comparison/{executionId:.+}") public Map getJudgeComparisonResults(@PathVariable String executionId) { PipelineExecution pipeline = executionRepository.retrieve(ExecutionType.PIPELINE, executionId); diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryResultArchiveController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryResultArchiveController.java index 8b78d3f1c..5ea6f9035 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryResultArchiveController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CanaryResultArchiveController.java @@ -24,8 +24,8 @@ import com.netflix.kayenta.storage.StorageService; import com.netflix.kayenta.storage.StorageServiceRepository; import com.netflix.spinnaker.kork.web.exceptions.NotFoundException; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; import java.util.List; import java.util.Map; @@ -38,8 +38,8 @@ @RestController @RequestMapping("/canaryResultArchive") -@Api( - value = "/canaryResultArchive", +@Tag( + name = "/canaryResultArchive", description = "Manipulate the archived canary result object store. This should be used only for Kayenta maintenance. Use the /canary endpoints for canary results.") @Slf4j @@ -56,7 +56,7 @@ public CanaryResultArchiveController( this.storageServiceRepository = storageServiceRepository; } - @ApiOperation(value = "Retrieve an archived canary result from object storage") + @Operation(summary = "Retrieve an archived canary result from object storage") @RequestMapping(value = "/{pipelineId:.+}", method = RequestMethod.GET) public CanaryExecutionStatusResponse loadArchivedCanaryResult( @RequestParam(required = false) final String storageAccountName, @@ -68,7 +68,7 @@ public CanaryExecutionStatusResponse loadArchivedCanaryResult( resolvedConfigurationAccountName, ObjectType.CANARY_RESULT_ARCHIVE, pipelineId); } - @ApiOperation(value = "Create an archived canary result to object storage") + @Operation(summary = "Create an archived canary result to object storage") @RequestMapping(consumes = "application/json", method = RequestMethod.POST) public CanaryArchiveResultUpdateResponse storeArchivedCanaryResult( @RequestParam(required = false) final String storageAccountName, @@ -101,7 +101,7 @@ public CanaryArchiveResultUpdateResponse storeArchivedCanaryResult( "Archived canary result '" + pipelineId + "' already exists."); } - @ApiOperation(value = "Update an archived canary result in object storage") + @Operation(summary = "Update an archived canary result in object storage") @RequestMapping( value = "/{pipelineId:.+}", consumes = "application/json", @@ -133,7 +133,7 @@ public CanaryArchiveResultUpdateResponse updateArchivedCanaryResult( return CanaryArchiveResultUpdateResponse.builder().pipelineId(pipelineId).build(); } - @ApiOperation(value = "Delete an archived canary result from object storage") + @Operation(summary = "Delete an archived canary result from object storage") @RequestMapping(value = "/{pipelineId:.+}", method = RequestMethod.DELETE) public void deleteArchivedCanaryResult( @RequestParam(required = false) final String storageAccountName, @@ -148,7 +148,7 @@ public void deleteArchivedCanaryResult( response.setStatus(HttpStatus.NO_CONTENT.value()); } - @ApiOperation(value = "Retrieve a list of archived canary result ids in object storage") + @Operation(summary = "Retrieve a list of archived canary result ids in object storage") @RequestMapping(method = RequestMethod.GET) public List> listAllCanaryArchivedResults( @RequestParam(required = false) final String storageAccountName) { diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CredentialsController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CredentialsController.java index 0dd5e857a..f9737babd 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CredentialsController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/CredentialsController.java @@ -18,7 +18,7 @@ import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -34,7 +34,7 @@ public CredentialsController(AccountCredentialsRepository accountCredentialsRepo this.accountCredentialsRepository = accountCredentialsRepository; } - @ApiOperation(value = "Retrieve a list of all configured credentials") + @Operation(summary = "Retrieve a list of all configured credentials") @RequestMapping(method = RequestMethod.GET) Set list() { return accountCredentialsRepository.getAll(); diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricSetListController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricSetListController.java index bb5251bc8..e9447e842 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricSetListController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricSetListController.java @@ -22,7 +22,7 @@ import com.netflix.kayenta.storage.ObjectType; import com.netflix.kayenta.storage.StorageService; import com.netflix.kayenta.storage.StorageServiceRepository; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.io.IOException; import java.util.Collections; import java.util.List; @@ -50,7 +50,7 @@ public MetricSetListController( this.storageServiceRepository = storageServiceRepository; } - @ApiOperation(value = "Retrieve a metric set list from object storage") + @Operation(summary = "Retrieve a metric set list from object storage") @RequestMapping(value = "/{metricSetListId:.+}", method = RequestMethod.GET) public List loadMetricSetList( @RequestParam(required = false) final String accountName, @@ -65,7 +65,7 @@ public List loadMetricSetList( resolvedAccountName, ObjectType.METRIC_SET_LIST, metricSetListId); } - @ApiOperation(value = "Write a metric set list to object storage") + @Operation(summary = "Write a metric set list to object storage") @RequestMapping(consumes = "application/json", method = RequestMethod.POST) public Map storeMetricSetList( @RequestParam(required = false) final String accountName, @@ -84,7 +84,7 @@ public Map storeMetricSetList( return Collections.singletonMap("metricSetListId", metricSetListId); } - @ApiOperation(value = "Delete a metric set list") + @Operation(summary = "Delete a metric set list") @RequestMapping(value = "/{metricSetListId:.+}", method = RequestMethod.DELETE) public void deleteMetricSetList( @RequestParam(required = false) final String accountName, @@ -101,7 +101,7 @@ public void deleteMetricSetList( response.setStatus(HttpStatus.NO_CONTENT.value()); } - @ApiOperation(value = "Retrieve a list of metric set list ids and timestamps") + @Operation(summary = "Retrieve a list of metric set list ids and timestamps") @RequestMapping(method = RequestMethod.GET) public List> listAllMetricSetLists( @RequestParam(required = false) final String accountName) { diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricSetPairListController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricSetPairListController.java index d5a9349a1..80aeb8aeb 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricSetPairListController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricSetPairListController.java @@ -18,7 +18,7 @@ import com.netflix.kayenta.metrics.MetricSetPair; import com.netflix.kayenta.service.MetricSetPairListService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.io.IOException; import java.util.Collections; import java.util.List; @@ -47,7 +47,7 @@ public MetricSetPairListController(MetricSetPairListService metricSetPairListSer this.metricSetPairListService = metricSetPairListService; } - @ApiOperation(value = "Retrieve a metric set pair list from object storage") + @Operation(summary = "Retrieve a metric set pair list from object storage") @RequestMapping(value = "/{metricSetPairListId:.+}", method = RequestMethod.GET) public List loadMetricSetPairList( @RequestParam(required = false) final String accountName, @@ -55,8 +55,8 @@ public List loadMetricSetPairList( return metricSetPairListService.loadMetricSetPairList(accountName, metricSetPairListId); } - @ApiOperation( - value = "Retrieve a single metric set pair from a metricSetPairList from object storage") + @Operation( + summary = "Retrieve a single metric set pair from a metricSetPairList from object storage") @RequestMapping( value = "/{metricSetPairListId:.+}/{metricSetPairId:.+}", method = RequestMethod.GET) @@ -70,7 +70,7 @@ public ResponseEntity loadMetricSetPair( .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); } - @ApiOperation(value = "Write a metric set pair list to object storage") + @Operation(summary = "Write a metric set pair list to object storage") @RequestMapping(consumes = "application/json", method = RequestMethod.POST) public Map storeMetricSetPairList( @RequestParam(required = false) final String accountName, @@ -82,7 +82,7 @@ public Map storeMetricSetPairList( return Collections.singletonMap("metricSetPairListId", metricSetPairListId); } - @ApiOperation(value = "Delete a metric set pair list") + @Operation(summary = "Delete a metric set pair list") @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{metricSetPairListId:.+}", method = RequestMethod.DELETE) public void deleteMetricSetPairList( @@ -91,7 +91,7 @@ public void deleteMetricSetPairList( metricSetPairListService.deleteMetricSetPairList(accountName, metricSetPairListId); } - @ApiOperation(value = "Retrieve a list of metric set pair list ids and timestamps") + @Operation(summary = "Retrieve a list of metric set pair list ids and timestamps") @RequestMapping(method = RequestMethod.GET) public List> listAllMetricSetPairLists( @RequestParam(required = false) final String accountName) { diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricsServiceMetadataController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricsServiceMetadataController.java index 8ce842f82..4eb5dc676 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricsServiceMetadataController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricsServiceMetadataController.java @@ -20,7 +20,7 @@ import com.netflix.kayenta.metrics.MetricsServiceRepository; import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.io.IOException; import java.util.List; import java.util.Map; @@ -48,7 +48,7 @@ public MetricsServiceMetadataController( this.metricsServiceRepository = metricsServiceRepository; } - @ApiOperation(value = "Retrieve a list of descriptors for use in populating the canary config ui") + @Operation(summary = "Retrieve a list of descriptors for use in populating the canary config ui") @RequestMapping(method = RequestMethod.GET) public List listMetadata( @RequestParam(required = false) final String metricsAccountName, diff --git a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricsServicesController.java b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricsServicesController.java index c8b94f59b..3accb7823 100644 --- a/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricsServicesController.java +++ b/kayenta-web/src/main/java/com/netflix/kayenta/controllers/MetricsServicesController.java @@ -20,7 +20,7 @@ import com.netflix.kayenta.security.AccountCredentials; import com.netflix.kayenta.security.AccountCredentialsRepository; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -40,7 +40,7 @@ public MetricsServicesController(AccountCredentialsRepository accountCredentials this.accountCredentialsRepository = accountCredentialsRepository; } - @ApiOperation(value = "Retrieve a list of all configured metrics services") + @Operation(summary = "Retrieve a list of all configured metrics services") @RequestMapping(method = RequestMethod.GET) List list() { Set metricAccountCredentials =