summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controlloop/common/feature-controlloop-management/pom.xml33
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java25
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/resources/openapi/openapi.yaml632
-rw-r--r--controlloop/common/feature-controlloop-trans/pom.xml38
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java33
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/resources/openapi/openapi.yaml654
-rw-r--r--pom.xml6
7 files changed, 1382 insertions, 39 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
diff --git a/controlloop/common/feature-controlloop-trans/pom.xml b/controlloop/common/feature-controlloop-trans/pom.xml
index fa59c3061..6346ec197 100644
--- a/controlloop/common/feature-controlloop-trans/pom.xml
+++ b/controlloop/common/feature-controlloop-trans/pom.xml
@@ -80,9 +80,45 @@
</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>
+ <typeMappings>
+ <typeMapping>Integer=int</typeMapping>
+ <typeMapping>Long=long</typeMapping>
+ </typeMappings>
+ <configOptions>
+ <useTags>true</useTags>
+ <sourceFolder>src/gen/java</sourceFolder>
+ <dateLibrary>java11</dateLibrary>
+ <interfaceOnly>true</interfaceOnly>
+ </configOptions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
-
<dependencies>
<dependency>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
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
diff --git a/pom.xml b/pom.xml
index 777359b9d..b674d5ac7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -137,6 +137,12 @@
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
+ <!-- Swagger v3 annotations -->
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>2.2.7</version>
+ </dependency>
</dependencies>
</project>