From 5bf08495b99dcd45659cc0c01a2d8b42601ddf46 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 18 Nov 2021 14:48:06 +0800 Subject: [PATCH] [KYUUBI #1354][FOLLOWUP] Add ApiResponse for operation apis ### _Why are the changes needed?_ Add ApiResponse for operation apis #1354 ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #1408 from simon824/r3. Closes #1354 6349ac5a [simon] ApiResponse b1f906e5 [simon] init Authored-by: simon Signed-off-by: ulysses-you --- .../server/api/v1/SessionsResource.scala | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/SessionsResource.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/SessionsResource.scala index 30c5532df..2cd057149 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/SessionsResource.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/SessionsResource.scala @@ -164,6 +164,13 @@ private[v1] class SessionsResource extends ApiRequestContext { Response.ok().build() } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON + )), + description = "Create an operation with EXECUTE_STATEMENT type" + ) @POST @Path("{sessionHandle}/operations/statement") def executeStatement(@PathParam("sessionHandle") sessionHandleStr: String, @@ -178,6 +185,13 @@ private[v1] class SessionsResource extends ApiRequestContext { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON + )), + description = "Create an operation with GET_TYPE_INFO type" + ) @POST @Path("{sessionHandle}/operations/typeinfo") def getTypeInfo(@PathParam("sessionHandle") sessionHandleStr: String): OperationHandle = { @@ -190,6 +204,13 @@ private[v1] class SessionsResource extends ApiRequestContext { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON + )), + description = "Create an operation with GET_CATALOGS type" + ) @POST @Path("{sessionHandle}/operations/catalogs") def getCatalogs(@PathParam("sessionHandle") sessionHandleStr: String): OperationHandle = { @@ -202,6 +223,13 @@ private[v1] class SessionsResource extends ApiRequestContext { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON + )), + description = "Create an operation with GET_SCHEMAS type" + ) @POST @Path("{sessionHandle}/operations/schemas") def getSchemas(@PathParam("sessionHandle") sessionHandleStr: String, @@ -215,6 +243,13 @@ private[v1] class SessionsResource extends ApiRequestContext { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON + )), + description = "Create an operation with GET_TABLES type" + ) @POST @Path("{sessionHandle}/operations/tables") def getTables(@PathParam("sessionHandle") sessionHandleStr: String, @@ -229,6 +264,13 @@ private[v1] class SessionsResource extends ApiRequestContext { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON + )), + description = "Create an operation with GET_TABLE_TYPES type" + ) @POST @Path("{sessionHandle}/operations/tabletypes") def getTableTypes(@PathParam("sessionHandle") sessionHandleStr: String): OperationHandle = { @@ -241,6 +283,13 @@ private[v1] class SessionsResource extends ApiRequestContext { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON + )), + description = "Create an operation with GET_COLUMNS type" + ) @POST @Path("{sessionHandle}/operations/columns") def getColumns(@PathParam("sessionHandle") sessionHandleStr: String, @@ -255,6 +304,13 @@ private[v1] class SessionsResource extends ApiRequestContext { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON + )), + description = "Create an operation with GET_FUNCTIONS type" + ) @POST @Path("{sessionHandle}/operations/functions") def getFunctions(@PathParam("sessionHandle") sessionHandleStr: String,