From 4c66b6faaf57a5b497375f6a719a31626ba9e4cc Mon Sep 17 00:00:00 2001 From: Jason McIntosh Date: Wed, 17 Jul 2024 21:37:46 -0500 Subject: [PATCH 1/3] fix(openapi): Uses openrewrite to convert owagger to openapi annotations --- build.gradle | 13 +++ gate-bom/gate-bom.gradle | 4 + .../gate-integrations-gremlin.gradle | 4 + .../gremlin/GremlinController.java | 6 +- gate-plugins/gate-plugins.gradle | 3 +- .../plugins/deck/DeckPluginsController.kt | 7 +- .../plugins/web/info/PluginInfoController.kt | 8 +- .../installed/PluginsInstalledController.kt | 5 +- .../web/publish/PluginPublishController.kt | 5 +- .../controllers/ApplicationController.groovy | 40 +++++---- .../gate/controllers/ArtifactController.java | 25 +++--- .../controllers/ArtifactoryController.java | 6 +- .../gate/controllers/AuthController.groovy | 13 +-- .../controllers/AwsCodeBuildController.java | 8 +- .../gate/controllers/BakeController.groovy | 8 +- .../BatchEntityTagsController.java | 4 +- .../gate/controllers/BuildController.groovy | 22 ++--- .../controllers/CapabilitiesController.java | 10 +-- .../controllers/CertificateController.groovy | 6 +- .../gate/controllers/CleanupController.java | 10 +-- .../gate/controllers/ClusterController.groovy | 20 ++--- .../gate/controllers/ConcourseController.java | 25 ++---- .../controllers/CredentialsController.groovy | 28 +++--- .../controllers/EntityTagsController.java | 15 ++-- .../controllers/ExecutionsController.java | 78 ++++++++-------- .../controllers/FirewallController.groovy | 10 +-- .../GoogleCloudBuildController.java | 8 +- .../gate/controllers/HistoryController.java | 4 +- .../gate/controllers/ImageController.groovy | 11 ++- .../controllers/InstanceController.groovy | 6 +- .../gate/controllers/JobController.groovy | 6 +- .../controllers/LoadBalancerController.groovy | 12 ++- .../gate/controllers/ManagedController.java | 89 ++++++++----------- .../gate/controllers/NetworkController.groovy | 6 +- .../gate/controllers/NexusController.java | 6 +- .../PipelineConfigController.groovy | 8 +- .../controllers/PipelineController.groovy | 58 ++++++------ .../PipelineTemplatesController.java | 18 ++-- .../gate/controllers/ProjectController.groovy | 10 +-- .../PubsubSubscriptionController.java | 4 +- .../controllers/RawResourceController.java | 6 +- .../ReorderPipelinesController.java | 6 +- .../gate/controllers/RoleController.groovy | 4 +- .../gate/controllers/SearchController.groovy | 4 +- .../SecurityGroupController.groovy | 8 +- .../controllers/ServerGroupController.groovy | 8 +- .../ServerGroupManagerController.java | 6 +- .../gate/controllers/SlackController.java | 4 +- .../controllers/SnapshotController.groovy | 6 +- .../controllers/StorageAccountController.java | 4 +- .../gate/controllers/SubnetController.groovy | 4 +- .../gate/controllers/TaskController.groovy | 14 +-- .../V2CanaryConfigController.groovy | 12 +-- .../controllers/V2CanaryController.groovy | 24 ++--- .../V2PipelineTemplatesController.java | 20 ++--- .../gate/controllers/VersionController.java | 4 +- .../gate/controllers/WebhookController.groovy | 8 +- .../aws/AmazonInfrastructureController.groovy | 14 +-- .../ecs/EcsCloudMetricController.groovy | 4 +- .../ecs/EcsClusterController.groovy | 6 +- .../ecs/EcsSecretsController.groovy | 4 +- .../ecs/EcsServerGroupEventsController.groovy | 4 +- .../ecs/EcsServiceDiscoveryController.java | 7 +- gradle.properties | 2 + 64 files changed, 400 insertions(+), 412 deletions(-) diff --git a/build.gradle b/build.gradle index a5760fa08b..f6cd8fc343 100644 --- a/build.gradle +++ b/build.gradle @@ -3,10 +3,20 @@ plugins { id "org.jetbrains.kotlin.jvm" version "$kotlinVersion" apply false id "org.jetbrains.kotlin.plugin.allopen" version "$kotlinVersion" apply false id "org.jetbrains.dokka" version "0.10.1" apply false + id("org.openrewrite.rewrite") version("6.16.4") + +} +rewrite { + activeRecipe("org.openrewrite.openapi.swagger.SwaggerToOpenAPI") +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-openapi:0.5.3") } allprojects { apply plugin: 'io.spinnaker.project' + apply plugin: 'org.openrewrite.rewrite' group = "io.spinnaker.gate" @@ -21,11 +31,14 @@ allprojects { apply plugin: 'groovy' repositories { + mavenCentral() + maven { url 'https://build.shibboleth.net/nexus/content/repositories/releases/' } maven { url 'https://repository.mulesoft.org/releases/' } } dependencies { + implementation enforcedPlatform("io.spinnaker.kork:kork-bom:$korkVersion") annotationProcessor platform("io.spinnaker.kork:kork-bom:$korkVersion") annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") diff --git a/gate-bom/gate-bom.gradle b/gate-bom/gate-bom.gradle index eef6c8337f..34bf0376bc 100644 --- a/gate-bom/gate-bom.gradle +++ b/gate-bom/gate-bom.gradle @@ -28,6 +28,10 @@ dependencies { api("io.spinnaker.fiat:fiat-api:$fiatVersion") api("io.spinnaker.fiat:fiat-core:$fiatVersion") + api("io.swagger.core.v3:swagger-annotations:2.2.22") + api("io.swagger.core.v3:swagger-core:2.2.22") + + rootProject .subprojects .findAll { it != project } diff --git a/gate-integrations-gremlin/gate-integrations-gremlin.gradle b/gate-integrations-gremlin/gate-integrations-gremlin.gradle index 24d9d5e98d..a7b7652455 100644 --- a/gate-integrations-gremlin/gate-integrations-gremlin.gradle +++ b/gate-integrations-gremlin/gate-integrations-gremlin.gradle @@ -1,5 +1,9 @@ dependencies { + implementation platform(project(":gate-bom")) + implementation project(":gate-core") + implementation "io.swagger.core.v3:swagger-annotations" + implementation "io.spinnaker.kork:kork-swagger" implementation "io.spinnaker.kork:kork-web" implementation "com.netflix.spectator:spectator-api" diff --git a/gate-integrations-gremlin/src/main/java/com/netflix/spinnaker/gate/controllers/gremlin/GremlinController.java b/gate-integrations-gremlin/src/main/java/com/netflix/spinnaker/gate/controllers/gremlin/GremlinController.java index 74cb251e4e..897a688d3d 100644 --- a/gate-integrations-gremlin/src/main/java/com/netflix/spinnaker/gate/controllers/gremlin/GremlinController.java +++ b/gate-integrations-gremlin/src/main/java/com/netflix/spinnaker/gate/controllers/gremlin/GremlinController.java @@ -1,7 +1,7 @@ package com.netflix.spinnaker.gate.controllers.gremlin; import com.netflix.spinnaker.gate.services.gremlin.GremlinService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; @@ -24,14 +24,14 @@ public GremlinController(GremlinService gremlinService) { this.gremlinService = gremlinService; } - @ApiOperation(value = "Retrieve a list of gremlin command templates") + @Operation(summary = "Retrieve a list of gremlin command templates") @RequestMapping(value = "/templates/command", method = RequestMethod.POST) List listCommandTemplates(@RequestBody(required = true) Map apiKeyMap) { String apiKeyValue = (String) apiKeyMap.get(APIKEY_KEY); return gremlinService.getCommandTemplates("Key " + apiKeyValue); } - @ApiOperation(value = "Retrieve a list of gremlin target templates") + @Operation(summary = "Retrieve a list of gremlin target templates") @RequestMapping(value = "/templates/target", method = RequestMethod.POST) List listTargetTemplates(@RequestBody(required = true) Map apiKeyMap) { String apiKeyValue = (String) apiKeyMap.get(APIKEY_KEY); diff --git a/gate-plugins/gate-plugins.gradle b/gate-plugins/gate-plugins.gradle index 36154c4ff3..421b263058 100644 --- a/gate-plugins/gate-plugins.gradle +++ b/gate-plugins/gate-plugins.gradle @@ -18,6 +18,7 @@ apply from: "${project.rootDir}/gradle/kotlin.gradle" apply from: "${project.rootDir}/gradle/kotlin-test.gradle" dependencies { + implementation platform(project(":gate-bom")) implementation project(":gate-api") implementation project(":gate-core") @@ -27,7 +28,7 @@ dependencies { implementation "io.spinnaker.kork:kork-plugins" implementation "io.spinnaker.kork:kork-web" - implementation "io.swagger:swagger-annotations" + implementation "io.swagger.core.v3:swagger-annotations" implementation "org.springframework:spring-web" implementation "org.pf4j:pf4j-update" diff --git a/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/deck/DeckPluginsController.kt b/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/deck/DeckPluginsController.kt index 38abd33d15..2e467e1fc5 100644 --- a/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/deck/DeckPluginsController.kt +++ b/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/deck/DeckPluginsController.kt @@ -16,7 +16,8 @@ package com.netflix.spinnaker.gate.plugins.deck import com.netflix.spinnaker.kork.web.exceptions.NotFoundException -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation + import java.util.concurrent.TimeUnit import javax.servlet.http.HttpServletResponse import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty @@ -36,13 +37,13 @@ class DeckPluginsController( private val deckPluginService: DeckPluginService ) { - @ApiOperation(value = "Retrieve a plugin manifest") + @Operation(summary = "Retrieve a plugin manifest") @GetMapping("/plugin-manifest.json") fun getPluginManifest(): List { return deckPluginService.getPluginsManifests() } - @ApiOperation(value = "Retrieve a single plugin asset by version") + @Operation(summary = "Retrieve a single plugin asset by version") @GetMapping("/{pluginId}/{pluginVersion}/{asset:.*}") fun getPluginAsset( @PathVariable pluginId: String, diff --git a/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/info/PluginInfoController.kt b/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/info/PluginInfoController.kt index 8c39292223..89c59e58b6 100644 --- a/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/info/PluginInfoController.kt +++ b/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/info/PluginInfoController.kt @@ -19,7 +19,7 @@ import com.netflix.spinnaker.gate.plugins.web.PluginService import com.netflix.spinnaker.gate.plugins.web.SpinnakerExtensionsConfigProperties import com.netflix.spinnaker.gate.services.internal.Front50Service import com.netflix.spinnaker.kork.plugins.update.internal.SpinnakerPluginInfo -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.security.access.prepost.PreAuthorize @@ -42,7 +42,7 @@ class PluginInfoController( private val spinnakerExtensionsConfigProperties: SpinnakerExtensionsConfigProperties ) { - @ApiOperation(value = "Persist plugin metadata information") + @Operation(summary = "Persist plugin metadata information") @RequestMapping( method = [RequestMethod.POST, RequestMethod.PUT], consumes = [MediaType.APPLICATION_JSON_VALUE] @@ -52,7 +52,7 @@ class PluginInfoController( return pluginService.upsertPluginInfo(pluginInfo) } - @ApiOperation(value = "Delete plugin info with the provided Id") + @Operation(summary = "Delete plugin info with the provided Id") @PreAuthorize("hasPermission(#this.this.appName, 'APPLICATION', 'WRITE')") @RequestMapping( value = ["/{id:.+}"], @@ -64,7 +64,7 @@ class PluginInfoController( return pluginService.deletePluginInfo(id) } - @ApiOperation(value = "Get all plugin info objects") + @Operation(summary = "Get all plugin info objects") @RequestMapping(method = [RequestMethod.GET]) fun getAllPluginInfo(@RequestParam(value = "service", required = false) service: String?): List<*> { return front50Service.getPluginInfo(service) diff --git a/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/installed/PluginsInstalledController.kt b/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/installed/PluginsInstalledController.kt index 67049bf9a3..ba5af344a1 100644 --- a/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/installed/PluginsInstalledController.kt +++ b/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/installed/PluginsInstalledController.kt @@ -13,7 +13,8 @@ import com.netflix.spinnaker.gate.services.internal.SwabbieService import com.netflix.spinnaker.kork.plugins.SpinnakerPluginDescriptor import com.netflix.spinnaker.kork.plugins.SpinnakerPluginManager import com.netflix.spinnaker.kork.plugins.update.SpinnakerUpdateManager -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation + import java.util.stream.Collectors import org.pf4j.PluginWrapper import org.slf4j.LoggerFactory @@ -43,7 +44,7 @@ class PluginsInstalledController( private val log by lazy { LoggerFactory.getLogger(javaClass) } - @ApiOperation(value = "Get all installed Spinnaker plugins") + @Operation(summary = "Get all installed Spinnaker plugins") @RequestMapping(method = [RequestMethod.GET]) fun getInstalledPlugins(@RequestParam(value = "service", required = false) service: String?): Map> { return when (service) { diff --git a/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/publish/PluginPublishController.kt b/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/publish/PluginPublishController.kt index 234ec6c22c..b1a5f0a2f3 100644 --- a/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/publish/PluginPublishController.kt +++ b/gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/publish/PluginPublishController.kt @@ -24,7 +24,8 @@ import com.netflix.spinnaker.gate.plugins.web.PluginService import com.netflix.spinnaker.kork.exceptions.SystemException import com.netflix.spinnaker.kork.plugins.update.internal.SpinnakerPluginInfo import com.netflix.spinnaker.security.AuthenticatedRequest -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation + import java.lang.String.format import lombok.SneakyThrows import okhttp3.MediaType @@ -55,7 +56,7 @@ class PluginPublishController( private val okHttpClient: OkHttpClient = okHttpClientProvider.getClient(DefaultServiceEndpoint("front50", front50Url)) @SneakyThrows - @ApiOperation(value = "Publish a plugin binary and the plugin info metadata.") + @Operation(summary = "Publish a plugin binary and the plugin info metadata.") @PostMapping("/{pluginId}/{pluginVersion}", consumes = [MULTIPART_FORM_DATA_VALUE]) fun publishPlugin( @RequestPart("plugin") body: MultipartFile, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ApplicationController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ApplicationController.groovy index 9dec875f3f..6f4953d2f1 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ApplicationController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ApplicationController.groovy @@ -21,8 +21,10 @@ import com.netflix.spinnaker.gate.services.ExecutionHistoryService import com.netflix.spinnaker.gate.services.TaskService import com.netflix.spinnaker.kork.web.exceptions.NotFoundException import groovy.util.logging.Slf4j -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 org.springframework.beans.factory.annotation.Autowired import org.springframework.core.env.Environment import org.springframework.http.HttpEntity @@ -59,13 +61,13 @@ class ApplicationController { @Autowired Environment environment - @ApiOperation(value = "Retrieve a list of applications", response = List.class) + @Operation(summary = "Retrieve a list of applications") @RequestMapping(method = RequestMethod.GET) @PostFilter("hasPermission(filterObject.get('name'), 'APPLICATION', 'READ')") List> getAllApplications( - @ApiParam(name = "account", required = false, value = "filters results to only include applications deployed in the specified account") + @Parameter(name = "account", required = false, description = "filters results to only include applications deployed in the specified account") @RequestParam(value = "account", required = false) String account, - @ApiParam(name = "owner", required = false, value = "filters results to only include applications owned by the specified email") + @Parameter(name = "owner", required = false, description = "filters results to only include applications owned by the specified email") @RequestParam(value = "owner", required = false) String owner) { return applicationService.getAllApplications() .findAll { @@ -82,7 +84,7 @@ class ApplicationController { } } - @ApiOperation(value = "Retrieve an application's details", response = HashMap.class) + @Operation(summary = "Retrieve an application's details") @RequestMapping(value = "/{application:.+}", method = RequestMethod.GET) Map getApplication(@PathVariable("application") String application, @RequestParam(value = "expand", defaultValue = "true") boolean expand) { def result = applicationService.getApplication(application, expand) @@ -96,14 +98,14 @@ class ApplicationController { result } - @ApiOperation(value = "Retrieve a list of an application's configuration revision history", response = List.class) + @Operation(summary = "Retrieve a list of an application's configuration revision history") @RequestMapping(value = "/{application}/history", method = RequestMethod.GET) List getApplicationHistory(@PathVariable("application") String application, @RequestParam(value = "limit", defaultValue = "20") int limit) { return applicationService.getApplicationHistory(application, limit) } - @ApiOperation(value = "Retrieve a list of an application's tasks", response = List.class) + @Operation(summary = "Retrieve a list of an application's tasks") @RequestMapping(value = "/{application}/tasks", method = RequestMethod.GET) List getTasks(@PathVariable("application") String application, @RequestParam(value = "page", required = false) Integer page, @@ -112,7 +114,7 @@ class ApplicationController { executionHistoryService.getTasks(application, page, limit, statuses) } - @ApiOperation(value = "Retrieve a list of an application's pipeline executions", response = List.class) + @Operation(summary = "Retrieve a list of an application's pipeline executions") @RequestMapping(value = "/{application}/pipelines", method = RequestMethod.GET) List getPipelines(@PathVariable("application") String application, @RequestParam(value = "limit", required = false) Integer limit, @@ -126,20 +128,20 @@ class ApplicationController { * @deprecated There is no reason to provide an app name, use PipelineController instead for pipeline operations. */ @Deprecated - @ApiOperation(value = "Cancel pipeline", response = HashMap.class) + @Operation(summary = "Cancel pipeline") @RequestMapping(value = "/{application}/pipelines/{id}/cancel", method = RequestMethod.PUT) Map cancelPipeline(@PathVariable("id") String id, @RequestParam(required = false) String reason) { taskService.cancelPipeline(id, reason) } - @ApiOperation(value = "Retrieve a list of an application's pipeline configurations", response = List.class) + @Operation(summary = "Retrieve a list of an application's pipeline configurations") @RequestMapping(value = "/{application}/pipelineConfigs", method = RequestMethod.GET) List getPipelineConfigsForApplication(@PathVariable("application") String application) { applicationService.getPipelineConfigsForApplication(application) } - @ApiOperation(value = "Retrieve a pipeline configuration", response = HashMap.class) + @Operation(summary = "Retrieve a pipeline configuration") @RequestMapping(value = "/{application}/pipelineConfigs/{pipelineName:.+}", method = RequestMethod.GET) Map getPipelineConfig( @PathVariable("application") String application, @PathVariable("pipelineName") String pipelineName) { @@ -153,13 +155,13 @@ class ApplicationController { config } - @ApiOperation(value = "Retrieve a list of an application's pipeline strategy configurations", response = List.class) + @Operation(summary = "Retrieve a list of an application's pipeline strategy configurations") @RequestMapping(value = "/{application}/strategyConfigs", method = RequestMethod.GET) List getStrategyConfigsForApplication(@PathVariable("application") String application) { applicationService.getStrategyConfigsForApplication(application) } - @ApiOperation(value = "Retrieve a pipeline strategy configuration", response = HashMap.class) + @Operation(summary = "Retrieve a pipeline strategy configuration") @RequestMapping(value = "/{application}/strategyConfigs/{strategyName}", method = RequestMethod.GET) Map getStrategyConfig(@PathVariable("application") String application, @PathVariable("strategyName") String strategyName) { @@ -177,7 +179,7 @@ class ApplicationController { * @deprecated Use PipelineController instead for pipeline operations. */ @Deprecated - @ApiOperation(value = "Invoke pipeline config", response = HttpEntity.class) + @Operation(summary = "Invoke pipeline config") @RequestMapping(value = "/{application}/pipelineConfigs/{pipelineName:.+}", method = RequestMethod.POST) HttpEntity invokePipelineConfig(@PathVariable("application") String application, @PathVariable("pipelineName") String pipelineName, @@ -190,7 +192,7 @@ class ApplicationController { * @deprecated There is no reason to provide an app name, use TaskController instead for task operations. */ @Deprecated - @ApiOperation(value = "Get task", response = HashMap.class) + @Operation(summary = "Get task") @RequestMapping(value = "/{application}/tasks/{id}", method = RequestMethod.GET) Map getTask(@PathVariable("id") String id) { taskService.getTask(id) @@ -200,7 +202,7 @@ class ApplicationController { * @deprecated There is no reason to provide an app name, use TaskController instead for task operations. */ @Deprecated - @ApiOperation(value = "Cancel task", response = HashMap.class) + @Operation(summary = "Cancel task") @RequestMapping(value = "/{application}/tasks/{id}/cancel", method = RequestMethod.PUT) Map cancelTask(@PathVariable("id") String id) { taskService.cancelTask(id) @@ -210,7 +212,7 @@ class ApplicationController { * @deprecated There is no reason to provide an app name, use TaskController instead for task operations. */ @Deprecated - @ApiOperation(value = "Get task details", response = HashMap.class) + @Operation(summary = "Get task details") @RequestMapping(value = "/{application}/tasks/{id}/details/{taskDetailsId}", method = RequestMethod.GET) Map getTaskDetails(@PathVariable("id") String id, @PathVariable("taskDetailsId") String taskDetailsId, @@ -222,7 +224,7 @@ class ApplicationController { * @deprecated There is no reason to provide an app name, use TaskController instead for task operations. */ @Deprecated - @ApiOperation(value = "Create task", response = HashMap.class) + @Operation(summary = "Create task") @RequestMapping(value = "/{application}/tasks", method = RequestMethod.POST) Map task(@PathVariable String application, @RequestBody Map map) { taskService.createAppTask(application, map) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ArtifactController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ArtifactController.java index 8caba35f76..256a1a02a0 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ArtifactController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ArtifactController.java @@ -18,7 +18,7 @@ import com.netflix.spinnaker.gate.services.ArtifactService; import com.netflix.spinnaker.kork.artifacts.model.Artifact; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.io.InputStream; import java.util.List; import java.util.Map; @@ -39,15 +39,13 @@ public class ArtifactController { @Autowired private ArtifactService artifactService; - @ApiOperation( - value = "Retrieve the list of artifact accounts configured in Clouddriver.", - response = List.class) + @Operation(summary = "Retrieve the list of artifact accounts configured in Clouddriver.") @RequestMapping(method = RequestMethod.GET, value = "/credentials") List all(@RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { return artifactService.getArtifactCredentials(sourceApp); } - @ApiOperation(value = "Fetch the contents of an artifact", response = StreamingResponseBody.class) + @Operation(summary = "Fetch the contents of an artifact") @RequestMapping(method = RequestMethod.PUT, value = "/fetch") StreamingResponseBody fetch( @RequestBody Map artifact, @@ -59,7 +57,7 @@ StreamingResponseBody fetch( }; } - @ApiOperation(value = "Retrieve the list of artifact names that belong to chosen account") + @Operation(summary = "Retrieve the list of artifact names that belong to chosen account") @RequestMapping(value = "/account/{accountName}/names", method = RequestMethod.GET) List artifactNames( @PathVariable String accountName, @@ -68,7 +66,7 @@ List artifactNames( return artifactService.getArtifactNames(sourceApp, accountName, type); } - @ApiOperation(value = "Retrieve the list of artifact versions by account and artifact names") + @Operation(summary = "Retrieve the list of artifact versions by account and artifact names") @RequestMapping(value = "/account/{accountName}/versions", method = RequestMethod.GET) List artifactVersions( @PathVariable String accountName, @@ -78,9 +76,10 @@ List artifactVersions( return artifactService.getArtifactVersions(sourceApp, accountName, type, artifactName); } - @ApiOperation( - value = "Retrieve the available artifact versions for an artifact provider and package name", - notes = "releaseStatus is an optional comma separated list of statuses to filter on.") + @Operation( + summary = + "Retrieve the available artifact versions for an artifact provider and package name", + description = "releaseStatus is an optional comma separated list of statuses to filter on.") @RequestMapping(value = "/{provider}/{packageName}", method = RequestMethod.GET) List getVersionsOfArtifactForProvider( @PathVariable String provider, @@ -89,8 +88,8 @@ List getVersionsOfArtifactForProvider( return artifactService.getVersionsOfArtifactForProvider(provider, packageName, releaseStatus); } - @ApiOperation( - value = "Retrieve the specified artifact version for an artifact provider and package name") + @Operation( + summary = "Retrieve the specified artifact version for an artifact provider and package name") @RequestMapping(value = "/{provider}/{packageName}/{version:.+}", method = RequestMethod.GET) Map getArtifact( @PathVariable String provider, @@ -99,7 +98,7 @@ Map getArtifact( return artifactService.getArtifactByVersion(provider, packageName, version); } - @ApiOperation(value = "Retrieve artifact by content hash") + @Operation(summary = "Retrieve artifact by content hash") @RequestMapping(value = "/content-address/{application}/{hash}", method = RequestMethod.GET) Artifact.StoredView getStoredArtifact( @PathVariable(value = "application") String application, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ArtifactoryController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ArtifactoryController.java index cec4b780ed..5892caf307 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ArtifactoryController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ArtifactoryController.java @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.internal.IgorService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; @@ -36,9 +36,7 @@ public ArtifactoryController(Optional igorService) { this.igorService = igorService; } - @ApiOperation( - value = "Retrieve the list of artifactory names available to triggers", - response = List.class) + @Operation(summary = "Retrieve the list of artifactory names available to triggers") @GetMapping(value = "/names") List names() { return igorService.get().getArtifactoryNames(); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AuthController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AuthController.groovy index 60a97d83a3..9d07e9f3c3 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AuthController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AuthController.groovy @@ -21,7 +21,8 @@ import com.netflix.spinnaker.gate.services.PermissionService import com.netflix.spinnaker.security.AuthenticatedRequest import com.netflix.spinnaker.security.User import groovy.util.logging.Slf4j -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation; + import org.apache.commons.lang3.exception.ExceptionUtils import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value @@ -68,7 +69,7 @@ class AuthController { } } - @ApiOperation(value = "Get user", response = User.class) + @Operation(summary = "Get user") @RequestMapping(value = "/user", method = RequestMethod.GET) User user(@ApiIgnore @SpinnakerUser User user) { if (!user) { @@ -82,7 +83,7 @@ class AuthController { return user } - @ApiOperation(value = "Get service accounts", response = List.class) + @Operation(summary = "Get service accounts") @RequestMapping(value = "/user/serviceAccounts", method = RequestMethod.GET) List getServiceAccounts(@ApiIgnore @SpinnakerUser User user, @RequestParam(name = "application", required = false) String application) { @@ -100,7 +101,7 @@ class AuthController { return permissionService.getServiceAccountsForApplication(user, appName) } - @ApiOperation(value = "Get logged out message", response = String.class) + @Operation(summary = "Get logged out message") @RequestMapping(value = "/loggedOut", method = RequestMethod.GET) String loggedOut() { return LOGOUT_MESSAGES[r.nextInt(LOGOUT_MESSAGES.size())] @@ -110,14 +111,14 @@ class AuthController { * On-demand endpoint to sync the user roles, in case * waiting for the periodic refresh won't work. */ - @ApiOperation(value = "Sync user roles") + @Operation(summary = "Sync user roles") @RequestMapping(value = "/roles/sync", method = RequestMethod.POST) @PreAuthorize("@authController.isAdmin()") void sync() { permissionService.sync() } - @ApiOperation(value = "Redirect to Deck") + @Operation(summary = "Redirect to Deck") @RequestMapping(value = "/redirect", method = RequestMethod.GET) void redirect(HttpServletResponse response, @RequestParam String to) { validDeckRedirect(to) ? diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AwsCodeBuildController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AwsCodeBuildController.java index 4217d92eb0..e5e96e59f1 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AwsCodeBuildController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AwsCodeBuildController.java @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.internal.IgorService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -31,15 +31,13 @@ public class AwsCodeBuildController { private final IgorService igorService; - @ApiOperation(value = "Retrieve the list of AWS CodeBuild accounts", response = List.class) + @Operation(summary = "Retrieve the list of AWS CodeBuild accounts") @GetMapping(value = "/accounts") List getAccounts() { return igorService.getAwsCodeBuildAccounts(); } - @ApiOperation( - value = "Retrieve the list of AWS CodeBuild projects in the account", - response = List.class) + @Operation(summary = "Retrieve the list of AWS CodeBuild projects in the account") @GetMapping(value = "/projects/{account}") List getProjects(@PathVariable String account) { return igorService.getAwsCodeBuildProjects(account); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BakeController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BakeController.groovy index 1d7aaedf83..26d5bc9202 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BakeController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BakeController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.BakeService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpStatus import org.springframework.web.bind.annotation.ExceptionHandler @@ -35,19 +35,19 @@ class BakeController { @Autowired BakeService bakeService - @ApiOperation(value = "Retrieve a list of available bakery base images, grouped by cloud provider") + @Operation(summary = "Retrieve a list of available bakery base images, grouped by cloud provider") @RequestMapping(value = "/options", method = RequestMethod.GET) def bakeOptions() { bakeService.bakeOptions() } - @ApiOperation(value = "Retrieve a list of available bakery base images for a given cloud provider") + @Operation(summary = "Retrieve a list of available bakery base images for a given cloud provider") @RequestMapping(value = "/options/{cloudProvider}", method = RequestMethod.GET) def bakeOptions(@PathVariable("cloudProvider") String cloudProvider) { bakeService.bakeOptions(cloudProvider) } - @ApiOperation(value = "Retrieve the logs for a given bake") + @Operation(summary = "Retrieve the logs for a given bake") @RequestMapping(value = "/logs/{region}/{statusId}", method = RequestMethod.GET) def lookupLogs(@PathVariable("region") String region, @PathVariable("statusId") String statusId) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BatchEntityTagsController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BatchEntityTagsController.java index 7b1d9dc81b..1a93364507 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BatchEntityTagsController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BatchEntityTagsController.java @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.TaskService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -37,7 +37,7 @@ public BatchEntityTagsController(TaskService taskService) { this.taskService = taskService; } - @ApiOperation(value = "Batch update a set of entity tags.", response = HashMap.class) + @Operation(summary = "Batch update a set of entity tags.") @RequestMapping(method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.ACCEPTED) public Map batchUpdate( diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BuildController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BuildController.groovy index c9de7d2df7..c3f77b08a8 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BuildController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BuildController.groovy @@ -21,7 +21,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.BuildService import groovy.transform.CompileStatic import groovy.util.logging.Slf4j -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -46,21 +46,21 @@ class BuildController { @Autowired BuildService buildService - @ApiOperation(value = "Get build masters", notes = "Deprecated, use the v3 endpoint instead", response = List.class) + @Operation(summary = "Get build masters", description = "Deprecated, use the v3 endpoint instead") @RequestMapping(value = "v2/builds", method = RequestMethod.GET) List getBuildMasters(@RequestParam(value = "type", defaultValue = "") String type) { log.debug(DEPRECATION_NOTICE_MESSAGE) buildService.getBuildMasters(type) } - @ApiOperation(value = "Get jobs for build master", notes = "Deprecated, use the v3 endpoint instead", response = List.class) + @Operation(summary = "Get jobs for build master", description = "Deprecated, use the v3 endpoint instead") @RequestMapping(value = "/v2/builds/{buildMaster}/jobs", method = RequestMethod.GET) List getJobsForBuildMaster(@PathVariable("buildMaster") String buildMaster) { log.debug(DEPRECATION_NOTICE_MESSAGE) buildService.getJobsForBuildMaster(buildMaster) } - @ApiOperation(value = "Get job config", notes = "Deprecated, use the v3 endpoint instead", response = HashMap.class) + @Operation(summary = "Get job config", description = "Deprecated, use the v3 endpoint instead") @RequestMapping(value = "/v2/builds/{buildMaster}/jobs/**", method = RequestMethod.GET) Map getJobConfig(@PathVariable("buildMaster") String buildMaster, HttpServletRequest request) { log.debug(DEPRECATION_NOTICE_MESSAGE) @@ -68,7 +68,7 @@ class BuildController { buildService.getJobConfig(buildMaster, job) } - @ApiOperation(value = "Get builds for build master", notes = "Deprecated, use the v3 endpoint instead", response = List.class) + @Operation(summary = "Get builds for build master", description = "Deprecated, use the v3 endpoint instead") @RequestMapping(value = "/v2/builds/{buildMaster}/builds/**", method = RequestMethod.GET) List getBuilds(@PathVariable("buildMaster") String buildMaster, HttpServletRequest request) { log.debug(DEPRECATION_NOTICE_MESSAGE) @@ -76,7 +76,7 @@ class BuildController { buildService.getBuilds(buildMaster, job) } - @ApiOperation(value = "Get build for build master", notes = "Deprecated, use the v3 endpoint instead", response = HashMap.class) + @Operation(summary = "Get build for build master", description = "Deprecated, use the v3 endpoint instead") @RequestMapping(value = "/v2/builds/{buildMaster}/build/{number}/**", method = RequestMethod.GET) Map getBuild(@PathVariable("buildMaster") String buildMaster, @PathVariable("number") String number, HttpServletRequest request) { log.debug(DEPRECATION_NOTICE_MESSAGE) @@ -90,33 +90,33 @@ class BuildController { * In this version, the job name is moved from a path parameter to a required query parameter wherever its used. */ - @ApiOperation(value = "Get build masters", response = List.class) + @Operation(summary = "Get build masters") @RequestMapping(value = "v3/builds", method = RequestMethod.GET) List v3GetBuildMasters(@RequestParam(value = "type", defaultValue = "") String type) { buildService.getBuildMasters(type) } - @ApiOperation(value = "Get jobs for build master", response = List.class) + @Operation(summary = "Get jobs for build master") @RequestMapping(value = "/v3/builds/{buildMaster}/jobs", method = RequestMethod.GET) List v3GetJobsForBuildMaster(@PathVariable("buildMaster") String buildMaster) { buildService.getJobsForBuildMaster(buildMaster) } - @ApiOperation(value = "Get job config", response = HashMap.class) + @Operation(summary = "Get job config") @RequestMapping(value = "/v3/builds/{buildMaster}/job", method = RequestMethod.GET) Map v3GetJobConfig(@PathVariable("buildMaster") String buildMaster, @RequestParam(value = "job", required = true) String job) { buildService.getJobConfig(buildMaster, job) } - @ApiOperation(value = "Get builds for build master", response = List.class) + @Operation(summary = "Get builds for build master") @RequestMapping(value = "/v3/builds/{buildMaster}/builds", method = RequestMethod.GET) List v3GetBuilds(@PathVariable("buildMaster") String buildMaster, @RequestParam(value = "job", required = true) String job) { buildService.getBuilds(buildMaster, job) } - @ApiOperation(value = "Get build for build master", response = HashMap.class) + @Operation(summary = "Get build for build master") @RequestMapping(value = "/v3/builds/{buildMaster}/build/{number}", method = RequestMethod.GET) Map v3GetBuild(@PathVariable("buildMaster") String buildMaster, @PathVariable("number") String number, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CapabilitiesController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CapabilitiesController.java index e1b51b6a52..bfadb70315 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CapabilitiesController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CapabilitiesController.java @@ -18,7 +18,7 @@ import com.netflix.spinnaker.gate.services.internal.EchoService; import com.netflix.spinnaker.gate.services.internal.OrcaServiceSelector; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Map; import java.util.Optional; @@ -39,21 +39,19 @@ public class CapabilitiesController { this.echoService = echoService; } - @ApiOperation(value = "Retrieve the list configured deployment monitors", response = List.class) + @Operation(summary = "Retrieve the list configured deployment monitors") @GetMapping(value = "/deploymentMonitors") List getDeploymentMonitors() { return orcaService.select().getDeploymentMonitors(); } - @ApiOperation( - value = "Retrieve the SpEL expression capabilities (e.g. registered functions, etc)", - response = Map.class) + @Operation(summary = "Retrieve the SpEL expression capabilities (e.g. registered functions, etc)") @GetMapping(value = "/expressions") Map getExpressionCapabilities() { return orcaService.select().getExpressionCapabilities(); } - @ApiOperation(value = "Retrieve the current state of the quiet period", response = Map.class) + @Operation(summary = "Retrieve the current state of the quiet period") @GetMapping(value = "/quietPeriod") Map getQuietPeriodState() { return echoService.map(EchoService::getQuietPeriodState).orElse(null); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CertificateController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CertificateController.groovy index 18004f9c81..7e7753928f 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CertificateController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CertificateController.groovy @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.CertificateService import com.netflix.spinnaker.gate.services.internal.ClouddriverServiceSelector -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader @@ -33,13 +33,13 @@ class CertificateController { @Autowired CertificateService certificateService - @ApiOperation(value = "Retrieve a list of all server certificates") + @Operation(summary = "Retrieve a list of all server certificates") @RequestMapping(method = RequestMethod.GET) List all(@RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { certificateService.getCertificates(sourceApp) } - @ApiOperation(value = "Retrieve a list of server certificates for a given cloud provider") + @Operation(summary = "Retrieve a list of server certificates for a given cloud provider") @RequestMapping(value = "/{cloudProvider}", method = RequestMethod.GET) List allByCloudProvider(@PathVariable String cloudProvider, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CleanupController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CleanupController.java index 3fa5a19728..d0737c6c71 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CleanupController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CleanupController.java @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.CleanupService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,7 +35,7 @@ public CleanupController(CleanupService cleanupService) { this.cleanupService = cleanupService; } - @ApiOperation(value = "Opt out of clean up for a marked resource.", response = Map.class) + @Operation(summary = "Opt out of clean up for a marked resource.") @RequestMapping( method = RequestMethod.GET, value = "/resources/{namespace}/{resourceId}/optOut", @@ -51,7 +51,7 @@ Map optOut(@PathVariable String namespace, @PathVariable String resourceId) { namespace, resourceId, "Resource has been opted out of automated deletion."); } - @ApiOperation(value = "Get information about a marked resource.", response = Map.class) + @Operation(summary = "Get information about a marked resource.") @RequestMapping( method = RequestMethod.GET, value = "/resources/{namespace}/{resourceId}", @@ -65,7 +65,7 @@ Map getMarkedResource(@PathVariable String namespace, @PathVariable String resou return markedResource; } - @ApiOperation(value = "Get all marked resources.", response = List.class) + @Operation(summary = "Get all marked resources.") @RequestMapping( method = RequestMethod.GET, value = "/resources/marked", @@ -74,7 +74,7 @@ List getAllMarkedResources() { return cleanupService.getMarkedList(); } - @ApiOperation(value = "Get all deleted resources.", response = List.class) + @Operation(summary = "Get all deleted resources.") @RequestMapping( method = RequestMethod.GET, value = "/resources/deleted", diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ClusterController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ClusterController.groovy index f8c3b9a426..f49628b594 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ClusterController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ClusterController.groovy @@ -20,7 +20,7 @@ import com.netflix.spinnaker.gate.services.ClusterService import com.netflix.spinnaker.gate.services.LoadBalancerService import groovy.transform.CompileStatic import groovy.transform.TypeCheckingMode -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -35,14 +35,14 @@ class ClusterController { @Autowired LoadBalancerService loadBalancerService - @ApiOperation(value = "Retrieve a list of cluster names for an application, grouped by account", response = HashMap.class) + @Operation(summary = "Retrieve a list of cluster names for an application, grouped by account") @RequestMapping(method = RequestMethod.GET) Map getClusters(@PathVariable("application") String app, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { clusterService.getClusters(app, sourceApp) } - @ApiOperation(value = "Retrieve a list of clusters for an account", response = List.class) + @Operation(summary = "Retrieve a list of clusters for an account") @RequestMapping(value = "/{account}", method = RequestMethod.GET) List getClusters(@PathVariable("application") String app, @PathVariable("account") String account, @@ -50,7 +50,7 @@ class ClusterController { clusterService.getClustersForAccount(app, account, sourceApp) } - @ApiOperation(value = "Retrieve a cluster's details", response = HashMap.class) + @Operation(summary = "Retrieve a cluster's details") @RequestMapping(value = "/{account}/{clusterName:.+}", method = RequestMethod.GET) Map getClusters(@PathVariable("application") String app, @PathVariable("account") String account, @@ -59,7 +59,7 @@ class ClusterController { clusterService.getCluster(app, account, clusterName, sourceApp) } - @ApiOperation(value = "Retrieve a cluster's loadbalancers", response = List.class) + @Operation(summary = "Retrieve a cluster's loadbalancers") @RequestMapping(value = "/{account}/{clusterName}/{type}/loadBalancers", method = RequestMethod.GET) List getClusterLoadBalancers(@PathVariable String applicationName, @PathVariable String account, @@ -69,7 +69,7 @@ class ClusterController { loadBalancerService.getClusterLoadBalancers(applicationName, account, type, clusterName, sourceApp) } - @ApiOperation(value = "Retrieve a list of server groups for a cluster", response = List.class) + @Operation(summary = "Retrieve a list of server groups for a cluster") @RequestMapping(value = "/{account}/{clusterName}/serverGroups", method = RequestMethod.GET) List getServerGroups(@PathVariable("application") String app, @PathVariable("account") String account, @@ -78,7 +78,7 @@ class ClusterController { clusterService.getClusterServerGroups(app, account, clusterName, sourceApp) } - @ApiOperation(value = "Retrieve a list of scaling activities for a server group", response = List.class) + @Operation(summary = "Retrieve a list of scaling activities for a server group") @RequestMapping(value = "/{account}/{clusterName}/serverGroups/{serverGroupName}/scalingActivities", method = RequestMethod.GET) List getScalingActivities(@PathVariable("application") String app, @PathVariable("account") String account, @@ -91,7 +91,7 @@ class ClusterController { } @CompileStatic(TypeCheckingMode.SKIP) - @ApiOperation(value = "Retrieve a server group's details", response = List.class) + @Operation(summary = "Retrieve a server group's details") @RequestMapping(value = "/{account}/{clusterName}/serverGroups/{serverGroupName:.+}", method = RequestMethod.GET) List getServerGroups(@PathVariable("application") String app, @PathVariable("account") String account, @@ -104,8 +104,8 @@ class ClusterController { } } - @ApiOperation(value = "Retrieve a server group that matches a target coordinate (e.g., newest, ancestor) relative to a cluster", - notes = "`scope` is either a zone or a region", response = HashMap.class) + @Operation(summary = "Retrieve a server group that matches a target coordinate (e.g., newest, ancestor) relative to a cluster", + description = "`scope` is either a zone or a region") @RequestMapping(value = "/{account:.+}/{clusterName:.+}/{cloudProvider}/{scope}/serverGroups/target/{target:.+}", method = RequestMethod.GET) Map getTargetServerGroup(@PathVariable("application") String app, @PathVariable("account") String account, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ConcourseController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ConcourseController.java index fc7afcec32..476c8c6406 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ConcourseController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ConcourseController.java @@ -18,7 +18,7 @@ import com.netflix.spinnaker.gate.services.internal.IgorService; import com.netflix.spinnaker.gate.services.internal.OrcaServiceSelector; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Optional; import lombok.RequiredArgsConstructor; @@ -32,26 +32,20 @@ public class ConcourseController { private final Optional igorService; private final OrcaServiceSelector orcaService; - @ApiOperation( - value = "Retrieve the list of team names available to triggers", - response = List.class) + @Operation(summary = "Retrieve the list of team names available to triggers") @GetMapping(value = "/{buildMaster}/teams") List teams(@PathVariable("buildMaster") String buildMaster) { return igorService.get().getConcourseTeams(buildMaster); } - @ApiOperation( - value = "Retrieve the list of pipeline names for a given team available to triggers", - response = List.class) + @Operation(summary = "Retrieve the list of pipeline names for a given team available to triggers") @GetMapping(value = "/{buildMaster}/teams/{team}/pipelines") List pipelines( @PathVariable("buildMaster") String buildMaster, @PathVariable("team") String team) { return igorService.get().getConcoursePipelines(buildMaster, team); } - @ApiOperation( - value = "Retrieve the list of job names for a given pipeline available to triggers", - response = List.class) + @Operation(summary = "Retrieve the list of job names for a given pipeline available to triggers") @GetMapping(value = "/{buildMaster}/teams/{team}/pipelines/{pipeline}/jobs") List jobs( @PathVariable("buildMaster") String buildMaster, @@ -60,10 +54,9 @@ List jobs( return igorService.get().getConcourseJobs(buildMaster, team, pipeline); } - @ApiOperation( - value = - "Retrieve the list of resource names for a given pipeline available to the Concourse stage", - response = List.class) + @Operation( + summary = + "Retrieve the list of resource names for a given pipeline available to the Concourse stage") @GetMapping(value = "/{buildMaster}/teams/{team}/pipelines/{pipeline}/resources") List resources( @PathVariable("buildMaster") String buildMaster, @@ -72,8 +65,8 @@ List resources( return igorService.get().getConcourseResources(buildMaster, team, pipeline); } - @ApiOperation( - value = + @Operation( + summary = "Inform Spinnaker of the Concourse build running connected to a particular Concourse stage execution") @PostMapping("/stage/start") void stageExecution( diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy index a0944f3a84..a4771bda6e 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy @@ -26,8 +26,8 @@ import com.netflix.spinnaker.gate.services.internal.ClouddriverService.Account import com.netflix.spinnaker.gate.services.internal.ClouddriverService.AccountDetails import com.netflix.spinnaker.kork.annotations.Alpha import com.netflix.spinnaker.security.User -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 org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.DeleteMapping import org.springframework.web.bind.annotation.GetMapping @@ -61,7 +61,7 @@ class CredentialsController { Boolean authorized } - @ApiOperation(value = "Retrieve a list of accounts") + @Operation(summary = "Retrieve a list of accounts") @RequestMapping(method = RequestMethod.GET) List getAccounts(@SpinnakerUser User user, @RequestParam(value = "expand", required = false) boolean expand) { List allAccounts = getAccountDetailsWithAuthorizedFlag(user) @@ -83,7 +83,7 @@ class CredentialsController { return allAccounts } - @ApiOperation(value = "Retrieve an account's details") + @Operation(summary = "Retrieve an account's details") @RequestMapping(value = '/{account:.+}', method = RequestMethod.GET) AccountDetails getAccount(@SpinnakerUser User user, @PathVariable("account") String account, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { @@ -91,44 +91,44 @@ class CredentialsController { } @GetMapping('/type/{accountType}') - @ApiOperation('Looks up account definitions by type.') + @Operation(summary='Looks up account definitions by type.') @Alpha List getAccountsByType( - @ApiParam(value = 'Value of the "@type" key for accounts to search for.', example = 'kubernetes') + @Parameter(description = 'Value of the "@type" key for accounts to search for.', example = 'kubernetes') @PathVariable String accountType, - @ApiParam('Maximum number of entries to return in results. Used for pagination.') + @Parameter(description='Maximum number of entries to return in results. Used for pagination.') @RequestParam(required = false) Integer limit, - @ApiParam('Account name to start account definition listing from. Used for pagination.') + @Parameter(description='Account name to start account definition listing from. Used for pagination.') @RequestParam(required = false) String startingAccountName ) { clouddriverService.getAccountDefinitionsByType(accountType, limit, startingAccountName) } @PostMapping - @ApiOperation('Creates a new account definition.') + @Operation(summary='Creates a new account definition.') @Alpha ClouddriverService.AccountDefinition createAccount( - @ApiParam('Account definition body including a discriminator field named "type" with the account type.') + @Parameter(description='Account definition body including a discriminator field named "type" with the account type.') @RequestBody ClouddriverService.AccountDefinition accountDefinition ) { clouddriverService.createAccountDefinition(accountDefinition) } @PutMapping - @ApiOperation('Updates an existing account definition.') + @Operation(summary='Updates an existing account definition.') @Alpha ClouddriverService.AccountDefinition updateAccount( - @ApiParam('Account definition body including a discriminator field named "type" with the account type.') + @Parameter(description='Account definition body including a discriminator field named "type" with the account type.') @RequestBody ClouddriverService.AccountDefinition accountDefinition ) { clouddriverService.updateAccountDefinition(accountDefinition) } @DeleteMapping('/{accountName}') - @ApiOperation('Deletes an account definition by name.') + @Operation(summary='Deletes an account definition by name.') @Alpha void deleteAccount( - @ApiParam('Name of account definition to delete.') + @Parameter(description='Name of account definition to delete.') @PathVariable String accountName ) { clouddriverService.deleteAccountDefinition(accountName) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/EntityTagsController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/EntityTagsController.java index 7c34ead17a..a419d366d8 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/EntityTagsController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/EntityTagsController.java @@ -19,8 +19,8 @@ import com.netflix.frigga.Names; import com.netflix.spinnaker.gate.services.EntityTagsService; import com.netflix.spinnaker.gate.services.TaskService; -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.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -54,8 +54,9 @@ public EntityTagsController(EntityTagsService entityTagsService, TaskService tas @RequestMapping(method = RequestMethod.GET) public Collection list( - @ApiParam( - "Any parameters to filter by, passed as individual parameters. Options are: \n cloudProvider, application, entityType, entityId, idPrefix, account, region, namespace, maxResults") + @Parameter( + description = + "Any parameters to filter by, passed as individual parameters. Options are: \n cloudProvider, application, entityType, entityId, idPrefix, account, region, namespace, maxResults") @RequestParam Map allParameters, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { @@ -74,9 +75,9 @@ public Map get(HttpServletRequest request) { return entityTagsService.get(id, request.getHeader("X-RateLimit-App")); } - @ApiOperation( - value = "Deletes a subset of tags for the provided tag ID", - notes = + @Operation( + summary = "Deletes a subset of tags for the provided tag ID", + description = "multiple tags can be deleted for an entity using a comma as a separator, e.g. /tag1,tag2") @RequestMapping(value = "/{id}/{tag}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.ACCEPTED) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ExecutionsController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ExecutionsController.java index 11089bdec2..da79f61ecd 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ExecutionsController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ExecutionsController.java @@ -16,8 +16,8 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.internal.OrcaServiceSelector; -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.Collections; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; @@ -33,33 +33,33 @@ public ExecutionsController(OrcaServiceSelector orcaServiceSelector) { this.orcaServiceSelector = orcaServiceSelector; } - @ApiOperation( - value = + @Operation( + summary = "Retrieves an ad-hoc collection of executions based on a number of user-supplied parameters. Either executionIds or pipelineConfigIds must be supplied in order to return any results. If both are supplied, an exception will be thrown.") @RequestMapping(value = "/executions", method = RequestMethod.GET) List getLatestExecutionsByConfigIds( - @ApiParam( - value = + @Parameter( + description = "A comma-separated list of pipeline configuration IDs to retrieve recent executions for. Either this OR pipelineConfigIds must be supplied, but not both.") @RequestParam(value = "pipelineConfigIds", required = false) String pipelineConfigIds, - @ApiParam( - value = + @Parameter( + description = "A comma-separated list of executions to retrieve. Either this OR pipelineConfigIds must be supplied, but not both.") @RequestParam(value = "executionIds", required = false) String executionIds, - @ApiParam( - value = + @Parameter( + description = "The number of executions to return per pipeline configuration. Ignored if executionIds parameter is supplied. If this value is missing, it is defaulted to 1.") @RequestParam(value = "limit", required = false) Integer limit, - @ApiParam( - value = + @Parameter( + description = "A comma-separated list of execution statuses to filter by. Ignored if executionIds parameter is supplied. If this value is missing, it is defaulted to all statuses.") @RequestParam(value = "statuses", required = false) String statuses, - @ApiParam( - value = + @Parameter( + description = "Expands each execution object in the resulting list. If this value is missing, it is defaulted to true.") @RequestParam(value = "expand", defaultValue = "true") boolean expand) { @@ -73,34 +73,34 @@ List getLatestExecutionsByConfigIds( .getSubsetOfExecutions(pipelineConfigIds, executionIds, limit, statuses, expand); } - @ApiOperation( - value = + @Operation( + summary = "Search for pipeline executions using a combination of criteria. The returned list is sorted by buildTime (trigger time) in reverse order so that newer executions are first in the list.") @RequestMapping( value = "/applications/{application}/executions/search", method = RequestMethod.GET) List searchForPipelineExecutionsByTrigger( - @ApiParam( - value = + @Parameter( + description = "Only includes executions that are part of this application. If this value is \"*\", results will include executions of all applications.", required = true) @PathVariable(value = "application") String application, - @ApiParam( - value = + @Parameter( + description = "Only includes executions that were triggered by a trigger with a type that is equal to a type provided in this field. The list of trigger types should be a comma-delimited string. If this value is missing, results will includes executions of all trigger types.") @RequestParam(value = "triggerTypes", required = false) String triggerTypes, - @ApiParam(value = "Only includes executions that with this pipeline name.") + @Parameter(description = "Only includes executions that with this pipeline name.") @RequestParam(value = "pipelineName", required = false) String pipelineName, - @ApiParam( - value = + @Parameter( + description = "Only includes executions that were triggered by a trigger with this eventId.") @RequestParam(value = "eventId", required = false) String eventId, - @ApiParam( - value = + @Parameter( + description = "Only includes executions that were triggered by a trigger that matches the subset of fields provided by this value. This value should be a base64-encoded string of a JSON representation of a trigger object. The comparison succeeds if the execution trigger contains all the fields of the input trigger, the fields are of the same type, and each value of the field \"matches\". The term \"matches\" is specific for each field's type:\n" + "- For Strings: A String value in the execution's trigger matches the input trigger's String value if the former equals the latter (case-insensitive) OR if the former matches the latter as a regular expression.\n" + "- For Maps: A Map value in the execution's trigger matches the input trigger's Map value if the former contains all keys of the latter and their values match.\n" @@ -108,40 +108,40 @@ List searchForPipelineExecutionsByTrigger( + "- Every other value is compared using the Java \"equals\" method (Groovy \"==\" operator)") @RequestParam(value = "trigger", required = false) String trigger, - @ApiParam( - value = + @Parameter( + description = "Only includes executions that were built at or after the given time, represented as a Unix timestamp in ms (UTC). This value must be >= 0 and <= the value of [triggerTimeEndBoundary], if provided. If this value is missing, it is defaulted to 0.") @RequestParam(value = "triggerTimeStartBoundary", defaultValue = "0") long triggerTimeStartBoundary, - @ApiParam( - value = + @Parameter( + description = "Only includes executions that were built at or before the given time, represented as a Unix timestamp in ms (UTC). This value must be <= 9223372036854775807 (Long.MAX_VALUE) and >= the value of [triggerTimeStartBoundary], if provided. If this value is missing, it is defaulted to 9223372036854775807.") @RequestParam( value = "triggerTimeEndBoundary", defaultValue = "9223372036854775807" /* Long.MAX_VALUE */) long triggerTimeEndBoundary, - @ApiParam( - value = + @Parameter( + description = "Only includes executions with a status that is equal to a status provided in this field. The list of statuses should be given as a comma-delimited string. If this value is missing, includes executions of all statuses. Allowed statuses are: NOT_STARTED, RUNNING, PAUSED, SUSPENDED, SUCCEEDED, FAILED_CONTINUE, TERMINAL, CANCELED, REDIRECT, STOPPED, SKIPPED, BUFFERED.") @RequestParam(value = "statuses", required = false) String statuses, - @ApiParam( - value = + @Parameter( + description = "Sets the first item of the resulting list for pagination. The list is 0-indexed. This value must be >= 0. If this value is missing, it is defaulted to 0.") @RequestParam(value = "startIndex", defaultValue = "0") int startIndex, - @ApiParam( - value = + @Parameter( + description = "Sets the size of the resulting list for pagination. This value must be > 0. If this value is missing, it is defaulted to 10.") @RequestParam(value = "size", defaultValue = "10") int size, - @ApiParam( - value = + @Parameter( + description = "Reverses the resulting list before it is paginated. If this value is missing, it is defaulted to false.") @RequestParam(value = "reverse", defaultValue = "false") boolean reverse, - @ApiParam( - value = + @Parameter( + description = "Expands each execution object in the resulting list. If this value is missing, it is defaulted to false.") @RequestParam(value = "expand", defaultValue = "false") boolean expand) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/FirewallController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/FirewallController.groovy index 317b98dd0e..39843efcba 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/FirewallController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/FirewallController.groovy @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.SecurityGroupService import com.netflix.spinnaker.kork.web.exceptions.NotFoundException -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -29,7 +29,7 @@ class FirewallController { @Autowired SecurityGroupService securityGroupService - @ApiOperation(value = "Retrieve a list of firewalls, grouped by account, cloud provider, and region") + @Operation(summary = "Retrieve a list of firewalls, grouped by account, cloud provider, and region") @RequestMapping(method = RequestMethod.GET) Map all(@RequestParam(value = "id", required = false) String id, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { @@ -45,7 +45,7 @@ class FirewallController { } } - @ApiOperation(value = "Retrieve a list of firewalls for a given account, grouped by region") + @Operation(summary = "Retrieve a list of firewalls for a given account, grouped by region") @RequestMapping(value = "/{account}", method = RequestMethod.GET) Map allByAccount( @PathVariable String account, @@ -54,7 +54,7 @@ class FirewallController { securityGroupService.getForAccountAndProvider(account, provider, sourceApp) } - @ApiOperation(value = "Retrieve a list of firewalls for a given account and region") + @Operation(summary = "Retrieve a list of firewalls for a given account and region") @RequestMapping(value = "/{account}/{region}", method = RequestMethod.GET) List allByAccountAndRegion( @PathVariable String account, @@ -64,7 +64,7 @@ class FirewallController { securityGroupService.getForAccountAndProviderAndRegion(account, provider, region, sourceApp) } - @ApiOperation(value = "Retrieve a firewall's details") + @Operation(summary = "Retrieve a firewall's details") @RequestMapping(value = "/{account}/{region}/{name:.+}", method = RequestMethod.GET) Map getSecurityGroup( @PathVariable String account, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/GoogleCloudBuildController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/GoogleCloudBuildController.java index 9f33a2d23b..1e98923468 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/GoogleCloudBuildController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/GoogleCloudBuildController.java @@ -19,7 +19,7 @@ import com.netflix.spinnaker.gate.services.BuildService; import com.netflix.spinnaker.gate.services.internal.GoogleCloudBuildTrigger; import com.netflix.spinnaker.gate.services.internal.IgorService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -41,15 +41,13 @@ public GoogleCloudBuildController(IgorService igorService, BuildService buildSer this.buildService = buildService; } - @ApiOperation(value = "Retrieve the list of Google Cloud Build accounts", response = List.class) + @Operation(summary = "Retrieve the list of Google Cloud Build accounts") @GetMapping(value = "/accounts") List getAccounts() { return igorService.getGoogleCloudBuildAccounts(); } - @ApiOperation( - value = "Retrieve the list of Google Cloud Build triggers for a given account", - response = List.class) + @Operation(summary = "Retrieve the list of Google Cloud Build triggers for a given account") @GetMapping(value = "/triggers/{account}") List getGoogleCloudBuildTriggers( @PathVariable("account") String account) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/HistoryController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/HistoryController.java index bfd7ba5d18..34da9882c8 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/HistoryController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/HistoryController.java @@ -2,7 +2,7 @@ import com.netflix.spinnaker.gate.services.internal.KeelService; import groovy.util.logging.Slf4j; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Map; import org.slf4j.Logger; @@ -29,7 +29,7 @@ public HistoryController(KeelService keelService) { this.keelService = keelService; } - @ApiOperation(value = "Get history for a resource", response = List.class) + @Operation(summary = "Get history for a resource") @RequestMapping(value = "/{name}", method = RequestMethod.GET) List> getHistory( @PathVariable("name") String name, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ImageController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ImageController.groovy index 0fea979983..ffece9d0e2 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ImageController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ImageController.groovy @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.ImageService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -30,7 +30,7 @@ class ImageController { @Autowired ImageService imageService - @ApiOperation(value = "Get image details", response = List.class) + @Operation(summary = "Get image details") @RequestMapping(value = "/{account}/{region}/{imageId:.+}", method = RequestMethod.GET) List getImageDetails(@PathVariable(value = "account") String account, @PathVariable(value = "region") String region, @@ -40,9 +40,8 @@ class ImageController { imageService.getForAccountAndRegion(provider, account, region, imageId, sourceApp) } - @ApiOperation(value = "Retrieve a list of images, filtered by cloud provider, region, and account", - notes = "The query parameter `q` filters the list of images by image name", - response = List.class) + @Operation(summary = "Retrieve a list of images, filtered by cloud provider, region, and account", + description = "The query parameter `q` filters the list of images by image name") @RequestMapping(value = "/find", method = RequestMethod.GET) List findImages(@RequestParam(value = "provider", defaultValue = "aws", required = false) String provider, @RequestParam(value = "q", required = false) String query, @@ -58,7 +57,7 @@ class ImageController { imageService.search(provider, query, region, account, count, additionalFilters, httpServletRequest.getHeader("X-RateLimit-Header")) } - @ApiOperation(value = "Find tags", response = List.class) + @Operation(summary = "Find tags") @RequestMapping(value = "/tags", method = RequestMethod.GET) List findTags(@RequestParam(value = "provider", defaultValue = "aws", required = false) String provider, @RequestParam(value = "account", required = true) String account, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/InstanceController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/InstanceController.groovy index 823e17cc6d..a0eac139a1 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/InstanceController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/InstanceController.groovy @@ -19,7 +19,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.InstanceService import groovy.transform.CompileStatic -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader @@ -35,7 +35,7 @@ class InstanceController { @Autowired InstanceService instanceService - @ApiOperation(value = "Retrieve an instance's details") + @Operation(summary = "Retrieve an instance's details") @RequestMapping(value = "/{account}/{region}/{instanceId:.+}", method = RequestMethod.GET) Map getInstanceDetails(@PathVariable(value = "account") String account, @PathVariable(value = "region") String region, @@ -44,7 +44,7 @@ class InstanceController { instanceService.getForAccountAndRegion(account, region, instanceId, sourceApp) } - @ApiOperation(value = "Retrieve an instance's console output") + @Operation(summary = "Retrieve an instance's console output") @RequestMapping(value = "/{account}/{region}/{instanceId}/console", method = RequestMethod.GET) Map getConsoleOutput(@PathVariable(value = "account") String account, @PathVariable(value = "region") String region, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/JobController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/JobController.groovy index c4a080cc22..c7d84137ee 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/JobController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/JobController.groovy @@ -19,7 +19,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.JobService import groovy.transform.CompileStatic -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -29,7 +29,7 @@ class JobController { @Autowired JobService jobService - @ApiOperation(value = "Get job", response = HashMap.class) + @Operation(summary = "Get job") @RequestMapping(value = "/applications/{applicationName}/jobs/{account}/{region}/{name}", method = RequestMethod.GET) Map getJob(@PathVariable String applicationName, @PathVariable String account, @PathVariable String region, @@ -39,7 +39,7 @@ class JobController { jobService.getForApplicationAndAccountAndRegion(applicationName, account, region, name, sourceApp) } - @ApiOperation(value = "Retrieve a list of preconfigured jobs in Orca") + @Operation(summary = "Retrieve a list of preconfigured jobs in Orca") @RequestMapping(value = "/jobs/preconfigured", method = RequestMethod.GET) List preconfiguredWebhooks() { jobService.getPreconfiguredJobs() diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/LoadBalancerController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/LoadBalancerController.groovy index 727e23454f..d6430926b3 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/LoadBalancerController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/LoadBalancerController.groovy @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.LoadBalancerService import groovy.transform.CompileStatic -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -29,14 +29,14 @@ class LoadBalancerController { @Autowired LoadBalancerService loadBalancerService - @ApiOperation(value = "Retrieve a list of load balancers for a given cloud provider", response = List.class) + @Operation(summary = "Retrieve a list of load balancers for a given cloud provider") @RequestMapping(value = '/loadBalancers', method = RequestMethod.GET) List getAll(@RequestParam(value = "provider", defaultValue = "aws", required = false) String provider, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { loadBalancerService.getAll(provider, sourceApp) } - @ApiOperation(value = "Retrieve a load balancer for a given cloud provider", response = HashMap.class) + @Operation(summary = "Retrieve a load balancer for a given cloud provider") @RequestMapping(value = "/loadBalancers/{name:.+}", method = RequestMethod.GET) Map getLoadBalancer(@PathVariable String name, @RequestParam(value = "provider", defaultValue = "aws", required = false) String provider, @@ -44,8 +44,7 @@ class LoadBalancerController { loadBalancerService.get(name, sourceApp, provider) } - @ApiOperation(value = "Retrieve a load balancer's details as a single element list for a given account, region, cloud provider and load balancer name", - response = List.class) + @Operation(summary = "Retrieve a load balancer's details as a single element list for a given account, region, cloud provider and load balancer name") @RequestMapping(value = "/loadBalancers/{account}/{region}/{name:.+}", method = RequestMethod.GET) List getLoadBalancerDetails(@PathVariable String account, @PathVariable String region, @@ -55,8 +54,7 @@ class LoadBalancerController { loadBalancerService.getDetailsForAccountAndRegion(account, region, name, sourceApp, provider) } - @ApiOperation(value = "Retrieve a list of load balancers for a given application", - response = List.class) + @Operation(summary = "Retrieve a list of load balancers for a given application") @RequestMapping(value = '/applications/{application}/loadBalancers', method = RequestMethod.GET) List getApplicationLoadBalancers(@PathVariable String application, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ManagedController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ManagedController.java index bd43971857..a7eaaceba5 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ManagedController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ManagedController.java @@ -18,7 +18,7 @@ import groovy.util.logging.Slf4j; import io.github.resilience4j.retry.RetryConfig; import io.github.resilience4j.retry.RetryRegistry; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.time.Duration; @@ -95,7 +95,7 @@ private void configureRetry() { .build()); } - @ApiOperation(value = "Post a graphql request", response = Map.class) + @Operation(summary = "Post a graphql request") @PostMapping( path = "/graphql", consumes = {APPLICATION_JSON_VALUE}, @@ -104,19 +104,19 @@ Map graphql(@RequestBody GraphQLRequest query) { return keelService.graphql(query); } - @ApiOperation(value = "Get a resource", response = Resource.class) + @Operation(summary = "Get a resource") @GetMapping(path = "/resources/{resourceId}") Resource getResource(@PathVariable("resourceId") String resourceId) { return keelService.getResource(resourceId); } - @ApiOperation(value = "Get a resource", response = Resource.class) + @Operation(summary = "Get a resource") @GetMapping(path = "/resources/{resourceId}.yml", produces = APPLICATION_YAML_VALUE) Resource getResourceYaml(@PathVariable("resourceId") String resourceId) { return keelService.getResourceYaml(resourceId); } - @ApiOperation(value = "Get status of a resource", response = Map.class) + @Operation(summary = "Get status of a resource") @GetMapping(path = "/resources/{resourceId}/status") Map getResourceStatus(@PathVariable("resourceId") String resourceId) { Map status = new HashMap<>(); @@ -124,7 +124,7 @@ Map getResourceStatus(@PathVariable("resourceId") String resourceId) { return status; } - @ApiOperation(value = "Ad-hoc validate and diff a resource", response = Map.class) + @Operation(summary = "Ad-hoc validate and diff a resource") @PostMapping( path = "/resources/diff", consumes = {APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE}, @@ -133,21 +133,19 @@ Map diffResource(@RequestBody Resource resource) { return keelService.diffResource(resource); } - @ApiOperation(value = "Pause management of a resource") + @Operation(summary = "Pause management of a resource") @PostMapping(path = "/resources/{resourceId}/pause") void pauseResource(@PathVariable("resourceId") String resourceId) { keelService.pauseResource(resourceId, Collections.emptyMap()); } - @ApiOperation(value = "Resume management of a resource") + @Operation(summary = "Resume management of a resource") @DeleteMapping(path = "/resources/{resourceId}/pause") void resumeResource(@PathVariable("resourceId") String resourceId) { keelService.resumeResource(resourceId); } - @ApiOperation( - value = "Generate a keel resource definition for a deployed cloud resource", - response = Resource.class) + @Operation(summary = "Generate a keel resource definition for a deployed cloud resource") @GetMapping(path = "/resources/export/{cloudProvider}/{account}/{type}/{name}") ResponseEntity exportResource( @PathVariable("cloudProvider") String cloudProvider, @@ -160,9 +158,8 @@ ResponseEntity exportResource( return new ResponseEntity<>(resource, yamlResponseHeaders, HttpStatus.OK); } - @ApiOperation( - value = "Generates an artifact definition based on the artifact used in a running cluster", - response = Map.class) + @Operation( + summary = "Generates an artifact definition based on the artifact used in a running cluster") @GetMapping(path = "/resources/export/artifact/{cloudProvider}/{account}/{clusterName}") ResponseEntity exportResource( @PathVariable("cloudProvider") String cloudProvider, @@ -172,30 +169,26 @@ ResponseEntity exportResource( return new ResponseEntity<>(artifact, yamlResponseHeaders, HttpStatus.OK); } - @ApiOperation(value = "Get a delivery config manifest", response = DeliveryConfig.class) + @Operation(summary = "Get a delivery config manifest") @GetMapping(path = "/delivery-configs/{name}") DeliveryConfig getManifest(@PathVariable("name") String name) { return keelService.getManifest(name); } - @ApiOperation(value = "Get a delivery config manifest", response = DeliveryConfig.class) + @Operation(summary = "Get a delivery config manifest") @GetMapping(path = "/delivery-configs/{name}.yml", produces = APPLICATION_YAML_VALUE) DeliveryConfig getManifestYaml(@PathVariable("name") String name) { return keelService.getManifestYaml(name); } - @ApiOperation( - value = "Get the status of each version of each artifact in each environment", - response = List.class) + @Operation(summary = "Get the status of each version of each artifact in each environment") @GetMapping(path = "/delivery-configs/{name}/artifacts") List> getManifestArtifacts(@PathVariable("name") String name) { return keelService.getManifestArtifacts(name); } @SneakyThrows - @ApiOperation( - value = "Create or update a delivery config manifest", - response = DeliveryConfig.class) + @Operation(summary = "Create or update a delivery config manifest") @PostMapping( path = "/delivery-configs", consumes = {APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE}, @@ -206,13 +199,13 @@ DeliveryConfig upsertManifest(@RequestBody DeliveryConfig manifest) { .executeCallable(() -> keelService.upsertManifest(manifest)); } - @ApiOperation(value = "Delete a delivery config manifest", response = DeliveryConfig.class) + @Operation(summary = "Delete a delivery config manifest") @DeleteMapping(path = "/delivery-configs/{name}") DeliveryConfig deleteManifest(@PathVariable("name") String name) { return keelService.deleteManifest(name); } - @ApiOperation(value = "Validate a delivery config manifest", response = Map.class) + @Operation(summary = "Validate a delivery config manifest") @PostMapping( path = "/delivery-configs/validate", consumes = {APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE}, @@ -235,7 +228,7 @@ ResponseEntity validateManifest(@RequestBody DeliveryConfig manifest) { } } - @ApiOperation(value = "Ad-hoc validate and diff a config manifest", response = Map.class) + @Operation(summary = "Ad-hoc validate and diff a config manifest") @PostMapping( path = "/delivery-configs/diff", consumes = {APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE}, @@ -244,7 +237,7 @@ List diffManifest(@RequestBody DeliveryConfig manifest) { return keelService.diffManifest(manifest); } - @ApiOperation(value = "Ad-hoc validate and diff a config manifest", response = Map.class) + @Operation(summary = "Ad-hoc validate and diff a config manifest") @GetMapping( path = "/delivery-configs/schema", produces = {APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE}) @@ -252,9 +245,7 @@ Map schema() { return keelService.schema(); } - @ApiOperation( - value = "List up-to {limit} current constraint states for an environment", - response = ConstraintState.class) + @Operation(summary = "List up-to {limit} current constraint states for an environment") @GetMapping(path = "/application/{application}/environment/{environment}/constraints") List getConstraintState( @PathVariable("application") String application, @@ -263,23 +254,19 @@ List getConstraintState( return keelService.getConstraintState(application, environment, Integer.valueOf(limit)); } - @ApiOperation( - value = "Get the delivery config associated with an application", - response = DeliveryConfig.class) + @Operation(summary = "Get the delivery config associated with an application") @GetMapping(path = "/application/{application}/config") DeliveryConfig getConfigBy(@PathVariable("application") String application) { return keelService.getConfigBy(application); } - @ApiOperation( - value = "Delete a delivery config manifest for an application", - response = DeliveryConfig.class) + @Operation(summary = "Delete a delivery config manifest for an application") @DeleteMapping(path = "/application/{application}/config") DeliveryConfig deleteManifestByApp(@PathVariable("application") String application) { return keelService.deleteManifestByAppName(application); } - @ApiOperation(value = "Update the status of an environment constraint") + @Operation(summary = "Update the status of an environment constraint") @PostMapping(path = "/application/{application}/environment/{environment}/constraint") void updateConstraintStatus( @PathVariable("application") String application, @@ -288,7 +275,7 @@ void updateConstraintStatus( keelService.updateConstraintStatus(application, environment, status); } - @ApiOperation(value = "Get managed details about an application", response = Map.class) + @Operation(summary = "Get managed details about an application") @GetMapping(path = "/application/{application}") Map getApplicationDetails( @PathVariable("application") String application, @@ -301,27 +288,27 @@ Map getApplicationDetails( application, includeDetails, entities, maxArtifactVersions); } - @ApiOperation(value = "Pause management of an entire application") + @Operation(summary = "Pause management of an entire application") @PostMapping(path = "/application/{application}/pause") void pauseApplication(@PathVariable("application") String application) { keelService.pauseApplication(application, Collections.emptyMap()); } - @ApiOperation(value = "Resume management of an entire application") + @Operation(summary = "Resume management of an entire application") @DeleteMapping(path = "/application/{application}/pause") void resumeApplication(@PathVariable("application") String application) { keelService.resumeApplication(application); } - @ApiOperation(value = "Create a pin for an artifact in an environment") + @Operation(summary = "Create a pin for an artifact in an environment") @PostMapping(path = "/application/{application}/pin") void createPin( @PathVariable("application") String application, @RequestBody EnvironmentArtifactPin pin) { keelService.pin(application, pin); } - @ApiOperation( - value = + @Operation( + summary = "Unpin one or more artifact(s) in an environment. If the `reference` parameter is specified, only " + "the corresponding artifact will be unpinned. If it's omitted, all pinned artifacts in the environment will be " + "unpinned.") @@ -333,14 +320,14 @@ void deletePin( keelService.deletePinForEnvironment(application, targetEnvironment, reference); } - @ApiOperation(value = "Veto an artifact version in an environment") + @Operation(summary = "Veto an artifact version in an environment") @PostMapping(path = "/application/{application}/veto") void veto( @PathVariable("application") String application, @RequestBody EnvironmentArtifactVeto veto) { keelService.veto(application, veto); } - @ApiOperation(value = "Remove veto of an artifact version in an environment") + @Operation(summary = "Remove veto of an artifact version in an environment") @DeleteMapping(path = "/application/{application}/veto/{targetEnvironment}/{reference}/{version}") void deleteVeto( @PathVariable("application") String application, @@ -350,21 +337,21 @@ void deleteVeto( keelService.deleteVeto(application, targetEnvironment, reference, version); } - @ApiOperation(value = "Veto an artifact version in an environment") + @Operation(summary = "Veto an artifact version in an environment") @PostMapping(path = "/application/{application}/mark/bad") void markBad( @PathVariable("application") String application, @RequestBody EnvironmentArtifactVeto veto) { keelService.markBad(application, veto); } - @ApiOperation(value = "Delete veto of an artifact version in an environment") + @Operation(summary = "Delete veto of an artifact version in an environment") @PostMapping(path = "/application/{application}/mark/good") void markGood( @PathVariable("application") String application, @RequestBody EnvironmentArtifactVeto veto) { keelService.markGood(application, veto); } - @ApiOperation(value = "Override the status of a verification") + @Operation(summary = "Override the status of a verification") @PostMapping(path = "/{application}/environment/{environment}/verifications") void overrideVerification( @PathVariable("application") String application, @@ -373,7 +360,7 @@ void overrideVerification( keelService.overrideVerification(application, environment, payload); } - @ApiOperation(value = "Retry a verification") + @Operation(summary = "Retry a verification") @PostMapping(path = "/{application}/environment/{environment}/verifications/retry") void retryVerification( @PathVariable("application") String application, @@ -392,7 +379,7 @@ ResponseEntity processNotificationCallback( return notificationService.processNotificationCallback(source, request, "keel"); } - @ApiOperation(value = "Get a report of application onboarding") + @Operation(summary = "Get a report of application onboarding") @GetMapping(path = "/reports/onboarding") ResponseEntity getOnboardingReport( @RequestHeader(value = "Accept", defaultValue = "text/html") String accept, @@ -414,7 +401,7 @@ ResponseEntity getOnboardingReport( return response; } - @ApiOperation(value = "Get a report of Managed Delivery adoption") + @Operation(summary = "Get a report of Managed Delivery adoption") @GetMapping(path = "/reports/adoption", produces = "text/html") ResponseEntity getAdoptionReport(@RequestParam Map params) throws IOException { @@ -424,7 +411,7 @@ ResponseEntity getAdoptionReport(@RequestParam Map param .body(keelResponse.getBody().in().readAllBytes()); } - @ApiOperation(value = "Get current environment details") + @Operation(summary = "Get current environment details") @GetMapping(path = "/environments/{application}", produces = MediaType.APPLICATION_JSON_VALUE) List> getEnvironments(@PathVariable String application) { return keelService.getEnvironments(application); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NetworkController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NetworkController.groovy index 9f97724937..8319e7e7eb 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NetworkController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NetworkController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.NetworkService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader @@ -32,13 +32,13 @@ class NetworkController { @Autowired NetworkService networkService - @ApiOperation(value = "Retrieve a list of networks, grouped by cloud provider", response = HashMap.class) + @Operation(summary = "Retrieve a list of networks, grouped by cloud provider") @RequestMapping(method = RequestMethod.GET) Map all(@RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { networkService.getNetworks(sourceApp) } - @ApiOperation(value = "Retrieve a list of networks for a given cloud provider", response = List.class) + @Operation(summary = "Retrieve a list of networks for a given cloud provider") @RequestMapping(value = "/{cloudProvider}", method = RequestMethod.GET) List allByCloudProvider(@PathVariable String cloudProvider, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NexusController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NexusController.java index 28e242e16e..3d6bab5e61 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NexusController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/NexusController.java @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.internal.IgorService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; @@ -36,9 +36,7 @@ public NexusController(Optional igorService) { this.igorService = igorService; } - @ApiOperation( - value = "Retrieve the list of nexus names available to triggers", - response = List.class) + @Operation(summary = "Retrieve the list of nexus names available to triggers") @GetMapping(value = "/names") List names() { return igorService.get().getNexusNames(); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineConfigController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineConfigController.groovy index 1c8bbba643..8cbd7175b8 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineConfigController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineConfigController.groovy @@ -21,7 +21,7 @@ import com.netflix.spinnaker.gate.services.internal.OrcaServiceSelector import com.netflix.spinnaker.kork.web.exceptions.NotFoundException import groovy.transform.CompileStatic import groovy.util.logging.Slf4j -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -36,20 +36,20 @@ class PipelineConfigController { @Autowired OrcaServiceSelector orcaServiceSelector - @ApiOperation(value = "Get all pipeline configs.", response = List.class) + @Operation(summary = "Get all pipeline configs.") @RequestMapping(method = RequestMethod.GET) Collection getAllPipelineConfigs() { return front50Service.getAllPipelineConfigs() } - @ApiOperation(value = "Get pipeline config history.", response = List.class) + @Operation(summary = "Get pipeline config history.") @RequestMapping(value = "/{pipelineConfigId}/history", method = RequestMethod.GET) Collection getPipelineConfigHistory(@PathVariable("pipelineConfigId") String pipelineConfigId, @RequestParam(value = "limit", defaultValue = "20") int limit) { return front50Service.getPipelineConfigHistory(pipelineConfigId, limit) } - @ApiOperation(value = "Convert a pipeline config to a pipeline template.", response = String.class) + @Operation(summary = "Convert a pipeline config to a pipeline template.") @RequestMapping(value = "/{pipelineConfigId}/convertToTemplate", method = RequestMethod.GET) String convertPipelineConfigToPipelineTemplate(@PathVariable("pipelineConfigId") String pipelineConfigId) { Map pipelineConfig = front50Service.getAllPipelineConfigs().find { (pipelineConfigId == it.get("id")) } diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineController.groovy index 9fced36317..bcb3e12401 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineController.groovy @@ -29,10 +29,9 @@ import groovy.transform.CompileDynamic import groovy.transform.CompileStatic import groovy.transform.InheritConstructors import groovy.util.logging.Slf4j -import io.swagger.annotations.ApiOperation -import io.swagger.annotations.ApiParam -import io.swagger.annotations.Example -import io.swagger.annotations.ExampleProperty +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; + import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpEntity import org.springframework.http.HttpStatus @@ -61,7 +60,7 @@ class PipelineController { ObjectMapper objectMapper @CompileDynamic - @ApiOperation(value = "Delete a pipeline definition") + @Operation(summary = "Delete a pipeline definition") @DeleteMapping("/{application}/{pipelineName:.+}") void deletePipeline(@PathVariable String application, @PathVariable String pipelineName) { List pipelineConfigs = front50Service.getPipelineConfigsForApplication(application, true) @@ -96,7 +95,7 @@ class PipelineController { } @CompileDynamic - @ApiOperation(value = "Save a pipeline definition") + @Operation(summary = "Save a pipeline definition") @PostMapping('') void savePipeline( @RequestBody Map pipeline, @@ -125,13 +124,13 @@ class PipelineController { } } - @ApiOperation(value = "Rename a pipeline definition") + @Operation(summary = "Rename a pipeline definition") @PostMapping('move') void renamePipeline(@RequestBody Map renameCommand) { pipelineService.move(renameCommand) } - @ApiOperation(value = "Retrieve a pipeline execution") + @Operation(summary = "Retrieve a pipeline execution") @GetMapping("{id}") Map getPipeline(@PathVariable("id") String id) { try { @@ -144,7 +143,7 @@ class PipelineController { } @CompileDynamic - @ApiOperation(value = "Update a pipeline definition", response = HashMap.class) + @Operation(summary = "Update a pipeline definition") @PutMapping("{id}") Map updatePipeline(@PathVariable("id") String id, @RequestBody Map pipeline) { def operation = [ @@ -174,7 +173,7 @@ class PipelineController { } } - @ApiOperation(value = "Cancel a pipeline execution") + @Operation(summary = "Cancel a pipeline execution") @PutMapping("{id}/cancel") void cancelPipeline(@PathVariable("id") String id, @RequestParam(required = false) String reason, @@ -182,25 +181,25 @@ class PipelineController { pipelineService.cancelPipeline(id, reason, force) } - @ApiOperation(value = "Pause a pipeline execution") + @Operation(summary = "Pause a pipeline execution") @PutMapping("{id}/pause") void pausePipeline(@PathVariable("id") String id) { pipelineService.pausePipeline(id) } - @ApiOperation(value = "Resume a pipeline execution", response = HashMap.class) + @Operation(summary = "Resume a pipeline execution") @PutMapping("{id}/resume") void resumePipeline(@PathVariable("id") String id) { pipelineService.resumePipeline(id) } - @ApiOperation(value = "Update a stage execution", response = HashMap.class) + @Operation(summary = "Update a stage execution") @PatchMapping("/{id}/stages/{stageId}") Map updateStage(@PathVariable("id") String id, @PathVariable("stageId") String stageId, @RequestBody Map context) { pipelineService.updatePipelineStage(id, stageId, context) } - @ApiOperation(value = "Restart a stage execution", response = HashMap.class) + @Operation(summary = "Restart a stage execution") @PutMapping("/{id}/stages/{stageId}/restart") Map restartStage(@PathVariable("id") String id, @PathVariable("stageId") String stageId, @RequestBody Map context) { Map pipelineMap = getPipeline(id) @@ -222,13 +221,13 @@ class PipelineController { pipelineService.restartPipelineStage(id, stageId, context) } - @ApiOperation(value = "Delete a pipeline execution", response = HashMap.class) + @Operation(summary = "Delete a pipeline execution") @DeleteMapping("{id}") Map deletePipeline(@PathVariable("id") String id) { pipelineService.deletePipeline(id); } - @ApiOperation(value = "Initiate a pipeline execution") + @Operation(summary = "Initiate a pipeline execution") @PostMapping('/start') ResponseEntity start(@RequestBody Map map) { if (map.containsKey("application")) { @@ -240,7 +239,7 @@ class PipelineController { }) } - @ApiOperation(value = "Trigger a pipeline execution") + @Operation(summary = "Trigger a pipeline execution") @PostMapping("/{application}/{pipelineNameOrId:.+}") @ResponseBody @ResponseStatus(HttpStatus.ACCEPTED) @@ -263,7 +262,7 @@ class PipelineController { } } - @ApiOperation(value = "Trigger a pipeline execution", response = Map.class) + @Operation(summary = "Trigger a pipeline execution") @PreAuthorize("hasPermission(#application, 'APPLICATION', 'EXECUTE')") @PostMapping("/v2/{application}/{pipelineNameOrId:.+}") HttpEntity invokePipelineConfigViaEcho(@PathVariable("application") String application, @@ -281,7 +280,7 @@ class PipelineController { } } - @ApiOperation(value = "Evaluate a pipeline expression using the provided execution as context", response = HashMap.class) + @Operation(summary = "Evaluate a pipeline expression using the provided execution as context") @GetMapping("{id}/evaluateExpression") Map evaluateExpressionForExecution(@PathVariable("id") String id, @RequestParam("expression") String pipelineExpression) { @@ -294,7 +293,7 @@ class PipelineController { } } - @ApiOperation(value = "Evaluate a pipeline expression using the provided execution as context", response = HashMap.class) + @Operation(summary = "Evaluate a pipeline expression using the provided execution as context") @PostMapping(value = "{id}/evaluateExpression", consumes = "text/plain") Map evaluateExpressionForExecutionViaPOST(@PathVariable("id") String id, @RequestBody String pipelineExpression) { @@ -307,7 +306,7 @@ class PipelineController { } } - @ApiOperation(value = "Evaluate a pipeline expression at a specific stage using the provided execution as context", response = HashMap.class) + @Operation(summary = "Evaluate a pipeline expression at a specific stage using the provided execution as context") @GetMapping("{id}/{stageId}/evaluateExpression") Map evaluateExpressionForExecutionAtStage(@PathVariable("id") String id, @PathVariable("stageId") String stageId, @@ -321,7 +320,7 @@ class PipelineController { } } - @ApiOperation(value = "Evaluate a pipeline expression using the provided execution as context", response = HashMap.class) + @Operation(summary = "Evaluate a pipeline expression using the provided execution as context") @PostMapping(value = "{id}/evaluateExpression", consumes = "application/json") Map evaluateExpressionForExecutionViaPOST(@PathVariable("id") String id, @RequestBody Map pipelineExpression) { @@ -334,19 +333,18 @@ class PipelineController { } } - @ApiOperation(value = "Evaluate variables same as Evaluate Variables stage using the provided execution as context", response = HashMap.class) + @Operation(summary = "Evaluate variables same as Evaluate Variables stage using the provided execution as context") @PostMapping(value = "{id}/evaluateVariables", consumes = "application/json") - Map evaluateVariables(@ApiParam(value = "Execution id to run against", required = true) + Map evaluateVariables(@Parameter(description = "Execution id to run against", required = true) @RequestParam("executionId") String executionId, - @ApiParam(value = "Comma separated list of requisite stage IDs for the evaluation stage", required = false) + @Parameter(description = "Comma separated list of requisite stage IDs for the evaluation stage", required = false) @RequestParam(value = "requisiteStageRefIds", defaultValue = "") String requisiteStageRefIds, - @ApiParam(value = "Version of SpEL evaluation logic to use (v3 or v4)", required = false) + @Parameter(description = "Version of SpEL evaluation logic to use (v3 or v4)", required = false) @RequestParam(value = "spelVersion", defaultValue = "") String spelVersionOverride, - @ApiParam(value = "List of variables/expressions to evaluate", + @Parameter(description = "List of variables/expressions to evaluate", required = true, - examples = @Example(value = - @ExampleProperty(mediaType = "application/json", value = '[{"key":"a","value":"1"},{"key":"b","value":"2"},{"key":"sum","value":"${a+b}"}]') - )) + example = '[{"key":"a","value":"1"},{"key":"b","value":"2"},{"key":"sum","value":"${a+b}"}]' + ) @RequestBody List> expressions) { try { return pipelineService.evaluateVariables(executionId, requisiteStageRefIds, spelVersionOverride, expressions) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineTemplatesController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineTemplatesController.java index 2e8d65efc4..131294abdd 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineTemplatesController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineTemplatesController.java @@ -22,7 +22,7 @@ import com.netflix.spinnaker.gate.services.PipelineTemplateService.PipelineTemplateDependent; import com.netflix.spinnaker.gate.services.TaskService; import com.netflix.spinnaker.security.AuthenticatedRequest; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.ArrayList; import java.util.Base64; import java.util.Collection; @@ -61,13 +61,13 @@ public PipelineTemplatesController( this.objectMapper = objectMapper; } - @ApiOperation(value = "List pipeline templates.", response = List.class) + @Operation(summary = "List pipeline templates.") @RequestMapping(method = RequestMethod.GET) public Collection list(@RequestParam(required = false) List scopes) { return pipelineTemplateService.findByScope(scopes); } - @ApiOperation(value = "Create a pipeline template.", response = HashMap.class) + @Operation(summary = "Create a pipeline template.") @RequestMapping(method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.ACCEPTED) public Map create(@RequestBody Map pipelineTemplate) { @@ -94,7 +94,7 @@ public Map create(@RequestBody Map pipelineTemplate) { return taskService.create(operation); } - @ApiOperation(value = "Resolve a pipeline template.", response = HashMap.class) + @Operation(summary = "Resolve a pipeline template.") @RequestMapping(value = "/resolve", method = RequestMethod.GET) public Map resolveTemplates( @RequestParam String source, @@ -103,13 +103,13 @@ public Map resolveTemplates( return pipelineTemplateService.resolve(source, executionId, pipelineConfigId); } - @ApiOperation(value = "Get a pipeline template.", response = HashMap.class) + @Operation(summary = "Get a pipeline template.") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public Map get(@PathVariable String id) { return pipelineTemplateService.get(id); } - @ApiOperation(value = "Update a pipeline template.", response = HashMap.class) + @Operation(summary = "Update a pipeline template.") @RequestMapping(value = "/{id}", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.ACCEPTED) public Map update( @@ -142,7 +142,7 @@ public Map update( return taskService.create(operation); } - @ApiOperation(value = "Delete a pipeline template.", response = HashMap.class) + @Operation(summary = "Delete a pipeline template.") @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.ACCEPTED) public Map delete( @@ -163,9 +163,7 @@ public Map delete( return taskService.create(operation); } - @ApiOperation( - value = "List all pipelines that implement a pipeline template", - response = List.class) + @Operation(summary = "List all pipelines that implement a pipeline template") @RequestMapping(value = "/{id}/dependents", method = RequestMethod.GET) public List listPipelineTemplateDependents( @PathVariable String id, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ProjectController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ProjectController.groovy index 911e148bf2..4a814b58be 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ProjectController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ProjectController.groovy @@ -19,7 +19,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.ProjectService import groovy.util.logging.Slf4j -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -30,26 +30,26 @@ class ProjectController { @Autowired ProjectService projectService - @ApiOperation(value = "Get all projects", response = List.class) + @Operation(summary = "Get all projects") @RequestMapping(method = RequestMethod.GET) List all() { return projectService.getAll() } - @ApiOperation(value = "Get a project", response = HashMap.class) + @Operation(summary = "Get a project") @RequestMapping(value = "/{id:.+}", method = RequestMethod.GET) Map get(@PathVariable("id") String projectId) { return projectService.get(projectId) } - @ApiOperation(value = "Get a project's clusters", response = List.class) + @Operation(summary = "Get a project's clusters") @RequestMapping(value = "/{id}/clusters", method = RequestMethod.GET) List getClusters(@PathVariable("id") String projectId, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { return projectService.getClusters(projectId, sourceApp) } - @ApiOperation(value = "Get all pipelines for project", response = List.class) + @Operation(summary = "Get all pipelines for project") @RequestMapping(value = "/{id:.+}/pipelines", method = RequestMethod.GET) List allPipelinesForProject(@PathVariable("id") String projectId, @RequestParam(value = "limit", defaultValue = "5") int limit, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PubsubSubscriptionController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PubsubSubscriptionController.java index 820e86cfad..ee7e1b6f95 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PubsubSubscriptionController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PubsubSubscriptionController.java @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.PubsubSubscriptionService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; @@ -30,7 +30,7 @@ public class PubsubSubscriptionController { @Autowired private PubsubSubscriptionService pubsubSubscriptionService; - @ApiOperation(value = "Retrieve the list of pub/sub subscriptions configured in Echo.") + @Operation(summary = "Retrieve the list of pub/sub subscriptions configured in Echo.") @RequestMapping(value = "/pubsub/subscriptions", method = RequestMethod.GET) List> all() { return pubsubSubscriptionService.getPubsubSubscriptions(); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/RawResourceController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/RawResourceController.java index ec6a4dcd85..575a3a7f21 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/RawResourceController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/RawResourceController.java @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.RawResourceService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; @@ -33,9 +33,7 @@ public RawResourceController(RawResourceService rawResourceService) { this.rawResourceService = rawResourceService; } - @ApiOperation( - value = "Retrieve a list of raw resources for a given application", - response = List.class) + @Operation(summary = "Retrieve a list of raw resources for a given application") @RequestMapping(value = "/applications/{application}/rawResources", method = RequestMethod.GET) List> getApplicationRawResources(@PathVariable String application) { return rawResourceService.getApplicationRawResources(application); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ReorderPipelinesController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ReorderPipelinesController.java index db6f11282f..b1f4eec248 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ReorderPipelinesController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ReorderPipelinesController.java @@ -23,7 +23,7 @@ import com.netflix.spinnaker.security.AuthenticatedRequest; import groovy.transform.CompileStatic; import groovy.util.logging.Slf4j; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.ArrayList; import java.util.Base64; import java.util.HashMap; @@ -47,13 +47,13 @@ public class ReorderPipelinesController { @Autowired TaskService taskService; - @ApiOperation(value = "Re-order pipelines") + @Operation(summary = "Re-order pipelines") @RequestMapping(value = "/pipelines/reorder", method = RequestMethod.POST) public Map reorderPipelines(@RequestBody ReorderPipelinesCommand reorderPipelinesCommand) { return handlePipelineReorder(reorderPipelinesCommand, false); } - @ApiOperation(value = "Re-order pipeline strategies") + @Operation(summary = "Re-order pipeline strategies") @RequestMapping(value = "/strategies/reorder", method = RequestMethod.POST) public Map reorderPipelineStrategies( @RequestBody ReorderPipelinesCommand reorderPipelinesCommand) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/RoleController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/RoleController.groovy index dedcd2e5c4..068d27389c 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/RoleController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/RoleController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.RoleService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -31,7 +31,7 @@ class RoleController { @Autowired RoleService roleService - @ApiOperation(value = "Retrieve a list of roles that can be used by the selected cloud provider") + @Operation(summary = "Retrieve a list of roles that can be used by the selected cloud provider") @RequestMapping(value = "/{cloudProvider}", method = RequestMethod.GET) List all(@PathVariable String cloudProvider) { roleService.getRoles(cloudProvider) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SearchController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SearchController.groovy index 5bc191f7e5..3ef14600b7 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SearchController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SearchController.groovy @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.SearchService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -29,7 +29,7 @@ class SearchController { @Autowired SearchService searchService - @ApiOperation(value = "Search infrastructure", response = List.class) + @Operation(summary = "Search infrastructure") @RequestMapping(value = "/search", method = RequestMethod.GET) List search(@RequestParam(value = "q", defaultValue = "", required = false) String query, @RequestParam(value = "type") String type, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SecurityGroupController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SecurityGroupController.groovy index 9a7802b497..ee029f2b1b 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SecurityGroupController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SecurityGroupController.groovy @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.SecurityGroupService import com.netflix.spinnaker.kork.web.exceptions.NotFoundException -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -30,7 +30,7 @@ class SecurityGroupController { @Autowired SecurityGroupService securityGroupService - @ApiOperation(value = "Retrieve a list of security groups, grouped by account, cloud provider, and region") + @Operation(summary = "Retrieve a list of security groups, grouped by account, cloud provider, and region") @RequestMapping(method = RequestMethod.GET) Map all(@RequestParam(value = "id", required = false) String id, @RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { @@ -46,7 +46,7 @@ class SecurityGroupController { } } - @ApiOperation(value = "Retrieve a list of security groups for a given account, grouped by region") + @Operation(summary = "Retrieve a list of security groups for a given account, grouped by region") @RequestMapping(value = "/{account}", method = RequestMethod.GET) Map allByAccount( @PathVariable String account, @@ -55,7 +55,7 @@ class SecurityGroupController { securityGroupService.getForAccountAndProvider(account, provider, sourceApp) } - @ApiOperation(value = "Retrieve a security group's details") + @Operation(summary = "Retrieve a security group's details") @RequestMapping(value = "/{account}/{region}/{name:.+}", method = RequestMethod.GET) Map getSecurityGroup( @PathVariable String account, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ServerGroupController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ServerGroupController.groovy index 38021873df..0161dde483 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ServerGroupController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ServerGroupController.groovy @@ -20,7 +20,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.ServerGroupService import com.netflix.spinnaker.kork.web.exceptions.NotFoundException import groovy.transform.CompileStatic -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader @@ -35,7 +35,7 @@ class ServerGroupController { @Autowired ServerGroupService serverGroupService - @ApiOperation(value = "Retrieve a list of server groups for a given application") + @Operation(summary = "Retrieve a list of server groups for a given application") @RequestMapping(value = "/applications/{applicationName}/serverGroups", method = RequestMethod.GET) List getServerGroupsForApplication(@PathVariable String applicationName, @RequestParam(required = false, value = 'expand', defaultValue = 'false') String expand, @@ -45,7 +45,7 @@ class ServerGroupController { serverGroupService.getForApplication(applicationName, expand, cloudProvider, clusters, sourceApp) } - @ApiOperation(value = "Retrieve a list of server groups for a list of applications or a list of servergroups by 'account:region:name'") + @Operation(summary = "Retrieve a list of server groups for a list of applications or a list of servergroups by 'account:region:name'") @RequestMapping(value = "/serverGroups", method = RequestMethod.GET) List getServerGroups(@RequestParam(required = false, value = 'applications') List applications, @RequestParam(required = false, value = 'ids') List ids, @@ -62,7 +62,7 @@ class ServerGroupController { } } - @ApiOperation(value = "Retrieve a server group's details") + @Operation(summary = "Retrieve a server group's details") @RequestMapping(value = "/applications/{applicationName}/serverGroups/{account}/{region}/{serverGroupName:.+}", method = RequestMethod.GET) Map getServerGroupDetails(@PathVariable String applicationName, @PathVariable String account, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ServerGroupManagerController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ServerGroupManagerController.java index 64bbdcbbcc..5f39090f52 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ServerGroupManagerController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ServerGroupManagerController.java @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.ServerGroupManagerService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; @@ -36,9 +36,7 @@ public class ServerGroupManagerController { this.serverGroupManagerService = serverGroupManagerService; } - @ApiOperation( - value = "Retrieve a list of server group managers for an application", - response = List.class) + @Operation(summary = "Retrieve a list of server group managers for an application") @RequestMapping(method = RequestMethod.GET) public List getServerGroupManagersForApplication(@PathVariable String application) { return this.serverGroupManagerService.getServerGroupManagersForApplication(application); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SlackController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SlackController.java index 8c984fde13..bff2cfa82c 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SlackController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SlackController.java @@ -20,7 +20,7 @@ import com.netflix.spinnaker.gate.config.SlackConfigProperties; import com.netflix.spinnaker.gate.services.SlackService; import com.netflix.spinnaker.kork.core.RetrySupport; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.time.Duration; import java.util.ArrayList; import java.util.Date; @@ -64,7 +64,7 @@ public SlackController( this.registry = registry; } - @ApiOperation("Retrieve a list of public slack channels") + @Operation(summary = "Retrieve a list of public slack channels") @RequestMapping("/channels") public List getChannels() { return slackChannelsCache.get(); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SnapshotController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SnapshotController.groovy index cb48904b85..d9530e40e9 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SnapshotController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SnapshotController.groovy @@ -19,7 +19,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.SnapshotService import groovy.transform.CompileStatic import groovy.util.logging.Slf4j -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -32,14 +32,14 @@ class SnapshotController { @Autowired SnapshotService snapshotService - @ApiOperation(value = "Get current snapshot", response = HashMap.class) + @Operation(summary = "Get current snapshot") @RequestMapping(value = "/{application}/snapshots/{account}", method = RequestMethod.GET) Map getCurrentSnapshot(@PathVariable("application") String application, @PathVariable("account") String account) { snapshotService.getCurrent(application, account) } - @ApiOperation(value = "Get snapshot history", response = List.class) + @Operation(summary = "Get snapshot history") @RequestMapping(value = "/{application}/snapshots/{account}/history", method = RequestMethod.GET) List getSnapshotHistory(@PathVariable("application") String application, @PathVariable("account") String account, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/StorageAccountController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/StorageAccountController.java index 3ad9b9a599..0f7753a7f4 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/StorageAccountController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/StorageAccountController.java @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers; import com.netflix.spinnaker.gate.services.appengine.StorageAccountService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestHeader; @@ -32,7 +32,7 @@ public class StorageAccountController { @Autowired private StorageAccountService storageAccountService; - @ApiOperation(value = "Retrieve the list of storage accounts configured in Clouddriver.") + @Operation(summary = "Retrieve the list of storage accounts configured in Clouddriver.") @RequestMapping(method = RequestMethod.GET) List all(@RequestHeader(value = "X-RateLimit-App", required = false) String sourceApp) { return storageAccountService.getAppengineStorageAccounts(sourceApp); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SubnetController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SubnetController.groovy index bfa896d928..0b3668c319 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SubnetController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/SubnetController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.internal.ClouddriverServiceSelector -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -28,7 +28,7 @@ class SubnetController { @Autowired ClouddriverServiceSelector clouddriverServiceSelector - @ApiOperation(value = "Retrieve a list of subnets for a given cloud provider", response = List.class) + @Operation(summary = "Retrieve a list of subnets for a given cloud provider") @RequestMapping(value = "/{cloudProvider}", method = RequestMethod.GET) List allByCloudProvider(@PathVariable String cloudProvider) { clouddriverServiceSelector.select().getSubnets(cloudProvider) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/TaskController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/TaskController.groovy index 883685879a..683c97c2e0 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/TaskController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/TaskController.groovy @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.TaskService import groovy.transform.CompileStatic -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -30,37 +30,37 @@ class TaskController { @Autowired TaskService taskService - @ApiOperation(value = "Get task", response = HashMap.class) + @Operation(summary = "Get task") @RequestMapping(value = "/{id}", method = RequestMethod.GET) Map getTask(@PathVariable("id") String id) { taskService.getTask(id) } - @ApiOperation(value = "Delete task", response = HashMap.class) + @Operation(summary = "Delete task") @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) Map deleteTask(@PathVariable("id") String id) { taskService.deleteTask(id) } - @ApiOperation(value = "Create task", response = HashMap.class) + @Operation(summary = "Create task") @RequestMapping(method = RequestMethod.POST) Map task(@RequestBody Map map) { taskService.createAppTask(map) } - @ApiOperation(value = "Cancel task", response = HashMap.class) + @Operation(summary = "Cancel task") @RequestMapping(value = "/{id}/cancel", method = RequestMethod.PUT) Map cancelTask(@PathVariable("id") String id) { taskService.cancelTask(id) } - @ApiOperation(value = "Cancel tasks", response = HashMap.class) + @Operation(summary = "Cancel tasks") @RequestMapping(value = "/cancel", method = RequestMethod.PUT) Map cancelTasks(@RequestParam List ids) { taskService.cancelTasks(ids) } - @ApiOperation(value = "Get task details", response = HashMap.class) + @Operation(summary = "Get task details") @RequestMapping(value = "/{id}/details/{taskDetailsId}", method = RequestMethod.GET) Map getTaskDetails(@PathVariable("id") String id, @PathVariable("taskDetailsId") String taskDetailsId, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2CanaryConfigController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2CanaryConfigController.groovy index bf0d82b0d1..f1151b9b6e 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2CanaryConfigController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2CanaryConfigController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.CanaryConfigService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.condition.ConditionalOnBean import org.springframework.web.bind.annotation.PathVariable @@ -35,28 +35,28 @@ class V2CanaryConfigController { @Autowired CanaryConfigService canaryConfigService - @ApiOperation(value = "Retrieve a list of canary configurations") + @Operation(summary = "Retrieve a list of canary configurations") @RequestMapping(method = RequestMethod.GET) List getCanaryConfigs(@RequestParam(value = "application", required = false) String application, @RequestParam(value = "configurationAccountName", required = false) String configurationAccountName) { canaryConfigService.getCanaryConfigs(application, configurationAccountName) } - @ApiOperation(value = "Retrieve a canary configuration by id") + @Operation(summary = "Retrieve a canary configuration by id") @RequestMapping(value = "/{id}", method = RequestMethod.GET) Map getCanaryConfig(@PathVariable String id, @RequestParam(value = "configurationAccountName", required = false) String configurationAccountName) { canaryConfigService.getCanaryConfig(id, configurationAccountName) } - @ApiOperation(value = "Create a canary configuration") + @Operation(summary = "Create a canary configuration") @RequestMapping(method = RequestMethod.POST) Map createCanaryConfig(@RequestBody Map config, @RequestParam(value = "configurationAccountName", required = false) String configurationAccountName) { canaryConfigService.createCanaryConfig(config, configurationAccountName) } - @ApiOperation(value = "Update a canary configuration") + @Operation(summary = "Update a canary configuration") @RequestMapping(value = "/{id}", method = RequestMethod.PUT) Map updateCanaryConfig(@PathVariable String id, @RequestParam(value = "configurationAccountName", required = false) String configurationAccountName, @@ -64,7 +64,7 @@ class V2CanaryConfigController { canaryConfigService.updateCanaryConfig(id, config, configurationAccountName) } - @ApiOperation(value = "Delete a canary configuration") + @Operation(summary = "Delete a canary configuration") @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) void deleteCanaryConfig(@PathVariable String id, @RequestParam(value = "configurationAccountName", required = false) String configurationAccountName) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2CanaryController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2CanaryController.groovy index c2f093f45b..634a3dc683 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2CanaryController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2CanaryController.groovy @@ -17,8 +17,8 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.V2CanaryService -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 org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression import org.springframework.web.bind.annotation.* @@ -31,26 +31,26 @@ class V2CanaryController { @Autowired V2CanaryService v2CanaryService - @ApiOperation(value = 'Retrieve a list of configured Kayenta accounts') + @Operation(summary = 'Retrieve a list of configured Kayenta accounts') @RequestMapping(value = '/credentials', method = RequestMethod.GET) List listCredentials() { v2CanaryService.getCredentials() } - @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(value = '/metadata/metricsService', method = RequestMethod.GET) List listMetricsServiceMetadata(@RequestParam(required = false) final String filter, @RequestParam(required = false) final String metricsAccountName) { v2CanaryService.listMetricsServiceMetadata(filter, metricsAccountName) } - @ApiOperation(value = 'Retrieve a list of all configured canary judges') + @Operation(summary = 'Retrieve a list of all configured canary judges') @RequestMapping(value = '/judges', method = RequestMethod.GET) List listJudges() { v2CanaryService.listJudges() } - @ApiOperation(value = 'Start a canary execution') + @Operation(summary = 'Start a canary execution') @RequestMapping(value = '/canary/{canaryConfigId:.+}', method = RequestMethod.POST) Map initiateCanary(@PathVariable String canaryConfigId, @RequestBody Map executionRequest, @@ -68,7 +68,7 @@ class V2CanaryController { configurationAccountName) } - @ApiOperation(value = 'Start a canary execution with the supplied canary config') + @Operation(summary = 'Start a canary execution with the supplied canary config') @RequestMapping(value = '/canary', method = RequestMethod.POST) Map initiateCanaryWithConfig(@RequestBody Map adhocExecutionRequest, @RequestParam(value = 'application', required = false) String application, @@ -83,7 +83,7 @@ class V2CanaryController { } // TODO: Change callers to the new endpoint sans canary config id in Spinnaker 1.17.x. - @ApiOperation(value = '(DEPRECATED) Retrieve a canary result') + @Operation(summary = '(DEPRECATED) Retrieve a canary result') @RequestMapping(value = '/canary/{canaryConfigId}/{canaryExecutionId}', method = RequestMethod.GET) @Deprecated Map getCanaryResult(@PathVariable String canaryConfigId /* unused */, @@ -92,19 +92,19 @@ class V2CanaryController { v2CanaryService.getCanaryResults(canaryExecutionId, storageAccountName) } - @ApiOperation(value = 'Retrieve a canary result') + @Operation(summary = 'Retrieve a canary result') @RequestMapping(value = '/canary/{canaryExecutionId}', method = RequestMethod.GET) Map getCanaryResult(@PathVariable String canaryExecutionId, @RequestParam(value='storageAccountName', required = false) String storageAccountName) { v2CanaryService.getCanaryResults(canaryExecutionId, storageAccountName) } - @ApiOperation(value = 'Retrieve a list of an application\'s canary results') + @Operation(summary = 'Retrieve a list of an application\'s canary results') @RequestMapping(value = '/{application}/executions', method = RequestMethod.GET) List getCanaryResultsByApplication(@PathVariable String application, @RequestParam(value='limit') int limit, @RequestParam(value='page', defaultValue='1') int page, - @ApiParam('Comma-separated list of statuses, e.g.: RUNNING, SUCCEEDED, TERMINAL') + @Parameter(description = 'Comma-separated list of statuses, e.g.: RUNNING, SUCCEEDED, TERMINAL') @RequestParam(value='statuses', required = false) String statuses, @RequestParam(value='storageAccountName', required = false) String storageAccountName) { v2CanaryService.getCanaryResultsByApplication(application, limit, page, statuses, storageAccountName) @@ -112,7 +112,7 @@ class V2CanaryController { // TODO(dpeach): remove this endpoint when a Kayenta endpoint for // retrieving a single metric set pair exists. - @ApiOperation(value = 'Retrieve a metric set pair list') + @Operation(summary = 'Retrieve a metric set pair list') @RequestMapping(value = '/metricSetPairList/{metricSetPairListId}', method = RequestMethod.GET) List getMetricSetPairList(@PathVariable String metricSetPairListId, @RequestParam(value='storageAccountName', required = false) String storageAccountName) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2PipelineTemplatesController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2PipelineTemplatesController.java index 04daea91fa..087071fa55 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2PipelineTemplatesController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/V2PipelineTemplatesController.java @@ -28,7 +28,7 @@ import com.netflix.spinnaker.kork.exceptions.HasAdditionalAttributes; import com.netflix.spinnaker.security.AuthenticatedRequest; import groovy.transform.InheritConstructors; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -69,25 +69,25 @@ public V2PipelineTemplatesController( } // TODO(louisjimenez): Deprecated. Will be replaced with /versions endpoint starting with 1.19. - @ApiOperation(value = "(ALPHA) List pipeline templates.", response = List.class) + @Operation(summary = "(ALPHA) List pipeline templates.") @RequestMapping(method = RequestMethod.GET) public Collection list(@RequestParam(required = false) List scopes) { return v2PipelineTemplateService.findByScope(scopes); } - @ApiOperation(value = "List pipeline templates with versions", response = Map.class) + @Operation(summary = "List pipeline templates with versions") @RequestMapping(value = "/versions", method = RequestMethod.GET) public Map> listVersions(@RequestParam(required = false) List scopes) { return v2PipelineTemplateService.findVersionsByScope(scopes); } - @ApiOperation(value = "(ALPHA) Plan a pipeline template configuration.", response = HashMap.class) + @Operation(summary = "(ALPHA) Plan a pipeline template configuration.") @RequestMapping(value = "/plan", method = RequestMethod.POST) public Map plan(@RequestBody Map pipeline) { return v2PipelineTemplateService.plan(pipeline); } - @ApiOperation(value = "(ALPHA) Create a pipeline template.", response = HashMap.class) + @Operation(summary = "(ALPHA) Create a pipeline template.") @RequestMapping(value = "/create", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public Map create( @@ -133,7 +133,7 @@ private void validateSchema(Map pipelineTemplate) { } } - @ApiOperation(value = "(ALPHA) Update a pipeline template.", response = HashMap.class) + @Operation(summary = "(ALPHA) Update a pipeline template.") @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public Map update( @@ -175,7 +175,7 @@ private Map makeUpdateOp( return operation; } - @ApiOperation(value = "(ALPHA) Get a pipeline template.", response = HashMap.class) + @Operation(summary = "(ALPHA) Get a pipeline template.") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public Map get( @PathVariable String id, @@ -184,7 +184,7 @@ public Map get( return v2PipelineTemplateService.get(id, tag, digest); } - @ApiOperation(value = "Delete a pipeline template.", response = HashMap.class) + @Operation(summary = "Delete a pipeline template.") @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) public Map delete( @@ -209,9 +209,7 @@ public Map delete( return taskService.createAndWaitForCompletion(operation); } - @ApiOperation( - value = "(ALPHA) List all pipelines that implement a pipeline template", - response = List.class) + @Operation(summary = "(ALPHA) List all pipelines that implement a pipeline template") @RequestMapping(value = "/{id}/dependents", method = RequestMethod.GET) public List listPipelineTemplateDependents(@PathVariable String id) { return v2PipelineTemplateService.getTemplateDependents(id); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/VersionController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/VersionController.java index 8bc6e9b96f..933d25a31b 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/VersionController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/VersionController.java @@ -16,7 +16,7 @@ package com.netflix.spinnaker.gate.controllers; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.Optional; import lombok.Data; import org.springframework.web.bind.annotation.RequestMapping; @@ -27,7 +27,7 @@ @RequestMapping("/version") public class VersionController { - @ApiOperation(value = "Fetch Gate's current version") + @Operation(summary = "Fetch Gate's current version") @RequestMapping(method = RequestMethod.GET) Version getVersion() { return new Version(); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/WebhookController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/WebhookController.groovy index e752cb4480..e111cae96c 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/WebhookController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/WebhookController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers import com.netflix.spinnaker.gate.services.WebhookService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpHeaders import org.springframework.http.ResponseEntity @@ -38,7 +38,7 @@ class WebhookController { @Autowired WebhookService webhookService - @ApiOperation(value = "Endpoint for posting webhooks to Spinnaker's webhook service") + @Operation(summary = "Endpoint for posting webhooks to Spinnaker's webhook service") @RequestMapping(value = "/{type}/{source}", method = RequestMethod.POST) Map webhooks(@PathVariable("type") String type, @PathVariable("source") String source, @@ -53,7 +53,7 @@ class WebhookController { } } - @ApiOperation(value = "Endpoint for posting webhooks to Spinnaker's CDEvents webhook service") + @Operation(summary = "Endpoint for posting webhooks to Spinnaker's CDEvents webhook service") @RequestMapping(value = "/cdevents/{source}", method = RequestMethod.POST) ResponseEntity webhooks(@PathVariable String source, @RequestBody CloudEvent cdEvent) @@ -62,7 +62,7 @@ class WebhookController { webhookService.webhooks(source, cdEvent, ceDataJsonString) } - @ApiOperation(value = "Retrieve a list of preconfigured webhooks in Orca") + @Operation(summary = "Retrieve a list of preconfigured webhooks in Orca") @RequestMapping(value = "/preconfigured", method = RequestMethod.GET) List preconfiguredWebhooks() { return webhookService.preconfiguredWebhooks() diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/aws/AmazonInfrastructureController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/aws/AmazonInfrastructureController.groovy index 4f264f856b..d93a85a40b 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/aws/AmazonInfrastructureController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/aws/AmazonInfrastructureController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers.aws import com.netflix.spinnaker.gate.services.aws.InfrastructureService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -31,32 +31,32 @@ class AmazonInfrastructureController { @Autowired InfrastructureService infrastructureService - @ApiOperation(value = "Get instance types", response = List.class) + @Operation(summary = "Get instance types") @RequestMapping(value = "/instanceTypes", method = RequestMethod.GET) List instanceTypes() { infrastructureService.instanceTypes } - @ApiOperation(value = "Get key pairs", response = List.class) + @Operation(summary = "Get key pairs") @RequestMapping(value = "/keyPairs", method = RequestMethod.GET) List keyPairs() { infrastructureService.keyPairs } - @ApiOperation(value = "Get subnets", response = List.class) + @Operation(summary = "Get subnets") @RequestMapping(value = "/subnets", method = RequestMethod.GET) List subnets() { infrastructureService.subnets } @Deprecated - @ApiOperation(value = "Get VPCs", response = List.class) + @Operation(summary = "Get VPCs") @RequestMapping(value = "/vpcs", method = RequestMethod.GET) List vpcs() { infrastructureService.vpcs } - @ApiOperation(value = "Get functions", response = List.class) + @Operation(summary = "Get functions") @RequestMapping(value = "/functions", method = RequestMethod.GET) List functions(@RequestParam(value = "functionName", required = false) String functionName, @RequestParam(value = "region", required = false) String region, @@ -64,7 +64,7 @@ class AmazonInfrastructureController { infrastructureService.getFunctions(functionName, region, account) } - @ApiOperation(value = "Get application functions", response = List.class) + @Operation(summary = "Get application functions") @RequestMapping(value = "/applications/{application}/functions", method = RequestMethod.GET) List applicationFunctions(@PathVariable String application) { infrastructureService.getApplicationFunctions(application) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsCloudMetricController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsCloudMetricController.groovy index 56dbfdab47..435519a87d 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsCloudMetricController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsCloudMetricController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers.ecs import com.netflix.spinnaker.gate.services.EcsCloudMetricService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestMethod @@ -29,7 +29,7 @@ class EcsCloudMetricController { @Autowired EcsCloudMetricService ecsClusterService - @ApiOperation(value = "Retrieve a list of MetricAlarms.") + @Operation(summary = "Retrieve a list of MetricAlarms.") @RequestMapping(value = "/alarms", method = RequestMethod.GET) List allMetricAlarms() { ecsClusterService.getEcsAllMetricAlarms() diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsClusterController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsClusterController.groovy index de24961d0e..e9d095c026 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsClusterController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsClusterController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers.ecs import com.netflix.spinnaker.gate.services.EcsClusterService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -29,13 +29,13 @@ class EcsClusterController { @Autowired EcsClusterService ecsClusterService - @ApiOperation(value = "Retrieve a list of ECS clusters that can be used for the account and region.") + @Operation(summary = "Retrieve a list of ECS clusters that can be used for the account and region.") @RequestMapping(value = "/ecs/ecsClusters", method = RequestMethod.GET) List all() { ecsClusterService.getAllEcsClusters() } - @ApiOperation(value = "Retrieve a list of Ecs Cluster Description WRT account and region") + @Operation(summary = "Retrieve a list of Ecs Cluster Description WRT account and region") @RequestMapping(value = "/ecs/ecsClusterDescriptions/{account}/{region}", method = RequestMethod.GET) List getEcsClusterDescriptions(@PathVariable String account, @PathVariable String region) { ecsClusterService.getEcsClusterDescriptions(account, region) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsSecretsController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsSecretsController.groovy index a00bcf71de..18516440b7 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsSecretsController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsSecretsController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers.ecs import com.netflix.spinnaker.gate.services.EcsSecretService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping @@ -29,7 +29,7 @@ class EcsSecretController { @Autowired EcsSecretService ecsSecretService - @ApiOperation(value = "Retrieve a list of Secrets Manager secrets that can be used for the account and region.") + @Operation(summary = "Retrieve a list of Secrets Manager secrets that can be used for the account and region.") @RequestMapping(value = "/ecs/secrets", method = RequestMethod.GET) List all() { ecsSecretService.getAllEcsSecrets() diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsServerGroupEventsController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsServerGroupEventsController.groovy index fd9bdd80db..155a0b5fa3 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsServerGroupEventsController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsServerGroupEventsController.groovy @@ -17,7 +17,7 @@ package com.netflix.spinnaker.gate.controllers.ecs import com.netflix.spinnaker.gate.services.EcsServerGroupEventsService -import io.swagger.annotations.ApiOperation +import io.swagger.v3.oas.annotations.Operation import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* @@ -27,7 +27,7 @@ class EcsServerGroupEventsController { @Autowired EcsServerGroupEventsService ecsServerGroupEventsService - @ApiOperation(value = "Retrieves a list of events for a server group") + @Operation(summary = "Retrieves a list of events for a server group") @RequestMapping(value = "applications/{application}/serverGroups/{account}/{serverGroupName}/events", method = RequestMethod.GET) List getEvents(@PathVariable String application, @PathVariable String account, diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsServiceDiscoveryController.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsServiceDiscoveryController.java index e170894b8a..361b334c3e 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsServiceDiscoveryController.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ecs/EcsServiceDiscoveryController.java @@ -16,7 +16,7 @@ package com.netflix.spinnaker.gate.controllers.ecs; import com.netflix.spinnaker.gate.services.EcsServiceDiscoveryService; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; @@ -27,8 +27,9 @@ public class EcsServiceDiscoveryController { @Autowired private EcsServiceDiscoveryService ecsServiceDiscoveryService; - @ApiOperation( - value = "Retrieve a list of Cloud Map services that can be used for the account and region.") + @Operation( + summary = + "Retrieve a list of Cloud Map services that can be used for the account and region.") @GetMapping(value = "/ecs/serviceDiscoveryRegistries") public List all() { return ecsServiceDiscoveryService.getAllEcsServiceDiscoveryRegistries(); diff --git a/gradle.properties b/gradle.properties index a1a6074e64..defc902ddd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,8 @@ org.gradle.parallel=true spinnakerGradleVersion=8.32.1 targetJava17=false +org.gradle.jvmargs=-Xmx4g -Xms4g + # To enable a composite reference to a project, set the # project property `'Composite=true'`. # From 08fa4c8cd8b80ca79bbf28bd47ef382a80cf74fe Mon Sep 17 00:00:00 2001 From: Jason McIntosh Date: Wed, 17 Jul 2024 21:45:52 -0500 Subject: [PATCH 2/3] fix(swagger): Adds property allow swagger generation --- .../netflix/spinnaker/gate/swagger/GenerateSwaggerSpec.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gate-web/src/test/groovy/com/netflix/spinnaker/gate/swagger/GenerateSwaggerSpec.groovy b/gate-web/src/test/groovy/com/netflix/spinnaker/gate/swagger/GenerateSwaggerSpec.groovy index 329415f4cd..d244e3ec54 100644 --- a/gate-web/src/test/groovy/com/netflix/spinnaker/gate/swagger/GenerateSwaggerSpec.groovy +++ b/gate-web/src/test/groovy/com/netflix/spinnaker/gate/swagger/GenerateSwaggerSpec.groovy @@ -28,7 +28,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder @TestPropertySource( // Enable Controllers we want to document in the spec here. properties = [ "retrofit.enabled=true","services.kayenta.enabled=true","services.kayenta.canary-config-store=true", - "services.keel.enabled=true", "spring.application.name=gate", 'services.fiat.baseUrl=https://localhost', 'services.keel.baseUrl=https://localhost' ]) + "services.keel.enabled=true", "spring.application.name=gate", 'services.fiat.baseUrl=https://localhost', 'services.keel.baseUrl=https://localhost', "spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER" ]) class GenerateSwaggerSpec extends Specification { @Autowired From 38506474c462413df8e02e235f51e9d991f4d126 Mon Sep 17 00:00:00 2001 From: Jason McIntosh Date: Thu, 18 Jul 2024 14:53:06 -0500 Subject: [PATCH 3/3] chore(swagger): Code minus kork constraints to switch to openapi. --- build.gradle | 1 - gate-bom/gate-bom.gradle | 3 --- .../gate-integrations-gremlin.gradle | 2 -- gate-web/gate-web.gradle | 2 +- .../CloudEventHandlerConfiguration.java | 2 +- .../spinnaker/gate/config/GateConfig.groovy | 17 ------------ .../gate/config/GateWebConfig.groovy | 27 ++++++++++++------- .../gate/controllers/AuthController.groovy | 9 +++---- .../src/main/resources/application.properties | 1 + gradle.properties | 2 +- 10 files changed, 25 insertions(+), 41 deletions(-) diff --git a/build.gradle b/build.gradle index f6cd8fc343..f98ac13571 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,6 @@ allprojects { apply plugin: 'org.openrewrite.rewrite' group = "io.spinnaker.gate" - if ([korkVersion, fiatVersion].find { it.endsWith('-SNAPSHOT') }) { repositories { mavenLocal() diff --git a/gate-bom/gate-bom.gradle b/gate-bom/gate-bom.gradle index 34bf0376bc..6144d36025 100644 --- a/gate-bom/gate-bom.gradle +++ b/gate-bom/gate-bom.gradle @@ -28,9 +28,6 @@ dependencies { api("io.spinnaker.fiat:fiat-api:$fiatVersion") api("io.spinnaker.fiat:fiat-core:$fiatVersion") - api("io.swagger.core.v3:swagger-annotations:2.2.22") - api("io.swagger.core.v3:swagger-core:2.2.22") - rootProject .subprojects diff --git a/gate-integrations-gremlin/gate-integrations-gremlin.gradle b/gate-integrations-gremlin/gate-integrations-gremlin.gradle index a7b7652455..c590b6db46 100644 --- a/gate-integrations-gremlin/gate-integrations-gremlin.gradle +++ b/gate-integrations-gremlin/gate-integrations-gremlin.gradle @@ -1,6 +1,4 @@ dependencies { - implementation platform(project(":gate-bom")) - implementation project(":gate-core") implementation "io.swagger.core.v3:swagger-annotations" diff --git a/gate-web/gate-web.gradle b/gate-web/gate-web.gradle index ee324b9fb4..dd447a5f98 100644 --- a/gate-web/gate-web.gradle +++ b/gate-web/gate-web.gradle @@ -53,7 +53,7 @@ dependencies { force = true // Unpin it after adoption of spring-boot-starter-graphql } - implementation "io.springfox:springfox-swagger2" + implementation "org.springdoc:springdoc-openapi-ui:1.8.0" implementation "io.cloudevents:cloudevents-spring:2.5.0" implementation "io.cloudevents:cloudevents-json-jackson:2.5.0" diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/CloudEventHandlerConfiguration.java b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/CloudEventHandlerConfiguration.java index f7c2165e7e..268b1d026e 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/CloudEventHandlerConfiguration.java +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/CloudEventHandlerConfiguration.java @@ -26,7 +26,7 @@ public class CloudEventHandlerConfiguration implements WebMvcConfigurer { @Override - public void configureMessageConverters(List> converters) { + public void extendMessageConverters(List> converters) { converters.add(cloudEventHttpMessageConverter()); } diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/GateConfig.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/GateConfig.groovy index e3a3bf41ba..c115dadca2 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/GateConfig.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/GateConfig.groovy @@ -18,7 +18,6 @@ package com.netflix.spinnaker.gate.config import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory import com.netflix.spectator.api.Registry import com.netflix.spinnaker.config.DefaultServiceEndpoint import com.netflix.spinnaker.config.OkHttp3ClientConfiguration @@ -28,8 +27,6 @@ import com.netflix.spinnaker.fiat.shared.FiatPermissionEvaluator import com.netflix.spinnaker.fiat.shared.FiatService import com.netflix.spinnaker.fiat.shared.FiatStatus import com.netflix.spinnaker.filters.AuthenticatedRequestFilter -import com.netflix.spinnaker.gate.converters.JsonHttpMessageConverter -import com.netflix.spinnaker.gate.converters.YamlHttpMessageConverter import com.netflix.spinnaker.gate.filters.RequestLoggingFilter import com.netflix.spinnaker.gate.filters.RequestSheddingFilter import com.netflix.spinnaker.gate.filters.ResetAuthenticatedRequestFilter @@ -57,7 +54,6 @@ import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Import import org.springframework.context.annotation.Primary import org.springframework.core.Ordered -import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder import org.springframework.util.CollectionUtils import org.springframework.web.client.RestTemplate @@ -101,19 +97,6 @@ class GateConfig { @Autowired Jackson2ObjectMapperBuilder objectMapperBuilder - /** - * This needs to be before the yaml converter in order for json to be the default - * response type. - */ - @Bean - AbstractJackson2HttpMessageConverter jsonHttpMessageConverter() { - return new JsonHttpMessageConverter(objectMapperBuilder.build()) - } - - @Bean - AbstractJackson2HttpMessageConverter yamlHttpMessageConverter() { - return new YamlHttpMessageConverter(objectMapperBuilder.factory(new YAMLFactory()).build()) - } @Bean RequestContextProvider requestContextProvider() { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/GateWebConfig.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/GateWebConfig.groovy index 4acd511ec0..31c6da7ed2 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/GateWebConfig.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/config/GateWebConfig.groovy @@ -16,27 +16,32 @@ package com.netflix.spinnaker.gate.config + +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory import com.netflix.spectator.api.Registry +import com.netflix.spinnaker.gate.converters.JsonHttpMessageConverter +import com.netflix.spinnaker.gate.converters.YamlHttpMessageConverter import com.netflix.spinnaker.gate.filters.ContentCachingFilter import com.netflix.spinnaker.gate.interceptors.RequestContextInterceptor import com.netflix.spinnaker.gate.interceptors.ResponseHeaderInterceptor import com.netflix.spinnaker.gate.interceptors.ResponseHeaderInterceptorConfigurationProperties import com.netflix.spinnaker.gate.retrofit.UpstreamBadRequest import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import com.netflix.spinnaker.kork.web.interceptors.MetricsInterceptor import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.ApplicationContext import org.springframework.context.annotation.Bean import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration import org.springframework.http.HttpStatus +import org.springframework.http.converter.HttpMessageConverter +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder import org.springframework.web.bind.annotation.ControllerAdvice import org.springframework.web.bind.annotation.ExceptionHandler import org.springframework.web.bind.annotation.ResponseBody -import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer import org.springframework.web.servlet.config.annotation.InterceptorRegistry import org.springframework.web.servlet.config.annotation.WebMvcConfigurer import org.springframework.web.servlet.handler.HandlerMappingIntrospector @@ -54,6 +59,9 @@ public class GateWebConfig implements WebMvcConfigurer { @Autowired DynamicConfigService dynamicConfigService + @Autowired + Jackson2ObjectMapperBuilder objectMapperBuilder + @Autowired Registry spectatorRegistry @@ -68,7 +76,7 @@ public class GateWebConfig implements WebMvcConfigurer { public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor( new MetricsInterceptor( - this.registry, "controller.invocations", ["account", "region"], ["BasicErrorController"] + this.registry, "controller.invocations", ["account", "region"], null, ["BasicErrorController"] ) ) @@ -81,8 +89,12 @@ public class GateWebConfig implements WebMvcConfigurer { return new HandlerMappingIntrospector(context) } - - // Add the ability to disable as this breaks numerous integration patterns + @Override + void extendMessageConverters(List> converters) { + converters.add(new JsonHttpMessageConverter(objectMapperBuilder.build())) + converters.add( new YamlHttpMessageConverter(objectMapperBuilder.factory(new YAMLFactory()).build())) + } +// Add the ability to disable as this breaks numerous integration patterns @Bean @ConditionalOnProperty(value = "content.cachingFilter.enabled", matchIfMissing = true) Filter contentCachingFilter() { @@ -126,9 +138,4 @@ public class GateWebConfig implements WebMvcConfigurer { ] } } - - @Override - void configureContentNegotiation(ContentNegotiationConfigurer configurer) { - configurer.favorPathExtension(false) - } } diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AuthController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AuthController.groovy index 9d07e9f3c3..da4e06c95b 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AuthController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/AuthController.groovy @@ -31,7 +31,6 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController -import springfox.documentation.annotations.ApiIgnore import javax.servlet.http.HttpServletResponse import java.util.regex.Pattern @@ -69,9 +68,9 @@ class AuthController { } } - @Operation(summary = "Get user") + @Operation(summary = "Get user", hidden=true) @RequestMapping(value = "/user", method = RequestMethod.GET) - User user(@ApiIgnore @SpinnakerUser User user) { + User user(@SpinnakerUser User user) { if (!user) { return user } @@ -83,9 +82,9 @@ class AuthController { return user } - @Operation(summary = "Get service accounts") + @Operation(summary = "Get service accounts", hidden=true) @RequestMapping(value = "/user/serviceAccounts", method = RequestMethod.GET) - List getServiceAccounts(@ApiIgnore @SpinnakerUser User user, + List getServiceAccounts(@SpinnakerUser User user, @RequestParam(name = "application", required = false) String application) { String appName = Optional.ofNullable(application) diff --git a/gate-web/src/main/resources/application.properties b/gate-web/src/main/resources/application.properties index 3d38c74dce..befe6aff40 100644 --- a/gate-web/src/main/resources/application.properties +++ b/gate-web/src/main/resources/application.properties @@ -23,3 +23,4 @@ spring.jackson.deserialization.read-unknown-enum-values-as-null=true # https://github.com/spinnaker/gate/pull/230 # Either way, this filter needs to come before the AuthenticatedRequestFilter spring.security.filter.order=0 +springdoc.writer-with-default-pretty-printer=true diff --git a/gradle.properties b/gradle.properties index defc902ddd..7fb141b549 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ enablePublishing=false fiatVersion=1.48.0 includeProviders=basic,iap,ldap,oauth2,saml,x509 -korkVersion=7.235.0 +korkVersion=opendocs-upgrade-SNAPSHOT kotlinVersion=1.6.21 org.gradle.parallel=true spinnakerGradleVersion=8.32.1