From 5a30cba11c187bcbebb2476061b196043b34ff05 Mon Sep 17 00:00:00 2001 From: "john.h.o.mantaring" Date: Wed, 2 Aug 2023 20:04:41 +0800 Subject: [PATCH] feat(connector-corda): support corda 5 RC via TS/HTTP (no JVM) Fixes #1480 Signed-off-by: adrian.batuto --- .../openapi/.openapi-generator/FILES | 1 - .../kotlin-spring/.openapi-generator/FILES | 10 + ...ApiPluginLedgerConnectorCordaController.kt | 73 +++ .../ApiPluginLedgerConnectorCordaService.kt | 45 ++ .../connector/corda/server/model/CPIIDV5.kt | 35 ++ .../corda/server/model/CPIV5Response.kt | 29 + .../corda/server/model/CPIV5ResponseCpis.kt | 43 ++ .../server/model/CPIV5ResponseCpisInner.kt | 51 ++ .../model/CPIV5ResponseCpisInnerCpksInner.kt | 49 ++ .../corda/server/model/CPIV5ResponseCpks.kt | 41 ++ .../corda/server/model/FlowStatus.kt | 45 ++ .../corda/server/model/FlowStatusFlowError.kt | 27 + .../server/model/FlowStatusV5Response.kt | 53 ++ .../server/model/FlowStatusV5Responses.kt | 29 + ...lowStatusV5ResponsesFlowStatusResponses.kt | 44 ++ ...atusV5ResponsesFlowStatusResponsesInner.kt | 53 ++ .../corda/server/model/FlowV5Error.kt | 31 + .../corda/server/model/StartFlowV5Request.kt | 37 ++ .../model/StartFlowV5RequestRequestBody.kt | 39 ++ .../src/main/resources/openapi.yaml | 453 ++++++++++++++ .../src/main/json/openapi.json | 396 +++++++++++- .../kotlin-client/.openapi-generator/FILES | 20 + .../generated/openapi/kotlin-client/README.md | 14 + .../openapi/kotlin-client/docs/CPIIDV5.md | 12 + .../kotlin-client/docs/CPIV5Response.md | 10 + .../kotlin-client/docs/CPIV5ResponseCpis.md | 15 + .../docs/CPIV5ResponseCpisInner.md | 15 + .../docs/CPIV5ResponseCpisInnerCpksInner.md | 15 + .../kotlin-client/docs/CPIV5ResponseCpks.md | 15 + .../openapi/kotlin-client/docs/DefaultApi.md | 184 ++++++ .../openapi/kotlin-client/docs/FlowStatus.md | 16 + .../kotlin-client/docs/FlowStatusFlowError.md | 11 + .../docs/FlowStatusV5Response.md | 16 + .../docs/FlowStatusV5Responses.md | 10 + ...lowStatusV5ResponsesFlowStatusResponses.md | 16 + ...atusV5ResponsesFlowStatusResponsesInner.md | 16 + .../openapi/kotlin-client/docs/FlowV5Error.md | 11 + .../kotlin-client/docs/StartFlowV5Request.md | 12 + .../docs/StartFlowV5RequestRequestBody.md | 13 + .../openapitools/client/apis/DefaultApi.kt | 290 +++++++++ .../org/openapitools/client/models/CPIIDV5.kt | 43 ++ .../client/models/CPIV5Response.kt | 36 ++ .../client/models/CPIV5ResponseCpis.kt | 60 ++ .../client/models/CPIV5ResponseCpisInner.kt | 57 ++ .../models/CPIV5ResponseCpisInnerCpksInner.kt | 56 ++ .../client/models/CPIV5ResponseCpks.kt | 59 ++ .../openapitools/client/models/FlowStatus.kt | 63 ++ .../client/models/FlowStatusFlowError.kt | 42 ++ .../client/models/FlowStatusV5Response.kt | 60 ++ .../client/models/FlowStatusV5Responses.kt | 36 ++ ...lowStatusV5ResponsesFlowStatusResponses.kt | 63 ++ ...atusV5ResponsesFlowStatusResponsesInner.kt | 60 ++ .../openapitools/client/models/FlowV5Error.kt | 39 ++ .../client/models/StartFlowV5Request.kt | 44 ++ .../models/StartFlowV5RequestRequestBody.kt | 47 ++ .../generated/openapi/typescript-axios/api.ts | 587 ++++++++++++++++++ .../plugin-ledger-connector-corda.ts | 52 +- .../src/main/typescript/public-api.ts | 1 + .../web-services/diagnose-node-endpoint-v1.ts | 6 + .../web-services/get-cpi-endpoint-v1.ts | 121 ++++ .../get-flow-status-response-endpoint-v1.ts | 126 ++++ .../list-flow-status-endpoint-v1.ts | 128 ++++ .../web-services/list-flows-endpoint-v1.ts | 6 + .../web-services/network-map-endpoint-v1.ts | 6 + .../integration/corda-v5-flow-test.ts | 348 +++++++++++ .../package.json | 6 +- .../typescript/corda/corda-v5-test-ledger.ts | 253 ++++++++ .../src/main/typescript/public-api.ts | 7 + .../corda-all-in-one/corda-v5/Dockerfile | 141 ++--- .../corda-all-in-one/corda-v5/README.md | 7 + .../corda-all-in-one/corda-v5/healthcheck.sh | 6 +- .../corda-v5/start-services.sh | 21 +- ...cts-demo-network.conf => supervisord.conf} | 23 +- 73 files changed, 4796 insertions(+), 109 deletions(-) create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIIDV5.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5Response.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpis.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInner.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInnerCpksInner.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpks.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatus.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusFlowError.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Response.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Responses.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponses.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponsesInner.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowV5Error.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5Request.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5RequestRequestBody.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIIDV5.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5Response.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpis.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpisInner.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpisInnerCpksInner.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpks.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatus.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusFlowError.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5Response.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5Responses.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5ResponsesFlowStatusResponses.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5ResponsesFlowStatusResponsesInner.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowV5Error.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/StartFlowV5Request.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/StartFlowV5RequestRequestBody.md create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIIDV5.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5Response.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpis.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInner.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInnerCpksInner.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpks.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatus.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusFlowError.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5Response.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5Responses.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponses.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponsesInner.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowV5Error.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/StartFlowV5Request.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/StartFlowV5RequestRequestBody.kt create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/get-cpi-endpoint-v1.ts create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/get-flow-status-response-endpoint-v1.ts create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/list-flow-status-endpoint-v1.ts create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/corda-v5-flow-test.ts create mode 100644 packages/cactus-test-tooling/src/main/typescript/corda/corda-v5-test-ledger.ts create mode 100644 tools/docker/corda-all-in-one/corda-v5/README.md rename tools/docker/corda-all-in-one/corda-v5/{supervisor/corda5-solarsystem-contracts-demo-network.conf => supervisord.conf} (58%) diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/FILES b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/FILES index bd08ea9f6fb..270cf21ca1a 100644 --- a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/FILES +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md models/health_check_response_pb.proto models/memory_usage_pb.proto diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/.openapi-generator/FILES index 64a8f4a148e..bb47ef081b3 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/.openapi-generator/FILES +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/.openapi-generator/FILES @@ -6,6 +6,10 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/Spri src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaService.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiUtil.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIIDV5.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5Response.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInner.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInnerCpksInner.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ClearMonitorTransactionsV1Request.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ClearMonitorTransactionsV1Response.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CordaNodeSshCredentials.kt @@ -19,6 +23,10 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/DiagnoseNodeV1Request.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/DiagnoseNodeV1Response.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowInvocationType.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Response.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Responses.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponsesInner.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowV5Error.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1Request.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1Response.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1ResponseTxInner.kt @@ -36,6 +44,8 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/Party.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/PublicKey.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/SHA256.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5Request.kt +src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5RequestRequestBody.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartMonitorV1Request.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartMonitorV1Response.kt src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StopMonitorV1Request.kt diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt index 41f830d3880..57bba068360 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt @@ -1,5 +1,6 @@ package org.hyperledger.cactus.plugin.ledger.connector.corda.server.api +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIV5Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ClearMonitorTransactionsV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ClearMonitorTransactionsV1Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsBadRequestV1Response @@ -7,6 +8,8 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployC import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Response +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV5Response +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV5Responses import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Request @@ -14,6 +17,7 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeC import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.NodeInfo +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV5Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StopMonitorV1Request @@ -102,6 +106,58 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se return ResponseEntity(service.diagnoseNodeV1(diagnoseNodeV1Request), HttpStatus.valueOf(200)) } + @Operation( + summary = "This method gets the current status of the specified flow instance.", + operationId = "flowStatusResponse", + description = """""", + responses = [ + ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = FlowStatusV5Response::class))]), + ApiResponse(responseCode = "401", description = "Unauthorized"), + ApiResponse(responseCode = "403", description = "Forbidden") ] + ) + @RequestMapping( + method = [RequestMethod.GET], + value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}"], + produces = ["text/plain"] + ) + fun flowStatusResponse(@Parameter(description = "Holding identity short hash", required = true) @PathVariable("holdingIDShortHash") holdingIDShortHash: kotlin.String,@Parameter(description = "Client request ID", required = true) @PathVariable("clientRequestID") clientRequestID: kotlin.String): ResponseEntity { + return ResponseEntity(service.flowStatusResponse(holdingIDShortHash, clientRequestID), HttpStatus.valueOf(200)) + } + + @Operation( + summary = "This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running.", + operationId = "flowStatusResponses", + description = """""", + responses = [ + ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = FlowStatusV5Responses::class))]), + ApiResponse(responseCode = "401", description = "Unauthorized"), + ApiResponse(responseCode = "403", description = "Forbidden") ] + ) + @RequestMapping( + method = [RequestMethod.GET], + value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}"], + produces = ["text/plain"] + ) + fun flowStatusResponses(@Parameter(description = "Holding identity short hash", required = true) @PathVariable("holdingIDShortHash") holdingIDShortHash: kotlin.String): ResponseEntity { + return ResponseEntity(service.flowStatusResponses(holdingIDShortHash), HttpStatus.valueOf(200)) + } + + @Operation( + summary = "List all CPIs uploaded to the cluster", + operationId = "getCPIResponse", + description = """""", + responses = [ + ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = CPIV5Response::class))]) ] + ) + @RequestMapping( + method = [RequestMethod.GET], + value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi"], + produces = ["application/json"] + ) + fun getCPIResponse(): ResponseEntity { + return ResponseEntity(service.getCPIResponse(), HttpStatus.valueOf(200)) + } + @Operation( summary = "Get transactions for monitored state classes.", operationId = "getMonitorTransactionsV1", @@ -186,6 +242,23 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se return ResponseEntity(service.networkMapV1(body), HttpStatus.valueOf(200)) } + @Operation( + summary = "This method starts a new instance for the specified flow for the specified holding identity.", + operationId = "startFlowParameters", + description = """""", + responses = [ + ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = FlowStatusV5Response::class))]) ] + ) + @RequestMapping( + method = [RequestMethod.POST], + value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}"], + produces = ["application/json"], + consumes = ["application/json"] + ) + fun startFlowParameters(@Parameter(description = "Holding identity short hash", required = true) @PathVariable("holdingIDShortHash") holdingIDShortHash: kotlin.String,@Parameter(description = "Request body for starting a flow", required = true) @Valid @RequestBody startFlowV5Request: StartFlowV5Request): ResponseEntity { + return ResponseEntity(service.startFlowParameters(holdingIDShortHash, startFlowV5Request), HttpStatus.valueOf(200)) + } + @Operation( summary = "Start monitoring corda changes (transactions) of given state class", operationId = "startMonitorV1", diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaService.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaService.kt index 9a9aeb8fd4e..060a185cca1 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaService.kt +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaService.kt @@ -1,5 +1,6 @@ package org.hyperledger.cactus.plugin.ledger.connector.corda.server.api +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIV5Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ClearMonitorTransactionsV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ClearMonitorTransactionsV1Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsBadRequestV1Response @@ -7,6 +8,8 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployC import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Response +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV5Response +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV5Responses import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Request @@ -14,6 +17,7 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeC import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.NodeInfo +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV5Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Request import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Response import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StopMonitorV1Request @@ -50,6 +54,37 @@ interface ApiPluginLedgerConnectorCordaService { */ fun diagnoseNodeV1(diagnoseNodeV1Request: DiagnoseNodeV1Request?): DiagnoseNodeV1Response + /** + * GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID} : This method gets the current status of the specified flow instance. + * + * @param holdingIDShortHash Holding identity short hash (required) + * @param clientRequestID Client request ID (required) + * @return OK (status code 200) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * @see ApiPluginLedgerConnectorCorda#flowStatusResponse + */ + fun flowStatusResponse(holdingIDShortHash: kotlin.String, clientRequestID: kotlin.String): FlowStatusV5Response + + /** + * GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash} : This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. + * + * @param holdingIDShortHash Holding identity short hash (required) + * @return OK (status code 200) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * @see ApiPluginLedgerConnectorCorda#flowStatusResponses + */ + fun flowStatusResponses(holdingIDShortHash: kotlin.String): FlowStatusV5Responses + + /** + * GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi : List all CPIs uploaded to the cluster + * + * @return OK (status code 200) + * @see ApiPluginLedgerConnectorCorda#getCPIResponse + */ + fun getCPIResponse(): CPIV5Response + /** * GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions : Get transactions for monitored state classes. * @@ -96,6 +131,16 @@ interface ApiPluginLedgerConnectorCordaService { */ fun networkMapV1(body: kotlin.Any?): List + /** + * POST /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash} : This method starts a new instance for the specified flow for the specified holding identity. + * + * @param holdingIDShortHash Holding identity short hash (required) + * @param startFlowV5Request Request body for starting a flow (required) + * @return OK (status code 200) + * @see ApiPluginLedgerConnectorCorda#startFlowParameters + */ + fun startFlowParameters(holdingIDShortHash: kotlin.String, startFlowV5Request: StartFlowV5Request): FlowStatusV5Response + /** * POST /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor : Start monitoring corda changes (transactions) of given state class * diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIIDV5.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIIDV5.kt new file mode 100644 index 00000000000..7ff98492701 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIIDV5.kt @@ -0,0 +1,35 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param name + * @param version + * @param signerSummaryHash + */ +data class CPIIDV5( + + @Schema(example = "string", required = true, description = "") + @get:JsonProperty("name", required = true) val name: kotlin.String, + + @Schema(example = "string", required = true, description = "") + @get:JsonProperty("version", required = true) val version: kotlin.String, + + @Schema(example = "string", description = "") + @get:JsonProperty("signerSummaryHash") val signerSummaryHash: kotlin.String? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5Response.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5Response.kt new file mode 100644 index 00000000000..ad4a9461908 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5Response.kt @@ -0,0 +1,29 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIV5ResponseCpisInner +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param cpis + */ +data class CPIV5Response( + + @field:Valid + @Schema(example = "null", description = "") + @get:JsonProperty("cpis") val cpis: kotlin.collections.List? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpis.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpis.kt new file mode 100644 index 00000000000..3d9a3129e3f --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpis.kt @@ -0,0 +1,43 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIIDV5 +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIV5ResponseCpks +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param cpiFileChecksum + * @param cpiFileFullChecksum + * @param cpks + * @param groupPolicy + * @param id + * @param timestamp + */ +data class CPIV5ResponseCpis( + + @field:JsonProperty("cpiFileChecksum") val cpiFileChecksum: kotlin.String? = null, + + @field:JsonProperty("cpiFileFullChecksum") val cpiFileFullChecksum: kotlin.String? = null, + + @field:Valid + @field:JsonProperty("cpks") val cpks: kotlin.collections.List? = null, + + @field:JsonProperty("groupPolicy") val groupPolicy: kotlin.String? = null, + + @field:Valid + @field:JsonProperty("id") val id: CPIIDV5? = null, + + @field:JsonProperty("timestamp") val timestamp: java.time.OffsetDateTime? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInner.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInner.kt new file mode 100644 index 00000000000..83346030cc0 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInner.kt @@ -0,0 +1,51 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIIDV5 +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIV5ResponseCpisInnerCpksInner +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param cpiFileChecksum + * @param cpiFileFullChecksum + * @param cpks + * @param groupPolicy + * @param id + * @param timestamp + */ +data class CPIV5ResponseCpisInner( + + @Schema(example = "string", description = "") + @get:JsonProperty("cpiFileChecksum") val cpiFileChecksum: kotlin.String? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("cpiFileFullChecksum") val cpiFileFullChecksum: kotlin.String? = null, + + @field:Valid + @Schema(example = "null", description = "") + @get:JsonProperty("cpks") val cpks: kotlin.collections.List? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("groupPolicy") val groupPolicy: kotlin.String? = null, + + @field:Valid + @Schema(example = "null", description = "") + @get:JsonProperty("id") val id: CPIIDV5? = null, + + @Schema(example = "2022-06-24T10:15:30Z", description = "") + @get:JsonProperty("timestamp") val timestamp: java.time.OffsetDateTime? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInnerCpksInner.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInnerCpksInner.kt new file mode 100644 index 00000000000..ff524de19e9 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpisInnerCpksInner.kt @@ -0,0 +1,49 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIIDV5 +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param hash + * @param id + * @param libraries + * @param mainBundle + * @param timestamp + * @param type + */ +data class CPIV5ResponseCpisInnerCpksInner( + + @Schema(example = "string", description = "") + @get:JsonProperty("hash") val hash: kotlin.String? = null, + + @field:Valid + @Schema(example = "null", description = "") + @get:JsonProperty("id") val id: CPIIDV5? = null, + + @Schema(example = "null", description = "") + @get:JsonProperty("libraries") val libraries: kotlin.collections.List? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("mainBundle") val mainBundle: kotlin.String? = null, + + @Schema(example = "2022-06-24T10:15:30Z", description = "") + @get:JsonProperty("timestamp") val timestamp: java.time.OffsetDateTime? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("type") val type: kotlin.String? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpks.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpks.kt new file mode 100644 index 00000000000..866900fda27 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIV5ResponseCpks.kt @@ -0,0 +1,41 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.CPIIDV5 +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param hash + * @param id + * @param libraries + * @param mainBundle + * @param timestamp + * @param type + */ +data class CPIV5ResponseCpks( + + @field:JsonProperty("hash") val hash: kotlin.String? = null, + + @field:Valid + @field:JsonProperty("id") val id: CPIIDV5? = null, + + @field:JsonProperty("libraries") val libraries: kotlin.collections.List? = null, + + @field:JsonProperty("mainBundle") val mainBundle: kotlin.String? = null, + + @field:JsonProperty("timestamp") val timestamp: java.time.OffsetDateTime? = null, + + @field:JsonProperty("type") val type: kotlin.String? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatus.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatus.kt new file mode 100644 index 00000000000..edf86ace570 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatus.kt @@ -0,0 +1,45 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusFlowError +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param flowError + * @param flowStatus + * @param holdingIDShortHash + * @param timestamp + * @param clientRequestId + * @param flowId + * @param flowResult + */ +data class FlowStatus( + + @field:Valid + @field:JsonProperty("flowError", required = true) val flowError: FlowStatusFlowError, + + @field:JsonProperty("flowStatus", required = true) val flowStatus: kotlin.String, + + @field:JsonProperty("holdingIDShortHash", required = true) val holdingIDShortHash: kotlin.String, + + @field:JsonProperty("timestamp", required = true) val timestamp: java.time.OffsetDateTime, + + @field:JsonProperty("clientRequestId") val clientRequestId: kotlin.String? = null, + + @field:JsonProperty("flowId") val flowId: kotlin.String? = null, + + @field:Valid + @field:JsonProperty("flowResult") val flowResult: kotlin.collections.List? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusFlowError.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusFlowError.kt new file mode 100644 index 00000000000..48ca2a8cc42 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusFlowError.kt @@ -0,0 +1,27 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param message + * @param type + */ +data class FlowStatusFlowError( + + @field:JsonProperty("message", required = true) val message: kotlin.String, + + @field:JsonProperty("type", required = true) val type: kotlin.String +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Response.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Response.kt new file mode 100644 index 00000000000..bb827ed9df2 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Response.kt @@ -0,0 +1,53 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowV5Error +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param flowStatus + * @param holdingIDShortHash + * @param timestamp + * @param clientRequestId + * @param flowError + * @param flowId + * @param flowResult + */ +data class FlowStatusV5Response( + + @Schema(example = "string", required = true, description = "") + @get:JsonProperty("flowStatus", required = true) val flowStatus: kotlin.String, + + @Schema(example = "string", required = true, description = "") + @get:JsonProperty("holdingIDShortHash", required = true) val holdingIDShortHash: kotlin.String, + + @Schema(example = "2022-06-24T10:15:30Z", required = true, description = "") + @get:JsonProperty("timestamp", required = true) val timestamp: java.time.OffsetDateTime, + + @Schema(example = "string", description = "") + @get:JsonProperty("clientRequestId") val clientRequestId: kotlin.String? = null, + + @field:Valid + @Schema(example = "null", description = "") + @get:JsonProperty("flowError") val flowError: FlowV5Error? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("flowId") val flowId: kotlin.String? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("flowResult") val flowResult: kotlin.String? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Responses.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Responses.kt new file mode 100644 index 00000000000..7c88833c843 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5Responses.kt @@ -0,0 +1,29 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV5ResponsesFlowStatusResponsesInner +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param flowStatusResponses + */ +data class FlowStatusV5Responses( + + @field:Valid + @Schema(example = "null", description = "") + @get:JsonProperty("flowStatusResponses") val flowStatusResponses: kotlin.collections.List? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponses.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponses.kt new file mode 100644 index 00000000000..fb67e297462 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponses.kt @@ -0,0 +1,44 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowV5Error +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param clientRequestId + * @param flowError + * @param flowId + * @param flowResult + * @param flowStatus + * @param holdingIDShortHash + * @param timestamp + */ +data class FlowStatusV5ResponsesFlowStatusResponses( + + @field:JsonProperty("clientRequestId") val clientRequestId: kotlin.String? = null, + + @field:Valid + @field:JsonProperty("flowError") val flowError: FlowV5Error? = null, + + @field:JsonProperty("flowId") val flowId: kotlin.String? = null, + + @field:JsonProperty("flowResult") val flowResult: kotlin.String? = null, + + @field:JsonProperty("flowStatus") val flowStatus: kotlin.String? = null, + + @field:JsonProperty("holdingIDShortHash") val holdingIDShortHash: kotlin.String? = null, + + @field:JsonProperty("timestamp") val timestamp: java.time.OffsetDateTime? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponsesInner.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponsesInner.kt new file mode 100644 index 00000000000..7218e7acfda --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV5ResponsesFlowStatusResponsesInner.kt @@ -0,0 +1,53 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowV5Error +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param clientRequestId + * @param flowError + * @param flowId + * @param flowResult + * @param flowStatus + * @param holdingIDShortHash + * @param timestamp + */ +data class FlowStatusV5ResponsesFlowStatusResponsesInner( + + @Schema(example = "string", description = "") + @get:JsonProperty("clientRequestId") val clientRequestId: kotlin.String? = null, + + @field:Valid + @Schema(example = "null", description = "") + @get:JsonProperty("flowError") val flowError: FlowV5Error? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("flowId") val flowId: kotlin.String? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("flowResult") val flowResult: kotlin.String? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("flowStatus") val flowStatus: kotlin.String? = null, + + @Schema(example = "string", description = "") + @get:JsonProperty("holdingIDShortHash") val holdingIDShortHash: kotlin.String? = null, + + @Schema(example = "2022-06-24T10:15:30Z", description = "") + @get:JsonProperty("timestamp") val timestamp: java.time.OffsetDateTime? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowV5Error.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowV5Error.kt new file mode 100644 index 00000000000..95060bba6f7 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowV5Error.kt @@ -0,0 +1,31 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param message + * @param type + */ +data class FlowV5Error( + + @Schema(example = "string", required = true, description = "") + @get:JsonProperty("message", required = true) val message: kotlin.String, + + @Schema(example = "string", required = true, description = "") + @get:JsonProperty("type", required = true) val type: kotlin.String +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5Request.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5Request.kt new file mode 100644 index 00000000000..ec5a6d57292 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5Request.kt @@ -0,0 +1,37 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV5RequestRequestBody +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * This method starts a new instance for the specified flow for the specified holding identity. + * @param clientRequestId + * @param flowClassName + * @param requestBody + */ +data class StartFlowV5Request( + + @Schema(example = "null", required = true, description = "") + @get:JsonProperty("clientRequestId", required = true) val clientRequestId: kotlin.String, + + @Schema(example = "null", required = true, description = "") + @get:JsonProperty("flowClassName", required = true) val flowClassName: kotlin.String, + + @field:Valid + @Schema(example = "null", required = true, description = "") + @get:JsonProperty("requestBody", required = true) val requestBody: StartFlowV5RequestRequestBody +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5RequestRequestBody.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5RequestRequestBody.kt new file mode 100644 index 00000000000..5ff7fae8301 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV5RequestRequestBody.kt @@ -0,0 +1,39 @@ +package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * + * @param chatName + * @param otherMember + * @param message + * @param numberOfRecords + */ +data class StartFlowV5RequestRequestBody( + + @Schema(example = "null", description = "") + @get:JsonProperty("chatName") val chatName: kotlin.String? = null, + + @Schema(example = "null", description = "") + @get:JsonProperty("otherMember") val otherMember: kotlin.String? = null, + + @Schema(example = "null", description = "") + @get:JsonProperty("message") val message: kotlin.String? = null, + + @Schema(example = "null", description = "") + @get:JsonProperty("numberOfRecords") val numberOfRecords: kotlin.String? = null +) { + +} + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/resources/openapi.yaml b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/resources/openapi.yaml index 07a90c1a428..c05516ce635 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/resources/openapi.yaml +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/resources/openapi.yaml @@ -224,6 +224,118 @@ paths: http: verbLowerCase: get path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi: + get: + operationId: getCPIResponse + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CPIV5Response' + description: OK + summary: List all CPIs uploaded to the cluster + x-hyperledger-cactus: + https: + verbLowerCase: get + path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}: + get: + operationId: flowStatusResponses + parameters: + - description: Holding identity short hash + explode: false + in: path + name: holdingIDShortHash + required: true + schema: + type: string + style: simple + responses: + "200": + content: + text/plain: + schema: + $ref: '#/components/schemas/FlowStatusV5Responses' + description: OK + "401": + description: Unauthorized + "403": + description: Forbidden + summary: This method returns an array containing the statuses of all flows running + for a specified holding identity. An empty array is returned if there are + no flows running. + x-hyperledger-cactus: + http: + verbLowerCase: get + path: "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}" + post: + operationId: startFlowParameters + parameters: + - description: Holding identity short hash + explode: false + in: path + name: holdingIDShortHash + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StartFlowV5Request' + description: Request body for starting a flow + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/FlowStatusV5Response' + description: OK + summary: This method starts a new instance for the specified flow for the specified + holding identity. + x-hyperledger-cactus: + http: + verbLowerCase: post + path: "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}" + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}: + get: + operationId: flowStatusResponse + parameters: + - description: Holding identity short hash + explode: false + in: path + name: holdingIDShortHash + required: true + schema: + type: string + style: simple + - description: Client request ID + explode: false + in: path + name: clientRequestID + required: true + schema: + type: string + style: simple + responses: + "200": + content: + text/plain: + schema: + $ref: '#/components/schemas/FlowStatusV5Response' + description: OK + "401": + description: Unauthorized + "403": + description: Forbidden + summary: This method gets the current status of the specified flow instance. + x-hyperledger-cactus: + http: + verbLowerCase: get + path: "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}" components: schemas: SHA256: @@ -1376,6 +1488,203 @@ components: PrometheusExporterMetricsResponse: nullable: false type: string + CPIV5Response: + example: + cpis: + - cpiFileFullChecksum: string + cpiFileChecksum: string + cpks: + - libraries: + - string + - string + id: + signerSummaryHash: string + name: string + version: string + mainBundle: string + type: string + hash: string + timestamp: 2022-06-24T10:15:30Z + - libraries: + - string + - string + id: + signerSummaryHash: string + name: string + version: string + mainBundle: string + type: string + hash: string + timestamp: 2022-06-24T10:15:30Z + groupPolicy: string + id: + signerSummaryHash: string + name: string + version: string + timestamp: 2022-06-24T10:15:30Z + - cpiFileFullChecksum: string + cpiFileChecksum: string + cpks: + - libraries: + - string + - string + id: + signerSummaryHash: string + name: string + version: string + mainBundle: string + type: string + hash: string + timestamp: 2022-06-24T10:15:30Z + - libraries: + - string + - string + id: + signerSummaryHash: string + name: string + version: string + mainBundle: string + type: string + hash: string + timestamp: 2022-06-24T10:15:30Z + groupPolicy: string + id: + signerSummaryHash: string + name: string + version: string + timestamp: 2022-06-24T10:15:30Z + properties: + cpis: + items: + $ref: '#/components/schemas/CPIV5Response_cpis_inner' + type: array + required: + - hash + - id + - libraries + - mainBundle + - timestamp + - type + type: object + StartFlowV5Request: + description: This method starts a new instance for the specified flow for the + specified holding identity. + example: + requestBody: + numberOfRecords: numberOfRecords + otherMember: otherMember + chatName: chatName + message: message + clientRequestId: clientRequestId + flowClassName: flowClassName + properties: + clientRequestId: + nullable: false + type: string + flowClassName: + nullable: false + type: string + requestBody: + $ref: '#/components/schemas/StartFlowV5Request_requestBody' + required: + - clientRequestId + - flowClassName + - requestBody + type: object + FlowStatusV5Response: + example: + holdingIDShortHash: string + flowError: + message: string + type: string + clientRequestId: string + flowResult: string + flowStatus: string + flowId: string + timestamp: 2022-06-24T10:15:30Z + properties: + clientRequestId: + example: string + nullable: true + type: string + flowError: + $ref: '#/components/schemas/FlowV5Error' + flowId: + example: string + nullable: true + type: string + flowResult: + example: string + nullable: true + type: string + flowStatus: + example: string + nullable: false + type: string + holdingIDShortHash: + example: string + nullable: false + type: string + timestamp: + example: 2022-06-24T10:15:30Z + format: date-time + nullable: false + type: string + required: + - flowStatus + - holdingIDShortHash + - timestamp + type: object + FlowStatusV5Responses: + properties: + flowStatusResponses: + items: + $ref: '#/components/schemas/FlowStatusV5Responses_flowStatusResponses_inner' + type: array + required: + - flowStatus + - holdingIDShortHash + - timestamp + type: object + CPIIDV5: + example: + signerSummaryHash: string + name: string + version: string + properties: + name: + example: string + nullable: false + type: string + signerSummaryHash: + example: string + nullable: true + type: string + version: + example: string + nullable: false + type: string + required: + - name + - version + type: object + FlowV5Error: + example: + message: string + type: string + properties: + message: + example: string + nullable: false + type: string + type: + example: string + nullable: false + type: string + required: + - message + - type + type: object GetMonitorTransactionsV1Response_tx_inner: example: data: data @@ -1388,3 +1697,147 @@ components: minItems: 0 type: string type: object + CPIV5Response_cpis_inner_cpks_inner: + example: + libraries: + - string + - string + id: + signerSummaryHash: string + name: string + version: string + mainBundle: string + type: string + hash: string + timestamp: 2022-06-24T10:15:30Z + properties: + hash: + example: string + nullable: false + type: string + id: + $ref: '#/components/schemas/CPIIDV5' + libraries: + items: + example: string + nullable: false + type: string + type: array + mainBundle: + example: string + nullable: false + type: string + timestamp: + example: 2022-06-24T10:15:30Z + format: date-time + nullable: false + type: string + type: + example: string + nullable: false + type: string + type: object + CPIV5Response_cpis_inner: + example: + cpiFileFullChecksum: string + cpiFileChecksum: string + cpks: + - libraries: + - string + - string + id: + signerSummaryHash: string + name: string + version: string + mainBundle: string + type: string + hash: string + timestamp: 2022-06-24T10:15:30Z + - libraries: + - string + - string + id: + signerSummaryHash: string + name: string + version: string + mainBundle: string + type: string + hash: string + timestamp: 2022-06-24T10:15:30Z + groupPolicy: string + id: + signerSummaryHash: string + name: string + version: string + timestamp: 2022-06-24T10:15:30Z + properties: + cpiFileChecksum: + example: string + nullable: false + type: string + cpiFileFullChecksum: + example: string + nullable: false + type: string + cpks: + items: + $ref: '#/components/schemas/CPIV5Response_cpis_inner_cpks_inner' + type: array + groupPolicy: + example: string + nullable: true + type: string + id: + $ref: '#/components/schemas/CPIIDV5' + timestamp: + example: 2022-06-24T10:15:30Z + format: date-time + nullable: false + type: string + type: object + StartFlowV5Request_requestBody: + example: + numberOfRecords: numberOfRecords + otherMember: otherMember + chatName: chatName + message: message + properties: + chatName: + type: string + otherMember: + type: string + message: + type: string + numberOfRecords: + type: string + type: object + FlowStatusV5Responses_flowStatusResponses_inner: + properties: + clientRequestId: + example: string + nullable: true + type: string + flowError: + $ref: '#/components/schemas/FlowV5Error' + flowId: + example: string + nullable: true + type: string + flowResult: + example: string + nullable: true + type: string + flowStatus: + example: string + nullable: false + type: string + holdingIDShortHash: + example: string + nullable: false + type: string + timestamp: + example: 2022-06-24T10:15:30Z + format: date-time + nullable: false + type: string + type: object diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/json/openapi.json b/packages/cactus-plugin-ledger-connector-corda/src/main/json/openapi.json index 5e49e7bc9a9..417cc9e5b26 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/json/openapi.json +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/json/openapi.json @@ -869,7 +869,242 @@ "PrometheusExporterMetricsResponse": { "type": "string", "nullable": false - } + }, + "CPIV5Response":{ + "type": "object", + "required": ["hash", "id", "libraries", "mainBundle", "timestamp", "type"], + "properties": { + "cpis": { + "type": "array", + "items": { + "type": "object", + "properties": { + "cpiFileChecksum": { + "type": "string", + "nullable": false, + "example": "string" + }, + "cpiFileFullChecksum": { + "type": "string", + "nullable": false, + "example": "string" + }, + "cpks": { + "type": "array", + "items": { + "type": "object", + "properties": { + "hash": { + "type": "string", + "nullable": false, + "example": "string" + }, + "id": { + "$ref": "#/components/schemas/CPIIDV5" + }, + "libraries": { + "type": "array", + "items": { + "type": "string", + "nullable": false, + "example": "string" + } + }, + "mainBundle": { + "type": "string", + "nullable": false, + "example": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time", + "nullable": false, + "example": "2022-06-24T10:15:30Z" + }, + "type": { + "type": "string", + "nullable": false, + "example": "string" + } + } + } + }, + "groupPolicy": { + "type": "string", + "nullable": true, + "example": "string" + }, + "id": { + "$ref": "#/components/schemas/CPIIDV5" + }, + "timestamp": { + "type": "string", + "format": "date-time", + "nullable": false, + "example": "2022-06-24T10:15:30Z" + } + } + } + } + } + }, + "StartFlowV5Request": { + "description": "This method starts a new instance for the specified flow for the specified holding identity.", + "type": "object", + "required": ["clientRequestId", "flowClassName", "requestBody"], + "properties": { + "clientRequestId": { + "type": "string", + "nullable": false + }, + "flowClassName": { + "type": "string", + "nullable": false + }, + "requestBody": { + "type": "object", + "properties": { + "chatName": { + "type": "string" + }, + "otherMember": { + "type": "string" + }, + "message": { + "type": "string" + }, + "numberOfRecords": { + "type": "string" + } + } + } + } + }, + "FlowStatusV5Response": { + "type": "object", + "required": ["flowStatus", "holdingIDShortHash", "timestamp"], + "properties": { + "clientRequestId": { + "type": "string", + "nullable": true, + "example": "string" + }, + "flowError": { + "$ref": "#/components/schemas/FlowV5Error" + }, + "flowId": { + "type": "string", + "nullable": true, + "example": "string" + }, + "flowResult": { + "type": "string", + "nullable": true, + "example": "string" + }, + "flowStatus": { + "type": "string", + "nullable": false, + "example": "string" + }, + "holdingIDShortHash": { + "type": "string", + "nullable": false, + "example": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time", + "nullable": false, + "example": "2022-06-24T10:15:30Z" + } + } + }, + "FlowStatusV5Responses": { + "type": "object", + "required": ["flowStatus", "holdingIDShortHash", "timestamp"], + "properties": { + "flowStatusResponses": { + "type": "array", + "items": { + "type": "object", + "properties": { + "clientRequestId": { + "type": "string", + "nullable": true, + "example": "string" + }, + "flowError": { + "$ref": "#/components/schemas/FlowV5Error" + }, + "flowId": { + "type": "string", + "nullable": true, + "example": "string" + }, + "flowResult": { + "type": "string", + "nullable": true, + "example": "string" + }, + "flowStatus": { + "type": "string", + "nullable": false, + "example": "string" + }, + "holdingIDShortHash": { + "type": "string", + "nullable": false, + "example": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time", + "nullable": false, + "example": "2022-06-24T10:15:30Z" + } + } + } + } + } + }, + "CPIIDV5":{ + "type": "object", + "required": ["name", "version"], + "properties": { + "name": { + "type": "string", + "nullable": false, + "example": "string" + }, + "signerSummaryHash": { + "type": "string", + "nullable": true, + "example": "string" + }, + "version": { + "type": "string", + "nullable": false, + "example": "string" + } + } + }, + "FlowV5Error": { + "type": "object", + "required": ["message", "type"], + "properties": { + "message": { + "type": "string", + "nullable": false, + "example": "string" + }, + "type": { + "type": "string", + "nullable": false, + "example": "string" + } + } + } } }, "paths": { @@ -1213,6 +1448,165 @@ } } } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi": { + "get": { + "x-hyperledger-cactus": { + "https": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi" + } + }, + "operationId": "getCPIResponse", + "summary": "List all CPIs uploaded to the cluster", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CPIV5Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}": { + "get": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}" + } + }, + "operationId": "flowStatusResponses", + "summary": "This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running.", + "parameters": [ + { + "name": "holdingIDShortHash", + "in": "path", + "required": true, + "description": "Holding identity short hash", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/FlowStatusV5Responses" + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + } + }, + "post": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}" + } + }, + "operationId": "startFlowParameters", + "summary": "This method starts a new instance for the specified flow for the specified holding identity.", + "requestBody": { + "description": "Request body for starting a flow", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StartFlowV5Request" + } + } + } + }, + "parameters": [ + { + "name": "holdingIDShortHash", + "in": "path", + "required": true, + "description": "Holding identity short hash", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FlowStatusV5Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}": { + "get": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}" + } + }, + "operationId": "flowStatusResponse", + "summary": "This method gets the current status of the specified flow instance.", + "parameters": [ + { + "name": "holdingIDShortHash", + "in": "path", + "required": true, + "description": "Holding identity short hash", + "schema": { + "type": "string" + } + }, + { + "name": "clientRequestID", + "in": "path", + "required": true, + "description": "Client request ID", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/FlowStatusV5Response" + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + } + } } } } diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index 935e06c407f..34d5b857509 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle +docs/CPIIDV5.md +docs/CPIV5Response.md +docs/CPIV5ResponseCpisInner.md +docs/CPIV5ResponseCpisInnerCpksInner.md docs/ClearMonitorTransactionsV1Request.md docs/ClearMonitorTransactionsV1Response.md docs/CordaNodeSshCredentials.md @@ -14,6 +18,10 @@ docs/DeployContractJarsV1Request.md docs/DiagnoseNodeV1Request.md docs/DiagnoseNodeV1Response.md docs/FlowInvocationType.md +docs/FlowStatusV5Response.md +docs/FlowStatusV5Responses.md +docs/FlowStatusV5ResponsesFlowStatusResponsesInner.md +docs/FlowV5Error.md docs/GetMonitorTransactionsV1Request.md docs/GetMonitorTransactionsV1Response.md docs/GetMonitorTransactionsV1ResponseTxInner.md @@ -31,6 +39,8 @@ docs/NodeInfo.md docs/Party.md docs/PublicKey.md docs/SHA256.md +docs/StartFlowV5Request.md +docs/StartFlowV5RequestRequestBody.md docs/StartMonitorV1Request.md docs/StartMonitorV1Response.md docs/StopMonitorV1Request.md @@ -59,6 +69,10 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +src/main/kotlin/org/openapitools/client/models/CPIIDV5.kt +src/main/kotlin/org/openapitools/client/models/CPIV5Response.kt +src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInner.kt +src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInnerCpksInner.kt src/main/kotlin/org/openapitools/client/models/ClearMonitorTransactionsV1Request.kt src/main/kotlin/org/openapitools/client/models/ClearMonitorTransactionsV1Response.kt src/main/kotlin/org/openapitools/client/models/CordaNodeSshCredentials.kt @@ -72,6 +86,10 @@ src/main/kotlin/org/openapitools/client/models/DeployContractJarsV1Request.kt src/main/kotlin/org/openapitools/client/models/DiagnoseNodeV1Request.kt src/main/kotlin/org/openapitools/client/models/DiagnoseNodeV1Response.kt src/main/kotlin/org/openapitools/client/models/FlowInvocationType.kt +src/main/kotlin/org/openapitools/client/models/FlowStatusV5Response.kt +src/main/kotlin/org/openapitools/client/models/FlowStatusV5Responses.kt +src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponsesInner.kt +src/main/kotlin/org/openapitools/client/models/FlowV5Error.kt src/main/kotlin/org/openapitools/client/models/GetMonitorTransactionsV1Request.kt src/main/kotlin/org/openapitools/client/models/GetMonitorTransactionsV1Response.kt src/main/kotlin/org/openapitools/client/models/GetMonitorTransactionsV1ResponseTxInner.kt @@ -89,6 +107,8 @@ src/main/kotlin/org/openapitools/client/models/NodeInfo.kt src/main/kotlin/org/openapitools/client/models/Party.kt src/main/kotlin/org/openapitools/client/models/PublicKey.kt src/main/kotlin/org/openapitools/client/models/SHA256.kt +src/main/kotlin/org/openapitools/client/models/StartFlowV5Request.kt +src/main/kotlin/org/openapitools/client/models/StartFlowV5RequestRequestBody.kt src/main/kotlin/org/openapitools/client/models/StartMonitorV1Request.kt src/main/kotlin/org/openapitools/client/models/StartMonitorV1Response.kt src/main/kotlin/org/openapitools/client/models/StopMonitorV1Request.kt diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/README.md index 653fb5d7541..419cb338ecd 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -47,11 +47,15 @@ Class | Method | HTTP request | Description *DefaultApi* | [**clearMonitorTransactionsV1**](docs/DefaultApi.md#clearmonitortransactionsv1) | **DELETE** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/clear-monitor-transactions | Clear transactions from internal store so they'll not be available by GetMonitorTransactionsV1 anymore. *DefaultApi* | [**deployContractJarsV1**](docs/DefaultApi.md#deploycontractjarsv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/deploy-contract-jars | Deploys a set of jar files (Cordapps, e.g. the contracts in Corda speak). *DefaultApi* | [**diagnoseNodeV1**](docs/DefaultApi.md#diagnosenodev1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/diagnose-node | +*DefaultApi* | [**flowStatusResponse**](docs/DefaultApi.md#flowstatusresponse) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID} | This method gets the current status of the specified flow instance. +*DefaultApi* | [**flowStatusResponses**](docs/DefaultApi.md#flowstatusresponses) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash} | This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. +*DefaultApi* | [**getCPIResponse**](docs/DefaultApi.md#getcpiresponse) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi | List all CPIs uploaded to the cluster *DefaultApi* | [**getMonitorTransactionsV1**](docs/DefaultApi.md#getmonitortransactionsv1) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions | Get transactions for monitored state classes. *DefaultApi* | [**getPrometheusMetricsV1**](docs/DefaultApi.md#getprometheusmetricsv1) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics | Get the Prometheus Metrics *DefaultApi* | [**invokeContractV1**](docs/DefaultApi.md#invokecontractv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/invoke-contract | Invokes a contract on a Corda ledger (e.g. a flow) *DefaultApi* | [**listFlowsV1**](docs/DefaultApi.md#listflowsv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows | *DefaultApi* | [**networkMapV1**](docs/DefaultApi.md#networkmapv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/network-map | +*DefaultApi* | [**startFlowParameters**](docs/DefaultApi.md#startflowparameters) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash} | This method starts a new instance for the specified flow for the specified holding identity. *DefaultApi* | [**startMonitorV1**](docs/DefaultApi.md#startmonitorv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor | Start monitoring corda changes (transactions) of given state class *DefaultApi* | [**stopMonitorV1**](docs/DefaultApi.md#stopmonitorv1) | **DELETE** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/stop-monitor | Stop monitoring corda changes (transactions) of given state class @@ -59,6 +63,10 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [org.openapitools.client.models.CPIIDV5](docs/CPIIDV5.md) + - [org.openapitools.client.models.CPIV5Response](docs/CPIV5Response.md) + - [org.openapitools.client.models.CPIV5ResponseCpisInner](docs/CPIV5ResponseCpisInner.md) + - [org.openapitools.client.models.CPIV5ResponseCpisInnerCpksInner](docs/CPIV5ResponseCpisInnerCpksInner.md) - [org.openapitools.client.models.ClearMonitorTransactionsV1Request](docs/ClearMonitorTransactionsV1Request.md) - [org.openapitools.client.models.ClearMonitorTransactionsV1Response](docs/ClearMonitorTransactionsV1Response.md) - [org.openapitools.client.models.CordaNodeSshCredentials](docs/CordaNodeSshCredentials.md) @@ -72,6 +80,10 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.DiagnoseNodeV1Request](docs/DiagnoseNodeV1Request.md) - [org.openapitools.client.models.DiagnoseNodeV1Response](docs/DiagnoseNodeV1Response.md) - [org.openapitools.client.models.FlowInvocationType](docs/FlowInvocationType.md) + - [org.openapitools.client.models.FlowStatusV5Response](docs/FlowStatusV5Response.md) + - [org.openapitools.client.models.FlowStatusV5Responses](docs/FlowStatusV5Responses.md) + - [org.openapitools.client.models.FlowStatusV5ResponsesFlowStatusResponsesInner](docs/FlowStatusV5ResponsesFlowStatusResponsesInner.md) + - [org.openapitools.client.models.FlowV5Error](docs/FlowV5Error.md) - [org.openapitools.client.models.GetMonitorTransactionsV1Request](docs/GetMonitorTransactionsV1Request.md) - [org.openapitools.client.models.GetMonitorTransactionsV1Response](docs/GetMonitorTransactionsV1Response.md) - [org.openapitools.client.models.GetMonitorTransactionsV1ResponseTxInner](docs/GetMonitorTransactionsV1ResponseTxInner.md) @@ -89,6 +101,8 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.Party](docs/Party.md) - [org.openapitools.client.models.PublicKey](docs/PublicKey.md) - [org.openapitools.client.models.SHA256](docs/SHA256.md) + - [org.openapitools.client.models.StartFlowV5Request](docs/StartFlowV5Request.md) + - [org.openapitools.client.models.StartFlowV5RequestRequestBody](docs/StartFlowV5RequestRequestBody.md) - [org.openapitools.client.models.StartMonitorV1Request](docs/StartMonitorV1Request.md) - [org.openapitools.client.models.StartMonitorV1Response](docs/StartMonitorV1Response.md) - [org.openapitools.client.models.StopMonitorV1Request](docs/StopMonitorV1Request.md) diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIIDV5.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIIDV5.md new file mode 100644 index 00000000000..875a0b4d775 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIIDV5.md @@ -0,0 +1,12 @@ + +# CPIIDV5 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **kotlin.String** | | +**version** | **kotlin.String** | | +**signerSummaryHash** | **kotlin.String** | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5Response.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5Response.md new file mode 100644 index 00000000000..6ed8840a223 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5Response.md @@ -0,0 +1,10 @@ + +# CPIV5Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cpis** | [**kotlin.collections.List<CPIV5ResponseCpisInner>**](CPIV5ResponseCpisInner.md) | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpis.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpis.md new file mode 100644 index 00000000000..fd52bb00d4c --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpis.md @@ -0,0 +1,15 @@ + +# CPIV5ResponseCpis + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cpiFileChecksum** | **kotlin.String** | | [optional] +**cpiFileFullChecksum** | **kotlin.String** | | [optional] +**cpks** | [**kotlin.collections.List<CPIV5ResponseCpks>**](CPIV5ResponseCpks.md) | | [optional] +**groupPolicy** | **kotlin.String** | | [optional] +**id** | [**CPIIDV5**](CPIIDV5.md) | | [optional] +**timestamp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpisInner.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpisInner.md new file mode 100644 index 00000000000..1c08dfde607 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpisInner.md @@ -0,0 +1,15 @@ + +# CPIV5ResponseCpisInner + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cpiFileChecksum** | **kotlin.String** | | [optional] +**cpiFileFullChecksum** | **kotlin.String** | | [optional] +**cpks** | [**kotlin.collections.List<CPIV5ResponseCpisInnerCpksInner>**](CPIV5ResponseCpisInnerCpksInner.md) | | [optional] +**groupPolicy** | **kotlin.String** | | [optional] +**id** | [**CPIIDV5**](CPIIDV5.md) | | [optional] +**timestamp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpisInnerCpksInner.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpisInnerCpksInner.md new file mode 100644 index 00000000000..1c5e19862e8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpisInnerCpksInner.md @@ -0,0 +1,15 @@ + +# CPIV5ResponseCpisInnerCpksInner + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hash** | **kotlin.String** | | [optional] +**id** | [**CPIIDV5**](CPIIDV5.md) | | [optional] +**libraries** | **kotlin.collections.List<kotlin.String>** | | [optional] +**mainBundle** | **kotlin.String** | | [optional] +**timestamp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] +**type** | **kotlin.String** | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpks.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpks.md new file mode 100644 index 00000000000..e2895172e8a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/CPIV5ResponseCpks.md @@ -0,0 +1,15 @@ + +# CPIV5ResponseCpks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hash** | **kotlin.String** | | [optional] +**id** | [**CPIIDV5**](CPIIDV5.md) | | [optional] +**libraries** | **kotlin.collections.List<kotlin.String>** | | [optional] +**mainBundle** | **kotlin.String** | | [optional] +**timestamp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] +**type** | **kotlin.String** | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/DefaultApi.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/DefaultApi.md index ead1f1e7bd7..5060674517f 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/DefaultApi.md +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/DefaultApi.md @@ -7,11 +7,15 @@ Method | HTTP request | Description [**clearMonitorTransactionsV1**](DefaultApi.md#clearMonitorTransactionsV1) | **DELETE** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/clear-monitor-transactions | Clear transactions from internal store so they'll not be available by GetMonitorTransactionsV1 anymore. [**deployContractJarsV1**](DefaultApi.md#deployContractJarsV1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/deploy-contract-jars | Deploys a set of jar files (Cordapps, e.g. the contracts in Corda speak). [**diagnoseNodeV1**](DefaultApi.md#diagnoseNodeV1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/diagnose-node | +[**flowStatusResponse**](DefaultApi.md#flowStatusResponse) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID} | This method gets the current status of the specified flow instance. +[**flowStatusResponses**](DefaultApi.md#flowStatusResponses) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash} | This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. +[**getCPIResponse**](DefaultApi.md#getCPIResponse) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi | List all CPIs uploaded to the cluster [**getMonitorTransactionsV1**](DefaultApi.md#getMonitorTransactionsV1) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions | Get transactions for monitored state classes. [**getPrometheusMetricsV1**](DefaultApi.md#getPrometheusMetricsV1) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics | Get the Prometheus Metrics [**invokeContractV1**](DefaultApi.md#invokeContractV1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/invoke-contract | Invokes a contract on a Corda ledger (e.g. a flow) [**listFlowsV1**](DefaultApi.md#listFlowsV1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows | [**networkMapV1**](DefaultApi.md#networkMapV1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/network-map | +[**startFlowParameters**](DefaultApi.md#startFlowParameters) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash} | This method starts a new instance for the specified flow for the specified holding identity. [**startMonitorV1**](DefaultApi.md#startMonitorV1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor | Start monitoring corda changes (transactions) of given state class [**stopMonitorV1**](DefaultApi.md#stopMonitorV1) | **DELETE** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/stop-monitor | Stop monitoring corda changes (transactions) of given state class @@ -153,6 +157,139 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json + +# **flowStatusResponse** +> FlowStatusV5Response flowStatusResponse(holdingIDShortHash, clientRequestID) + +This method gets the current status of the specified flow instance. + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = DefaultApi() +val holdingIDShortHash : kotlin.String = holdingIDShortHash_example // kotlin.String | Holding identity short hash +val clientRequestID : kotlin.String = clientRequestID_example // kotlin.String | Client request ID +try { + val result : FlowStatusV5Response = apiInstance.flowStatusResponse(holdingIDShortHash, clientRequestID) + println(result) +} catch (e: ClientException) { + println("4xx response calling DefaultApi#flowStatusResponse") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling DefaultApi#flowStatusResponse") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **holdingIDShortHash** | **kotlin.String**| Holding identity short hash | + **clientRequestID** | **kotlin.String**| Client request ID | + +### Return type + +[**FlowStatusV5Response**](FlowStatusV5Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **flowStatusResponses** +> FlowStatusV5Responses flowStatusResponses(holdingIDShortHash) + +This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = DefaultApi() +val holdingIDShortHash : kotlin.String = holdingIDShortHash_example // kotlin.String | Holding identity short hash +try { + val result : FlowStatusV5Responses = apiInstance.flowStatusResponses(holdingIDShortHash) + println(result) +} catch (e: ClientException) { + println("4xx response calling DefaultApi#flowStatusResponses") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling DefaultApi#flowStatusResponses") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **holdingIDShortHash** | **kotlin.String**| Holding identity short hash | + +### Return type + +[**FlowStatusV5Responses**](FlowStatusV5Responses.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **getCPIResponse** +> CPIV5Response getCPIResponse() + +List all CPIs uploaded to the cluster + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = DefaultApi() +try { + val result : CPIV5Response = apiInstance.getCPIResponse() + println(result) +} catch (e: ClientException) { + println("4xx response calling DefaultApi#getCPIResponse") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling DefaultApi#getCPIResponse") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**CPIV5Response**](CPIV5Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + # **getMonitorTransactionsV1** > GetMonitorTransactionsV1Response getMonitorTransactionsV1(getMonitorTransactionsV1Request) @@ -373,6 +510,53 @@ Name | Type | Description | Notes No authorization required +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **startFlowParameters** +> FlowStatusV5Response startFlowParameters(holdingIDShortHash, startFlowV5Request) + +This method starts a new instance for the specified flow for the specified holding identity. + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = DefaultApi() +val holdingIDShortHash : kotlin.String = holdingIDShortHash_example // kotlin.String | Holding identity short hash +val startFlowV5Request : StartFlowV5Request = // StartFlowV5Request | Request body for starting a flow +try { + val result : FlowStatusV5Response = apiInstance.startFlowParameters(holdingIDShortHash, startFlowV5Request) + println(result) +} catch (e: ClientException) { + println("4xx response calling DefaultApi#startFlowParameters") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling DefaultApi#startFlowParameters") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **holdingIDShortHash** | **kotlin.String**| Holding identity short hash | + **startFlowV5Request** | [**StartFlowV5Request**](StartFlowV5Request.md)| Request body for starting a flow | + +### Return type + +[**FlowStatusV5Response**](FlowStatusV5Response.md) + +### Authorization + +No authorization required + ### HTTP request headers - **Content-Type**: application/json diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatus.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatus.md new file mode 100644 index 00000000000..fbe70b112f8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatus.md @@ -0,0 +1,16 @@ + +# FlowStatus + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**flowError** | [**FlowStatusFlowError**](FlowStatusFlowError.md) | | +**flowStatus** | **kotlin.String** | | +**holdingIDShortHash** | **kotlin.String** | | +**timestamp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | +**clientRequestId** | **kotlin.String** | | [optional] +**flowId** | **kotlin.String** | | [optional] +**flowResult** | [**kotlin.collections.List<kotlin.Any>**](kotlin.Any.md) | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusFlowError.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusFlowError.md new file mode 100644 index 00000000000..21a185fdf98 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusFlowError.md @@ -0,0 +1,11 @@ + +# FlowStatusFlowError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **kotlin.String** | | +**type** | **kotlin.String** | | + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5Response.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5Response.md new file mode 100644 index 00000000000..d0c149e6622 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5Response.md @@ -0,0 +1,16 @@ + +# FlowStatusV5Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**flowStatus** | **kotlin.String** | | +**holdingIDShortHash** | **kotlin.String** | | +**timestamp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | +**clientRequestId** | **kotlin.String** | | [optional] +**flowError** | [**FlowV5Error**](FlowV5Error.md) | | [optional] +**flowId** | **kotlin.String** | | [optional] +**flowResult** | **kotlin.String** | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5Responses.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5Responses.md new file mode 100644 index 00000000000..19d43f5aab6 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5Responses.md @@ -0,0 +1,10 @@ + +# FlowStatusV5Responses + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**flowStatusResponses** | [**kotlin.collections.List<FlowStatusV5ResponsesFlowStatusResponsesInner>**](FlowStatusV5ResponsesFlowStatusResponsesInner.md) | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5ResponsesFlowStatusResponses.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5ResponsesFlowStatusResponses.md new file mode 100644 index 00000000000..cfcee5f3fc1 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5ResponsesFlowStatusResponses.md @@ -0,0 +1,16 @@ + +# FlowStatusV5ResponsesFlowStatusResponses + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**clientRequestId** | **kotlin.String** | | [optional] +**flowError** | [**FlowV5Error**](FlowV5Error.md) | | [optional] +**flowId** | **kotlin.String** | | [optional] +**flowResult** | **kotlin.String** | | [optional] +**flowStatus** | **kotlin.String** | | [optional] +**holdingIDShortHash** | **kotlin.String** | | [optional] +**timestamp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5ResponsesFlowStatusResponsesInner.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5ResponsesFlowStatusResponsesInner.md new file mode 100644 index 00000000000..064cb714b8b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowStatusV5ResponsesFlowStatusResponsesInner.md @@ -0,0 +1,16 @@ + +# FlowStatusV5ResponsesFlowStatusResponsesInner + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**clientRequestId** | **kotlin.String** | | [optional] +**flowError** | [**FlowV5Error**](FlowV5Error.md) | | [optional] +**flowId** | **kotlin.String** | | [optional] +**flowResult** | **kotlin.String** | | [optional] +**flowStatus** | **kotlin.String** | | [optional] +**holdingIDShortHash** | **kotlin.String** | | [optional] +**timestamp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowV5Error.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowV5Error.md new file mode 100644 index 00000000000..622147d0812 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/FlowV5Error.md @@ -0,0 +1,11 @@ + +# FlowV5Error + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **kotlin.String** | | +**type** | **kotlin.String** | | + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/StartFlowV5Request.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/StartFlowV5Request.md new file mode 100644 index 00000000000..7ab82a98bfb --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/StartFlowV5Request.md @@ -0,0 +1,12 @@ + +# StartFlowV5Request + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**clientRequestId** | **kotlin.String** | | +**flowClassName** | **kotlin.String** | | +**requestBody** | [**StartFlowV5RequestRequestBody**](StartFlowV5RequestRequestBody.md) | | + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/StartFlowV5RequestRequestBody.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/StartFlowV5RequestRequestBody.md new file mode 100644 index 00000000000..8e2a8b36830 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/StartFlowV5RequestRequestBody.md @@ -0,0 +1,13 @@ + +# StartFlowV5RequestRequestBody + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chatName** | **kotlin.String** | | [optional] +**otherMember** | **kotlin.String** | | [optional] +**message** | **kotlin.String** | | [optional] +**numberOfRecords** | **kotlin.String** | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 2ee32d5289f..adfe30eb42b 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -19,6 +19,7 @@ import java.io.IOException import okhttp3.OkHttpClient import okhttp3.HttpUrl +import org.openapitools.client.models.CPIV5Response import org.openapitools.client.models.ClearMonitorTransactionsV1Request import org.openapitools.client.models.ClearMonitorTransactionsV1Response import org.openapitools.client.models.DeployContractJarsBadRequestV1Response @@ -26,6 +27,8 @@ import org.openapitools.client.models.DeployContractJarsSuccessV1Response import org.openapitools.client.models.DeployContractJarsV1Request import org.openapitools.client.models.DiagnoseNodeV1Request import org.openapitools.client.models.DiagnoseNodeV1Response +import org.openapitools.client.models.FlowStatusV5Response +import org.openapitools.client.models.FlowStatusV5Responses import org.openapitools.client.models.GetMonitorTransactionsV1Request import org.openapitools.client.models.GetMonitorTransactionsV1Response import org.openapitools.client.models.InvokeContractV1Request @@ -33,6 +36,7 @@ import org.openapitools.client.models.InvokeContractV1Response import org.openapitools.client.models.ListFlowsV1Request import org.openapitools.client.models.ListFlowsV1Response import org.openapitools.client.models.NodeInfo +import org.openapitools.client.models.StartFlowV5Request import org.openapitools.client.models.StartMonitorV1Request import org.openapitools.client.models.StartMonitorV1Response import org.openapitools.client.models.StopMonitorV1Request @@ -278,6 +282,217 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } + /** + * This method gets the current status of the specified flow instance. + * + * @param holdingIDShortHash Holding identity short hash + * @param clientRequestID Client request ID + * @return FlowStatusV5Response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun flowStatusResponse(holdingIDShortHash: kotlin.String, clientRequestID: kotlin.String) : FlowStatusV5Response { + val localVarResponse = flowStatusResponseWithHttpInfo(holdingIDShortHash = holdingIDShortHash, clientRequestID = clientRequestID) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as FlowStatusV5Response + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * This method gets the current status of the specified flow instance. + * + * @param holdingIDShortHash Holding identity short hash + * @param clientRequestID Client request ID + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun flowStatusResponseWithHttpInfo(holdingIDShortHash: kotlin.String, clientRequestID: kotlin.String) : ApiResponse { + val localVariableConfig = flowStatusResponseRequestConfig(holdingIDShortHash = holdingIDShortHash, clientRequestID = clientRequestID) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation flowStatusResponse + * + * @param holdingIDShortHash Holding identity short hash + * @param clientRequestID Client request ID + * @return RequestConfig + */ + fun flowStatusResponseRequestConfig(holdingIDShortHash: kotlin.String, clientRequestID: kotlin.String) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + + return RequestConfig( + method = RequestMethod.GET, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}".replace("{"+"holdingIDShortHash"+"}", encodeURIComponent(holdingIDShortHash.toString())).replace("{"+"clientRequestID"+"}", encodeURIComponent(clientRequestID.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. + * + * @param holdingIDShortHash Holding identity short hash + * @return FlowStatusV5Responses + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun flowStatusResponses(holdingIDShortHash: kotlin.String) : FlowStatusV5Responses { + val localVarResponse = flowStatusResponsesWithHttpInfo(holdingIDShortHash = holdingIDShortHash) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as FlowStatusV5Responses + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. + * + * @param holdingIDShortHash Holding identity short hash + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun flowStatusResponsesWithHttpInfo(holdingIDShortHash: kotlin.String) : ApiResponse { + val localVariableConfig = flowStatusResponsesRequestConfig(holdingIDShortHash = holdingIDShortHash) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation flowStatusResponses + * + * @param holdingIDShortHash Holding identity short hash + * @return RequestConfig + */ + fun flowStatusResponsesRequestConfig(holdingIDShortHash: kotlin.String) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + + return RequestConfig( + method = RequestMethod.GET, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}".replace("{"+"holdingIDShortHash"+"}", encodeURIComponent(holdingIDShortHash.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * List all CPIs uploaded to the cluster + * + * @return CPIV5Response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getCPIResponse() : CPIV5Response { + val localVarResponse = getCPIResponseWithHttpInfo() + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as CPIV5Response + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * List all CPIs uploaded to the cluster + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getCPIResponseWithHttpInfo() : ApiResponse { + val localVariableConfig = getCPIResponseRequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getCPIResponse + * + * @return RequestConfig + */ + fun getCPIResponseRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + /** * Get transactions for monitored state classes. * @@ -633,6 +848,81 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } + /** + * This method starts a new instance for the specified flow for the specified holding identity. + * + * @param holdingIDShortHash Holding identity short hash + * @param startFlowV5Request Request body for starting a flow + * @return FlowStatusV5Response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun startFlowParameters(holdingIDShortHash: kotlin.String, startFlowV5Request: StartFlowV5Request) : FlowStatusV5Response { + val localVarResponse = startFlowParametersWithHttpInfo(holdingIDShortHash = holdingIDShortHash, startFlowV5Request = startFlowV5Request) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as FlowStatusV5Response + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * This method starts a new instance for the specified flow for the specified holding identity. + * + * @param holdingIDShortHash Holding identity short hash + * @param startFlowV5Request Request body for starting a flow + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun startFlowParametersWithHttpInfo(holdingIDShortHash: kotlin.String, startFlowV5Request: StartFlowV5Request) : ApiResponse { + val localVariableConfig = startFlowParametersRequestConfig(holdingIDShortHash = holdingIDShortHash, startFlowV5Request = startFlowV5Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation startFlowParameters + * + * @param holdingIDShortHash Holding identity short hash + * @param startFlowV5Request Request body for starting a flow + * @return RequestConfig + */ + fun startFlowParametersRequestConfig(holdingIDShortHash: kotlin.String, startFlowV5Request: StartFlowV5Request) : RequestConfig { + val localVariableBody = startFlowV5Request + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}".replace("{"+"holdingIDShortHash"+"}", encodeURIComponent(holdingIDShortHash.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + /** * Start monitoring corda changes (transactions) of given state class * diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIIDV5.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIIDV5.kt new file mode 100644 index 00000000000..3299d86e4f2 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIIDV5.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param name + * @param version + * @param signerSummaryHash + */ + + +data class CPIIDV5 ( + + @Json(name = "name") + val name: kotlin.String, + + @Json(name = "version") + val version: kotlin.String, + + @Json(name = "signerSummaryHash") + val signerSummaryHash: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5Response.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5Response.kt new file mode 100644 index 00000000000..10ca088fb66 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5Response.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.CPIV5ResponseCpisInner + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param cpis + */ + + +data class CPIV5Response ( + + @Json(name = "cpis") + val cpis: kotlin.collections.List? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpis.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpis.kt new file mode 100644 index 00000000000..1902548f973 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpis.kt @@ -0,0 +1,60 @@ +/** + * Hyperledger Cactus Plugin - Connector Corda + * + * Can perform basic tasks on a Corda ledger + * + * The version of the OpenAPI document: 0.3.0 + * + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.CPIIDV5 +import org.openapitools.client.models.CPIV5ResponseCpks + +import com.squareup.moshi.Json + +/** + * + * + * @param cpiFileChecksum + * @param cpiFileFullChecksum + * @param cpks + * @param groupPolicy + * @param id + * @param timestamp + */ + +data class CPIV5ResponseCpis ( + + @Json(name = "cpiFileChecksum") + val cpiFileChecksum: kotlin.String? = null, + + @Json(name = "cpiFileFullChecksum") + val cpiFileFullChecksum: kotlin.String? = null, + + @Json(name = "cpks") + val cpks: kotlin.collections.List? = null, + + @Json(name = "groupPolicy") + val groupPolicy: kotlin.String? = null, + + @Json(name = "id") + val id: CPIIDV5? = null, + + @Json(name = "timestamp") + val timestamp: java.time.OffsetDateTime? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInner.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInner.kt new file mode 100644 index 00000000000..44d41d06dab --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInner.kt @@ -0,0 +1,57 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.CPIIDV5 +import org.openapitools.client.models.CPIV5ResponseCpisInnerCpksInner + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param cpiFileChecksum + * @param cpiFileFullChecksum + * @param cpks + * @param groupPolicy + * @param id + * @param timestamp + */ + + +data class CPIV5ResponseCpisInner ( + + @Json(name = "cpiFileChecksum") + val cpiFileChecksum: kotlin.String? = null, + + @Json(name = "cpiFileFullChecksum") + val cpiFileFullChecksum: kotlin.String? = null, + + @Json(name = "cpks") + val cpks: kotlin.collections.List? = null, + + @Json(name = "groupPolicy") + val groupPolicy: kotlin.String? = null, + + @Json(name = "id") + val id: CPIIDV5? = null, + + @Json(name = "timestamp") + val timestamp: java.time.OffsetDateTime? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInnerCpksInner.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInnerCpksInner.kt new file mode 100644 index 00000000000..e000d075e38 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpisInnerCpksInner.kt @@ -0,0 +1,56 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.CPIIDV5 + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param hash + * @param id + * @param libraries + * @param mainBundle + * @param timestamp + * @param type + */ + + +data class CPIV5ResponseCpisInnerCpksInner ( + + @Json(name = "hash") + val hash: kotlin.String? = null, + + @Json(name = "id") + val id: CPIIDV5? = null, + + @Json(name = "libraries") + val libraries: kotlin.collections.List? = null, + + @Json(name = "mainBundle") + val mainBundle: kotlin.String? = null, + + @Json(name = "timestamp") + val timestamp: java.time.OffsetDateTime? = null, + + @Json(name = "type") + val type: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpks.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpks.kt new file mode 100644 index 00000000000..e2f54de7d9e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CPIV5ResponseCpks.kt @@ -0,0 +1,59 @@ +/** + * Hyperledger Cactus Plugin - Connector Corda + * + * Can perform basic tasks on a Corda ledger + * + * The version of the OpenAPI document: 0.3.0 + * + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.CPIIDV5 + +import com.squareup.moshi.Json + +/** + * + * + * @param hash + * @param id + * @param libraries + * @param mainBundle + * @param timestamp + * @param type + */ + +data class CPIV5ResponseCpks ( + + @Json(name = "hash") + val hash: kotlin.String? = null, + + @Json(name = "id") + val id: CPIIDV5? = null, + + @Json(name = "libraries") + val libraries: kotlin.collections.List? = null, + + @Json(name = "mainBundle") + val mainBundle: kotlin.String? = null, + + @Json(name = "timestamp") + val timestamp: java.time.OffsetDateTime? = null, + + @Json(name = "type") + val type: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatus.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatus.kt new file mode 100644 index 00000000000..fe631038551 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatus.kt @@ -0,0 +1,63 @@ +/** + * Hyperledger Cactus Plugin - Connector Corda + * + * Can perform basic tasks on a Corda ledger + * + * The version of the OpenAPI document: 0.3.0 + * + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.FlowStatusFlowError + +import com.squareup.moshi.Json + +/** + * + * + * @param flowError + * @param flowStatus + * @param holdingIDShortHash + * @param timestamp + * @param clientRequestId + * @param flowId + * @param flowResult + */ + +data class FlowStatus ( + + @Json(name = "flowError") + val flowError: FlowStatusFlowError, + + @Json(name = "flowStatus") + val flowStatus: kotlin.String, + + @Json(name = "holdingIDShortHash") + val holdingIDShortHash: kotlin.String, + + @Json(name = "timestamp") + val timestamp: java.time.OffsetDateTime, + + @Json(name = "clientRequestId") + val clientRequestId: kotlin.String? = null, + + @Json(name = "flowId") + val flowId: kotlin.String? = null, + + @Json(name = "flowResult") + val flowResult: kotlin.collections.List? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusFlowError.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusFlowError.kt new file mode 100644 index 00000000000..f001a1b2657 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusFlowError.kt @@ -0,0 +1,42 @@ +/** + * Hyperledger Cactus Plugin - Connector Corda + * + * Can perform basic tasks on a Corda ledger + * + * The version of the OpenAPI document: 0.3.0 + * + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json + +/** + * + * + * @param message + * @param type + */ + +data class FlowStatusFlowError ( + + @Json(name = "message") + val message: kotlin.String, + + @Json(name = "type") + val type: kotlin.String + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5Response.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5Response.kt new file mode 100644 index 00000000000..47337d9cf14 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5Response.kt @@ -0,0 +1,60 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.FlowV5Error + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param flowStatus + * @param holdingIDShortHash + * @param timestamp + * @param clientRequestId + * @param flowError + * @param flowId + * @param flowResult + */ + + +data class FlowStatusV5Response ( + + @Json(name = "flowStatus") + val flowStatus: kotlin.String, + + @Json(name = "holdingIDShortHash") + val holdingIDShortHash: kotlin.String, + + @Json(name = "timestamp") + val timestamp: java.time.OffsetDateTime, + + @Json(name = "clientRequestId") + val clientRequestId: kotlin.String? = null, + + @Json(name = "flowError") + val flowError: FlowV5Error? = null, + + @Json(name = "flowId") + val flowId: kotlin.String? = null, + + @Json(name = "flowResult") + val flowResult: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5Responses.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5Responses.kt new file mode 100644 index 00000000000..f2f3e895102 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5Responses.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.FlowStatusV5ResponsesFlowStatusResponsesInner + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param flowStatusResponses + */ + + +data class FlowStatusV5Responses ( + + @Json(name = "flowStatusResponses") + val flowStatusResponses: kotlin.collections.List? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponses.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponses.kt new file mode 100644 index 00000000000..d6f3e9d109f --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponses.kt @@ -0,0 +1,63 @@ +/** + * Hyperledger Cactus Plugin - Connector Corda + * + * Can perform basic tasks on a Corda ledger + * + * The version of the OpenAPI document: 0.3.0 + * + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.FlowV5Error + +import com.squareup.moshi.Json + +/** + * + * + * @param clientRequestId + * @param flowError + * @param flowId + * @param flowResult + * @param flowStatus + * @param holdingIDShortHash + * @param timestamp + */ + +data class FlowStatusV5ResponsesFlowStatusResponses ( + + @Json(name = "clientRequestId") + val clientRequestId: kotlin.String? = null, + + @Json(name = "flowError") + val flowError: FlowV5Error? = null, + + @Json(name = "flowId") + val flowId: kotlin.String? = null, + + @Json(name = "flowResult") + val flowResult: kotlin.String? = null, + + @Json(name = "flowStatus") + val flowStatus: kotlin.String? = null, + + @Json(name = "holdingIDShortHash") + val holdingIDShortHash: kotlin.String? = null, + + @Json(name = "timestamp") + val timestamp: java.time.OffsetDateTime? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponsesInner.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponsesInner.kt new file mode 100644 index 00000000000..0bafc0a1e51 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowStatusV5ResponsesFlowStatusResponsesInner.kt @@ -0,0 +1,60 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.FlowV5Error + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param clientRequestId + * @param flowError + * @param flowId + * @param flowResult + * @param flowStatus + * @param holdingIDShortHash + * @param timestamp + */ + + +data class FlowStatusV5ResponsesFlowStatusResponsesInner ( + + @Json(name = "clientRequestId") + val clientRequestId: kotlin.String? = null, + + @Json(name = "flowError") + val flowError: FlowV5Error? = null, + + @Json(name = "flowId") + val flowId: kotlin.String? = null, + + @Json(name = "flowResult") + val flowResult: kotlin.String? = null, + + @Json(name = "flowStatus") + val flowStatus: kotlin.String? = null, + + @Json(name = "holdingIDShortHash") + val holdingIDShortHash: kotlin.String? = null, + + @Json(name = "timestamp") + val timestamp: java.time.OffsetDateTime? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowV5Error.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowV5Error.kt new file mode 100644 index 00000000000..18c0d00ed07 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FlowV5Error.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param message + * @param type + */ + + +data class FlowV5Error ( + + @Json(name = "message") + val message: kotlin.String, + + @Json(name = "type") + val type: kotlin.String + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/StartFlowV5Request.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/StartFlowV5Request.kt new file mode 100644 index 00000000000..425a6ffe739 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/StartFlowV5Request.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.StartFlowV5RequestRequestBody + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method starts a new instance for the specified flow for the specified holding identity. + * + * @param clientRequestId + * @param flowClassName + * @param requestBody + */ + + +data class StartFlowV5Request ( + + @Json(name = "clientRequestId") + val clientRequestId: kotlin.String, + + @Json(name = "flowClassName") + val flowClassName: kotlin.String, + + @Json(name = "requestBody") + val requestBody: StartFlowV5RequestRequestBody + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/StartFlowV5RequestRequestBody.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/StartFlowV5RequestRequestBody.kt new file mode 100644 index 00000000000..45e22a103d6 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/StartFlowV5RequestRequestBody.kt @@ -0,0 +1,47 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param chatName + * @param otherMember + * @param message + * @param numberOfRecords + */ + + +data class StartFlowV5RequestRequestBody ( + + @Json(name = "chatName") + val chatName: kotlin.String? = null, + + @Json(name = "otherMember") + val otherMember: kotlin.String? = null, + + @Json(name = "message") + val message: kotlin.String? = null, + + @Json(name = "numberOfRecords") + val numberOfRecords: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/generated/openapi/typescript-axios/api.ts index 7a221d23b2b..c4574f0f6ec 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -23,6 +23,130 @@ import type { RequestArgs } from './base'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; +/** + * + * @export + * @interface CPIIDV5 + */ +export interface CPIIDV5 { + /** + * + * @type {string} + * @memberof CPIIDV5 + */ + 'name': string; + /** + * + * @type {string} + * @memberof CPIIDV5 + */ + 'signerSummaryHash'?: string | null; + /** + * + * @type {string} + * @memberof CPIIDV5 + */ + 'version': string; +} +/** + * + * @export + * @interface CPIV5Response + */ +export interface CPIV5Response { + /** + * + * @type {Array} + * @memberof CPIV5Response + */ + 'cpis'?: Array; +} +/** + * + * @export + * @interface CPIV5ResponseCpisInner + */ +export interface CPIV5ResponseCpisInner { + /** + * + * @type {string} + * @memberof CPIV5ResponseCpisInner + */ + 'cpiFileChecksum'?: string; + /** + * + * @type {string} + * @memberof CPIV5ResponseCpisInner + */ + 'cpiFileFullChecksum'?: string; + /** + * + * @type {Array} + * @memberof CPIV5ResponseCpisInner + */ + 'cpks'?: Array; + /** + * + * @type {string} + * @memberof CPIV5ResponseCpisInner + */ + 'groupPolicy'?: string | null; + /** + * + * @type {CPIIDV5} + * @memberof CPIV5ResponseCpisInner + */ + 'id'?: CPIIDV5; + /** + * + * @type {string} + * @memberof CPIV5ResponseCpisInner + */ + 'timestamp'?: string; +} +/** + * + * @export + * @interface CPIV5ResponseCpisInnerCpksInner + */ +export interface CPIV5ResponseCpisInnerCpksInner { + /** + * + * @type {string} + * @memberof CPIV5ResponseCpisInnerCpksInner + */ + 'hash'?: string; + /** + * + * @type {CPIIDV5} + * @memberof CPIV5ResponseCpisInnerCpksInner + */ + 'id'?: CPIIDV5; + /** + * + * @type {Array} + * @memberof CPIV5ResponseCpisInnerCpksInner + */ + 'libraries'?: Array; + /** + * + * @type {string} + * @memberof CPIV5ResponseCpisInnerCpksInner + */ + 'mainBundle'?: string; + /** + * + * @type {string} + * @memberof CPIV5ResponseCpisInnerCpksInner + */ + 'timestamp'?: string; + /** + * + * @type {string} + * @memberof CPIV5ResponseCpisInnerCpksInner + */ + 'type'?: string; +} /** * * @export @@ -373,6 +497,136 @@ export const FlowInvocationType = { export type FlowInvocationType = typeof FlowInvocationType[keyof typeof FlowInvocationType]; +/** + * + * @export + * @interface FlowStatusV5Response + */ +export interface FlowStatusV5Response { + /** + * + * @type {string} + * @memberof FlowStatusV5Response + */ + 'clientRequestId'?: string | null; + /** + * + * @type {FlowV5Error} + * @memberof FlowStatusV5Response + */ + 'flowError'?: FlowV5Error; + /** + * + * @type {string} + * @memberof FlowStatusV5Response + */ + 'flowId'?: string | null; + /** + * + * @type {string} + * @memberof FlowStatusV5Response + */ + 'flowResult'?: string | null; + /** + * + * @type {string} + * @memberof FlowStatusV5Response + */ + 'flowStatus': string; + /** + * + * @type {string} + * @memberof FlowStatusV5Response + */ + 'holdingIDShortHash': string; + /** + * + * @type {string} + * @memberof FlowStatusV5Response + */ + 'timestamp': string; +} +/** + * + * @export + * @interface FlowStatusV5Responses + */ +export interface FlowStatusV5Responses { + /** + * + * @type {Array} + * @memberof FlowStatusV5Responses + */ + 'flowStatusResponses'?: Array; +} +/** + * + * @export + * @interface FlowStatusV5ResponsesFlowStatusResponsesInner + */ +export interface FlowStatusV5ResponsesFlowStatusResponsesInner { + /** + * + * @type {string} + * @memberof FlowStatusV5ResponsesFlowStatusResponsesInner + */ + 'clientRequestId'?: string | null; + /** + * + * @type {FlowV5Error} + * @memberof FlowStatusV5ResponsesFlowStatusResponsesInner + */ + 'flowError'?: FlowV5Error; + /** + * + * @type {string} + * @memberof FlowStatusV5ResponsesFlowStatusResponsesInner + */ + 'flowId'?: string | null; + /** + * + * @type {string} + * @memberof FlowStatusV5ResponsesFlowStatusResponsesInner + */ + 'flowResult'?: string | null; + /** + * + * @type {string} + * @memberof FlowStatusV5ResponsesFlowStatusResponsesInner + */ + 'flowStatus'?: string; + /** + * + * @type {string} + * @memberof FlowStatusV5ResponsesFlowStatusResponsesInner + */ + 'holdingIDShortHash'?: string; + /** + * + * @type {string} + * @memberof FlowStatusV5ResponsesFlowStatusResponsesInner + */ + 'timestamp'?: string; +} +/** + * + * @export + * @interface FlowV5Error + */ +export interface FlowV5Error { + /** + * + * @type {string} + * @memberof FlowV5Error + */ + 'message': string; + /** + * + * @type {string} + * @memberof FlowV5Error + */ + 'type': string; +} /** * * @export @@ -799,6 +1053,62 @@ export interface SHA256 { */ 'size': number; } +/** + * This method starts a new instance for the specified flow for the specified holding identity. + * @export + * @interface StartFlowV5Request + */ +export interface StartFlowV5Request { + /** + * + * @type {string} + * @memberof StartFlowV5Request + */ + 'clientRequestId': string; + /** + * + * @type {string} + * @memberof StartFlowV5Request + */ + 'flowClassName': string; + /** + * + * @type {StartFlowV5RequestRequestBody} + * @memberof StartFlowV5Request + */ + 'requestBody': StartFlowV5RequestRequestBody; +} +/** + * + * @export + * @interface StartFlowV5RequestRequestBody + */ +export interface StartFlowV5RequestRequestBody { + /** + * + * @type {string} + * @memberof StartFlowV5RequestRequestBody + */ + 'chatName'?: string; + /** + * + * @type {string} + * @memberof StartFlowV5RequestRequestBody + */ + 'otherMember'?: string; + /** + * + * @type {string} + * @memberof StartFlowV5RequestRequestBody + */ + 'message'?: string; + /** + * + * @type {string} + * @memberof StartFlowV5RequestRequestBody + */ + 'numberOfRecords'?: string; +} /** * * @export @@ -1002,6 +1312,108 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati options: localVarRequestOptions, }; }, + /** + * + * @summary This method gets the current status of the specified flow instance. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {string} clientRequestID Client request ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + flowStatusResponse: async (holdingIDShortHash: string, clientRequestID: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'holdingIDShortHash' is not null or undefined + assertParamExists('flowStatusResponse', 'holdingIDShortHash', holdingIDShortHash) + // verify required parameter 'clientRequestID' is not null or undefined + assertParamExists('flowStatusResponse', 'clientRequestID', clientRequestID) + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}` + .replace(`{${"holdingIDShortHash"}}`, encodeURIComponent(String(holdingIDShortHash))) + .replace(`{${"clientRequestID"}}`, encodeURIComponent(String(clientRequestID))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + flowStatusResponses: async (holdingIDShortHash: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'holdingIDShortHash' is not null or undefined + assertParamExists('flowStatusResponses', 'holdingIDShortHash', holdingIDShortHash) + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}` + .replace(`{${"holdingIDShortHash"}}`, encodeURIComponent(String(holdingIDShortHash))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary List all CPIs uploaded to the cluster + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCPIResponse: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary Get transactions for monitored state classes. @@ -1166,6 +1578,46 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati options: localVarRequestOptions, }; }, + /** + * + * @summary This method starts a new instance for the specified flow for the specified holding identity. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {StartFlowV5Request} startFlowV5Request Request body for starting a flow + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + startFlowParameters: async (holdingIDShortHash: string, startFlowV5Request: StartFlowV5Request, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'holdingIDShortHash' is not null or undefined + assertParamExists('startFlowParameters', 'holdingIDShortHash', holdingIDShortHash) + // verify required parameter 'startFlowV5Request' is not null or undefined + assertParamExists('startFlowParameters', 'startFlowV5Request', startFlowV5Request) + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}` + .replace(`{${"holdingIDShortHash"}}`, encodeURIComponent(String(holdingIDShortHash))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(startFlowV5Request, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary Start monitoring corda changes (transactions) of given state class @@ -1276,6 +1728,39 @@ export const DefaultApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.diagnoseNodeV1(diagnoseNodeV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @summary This method gets the current status of the specified flow instance. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {string} clientRequestID Client request ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async flowStatusResponse(holdingIDShortHash: string, clientRequestID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.flowStatusResponse(holdingIDShortHash, clientRequestID, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async flowStatusResponses(holdingIDShortHash: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.flowStatusResponses(holdingIDShortHash, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary List all CPIs uploaded to the cluster + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCPIResponse(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getCPIResponse(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @summary Get transactions for monitored state classes. @@ -1328,6 +1813,18 @@ export const DefaultApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.networkMapV1(body, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @summary This method starts a new instance for the specified flow for the specified holding identity. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {StartFlowV5Request} startFlowV5Request Request body for starting a flow + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async startFlowParameters(holdingIDShortHash: string, startFlowV5Request: StartFlowV5Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.startFlowParameters(holdingIDShortHash, startFlowV5Request, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @summary Start monitoring corda changes (transactions) of given state class @@ -1389,6 +1886,36 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa diagnoseNodeV1(diagnoseNodeV1Request?: DiagnoseNodeV1Request, options?: any): AxiosPromise { return localVarFp.diagnoseNodeV1(diagnoseNodeV1Request, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary This method gets the current status of the specified flow instance. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {string} clientRequestID Client request ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + flowStatusResponse(holdingIDShortHash: string, clientRequestID: string, options?: any): AxiosPromise { + return localVarFp.flowStatusResponse(holdingIDShortHash, clientRequestID, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + flowStatusResponses(holdingIDShortHash: string, options?: any): AxiosPromise { + return localVarFp.flowStatusResponses(holdingIDShortHash, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary List all CPIs uploaded to the cluster + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCPIResponse(options?: any): AxiosPromise { + return localVarFp.getCPIResponse(options).then((request) => request(axios, basePath)); + }, /** * * @summary Get transactions for monitored state classes. @@ -1436,6 +1963,17 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa networkMapV1(body?: object, options?: any): AxiosPromise> { return localVarFp.networkMapV1(body, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary This method starts a new instance for the specified flow for the specified holding identity. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {StartFlowV5Request} startFlowV5Request Request body for starting a flow + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + startFlowParameters(holdingIDShortHash: string, startFlowV5Request: StartFlowV5Request, options?: any): AxiosPromise { + return localVarFp.startFlowParameters(holdingIDShortHash, startFlowV5Request, options).then((request) => request(axios, basePath)); + }, /** * * @summary Start monitoring corda changes (transactions) of given state class @@ -1501,6 +2039,42 @@ export class DefaultApi extends BaseAPI { return DefaultApiFp(this.configuration).diagnoseNodeV1(diagnoseNodeV1Request, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary This method gets the current status of the specified flow instance. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {string} clientRequestID Client request ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public flowStatusResponse(holdingIDShortHash: string, clientRequestID: string, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).flowStatusResponse(holdingIDShortHash, clientRequestID, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public flowStatusResponses(holdingIDShortHash: string, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).flowStatusResponses(holdingIDShortHash, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary List all CPIs uploaded to the cluster + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public getCPIResponse(options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).getCPIResponse(options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Get transactions for monitored state classes. @@ -1558,6 +2132,19 @@ export class DefaultApi extends BaseAPI { return DefaultApiFp(this.configuration).networkMapV1(body, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary This method starts a new instance for the specified flow for the specified holding identity. + * @param {string} holdingIDShortHash Holding identity short hash + * @param {StartFlowV5Request} startFlowV5Request Request body for starting a flow + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public startFlowParameters(holdingIDShortHash: string, startFlowV5Request: StartFlowV5Request, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).startFlowParameters(holdingIDShortHash, startFlowV5Request, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Start monitoring corda changes (transactions) of given state class diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/plugin-ledger-connector-corda.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/plugin-ledger-connector-corda.ts index 22d6b1ff8f1..1fe750c6941 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/plugin-ledger-connector-corda.ts +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/plugin-ledger-connector-corda.ts @@ -32,6 +32,19 @@ import { IInvokeContractEndpointV1Options, InvokeContractEndpointV1, } from "./web-services/invoke-contract-endpoint-v1"; + +import { + IListCPIEndpointV1Options, + ListCPIEndpointV1, +} from "./web-services/get-cpi-endpoint-v1"; +import { + IFlowStatusEndpointV1Options, + FlowStatusEndpointV1, +} from "./web-services/list-flow-status-endpoint-v1"; +import { + IFlowStatusResponseEndpointV1Options, + FlowStatusResponseEndpointV1, +} from "./web-services/get-flow-status-response-endpoint-v1"; import { IListFlowsEndpointV1Options, ListFlowsEndpointV1, @@ -47,6 +60,10 @@ import { import fs from "fs"; +export enum CordaVersion { + CORDA_V4X = "CORDA_V4X", + CORDA_V5 = "CORDA_V5", +} export interface IPluginLedgerConnectorCordaOptions extends ICactusPluginOptions { logLevel?: LogLevelDesc; @@ -56,6 +73,9 @@ export interface IPluginLedgerConnectorCordaOptions cordaStartCmd?: string; cordaStopCmd?: string; apiUrl?: string; + cordaVersion?: CordaVersion; + holdingIDShortHash?: any; + clientRequestID?: any; /** * Path to the file where the private key for the ssh configuration is located * This property is optional. Its use is not recommended for most cases, it will override the privateKey property of the sshConfigAdminShell. @@ -204,11 +224,12 @@ export class PluginLedgerConnectorCorda const endpoint = new GetPrometheusExporterMetricsEndpointV1(opts); endpoints.push(endpoint); } - { const opts: IListFlowsEndpointV1Options = { apiUrl: this.options.apiUrl, logLevel: this.options.logLevel, + cordaVersion: this.options.cordaVersion, + connector: this, }; const endpoint = new ListFlowsEndpointV1(opts); endpoints.push(endpoint); @@ -232,6 +253,35 @@ export class PluginLedgerConnectorCorda endpoints.push(endpoint); } + { + const opts: IListCPIEndpointV1Options = { + apiUrl: this.options.apiUrl, + logLevel: this.options.logLevel, + }; + const endpoint = new ListCPIEndpointV1(opts); + endpoints.push(endpoint); + } + + { + const opts: IFlowStatusEndpointV1Options = { + apiUrl: this.options.apiUrl, + logLevel: this.options.logLevel, + holdingIDShortHash: this.options.holdingIDShortHash, + }; + const endpoint = new FlowStatusEndpointV1(opts); + endpoints.push(endpoint); + } + + { + const opts: IFlowStatusResponseEndpointV1Options = { + apiUrl: this.options.apiUrl, + logLevel: this.options.logLevel, + holdingIDShortHash: this.options.holdingIDShortHash, + clientRequestID: this.options.clientRequestID, + }; + const endpoint = new FlowStatusResponseEndpointV1(opts); + endpoints.push(endpoint); + } this.log.info(`Instantiated endpoints of ${pkgName}`); return endpoints; } diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/public-api.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/public-api.ts index 2403d0e76fe..1556194247a 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/public-api.ts +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/public-api.ts @@ -1,6 +1,7 @@ export { PluginLedgerConnectorCorda, IPluginLedgerConnectorCordaOptions, + CordaVersion, } from "./plugin-ledger-connector-corda"; export * from "./generated/openapi/typescript-axios/index"; diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/diagnose-node-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/diagnose-node-endpoint-v1.ts index a8b2b0c5661..40f14efd79f 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/diagnose-node-endpoint-v1.ts +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/diagnose-node-endpoint-v1.ts @@ -24,9 +24,15 @@ import { DiagnoseNodeV1Response, } from "../generated/openapi/typescript-axios"; +import { + PluginLedgerConnectorCorda, + CordaVersion, +} from "../plugin-ledger-connector-corda"; export interface IDiagnoseNodeEndpointV1Options { logLevel?: LogLevelDesc; apiUrl?: string; + cordaVersion?: CordaVersion; + connector?: PluginLedgerConnectorCorda; } export class DiagnoseNodeEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/get-cpi-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/get-cpi-endpoint-v1.ts new file mode 100644 index 00000000000..1593ba73cce --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/get-cpi-endpoint-v1.ts @@ -0,0 +1,121 @@ +import { Express, Request, Response } from "express"; +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, + Configuration, +} from "@hyperledger/cactus-core-api"; + +import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; + +import { + Checks, + IAsyncProvider, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { + DefaultApi, + CPIV5Response, +} from "../generated/openapi/typescript-axios"; + +import OAS from "../../json/openapi.json"; +import https from "https"; +export interface IListCPIEndpointV1Options { + logLevel?: LogLevelDesc; + apiUrl?: string; +} + +export class ListCPIEndpointV1 implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "ListCPIEndpointV1"; + + private readonly log: Logger; + private readonly apiUrl?: string; + + public get className(): string { + return ListCPIEndpointV1.CLASS_NAME; + } + + constructor(public readonly options: IListCPIEndpointV1Options) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(options, `${fnTag} options`); + + this.log = LoggerProvider.getOrCreate({ + label: "list-cpi-endpoint-v1", + level: options.logLevel || "INFO", + }); + + this.apiUrl = options.apiUrl; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + httpsAgent: new https.Agent({ rejectUnauthorized: false }), + }), + }; + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/cpi" + ]; + } + + /** + * Returns the endpoint path to be used when installing the endpoint into the + * API server of Cactus. + */ + public getPath(): string { + return this.oasPath.get["x-hyperledger-cactus"].https.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.get["x-hyperledger-cactus"].https.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.get.operationId; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "GetCPIResponseV1#constructor()"; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + this.log.debug(`${verbUpper} ${this.getPath()}`); + + try { + if (this.apiUrl === undefined) throw "apiUrl option is necessary"; + const body = await this.callInternalContainer(req.body); + res.status(200); + res.json(body); + } catch (ex) { + this.log.error(`${fnTag} failed to serve request`, ex); + res.status(500); + res.statusMessage = ex.message; + res.json({ error: ex.stack }); + } + } + + async callInternalContainer(req: any): Promise { + const apiConfig = new Configuration({ basePath: this.apiUrl }); + const apiClient = new DefaultApi(apiConfig); + const res = await apiClient.getCPIResponse(req); + return res.data; + } +} diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/get-flow-status-response-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/get-flow-status-response-endpoint-v1.ts new file mode 100644 index 00000000000..a7384f75bef --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/get-flow-status-response-endpoint-v1.ts @@ -0,0 +1,126 @@ +import { Express, Request, Response } from "express"; + +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, + Configuration, +} from "@hyperledger/cactus-core-api"; + +import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; + +import { + Checks, + IAsyncProvider, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { + DefaultApi, + FlowStatusV5Response, +} from "../generated/openapi/typescript-axios"; + +import OAS from "../../json/openapi.json"; + +export interface IFlowStatusResponseEndpointV1Options { + logLevel?: LogLevelDesc; + apiUrl?: string; + holdingIDShortHash: string; + clientRequestID: string; +} + +export class FlowStatusResponseEndpointV1 implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "FlowStatusResponseEndpointV1"; + + private readonly log: Logger; + private readonly apiUrl?: string; + public get className(): string { + return FlowStatusResponseEndpointV1.CLASS_NAME; + } + + constructor(public readonly options: IFlowStatusResponseEndpointV1Options) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(options, `${fnTag} options`); + + this.log = LoggerProvider.getOrCreate({ + label: "list-flow-status-response-endpoint-v1", + level: options.logLevel || "INFO", + }); + + this.apiUrl = options.apiUrl; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}/{clientRequestID}" + ]; + } + + /** + * Returns the endpoint path to be used when installing the endpoint into the + * API server of Cactus. + */ + public getPath(): string { + return this.oasPath.get["x-hyperledger-cactus"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.get["x-hyperledger-cactus"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.get.operationId; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "sFlowStatusResponseEndpointV1#constructor()"; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + this.log.debug(`${verbUpper} ${this.getPath()}`); + + try { + if (this.apiUrl === undefined) throw "apiUrl option is necessary"; + const body = await this.callInternalContainer(req.body); + res.status(200); + res.json(body); + } catch (ex) { + this.log.error(`${fnTag} failed to serve request`, ex); + res.status(500); + res.statusMessage = ex.message; + res.json({ error: ex.stack }); + } + } + + async callInternalContainer(req: any): Promise { + const apiConfig = new Configuration({ basePath: this.apiUrl }); + const apiClient = new DefaultApi(apiConfig); + const res = await apiClient.flowStatusResponse( + this.options.holdingIDShortHash, + this.options.clientRequestID, + req, + ); + return res.data; + } +} diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/list-flow-status-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/list-flow-status-endpoint-v1.ts new file mode 100644 index 00000000000..cd9d72495bd --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/list-flow-status-endpoint-v1.ts @@ -0,0 +1,128 @@ +import { Express, Request, Response } from "express"; + +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, + Configuration, +} from "@hyperledger/cactus-core-api"; + +import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; + +import { + Checks, + IAsyncProvider, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { + DefaultApi, + StartFlowV5Request, + FlowStatusV5Response, +} from "../generated/openapi/typescript-axios"; + +import OAS from "../../json/openapi.json"; + +export interface IFlowStatusEndpointV1Options { + logLevel?: LogLevelDesc; + apiUrl?: string; + holdingIDShortHash: string; +} + +export class FlowStatusEndpointV1 implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "FlowStatusEndpointV1"; + + private readonly log: Logger; + private readonly apiUrl?: string; + + public get className(): string { + return FlowStatusEndpointV1.CLASS_NAME; + } + + constructor(public readonly options: IFlowStatusEndpointV1Options) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(options, `${fnTag} options`); + + this.log = LoggerProvider.getOrCreate({ + label: "list-flow-status-endpoint-v1", + level: options.logLevel || "INFO", + }); + + this.apiUrl = options.apiUrl; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/flow/{holdingIDShortHash}" + ]; + } + + /** + * Returns the endpoint path to be used when installing the endpoint into the + * API server of Cactus. + */ + public getPath(): string { + return this.oasPath.get["x-hyperledger-cactus"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.get["x-hyperledger-cactus"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.get.operationId; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "FlowStatusEndpointV1#constructor()"; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + this.log.debug(`${verbUpper} ${this.getPath()}`); + + try { + if (this.apiUrl === undefined) throw "apiUrl option is necessary"; + const body = await this.callInternalContainer(req.body); + res.status(200); + res.json(body); + } catch (ex) { + this.log.error(`${fnTag} failed to serve request`, ex); + res.status(500); + res.statusMessage = ex.message; + res.json({ error: ex.stack }); + } + } + + async callInternalContainer( + req: StartFlowV5Request, + ): Promise { + const apiConfig = new Configuration({ basePath: this.apiUrl }); + const apiClient = new DefaultApi(apiConfig); + const res = await apiClient.startFlowParameters( + this.options.holdingIDShortHash, + req, + ); + return res.data; + } +} diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/list-flows-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/list-flows-endpoint-v1.ts index bb0268d68c3..bf776e552c6 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/list-flows-endpoint-v1.ts +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/list-flows-endpoint-v1.ts @@ -24,9 +24,15 @@ import { ListFlowsV1Response, } from "../generated/openapi/typescript-axios"; +import { + PluginLedgerConnectorCorda, + CordaVersion, +} from "../plugin-ledger-connector-corda"; export interface IListFlowsEndpointV1Options { logLevel?: LogLevelDesc; apiUrl?: string; + cordaVersion?: CordaVersion; + connector?: PluginLedgerConnectorCorda; } export class ListFlowsEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/network-map-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/network-map-endpoint-v1.ts index 8a5080f1473..60119d7d2cb 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/network-map-endpoint-v1.ts +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/web-services/network-map-endpoint-v1.ts @@ -19,10 +19,16 @@ import OAS from "../../json/openapi.json"; import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; import { DefaultApi, NodeInfo } from "../generated/openapi/typescript-axios"; +import { + PluginLedgerConnectorCorda, + CordaVersion, +} from "../plugin-ledger-connector-corda"; export interface INetworkMapEndpointV1Options { logLevel?: LogLevelDesc; apiUrl?: string; + cordaVersion?: CordaVersion; + connector?: PluginLedgerConnectorCorda; } export class NetworkMapEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/corda-v5-flow-test.ts b/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/corda-v5-flow-test.ts new file mode 100644 index 00000000000..9bee7196eff --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/corda-v5-flow-test.ts @@ -0,0 +1,348 @@ +import test, { Test } from "tape-promise/tape"; +import { v4 as uuidv4 } from "uuid"; +import "jest-extended"; + +import { + CordaV5TestLedger, + Containers, + pruneDockerAllIfGithubAction, +} from "@hyperledger/cactus-test-tooling"; + +import { LogLevelDesc } from "@hyperledger/cactus-common"; +import { + PluginLedgerConnectorCorda, + CordaVersion, +} from "../../../main/typescript/plugin-ledger-connector-corda"; +import { DefaultApi } from "../../../main/typescript/generated/openapi/typescript-axios/index"; +import axios, { AxiosRequestConfig } from "axios"; + +const testCase = "Tests are passing on the JVM side"; +const logLevel: LogLevelDesc = "TRACE"; + +import https from "https"; + +test.onFailure(async () => { + await Containers.logDiagnostics({ logLevel }); +}); + +test("BEFORE " + testCase, async (t: Test) => { + const pruning = pruneDockerAllIfGithubAction({ logLevel }); + await t.doesNotReject(pruning, "Pruning didn't throw OK"); + t.end(); +}); + +test("can get past logs of an account", async (t: Test) => { + const logLevel: LogLevelDesc = "TRACE"; + const cordaV5TestLedger = new CordaV5TestLedger(); + await cordaV5TestLedger.start(); + t.ok(cordaV5TestLedger, "cordaV5TestLedger started OK"); + + test.onFinish(async () => { + await cordaV5TestLedger.stop(); + await cordaV5TestLedger.destroy(); + }); + const sshConfig = await cordaV5TestLedger.getSshConfig(); + const connector: PluginLedgerConnectorCorda = new PluginLedgerConnectorCorda({ + instanceId: uuidv4(), + sshConfigAdminShell: sshConfig, + corDappsDir: "", + logLevel, + cordaVersion: CordaVersion.CORDA_V5, + apiUrl: "https://127.0.0.1:8888", + }); + const apiUrl = "https://127.0.0.1:8888"; + + await connector.getOrCreateWebServices(); + + const customHttpsAgent = new https.Agent({ + // Configure your custom settings here + rejectUnauthorized: false, // Example: Allow self-signed certificates (use with caution) + }); + + const username = "admin"; + const password = "admin"; + const axiosConfig: AxiosRequestConfig = { + baseURL: apiUrl, + headers: { + Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString( + "base64", + )}`, + }, + httpsAgent: customHttpsAgent, + }; + + const axiosInstance = axios.create(axiosConfig); + const apiClient = new DefaultApi(undefined, apiUrl, axiosInstance); + + const container = cordaV5TestLedger.getContainer(); + const cmd = ["./gradlew", "listVNodes"]; + const timeout = 180000; // 3 minutes + const cwd = "/CSDE-cordapp-template-kotlin"; + const shortHashID = await Containers.exec( + container, + cmd, + timeout, + logLevel, + cwd, + ); + + function extractShortHash(name: string) { + const regex = new RegExp(`MyCorDapp\\s*([A-Z0-9]*)\\s*CN=${name}`); + const match = shortHashID.match(regex); + if (match) { + return match[1]; + } else { + return "err"; + } + } + + const shortHashBob = extractShortHash("Bob"); + t.ok(shortHashBob, `Short hash ID for Bob: ${shortHashBob}`); + + const shortHashDave = extractShortHash("Dave"); + t.ok(shortHashDave, `Short hash ID for Dave: ${shortHashDave}`); + + const shortHashCharlie = extractShortHash("Charlie"); + t.ok(shortHashCharlie, `Short hash ID for Charlie: ${shortHashCharlie}`); + + const shortHashAlice = extractShortHash("Alice"); + t.ok(shortHashAlice, `Short hash ID for Alice: ${shortHashAlice}`); + + const request = { + clientRequestId: "test-1", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.CreateNewChatFlow", + requestBody: { + chatName: "Test-1", + otherMember: "CN=Bob, OU=Test Dept, O=R3, L=London, C=GB", + message: "Testing", + }, + }; + + const listCPI = await apiClient.getCPIResponse(); + t.ok(listCPI, "getCPIResponse truthy OK"); + + const startflow = await apiClient.startFlowParameters( + shortHashCharlie, + request, + ); + + t.ok(startflow.status, "startFlowParameters endpoint OK"); + + await waitProcess(5); + await waitForStatusChange(shortHashCharlie, "test-1"); + const checkflow = await apiClient.flowStatusResponse( + shortHashCharlie, + "test-1", + ); + t.ok(checkflow.status, "flowStatusResponse endpoint OK"); + t.equal(checkflow.data.flowStatus, "COMPLETED", "flowStatus is COMPLETED"); + t.equal(checkflow.data.flowError, null, "flowError should be null"); + + // Follow the flow as per https://docs.r3.com/en/platform/corda/5.0/developing-applications/getting-started/utxo-ledger-example-cordapp/running-the-chat-cordapp.html + test("Simulate a conversation between Alice and Bob", async (t) => { + //1. Alice creates a new chat + const aliceCreateChat = { + clientRequestId: "create-1", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.CreateNewChatFlow", + requestBody: { + chatName: "Chat with Bob", + otherMember: "CN=Bob, OU=Test Dept, O=R3, L=London, C=GB", + message: "Hello Bob", + }, + }; + let startflowChat = await apiClient.startFlowParameters( + shortHashAlice, + aliceCreateChat, + ); + t.ok(startflowChat.status, "startflowChat OK"); + await waitProcess(5); + const checkflow = await apiClient.flowStatusResponse( + shortHashAlice, + "create-1", + ); + t.ok(checkflow.status, "flowStatusResponse OK"); + + await waitForStatusChange(shortHashAlice, "create-1"); + + //2. Bob lists his chats + const bobListChats = { + clientRequestId: "list-1", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.ListChatsFlow", + requestBody: {}, + }; + startflowChat = await apiClient.startFlowParameters( + shortHashBob, + bobListChats, + ); + await waitProcess(10); + const flowData = await waitForStatusChange(shortHashBob, "list-1"); + + const flowResult = + flowData !== null && flowData !== undefined ? flowData.flowResult : null; + const chatWithBobId = (() => { + if (typeof flowResult === "string") { + const parseFlowResult = JSON.parse(flowResult); + const chatWithBobObj = parseFlowResult.find( + (item: { chatName: string }) => item.chatName === "Chat with Bob", + ); + return chatWithBobObj && "id" in chatWithBobObj + ? chatWithBobObj.id + : undefined; + } + })(); + + //3. Bob updates chat twice + const bobUpdate1 = { + clientRequestId: "update-1", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.UpdateChatFlow", + requestBody: { + id: chatWithBobId, + message: "Hi Alice", + }, + }; + await apiClient.startFlowParameters(shortHashBob, bobUpdate1); + await waitProcess(5); + await waitForStatusChange(shortHashBob, "update-1"); + const bobUpdate2 = { + clientRequestId: "update-2", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.UpdateChatFlow", + requestBody: { + id: chatWithBobId, + message: "How are you today?", + }, + }; + await apiClient.startFlowParameters(shortHashBob, bobUpdate2); + await waitProcess(5); + await waitForStatusChange(shortHashBob, "update-2"); + + //4. Alice lists chat + const aliceListsChat = { + clientRequestId: "list-2", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.ListChatsFlow", + requestBody: {}, + }; + await apiClient.startFlowParameters(shortHashAlice, aliceListsChat); + await waitProcess(5); + await waitForStatusChange(shortHashAlice, "list-2"); + + //5. Alice checks the history of the chat with Bob + const aliceHistoryRequest = { + clientRequestId: "get-1", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.GetChatFlow", + requestBody: { + id: chatWithBobId, + numberOfRecords: "4", + }, + }; + await apiClient.startFlowParameters(shortHashAlice, aliceHistoryRequest); + await waitProcess(5); + await waitForStatusChange(shortHashAlice, "get-1"); + + //6. Alice replies to Bob + const aliceReply = { + clientRequestId: "update-4", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.UpdateChatFlow", + requestBody: { + id: chatWithBobId, + message: "I am very well thank you", + }, + }; + await apiClient.startFlowParameters(shortHashAlice, aliceReply); + await waitProcess(5); + await waitForStatusChange(shortHashAlice, "update-4"); + + //7. Bob gets the chat history + const bobHistoryRequest = { + clientRequestId: "get-2", + flowClassName: + "com.r3.developers.csdetemplate.utxoexample.workflows.GetChatFlow", + requestBody: { + id: chatWithBobId, + numberOfRecords: "2", + }, + }; + await apiClient.startFlowParameters(shortHashBob, bobHistoryRequest); + await waitProcess(5); + await waitForStatusChange(shortHashBob, "get-2"); + }); + + test("Negative Test, invalid flow class name", async (t: Test) => { + const invalidFlowName = "nonExistentFlow"; + const shortHash = shortHashBob; + const request = { + clientRequestId: "test-1", + flowClassName: invalidFlowName, + requestBody: { + chatName: "Test-1", + otherMember: "CN=Bob, OU=Test Dept, O=R3, L=London, C=GB", + message: "Testing", + }, + }; + try { + await apiClient.startFlowParameters(shortHash, request); + t.fail("Expected an error for an invalid flow name but it succeeded."); + } catch (error) { + t.pass("Failed as expected for an invalid flow name."); + } + }); + + test("Negative Test, invalid username and password ", async (t: Test) => { + const apiUrl = "https://127.0.0.1:8888"; + const username = "invalidUsername"; + const password = "invalidPassword"; + const axiosConfig: AxiosRequestConfig = { + baseURL: apiUrl, + headers: { + Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString( + "base64", + )}`, + }, + }; + const axiosInstance = axios.create(axiosConfig); + const apiClient = new DefaultApi(undefined, apiUrl, axiosInstance); + try { + await apiClient.getCPIResponse(); + t.fail("Expected an error for unauthorized access but it succeeded."); + } catch (error) { + t.pass("Failed as expected for unauthorized access."); + } + }); + + // function to wait for the status to change to COMPLETED + async function waitForStatusChange(shortHash: string, flowName: string) { + try { + let checkFlowObject = await apiClient.flowStatusResponse( + shortHash, + flowName, + ); + if (checkFlowObject.data.flowStatus === "COMPLETED") { + return checkFlowObject.data; + } else if (checkFlowObject.data.flowStatus === "RUNNING") { + await new Promise((resolve) => setTimeout(resolve, 20000)); + await waitForStatusChange(shortHash, flowName); + } + } catch (error) { + console.error( + "An error occurred while waiting for status change:", + error, + ); + } + } + + //Function to add a delay + function waitProcess(seconds: number) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, seconds * 1000); + }); + } +}); diff --git a/packages/cactus-plugin-persistence-ethereum/package.json b/packages/cactus-plugin-persistence-ethereum/package.json index 6b054e9d81f..c9400b1c213 100644 --- a/packages/cactus-plugin-persistence-ethereum/package.json +++ b/packages/cactus-plugin-persistence-ethereum/package.json @@ -52,9 +52,9 @@ "build:dev:backend:postbuild": "npm run copy-sql && npm run copy-yarn-lock", "codegen": "run-p 'codegen:*'", "codegen:openapi": "npm run generate-sdk", - "copy-sql": "cp -raf ./src/main/sql ./dist/lib/main/", - "copy-yarn-lock": "cp -af ../../yarn.lock ./dist/yarn.lock", - "generate-sdk": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected" + "generate-sdk": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected", + "copy-sql": "cp -r ./src/main/sql ./dist/lib/main/", + "copy-yarn-lock": "cp -f ../../yarn.lock ./dist/yarn.lock" }, "dependencies": { "@ethersproject/abi": "5.7.0", diff --git a/packages/cactus-test-tooling/src/main/typescript/corda/corda-v5-test-ledger.ts b/packages/cactus-test-tooling/src/main/typescript/corda/corda-v5-test-ledger.ts new file mode 100644 index 00000000000..113cb2be3e1 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/typescript/corda/corda-v5-test-ledger.ts @@ -0,0 +1,253 @@ +import { EventEmitter } from "events"; +//import path from "path"; + +import { Config as SshConfig } from "node-ssh"; +import Docker, { Container, ContainerInfo } from "dockerode"; +import Joi from "joi"; + +import { ITestLedger } from "../i-test-ledger"; +import { Containers } from "../common/containers"; + +import { + LogLevelDesc, + Logger, + LoggerProvider, + Checks, + Bools, +} from "@hyperledger/cactus-common"; + +/* + * Contains options for Corda container + */ +export interface ICordaV5TestLedgerConstructorOptions { + imageVersion?: string; + imageName?: string; + publicPort?: number; + postgresPort?: number; + logLevel?: LogLevelDesc; + emitContainerLogs?: boolean; +} + +/* + * Provides default options for Corda container + */ +const DEFAULTS = Object.freeze({ + imageVersion: "latest", + imageName: "ghcr.io/hyperledger/cactus-corda-5-all-in-one-alpha-2023-10-18", + publicPort: 8888, + postgresPort: 5431, +}); +export const CORDA_V5_TEST_LEDGER_DEFAULT_OPTIONS = DEFAULTS; + +/* + * Provides validations for the Corda container's options + */ +export const JOI_SCHEMA: Joi.Schema = Joi.object().keys({ + imageVersion: Joi.string().min(5).required(), + imageName: Joi.string().min(1).required(), + publicPort: Joi.number().min(1).max(65535).required(), + postgresPort: Joi.number().min(1).max(65535).required(), +}); +export const CORDA_V5_TEST_LEDGER_OPTIONS_JOI_SCHEMA = JOI_SCHEMA; + +export class CordaV5TestLedger implements ITestLedger { + public static readonly CLASS_NAME = "CordaV5TestLedger"; + + private readonly log: Logger; + //private readonly envVars: string[]; + + public get className(): string { + return CordaV5TestLedger.CLASS_NAME; + } + + public readonly imageVersion: string; + public readonly imageName: string; + public readonly publicPort: number; + public readonly postgresPort: number; + public readonly emitContainerLogs: boolean; + + private container: Container | undefined; + private containerId: string | undefined; + + constructor(public readonly opts: ICordaV5TestLedgerConstructorOptions = {}) { + const fnTag = `${this.className}#constructor()`; + Checks.truthy(opts, `${fnTag} options`); + + this.imageVersion = opts.imageVersion || DEFAULTS.imageVersion; + this.imageName = opts.imageName || DEFAULTS.imageName; + + this.publicPort = opts.publicPort || DEFAULTS.publicPort; + this.postgresPort = opts.postgresPort || DEFAULTS.postgresPort; + this.emitContainerLogs = Bools.isBooleanStrict(opts.emitContainerLogs) + ? (opts.emitContainerLogs as boolean) + : true; + + this.validateConstructorOptions(); + const label = "corda-v5-test-ledger"; + const level = opts.logLevel || "INFO"; + this.log = LoggerProvider.getOrCreate({ level, label }); + } + + public getContainerId(): string { + const fnTag = `${this.className}.getContainerId()`; + Checks.nonBlankString(this.containerId, `${fnTag}::containerId`); + return this.containerId as string; + } + + public async start(skipPull = false): Promise { + const imageFqn = this.getContainerImageName(); + + if (this.container) { + await this.container.stop(); + await this.container.remove(); + } + const docker = new Docker(); + + if (!skipPull) { + await Containers.pullImage(imageFqn, {}, this.opts.logLevel); + } + + return new Promise((resolve, reject) => { + const eventEmitter: EventEmitter = docker.run( + imageFqn, + [], + [], + { + User: "root", + NetworkMode: "host", // Set the container to use the host network + Binds: ["/var/run/docker.sock:/var/run/docker.sock"], // Mount the Docker socket + PublishAllPorts: true, + Privileged: true, + }, + {}, + (err: unknown) => { + if (err) { + reject(err); + } + }, + ); + + eventEmitter.once("start", async (container: Container) => { + this.container = container; + this.containerId = container.id; + + if (this.emitContainerLogs) { + const fnTag = `[${this.getContainerImageName()}]`; + await Containers.streamLogs({ + container: this.getContainer(), + tag: fnTag, + log: this.log, + }); + } + + try { + let isHealthy = false; + do { + const containerInfo = await this.getContainerInfo(); + this.log.debug(`ContainerInfo.Status=%o`, containerInfo.Status); + this.log.debug(`ContainerInfo.State=%o`, containerInfo.State); + isHealthy = containerInfo.Status.endsWith("(healthy)"); + if (!isHealthy) { + await new Promise((resolve2) => setTimeout(resolve2, 1000)); + } + } while (!isHealthy); + resolve(container); + } catch (ex) { + reject(ex); + } + }); + }); + } + + public async logDebugPorts(): Promise { + const publicPort = await this.getPublicPort(); + this.log.info(`R3 Corda V5 public port: ${publicPort}`); + + const supervisorDUrl = await this.getSupervisorDLocalhostUrl(); + this.log.info(`SupervisorD Web UI accessible: %o`, supervisorDUrl); + } + + public stop(): Promise { + return Containers.stop(this.getContainer()); + } + + public destroy(): Promise { + const fnTag = `${this.className}.destroy()`; + if (this.container) { + return this.container.remove(); + } else { + return Promise.reject( + new Error(`${fnTag} Container was never created, nothing to destroy.`), + ); + } + } + + protected async getContainerInfo(): Promise { + const fnTag = `${this.className}.getContainerInfo()`; + const docker = new Docker(); + const containerInfos = await docker.listContainers({}); + const id = this.getContainerId(); + + const aContainerInfo = containerInfos.find((ci) => ci.Id === id); + + if (aContainerInfo) { + return aContainerInfo; + } else { + throw new Error(`${fnTag} no container with ID "${id}"`); + } + } + + public async getPublicPort(): Promise { + const aContainerInfo = await this.getContainerInfo(); + return Containers.getPublicPort(8888, aContainerInfo); + } + + public async getSupervisorDLocalhostUrl(): Promise { + const port = await this.getPublicPort(); + return `https://localhost:${port}/api/v1/swagger#`; + } + + public async getSSHPublicPort(): Promise { + const aContainerInfo = await this.getContainerInfo(); + return Containers.getPublicPort(22, aContainerInfo); + } + + public async getSshConfig(): Promise { + //port 22 is not being checked as of now because we can't modify the export ports unless we change the gradle sample + //const publicPort = await this.getSSHPublicPort(); + const sshConfig: SshConfig = { + host: "127.0.0.1", + port: 22, + username: "root", + }; + + return sshConfig; + } + + public getContainer(): Container { + const fnTag = `${this.className}.getContainer()`; + if (!this.container) { + throw new Error(`${fnTag} container not set on this instance yet.`); + } else { + return this.container; + } + } + + public getContainerImageName(): string { + return `${this.imageName}:${this.imageVersion}`; + } + + private validateConstructorOptions(): void { + const fnTag = `${this.className}#validateConstructorOptions()`; + const validationResult = JOI_SCHEMA.validate({ + imageVersion: this.imageVersion, + imageName: this.imageName, + publicPort: this.publicPort, + postgresPort: this.postgresPort, + }); + + if (validationResult.error) { + throw new Error(`${fnTag} ${validationResult.error.annotate()}`); + } + } +} diff --git a/packages/cactus-test-tooling/src/main/typescript/public-api.ts b/packages/cactus-test-tooling/src/main/typescript/public-api.ts index df89cd21444..ba7c67244ae 100755 --- a/packages/cactus-test-tooling/src/main/typescript/public-api.ts +++ b/packages/cactus-test-tooling/src/main/typescript/public-api.ts @@ -34,6 +34,13 @@ export { export { ICordappJarFile } from "./corda/cordapp-jar-file"; +export { + CordaV5TestLedger, + ICordaV5TestLedgerConstructorOptions, + CORDA_V5_TEST_LEDGER_DEFAULT_OPTIONS, + CORDA_V5_TEST_LEDGER_OPTIONS_JOI_SCHEMA, +} from "./corda/corda-v5-test-ledger"; + export * from "./quorum/i-quorum-genesis-options"; export { Containers, diff --git a/tools/docker/corda-all-in-one/corda-v5/Dockerfile b/tools/docker/corda-all-in-one/corda-v5/Dockerfile index 4316e323d55..6bd4336cf76 100644 --- a/tools/docker/corda-all-in-one/corda-v5/Dockerfile +++ b/tools/docker/corda-all-in-one/corda-v5/Dockerfile @@ -1,84 +1,71 @@ -FROM cruizba/ubuntu-dind:20.10.9 - -WORKDIR / - -RUN apt update -RUN apt -y upgrade - -# # Install git so we can check out the corda5-solarsystem-contracts-demo repo of Corda -RUN apt install -y git - -# Need curl to run healthchecks -RUN apt install -y curl - -RUN export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends openjdk-11-jdk - -# jq is needed by the /download-frozen-image-v2.sh script to pre-fetch docker images without docker. -RUN apt install -y jq - -# Get the utility script that can pre-fetch the container images without -# a functioning Docker daemon available which we do not have at image build -# time so have to resort to manually get the images instead of just saying -# "docker pull my/cool-image..." etc. -# The reason to jump trough these hoops is to avoid DockerHub rate limiting issues -RUN curl -sSL https://raw.githubusercontent.com/moby/moby/dedf8528a51c6db40686ed6676e9486d1ed5f9c0/contrib/download-frozen-image-v2.sh > /download-frozen-image-v2.sh -RUN chmod +x /download-frozen-image-v2.sh -RUN mkdir -p /etc/corda/corda-dev/ -RUN /download-frozen-image-v2.sh /etc/corda/corda-dev/ corda/corda-dev:5.0.0-devpreview-1.0 - -RUN curl https://download.corda.net/corda-cli/1.0.0-DevPreview/get-corda-cli.sh > /get-corda-cli.sh -RUN chmod +x /get-corda-cli.sh -RUN /get-corda-cli.sh - -RUN curl https://download.corda.net/cordapp-builder/5.0.0-DevPreview-1.0/cordapp-builder-installer.jar --output /cordapp-builder-installer.jar -RUN java -jar /cordapp-builder-installer.jar - -RUN git clone https://github.com/corda/corda5-solarsystem-contracts-demo.git -WORKDIR /corda5-solarsystem-contracts-demo - -# Placing the ARG here instead of the top may seem like bad form, but it has -# better build performance this way when we change the ARG's value it will -# not spend 5 to 10 minutes installing the OS level dependencies on the top of -# the image definition file because the cached layers will be the same for those. -ARG SOLARSYSTEM_DEMO_SHA=a3be5ad48d249be7f71c5f15074c874dc0d09b41 -RUN git checkout ${SOLARSYSTEM_DEMO_SHA} - -RUN /root/bin/corda-cli/bin/corda-cli network config docker-compose solar-system -RUN chmod +x gradlew -RUN ./gradlew build - -RUN /root/bin/corda-cli/bin/corda-cli network deploy -n solar-system -f solar-system.yaml > docker-compose.yaml - -RUN sed -i 's+corda/corda-dev:latest+corda/corda-dev:5.0.0-devpreview-1.0+g' /corda5-solarsystem-contracts-demo/docker-compose.yaml - -RUN /root/.local/lib/cordapp-builder/bin/cordapp-builder create --cpk contracts/build/libs/corda5-solar-system-contracts-demo-contracts-1.0-SNAPSHOT-cordapp.cpk --cpk workflows/build/libs/corda5-solar-system-contracts-demo-workflows-1.0-SNAPSHOT-cordapp.cpk -o solar-system.cpb - -# OpenSSH server +FROM docker:20.10.3-dind + +RUN apk update +RUN apk add py-pip python3-dev libffi-dev openssl-dev gcc libc-dev make + +# Need curl for healthchecks +RUN apk add --no-cache curl + +# Need to run shell script run.sh for Corda CLI +RUN apk add --no-cache bash + +# The file binary is used to inspect exectubles when debugging container image issues +RUN apk add --no-cache file +RUN apk add --no-cache ca-certificates +RUN apk add --no-cache tzdata +RUN apk add --no-cache gnupg + +#----------------- INSTALLING CORDA CDSE PREREQUISITES -------------------- +#-------------------------------------------------------------------------- + +# Installing Zulu11 JDK +RUN wget -P /etc/apk/keys/ \ +https://cdn.azul.com/public_keys/alpine-signing@azul.com-5d5dc44c.rsa.pub +RUN echo "https://repos.azul.com/zulu/alpine" | tee -a /etc/apk/repositories +RUN apk update +RUN apk add --no-cache zulu11-jdk + +# Installing Corda CLI +RUN mkdir /platform-jars && \ + wget -O /platform-jars/binary.tar.gz \ + https://download.corda.net/c5-release-pack/E0b6f4f8-8907-47ae-b3cd-7f25ff756c2f-5.0.0-GA/platform-jars-5.0.0.tar.gz + +RUN cd /platform-jars/ && \ + tar -xvzf binary.tar.gz && \ + cp net/corda/cli/deployment/corda-cli-installer/5.0.0.0/corda-cli-installer-5.0.0.0.zip . && \ + unzip corda-cli-installer-5.0.0.0.zip -d corda-cli-installer && \ + corda-cli-installer/./install.sh +ENV PATH="$PATH:~/.corda/cli" + +#-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- + +# Installing CORDA CDSE +RUN apk add --no-cache git +RUN git clone https://github.com/corda/CSDE-cordapp-template-kotlin.git + +RUN cd CSDE-cordapp-template-kotlin/ && \ + git checkout release/corda-5-0 + +RUN apk add --no-cache supervisor +## TO FIX: Exposing the required ports 5005, 5432 and 8888 for CSDE +## and 9001 for supervisor. Currently commented because of "--network host" being used to run the container +# EXPOSE 5005 +# EXPOSE 5432 +# EXPOSE 8888 +# EXPOSE 9001 EXPOSE 22 -# supervisord web ui/dashboard -EXPOSE 9001 - -# earth-node RPC -EXPOSE 12112 - -# mars-node RPC -EXPOSE 12116 - -# pluto-node RPC -EXPOSE 12119 +COPY supervisord.conf /etc/supervisord.conf -# notary-node RPC -EXPOSE 12122 +COPY start-services.sh /start-services.sh +RUN chmod +x /start-services.sh -COPY ./start-services.sh /start-services.sh +WORKDIR /CSDE-cordapp-template-kotlin/ -COPY ./supervisor/ /etc/supervisor/conf.d/ +# Extend the parent image's entrypoint +# https://superuser.com/questions/1459466/can-i-add-an-additional-docker-entrypoint-script ENTRYPOINT ["/usr/bin/supervisord"] -CMD ["--nodaemon"] +CMD ["--configuration", "/etc/supervisord.conf", "--nodaemon"] -# Add our healthcheck script that determines when do we consider the container healthy -COPY healthcheck.sh / -HEALTHCHECK --interval=2s --timeout=5s --start-period=30s --retries=180 CMD /healthcheck.sh -#RUN ~/bin/corda-cli/bin/corda-cli package install -n solar-system solar-system.cpb +HEALTHCHECK --interval=10s --timeout=5s --start-period=100s --retries=1000 CMD [ -f 5vNodeSetupdone.txt ] \ No newline at end of file diff --git a/tools/docker/corda-all-in-one/corda-v5/README.md b/tools/docker/corda-all-in-one/corda-v5/README.md new file mode 100644 index 00000000000..fe53d2d4513 --- /dev/null +++ b/tools/docker/corda-all-in-one/corda-v5/README.md @@ -0,0 +1,7 @@ +# Instructions to compile and run the new Corda v5.0 test network + +To create an image of the dockerfile run: +`DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/corda-v5 -t newcordaimg` + +To run the AIO, execute: +`docker run -it --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock --network host -d newcordaimg` \ No newline at end of file diff --git a/tools/docker/corda-all-in-one/corda-v5/healthcheck.sh b/tools/docker/corda-all-in-one/corda-v5/healthcheck.sh index 469aab00863..601cfe42201 100755 --- a/tools/docker/corda-all-in-one/corda-v5/healthcheck.sh +++ b/tools/docker/corda-all-in-one/corda-v5/healthcheck.sh @@ -2,7 +2,5 @@ set -e #/root/bin/corda-cli/bin/corda-cli network status -n solar-system - -curl -u martian:password --insecure https://localhost:12116/api/v1/nodestatus/getnetworkreadinessstatus -curl -u earthling:password --insecure https://localhost:12112/api/v1/nodestatus/getnetworkreadinessstatus -curl -u plutonian:password --insecure https://localhost:12119/api/v1/nodestatus/getnetworkreadinessstatus +#Need to change since token is needed to check health status +#curl -u admin:admin --insecure https://localhost:8888/api/v1/swagger# diff --git a/tools/docker/corda-all-in-one/corda-v5/start-services.sh b/tools/docker/corda-all-in-one/corda-v5/start-services.sh index 9df798835be..91aa8ffb530 100755 --- a/tools/docker/corda-all-in-one/corda-v5/start-services.sh +++ b/tools/docker/corda-all-in-one/corda-v5/start-services.sh @@ -1,11 +1,14 @@ #!/bin/bash +set -e -# Load the cached container images into the Docker Daemon before launching -# the Docker Compose network. This is the preferred workaround to synchronizing -# different processes of a supervisord configuration -tar -cC '/etc/corda/corda-dev/' . | docker load - -# Now that the images are cached **and** loaded to the daemon, we can start the -# corda network via the docker-compose file and it will not need to download -# anything from DockerHub (if it does, that's a bug) -supervisorctl start corda5-solarsystem-contracts-demo-network +cd /CSDE-cordapp-template-kotlin/ +while true; do + echo "Waiting for startCorda to execute..." + if ./gradlew listVnodes | grep "X500"; then + echo "Starting v5NodeSetup..."; + ./gradlew 5-vNodeSetup + break; + fi + sleep 5; +done +touch 5vNodeSetupdone.txt diff --git a/tools/docker/corda-all-in-one/corda-v5/supervisor/corda5-solarsystem-contracts-demo-network.conf b/tools/docker/corda-all-in-one/corda-v5/supervisord.conf similarity index 58% rename from tools/docker/corda-all-in-one/corda-v5/supervisor/corda5-solarsystem-contracts-demo-network.conf rename to tools/docker/corda-all-in-one/corda-v5/supervisord.conf index 8d7bbe324b5..a7a8dd04054 100644 --- a/tools/docker/corda-all-in-one/corda-v5/supervisor/corda5-solarsystem-contracts-demo-network.conf +++ b/tools/docker/corda-all-in-one/corda-v5/supervisord.conf @@ -1,30 +1,27 @@ [supervisord] -logfile = /var/log/supervisord.log logfile_maxbytes = 50MB logfile_backups=10 loglevel = info -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl=http://127.0.0.1:9001 - [inet_http_server] port = 0.0.0.0:9001 -[program:start-services] -command=/start-services.sh +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[program:startCorda] +directory=/CSDE-cordapp-template-kotlin +command=/bin/bash -c "./gradlew startCorda" autostart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 -[program:corda5-solarsystem-contracts-demo-network] -command=/usr/local/bin/docker-compose -f /corda5-solarsystem-contracts-demo/docker-compose.yaml up -autostart=false -autorestart=true +[program:5vNodeSetup] +directory=/ +command=/bin/bash -c "./start-services.sh" +autostart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr