diff options
author | lapentafd <francesco.lapenta@est.tech> | 2023-02-13 13:59:45 +0000 |
---|---|---|
committer | Francesco Davide Lapenta <francesco.lapenta@est.tech> | 2023-02-13 14:04:58 +0000 |
commit | 44dd8296a49937e347f6c2304bcaa09e3a67e3cc (patch) | |
tree | c8009f1a989ee9bb01c1b0a73f103474ed27c316 /controlloop/common/feature-controlloop-trans/src | |
parent | 70ddcbe8e34eda99a7e6e9f383cc78a0d6f0cbd2 (diff) |
Clean Annotations drools-applications
Added swagger extracted documentation in openapi.yaml
Issue-ID: POLICY-3465
Change-Id: Icb30dea789559b0de379ce0e5d8da3e8d9a5dac5
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Diffstat (limited to 'controlloop/common/feature-controlloop-trans/src')
2 files changed, 667 insertions, 20 deletions
diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java index 3521e9f55..be4f1b69f 100644 --- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java +++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +21,6 @@ package org.onap.policy.drools.server.restful; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import java.util.UUID; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -43,16 +41,15 @@ import org.onap.policy.drools.apps.controlloop.feature.trans.ControlLoopMetricsM @Path("/policy/pdp/engine/controllers/transactions") @Produces({MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML}) @Consumes({MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML}) -@Api -public class RestTransactionTracker { +public class RestTransactionTracker implements PolicyApi { /** * GET transactions. */ + @Override @GET @Path("inprogress") - @ApiOperation(value = "Retrieve in-progress transactions", responseContainer = "List") public Response transactions() { return Response.status(Response.Status.OK) .entity(ControlLoopMetricsManager.getManager().getTransactions()).build(); @@ -62,11 +59,10 @@ public class RestTransactionTracker { * GET one transaction. */ + @Override @GET @Path("inprogress/{transactionId}") - @ApiOperation(value = "Retrieve an in-progress transaction", response = VirtualControlLoopNotification.class) - public Response transactionId( - @ApiParam(value = "UUID", required = true) @PathParam("transactionId") String transactionId) { + public Response transactionId(@PathParam("transactionId") String transactionId) { VirtualControlLoopNotification notification = ControlLoopMetricsManager.getManager().getTransaction(UUID.fromString(transactionId)); return Response.status((notification != null) ? Response.Status.OK : Response.Status.NOT_FOUND) @@ -77,11 +73,10 @@ public class RestTransactionTracker { * Resets the cache with a new cache size. */ + @Override @PUT @Path("cacheSize/{cacheSize}") - @ApiOperation(value = "Sets the cache size", response = Integer.class) - public Response cacheSize( - @ApiParam(value = "cache size", required = true) @PathParam("cacheSize") int cacheSize) { + public Response cacheSize1(@PathParam("cacheSize") int cacheSize) { ControlLoopMetricsManager.getManager().resetCache(cacheSize, ControlLoopMetricsManager.getManager().getTransactionTimeout()); return Response.status(Response.Status.OK) @@ -92,9 +87,9 @@ public class RestTransactionTracker { * GET the cache size. */ + @Override @GET @Path("cacheSize") - @ApiOperation(value = "Gets the cache size", response = Integer.class) public Response cacheSize() { return Response.status(Response.Status.OK) .entity(ControlLoopMetricsManager.getManager().getCacheSize()).build(); @@ -103,12 +98,10 @@ public class RestTransactionTracker { /** * Resets the cache with a new transaction timeout in seconds. */ - + @Override @PUT @Path("timeout/{timeoutSecs}") - @ApiOperation(value = "Sets the timeout in seconds", response = Integer.class) - public Response timeout( - @ApiParam(value = "timeout", required = true) @PathParam("timeoutSecs") long timeoutSecs) { + public Response timeout(@PathParam("timeoutSecs") long timeoutSecs) { ControlLoopMetricsManager.getManager().resetCache( ControlLoopMetricsManager.getManager().getCacheSize(), timeoutSecs); return Response.status(Response.Status.OK) @@ -118,12 +111,12 @@ public class RestTransactionTracker { /** * GET the cache timeout. */ - + @Override @GET @Path("timeout") - @ApiOperation(value = "Gets the cache timeout", response = Long.class) - public Response timeout() { + public Response timeout1() { return Response.status(Response.Status.OK) .entity(ControlLoopMetricsManager.getManager().getTransactionTimeout()).build(); } + } diff --git a/controlloop/common/feature-controlloop-trans/src/main/resources/openapi/openapi.yaml b/controlloop/common/feature-controlloop-trans/src/main/resources/openapi/openapi.yaml new file mode 100644 index 000000000..d86d7a8c6 --- /dev/null +++ b/controlloop/common/feature-controlloop-trans/src/main/resources/openapi/openapi.yaml @@ -0,0 +1,654 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2023 Nordix Foundation +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +openapi: 3.0.1 +info: + title: "PDP APPS Documentation" + description: PDP-D Telemetry Services + version: Swagger Server +servers: +- url: http://{drools-apps}:9696 + variables: + drools-apps: + default: 0.0.0.0 +tags: +- name: TransactionTracker +paths: + /policy/pdp/engine/controllers/transactions/inprogress: + get: + tags: + - TransactionTracker + summary: Retrieve in-progress transactions + operationId: transactions + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + application/yaml: + schema: + $ref: '#/components/schemas/Response' + /policy/pdp/engine/controllers/transactions/inprogress/{transactionId}: + get: + tags: + - TransactionTracker + summary: Retrieve an in-progress transaction + operationId: transactionId + parameters: + - name: transactionId + in: path + description: UUID + required: true + schema: + type: string + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + application/yaml: + schema: + $ref: '#/components/schemas/Response' + /policy/pdp/engine/controllers/transactions/cacheSize: + get: + tags: + - TransactionTracker + summary: Gets the cache size + operationId: cacheSize + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + application/yaml: + schema: + $ref: '#/components/schemas/Response' + /policy/pdp/engine/controllers/transactions/cacheSize/{cacheSize}: + put: + tags: + - TransactionTracker + summary: Sets the cache size + operationId: cacheSize_1 + parameters: + - name: cacheSize + in: path + description: cache size + required: true + schema: + type: integer + format: int32 + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + application/yaml: + schema: + $ref: '#/components/schemas/Response' + /policy/pdp/engine/controllers/transactions/timeout/{timeoutSecs}: + put: + tags: + - TransactionTracker + summary: Sets the timeout in seconds + operationId: timeout + parameters: + - name: timeoutSecs + in: path + description: timeout + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + application/yaml: + schema: + $ref: '#/components/schemas/Response' + /policy/pdp/engine/controllers/transactions/timeout: + get: + tags: + - TransactionTracker + summary: Gets the cache timeout + operationId: timeout_1 + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + application/yaml: + schema: + $ref: '#/components/schemas/Response' +components: + schemas: + Agenda: + type: object + AgendaEventListener: + type: object + Annotation: + type: object + Calendars: + type: object + Channel: + type: object + ClassLoader: + type: object + properties: + parent: + $ref: '#/components/schemas/ClassLoader' + name: + type: string + unnamedModule: + $ref: '#/components/schemas/Module' + registeredAsParallelCapable: + type: boolean + definedPackages: + type: array + items: + $ref: '#/components/schemas/Package' + EntryPoint: + type: object + properties: + objects: + type: array + items: + type: object + properties: {} + entryPointId: + type: string + factHandles: + type: array + items: + $ref: '#/components/schemas/FactHandle' + factCount: + type: integer + format: int64 + Environment: + type: object + FactField: + type: object + properties: + fieldAnnotations: + type: array + items: + $ref: '#/components/schemas/Annotation' + metaData: + type: object + additionalProperties: + type: object + properties: {} + key: + type: boolean + name: + type: string + index: + type: integer + format: int32 + FactHandle: + type: object + FactType: + type: object + properties: + classAnnotations: + type: array + items: + $ref: '#/components/schemas/Annotation' + superClass: + type: string + metaData: + type: object + additionalProperties: + type: object + properties: {} + name: + type: string + packageName: + type: string + simpleName: + type: string + fields: + type: array + items: + $ref: '#/components/schemas/FactField' + Global: + type: object + properties: + name: + type: string + type: + type: string + Globals: + type: object + properties: + globalKeys: + type: array + items: + type: string + InputStream: + type: object + KieBase: + type: object + properties: + entryPointIds: + uniqueItems: true + type: array + items: + type: string + kieSessions: + type: array + items: + $ref: '#/components/schemas/KieSession' + processes: + type: array + items: + $ref: '#/components/schemas/Process' + kiePackages: + type: array + items: + $ref: '#/components/schemas/KiePackage' + kieBaseEventListeners: + type: array + items: + $ref: '#/components/schemas/KieBaseEventListener' + KieBaseEventListener: + type: object + KieContainer: + type: object + properties: + releaseId: + $ref: '#/components/schemas/ReleaseId' + kieBase: + $ref: '#/components/schemas/KieBase' + kieBaseNames: + type: array + items: + type: string + kieSessionConfiguration: + $ref: '#/components/schemas/KieSessionConfiguration' + classLoader: + $ref: '#/components/schemas/ClassLoader' + KiePackage: + type: object + properties: + functionNames: + type: array + items: + type: string + globalVariables: + type: array + items: + $ref: '#/components/schemas/Global' + processes: + type: array + items: + $ref: '#/components/schemas/Process' + queries: + type: array + items: + $ref: '#/components/schemas/Query' + factTypes: + type: array + items: + $ref: '#/components/schemas/FactType' + rules: + type: array + items: + $ref: '#/components/schemas/Rule' + name: + type: string + KieRuntimeLogger: + type: object + KieSession: + type: object + properties: + identifier: + type: integer + format: int64 + id: + type: integer + format: int32 + sessionConfiguration: + $ref: '#/components/schemas/KieSessionConfiguration' + channels: + type: object + additionalProperties: + $ref: '#/components/schemas/Channel' + sessionClock: + $ref: '#/components/schemas/SessionClock' + globals: + $ref: '#/components/schemas/Globals' + calendars: + $ref: '#/components/schemas/Calendars' + kieBase: + $ref: '#/components/schemas/KieBase' + environment: + $ref: '#/components/schemas/Environment' + agenda: + $ref: '#/components/schemas/Agenda' + entryPoints: + type: array + items: + $ref: '#/components/schemas/EntryPoint' + objects: + type: array + items: + type: object + properties: {} + entryPointId: + type: string + factHandles: + type: array + items: + $ref: '#/components/schemas/FactHandle' + factCount: + type: integer + format: int64 + workItemManager: + $ref: '#/components/schemas/WorkItemManager' + processInstances: + type: array + items: + $ref: '#/components/schemas/ProcessInstance' + logger: + $ref: '#/components/schemas/KieRuntimeLogger' + ruleRuntimeEventListeners: + type: array + items: + $ref: '#/components/schemas/RuleRuntimeEventListener' + agendaEventListeners: + type: array + items: + $ref: '#/components/schemas/AgendaEventListener' + processEventListeners: + type: array + items: + $ref: '#/components/schemas/ProcessEventListener' + KieSessionConfiguration: + type: object + Module: + type: object + properties: + layer: + $ref: '#/components/schemas/ModuleLayer' + name: + type: string + descriptor: + $ref: '#/components/schemas/ModuleDescriptor' + classLoader: + $ref: '#/components/schemas/ClassLoader' + annotations: + type: array + items: + $ref: '#/components/schemas/Annotation' + declaredAnnotations: + type: array + items: + $ref: '#/components/schemas/Annotation' + named: + type: boolean + packages: + uniqueItems: true + type: array + items: + type: string + ModuleDescriptor: + type: object + properties: + open: + type: boolean + automatic: + type: boolean + ModuleLayer: + type: object + Package: + type: object + properties: + name: + type: string + specificationTitle: + type: string + specificationVersion: + type: string + specificationVendor: + type: string + implementationTitle: + type: string + implementationVersion: + type: string + implementationVendor: + type: string + annotations: + type: array + items: + $ref: '#/components/schemas/Annotation' + declaredAnnotations: + type: array + items: + $ref: '#/components/schemas/Annotation' + sealed: + type: boolean + PolicyContainer: + type: object + properties: + kieContainer: + $ref: '#/components/schemas/KieContainer' + artifactId: + type: string + groupId: + type: string + policySessions: + type: array + items: + $ref: '#/components/schemas/PolicySession' + version: + type: string + name: + type: string + classLoader: + $ref: '#/components/schemas/ClassLoader' + alive: + type: boolean + PolicySession: + type: object + properties: + name: + type: string + container: + $ref: '#/components/schemas/PolicyContainer' + kieSession: + $ref: '#/components/schemas/KieSession' + fullName: + type: string + Process: + type: object + properties: + resource: + $ref: '#/components/schemas/Resource' + metaData: + type: object + additionalProperties: + type: object + properties: {} + version: + type: string + name: + type: string + packageName: + type: string + id: + type: string + type: + type: string + knowledgeType: + type: string + enum: + - RULE + - TYPE + - WINDOW + - ENUM + - PROCESS + - FUNCTION + - QUERY + namespace: + type: string + ProcessEventListener: + type: object + ProcessInstance: + type: object + properties: + processName: + type: string + parentProcessInstanceId: + type: string + process: + $ref: '#/components/schemas/Process' + processId: + type: string + id: + type: string + state: + type: integer + format: int32 + eventTypes: + type: array + items: + type: string + Query: + type: object + properties: + metaData: + type: object + additionalProperties: + type: object + properties: {} + name: + type: string + packageName: + type: string + knowledgeType: + type: string + enum: + - RULE + - TYPE + - WINDOW + - ENUM + - PROCESS + - FUNCTION + - QUERY + namespace: + type: string + id: + type: string + Reader: + type: object + ReleaseId: + type: object + properties: + artifactId: + type: string + groupId: + type: string + snapshot: + type: boolean + version: + type: string + Resource: + type: object + properties: + sourcePath: + type: string + targetPath: + type: string + resourceType: + $ref: '#/components/schemas/ResourceType' + reader: + $ref: '#/components/schemas/Reader' + configuration: + $ref: '#/components/schemas/ResourceConfiguration' + inputStream: + $ref: '#/components/schemas/InputStream' + ResourceConfiguration: + type: object + ResourceType: + type: object + properties: + name: + type: string + description: + type: string + defaultExtension: + type: string + defaultPath: + type: string + fullyCoveredByExecModel: + type: boolean + allExtensions: + type: array + items: + type: string + Rule: + type: object + properties: + metaData: + type: object + additionalProperties: + type: object + properties: {} + name: + type: string + packageName: + type: string + knowledgeType: + type: string + enum: + - RULE + - TYPE + - WINDOW + - ENUM + - PROCESS + - FUNCTION + - QUERY + namespace: + type: string + id: + type: string + RuleRuntimeEventListener: + type: object + SessionClock: + type: object + properties: + currentTime: + type: integer + format: int64 + WorkItemManager: + type: object + Response: + type: object |