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-management | |
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-management')
3 files changed, 672 insertions, 18 deletions
diff --git a/controlloop/common/feature-controlloop-management/pom.xml b/controlloop/common/feature-controlloop-management/pom.xml index e0c9db9d0..9d7d22e3f 100644 --- a/controlloop/common/feature-controlloop-management/pom.xml +++ b/controlloop/common/feature-controlloop-management/pom.xml @@ -91,6 +91,39 @@ </execution> </executions> </plugin> + <!-- Controllers interfaces generation --> + <plugin> + <groupId>io.swagger.codegen.v3</groupId> + <artifactId>swagger-codegen-maven-plugin</artifactId> + <version>3.0.36</version> + <executions> + <execution> + <id>code-gen</id> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <inputSpec>${project.basedir}/src/main/resources/openapi/openapi.yaml</inputSpec> + <invokerPackage>org.onap.policy.drools.server.restful</invokerPackage> + <modelPackage>org.onap.policy.drools.server.restful.model</modelPackage> + <apiPackage>org.onap.policy.drools.server.restful</apiPackage> + <language>jaxrs-spec</language> + <generateModels>false</generateModels> + <generateSupportingFiles>false</generateSupportingFiles> + <sortParamsByRequiredFlag>false</sortParamsByRequiredFlag> + <importMappings> + Response=javax.ws.rs.core.Response + </importMappings> + <configOptions> + <useTags>true</useTags> + <sourceFolder>src/gen/java</sourceFolder> + <dateLibrary>java11</dateLibrary> + <interfaceOnly>true</interfaceOnly> + </configOptions> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java index 0a721e8f5..d6ee19017 100644 --- a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java +++ b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java @@ -20,11 +20,6 @@ package org.onap.policy.drools.server.restful; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; @@ -51,8 +46,7 @@ import org.slf4j.LoggerFactory; @Path("/policy/pdp") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -@Api -public class RestControlLoopManager { +public class RestControlLoopManager implements PolicyApi { private static final Logger logger = LoggerFactory.getLogger(RestControlLoopManager.class); /** @@ -64,11 +58,9 @@ public class RestControlLoopManager { */ @GET @Path("engine/controllers/{controller}/drools/facts/{session}/controlloops") - @ApiOperation(value = "Control Loops", notes = "Compact list", responseContainer = "List") - @ApiResponses(value = {@ApiResponse(code = 404, message = "Control Loops cannot be found")}) public Response controlLoops( - @ApiParam(value = "Policy Controller Name", required = true) @PathParam("controller") String controllerName, - @ApiParam(value = "Drools Session Name", required = true) @PathParam("session") String sessionName) { + @PathParam("controller") String controllerName, + @PathParam("session") String sessionName) { try { List<String> controlLoopNames = @@ -93,12 +85,10 @@ public class RestControlLoopManager { */ @GET @Path("engine/controllers/{controller}/drools/facts/{session}/controlloops/{controlLoopName}") - @ApiOperation(value = "Control Loop", notes = "Control Loop Parameters", responseContainer = "List") - @ApiResponses(value = {@ApiResponse(code = 404, message = "The Control Loop cannot be found")}) public Response controlLoop( - @ApiParam(value = "Policy Controller Name", required = true) @PathParam("controller") String controllerName, - @ApiParam(value = "Drools Session Name", required = true) @PathParam("session") String sessionName, - @ApiParam(value = "Control Loop Name", required = true) @PathParam("controlLoopName") String controlLoopName) { + @PathParam("controller") String controllerName, + @PathParam("session") String sessionName, + @PathParam("controlLoopName") String controlLoopName) { try { List<ControlLoopParams> controlLoopParams = @@ -121,8 +111,7 @@ public class RestControlLoopManager { */ @GET @Path("engine/tools/controlloops/aai/customQuery/{vserverId}") - @ApiOperation(value = "AAI Custom Query") - public Response aaiCustomQuery(@ApiParam(value = "vserver Identifier") String vserverId) { + public Response aaiCustomQuery(String vserverId) { var mgr = PolicyEngineConstants.getManager(); return Response diff --git a/controlloop/common/feature-controlloop-management/src/main/resources/openapi/openapi.yaml b/controlloop/common/feature-controlloop-management/src/main/resources/openapi/openapi.yaml new file mode 100644 index 000000000..d13ca26c0 --- /dev/null +++ b/controlloop/common/feature-controlloop-management/src/main/resources/openapi/openapi.yaml @@ -0,0 +1,632 @@ +# ============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: RestControlLoopManager +- name: TransactionTracker +paths: + /policy/pdp/engine/controllers/{controller}/drools/facts/{session}/controlloops: + get: + tags: + - RestControlLoopManager + summary: Control Loops + description: Compact list + operationId: controlLoops + parameters: + - name: controller + in: path + description: Policy Controller Name + required: true + schema: + type: string + - name: session + in: path + description: Drools Session Name + 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' + 404: + description: Control Loops cannot be found + content: {} + /policy/pdp/engine/controllers/{controller}/drools/facts/{session}/controlloops/{controlLoopName}: + get: + tags: + - RestControlLoopManager + summary: Control Loop + description: Control Loop Parameters + operationId: controlLoop + parameters: + - name: controller + in: path + description: Policy Controller Name + required: true + schema: + type: string + - name: session + in: path + description: Drools Session Name + required: true + schema: + type: string + - name: controlLoopName + in: path + description: Control Loop Name + 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' + 404: + description: The Control Loop cannot be found + content: {} + /policy/pdp/engine/tools/controlloops/aai/customQuery/{vserverId}: + get: + tags: + - RestControlLoopManager + summary: AAI Custom Query + operationId: aaiCustomQuery + parameters: + - name: vserverId + in: path + description: ServerId + 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' + x-codegen-request-body-name: body +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 |