diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 0991ed8e95..c2c6d14e56 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,2 +1,2 @@ # comma delimited path of files to exclude from copy/paste duplicate checking -sonar.cpd.exclusions=packages/cli/src/lib/bundler/scalprumConfig.ts \ No newline at end of file +sonar.cpd.exclusions=plugins/orchestrator-common/src/generated/**,packages/cli/src/lib/bundler/scalprumConfig.ts \ No newline at end of file diff --git a/plugins/orchestrator-backend/src/service/OrchestratorService.ts b/plugins/orchestrator-backend/src/service/OrchestratorService.ts index d0a7bdc471..3a2bb5aedf 100644 --- a/plugins/orchestrator-backend/src/service/OrchestratorService.ts +++ b/plugins/orchestrator-backend/src/service/OrchestratorService.ts @@ -55,18 +55,23 @@ export class OrchestratorService { public async fetchInstances(args: { pagination?: Pagination; filter?: FilterInfo; + workflowId?: string; }): Promise { + const definitionIds = args.workflowId + ? [args.workflowId] + : this.workflowCacheService.definitionIds; return await this.dataIndexService.fetchInstances({ - definitionIds: this.workflowCacheService.definitionIds, + definitionIds: definitionIds, pagination: args.pagination, filter: args.filter, }); } - public async fetchInstancesTotalCount(): Promise { - return await this.dataIndexService.fetchInstancesTotalCount( - this.workflowCacheService.definitionIds, - ); + public async fetchInstancesTotalCount(workflowId?: string): Promise { + const definitionIds = workflowId + ? [workflowId] + : this.workflowCacheService.definitionIds; + return await this.dataIndexService.fetchInstancesTotalCount(definitionIds); } public async fetchWorkflowSource(args: { diff --git a/plugins/orchestrator-backend/src/service/api/v2.ts b/plugins/orchestrator-backend/src/service/api/v2.ts index 122ad9eb7b..061f66c487 100644 --- a/plugins/orchestrator-backend/src/service/api/v2.ts +++ b/plugins/orchestrator-backend/src/service/api/v2.ts @@ -90,13 +90,15 @@ export class V2 { public async getInstances( pagination?: Pagination, filter?: FilterInfo, + workflowId?: string, ): Promise { const instances = await this.orchestratorService.fetchInstances({ pagination, filter, + workflowId, }); const totalCount = - await this.orchestratorService.fetchInstancesTotalCount(); + await this.orchestratorService.fetchInstancesTotalCount(workflowId); const result: ProcessInstanceListResultDTO = { items: instances?.map(mapToProcessInstanceDTO), diff --git a/plugins/orchestrator-backend/src/service/router.ts b/plugins/orchestrator-backend/src/service/router.ts index 5b4ff1c4f4..9be1642eaa 100644 --- a/plugins/orchestrator-backend/src/service/router.ts +++ b/plugins/orchestrator-backend/src/service/router.ts @@ -796,6 +796,39 @@ function setupInternalRoutes( }, ); + // v2 + routerApi.openApiBackend.register( + 'getWorkflowInstances', + async (c, req: express.Request, res: express.Response, next) => { + const endpointName = 'getWorkflowInstances'; + const workflowId = c.request.params.workflowId as string; + const endpoint = `/v2/workflows/${workflowId}/instances`; + + auditLogger.auditLog({ + eventName: endpointName, + stage: 'start', + status: 'succeeded', + level: 'debug', + request: req, + message: `Received request to '${endpoint}' endpoint`, + }); + + const decision = await authorize( + req, + orchestratorWorkflowInstancesReadPermission, + permissions, + httpAuth, + ); + if (decision.result === AuthorizeResult.DENY) { + manageDenyAuthorization(endpointName, endpoint, req); + } + await routerApi.v2 + .getInstances(buildPagination(req), buildFilter(req), workflowId) + .then(result => res.json(result)) + .catch(next); + }, + ); + // v2 routerApi.openApiBackend.register( 'getInstances', diff --git a/plugins/orchestrator-common/src/generated/.METADATA.sha1 b/plugins/orchestrator-common/src/generated/.METADATA.sha1 index 7fe91fd258..706b2925d8 100644 --- a/plugins/orchestrator-common/src/generated/.METADATA.sha1 +++ b/plugins/orchestrator-common/src/generated/.METADATA.sha1 @@ -1 +1 @@ -dafd6a712ec5abf3cf6be47f4f216c3e9c36b699 +93059f9ed87bfe29bf2ea6dfebf85e3342dcb573 diff --git a/plugins/orchestrator-common/src/generated/api/definition.ts b/plugins/orchestrator-common/src/generated/api/definition.ts index a6fbd131c3..4254dc7791 100644 --- a/plugins/orchestrator-common/src/generated/api/definition.ts +++ b/plugins/orchestrator-common/src/generated/api/definition.ts @@ -1,5 +1,5 @@ /* eslint-disable */ /* prettier-ignore */ // GENERATED FILE DO NOT EDIT. -const OPENAPI = `{"openapi":"3.1.0","info":{"title":"Orchestratorplugin","description":"APItointeractwithorchestratorplugin","license":{"name":"Apache2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"version":"0.0.1"},"servers":[{"url":"/"}],"paths":{"/v2/workflows/overview":{"post":{"operationId":"getWorkflowsOverview","description":"Returnsthekeyfieldsoftheworkflowincludingdataonthelastruninstance","requestBody":{"required":false,"description":"Paginationandfilters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOverviewsRequestParams"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOverviewListResultDTO"}}}},"500":{"description":"Errorfetchingworkflowoverviews","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/overview":{"get":{"operationId":"getWorkflowOverviewById","description":"Returnsthekeyfieldsoftheworkflowincludingdataonthelastruninstance","parameters":[{"name":"workflowId","in":"path","required":true,"description":"Uniqueidentifieroftheworkflow","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOverviewDTO"}}}},"500":{"description":"Errorfetchingworkflowoverview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}":{"get":{"operationId":"getWorkflowById","description":"Getfullworkflowinfo","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDTO"}}}},"500":{"description":"Errorfetchingworkflowbyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/source":{"get":{"operationId":"getWorkflowSourceById","description":"Gettheworkflow'sdefinition","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Errorfetchingworkflowsourcebyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/inputSchema":{"get":{"operationId":"getWorkflowInputSchemaById","description":"Gettheworkflowinputschema.Itdefinestheinputfieldsoftheworkflow","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}},{"name":"instanceId","in":"query","description":"IDofinstance","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Errorfetchingworkflowinputschemabyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances":{"post":{"operationId":"getInstances","summary":"Getinstances","description":"Retrieveanarrayofworkflowexecutions(instances)","requestBody":{"required":false,"description":"Parametersforretrievinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInstancesRequestParams"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessInstanceListResultDTO"}}}},"500":{"description":"Errorfetchinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/{instanceId}":{"get":{"summary":"GetWorkflowInstancebyID","description":"Getaworkflowexecution/run(instance)","operationId":"getInstanceById","parameters":[{"name":"instanceId","in":"path","required":true,"description":"IDoftheworkflowinstance","schema":{"type":"string"}},{"name":"includeAssessment","in":"query","required":false,"description":"Whethertoincludeassessment","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Successfulresponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssessedProcessInstanceDTO"}}}},"500":{"description":"Errorfetchinginstance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/statuses":{"get":{"operationId":"getWorkflowStatuses","summary":"Getworkflowstatuslist","description":"Retrievearraywiththestatusofallinstances","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowRunStatusDTO"}}}}},"500":{"description":"Errorfetchingworkflowstatuses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/execute":{"post":{"summary":"Executeaworkflow","description":"Executeaworkflow","operationId":"executeWorkflow","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtoexecute","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteWorkflowRequestDTO"}}}},"responses":{"200":{"description":"Successfulexecution","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteWorkflowResponseDTO"}}}},"500":{"description":"InternalServerError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/{instanceId}/abort":{"delete":{"summary":"Abortaworkflowinstance","operationId":"abortWorkflow","description":"AbortsaworkflowinstanceidentifiedbytheprovidedinstanceId.","parameters":[{"name":"instanceId","in":"path","required":true,"description":"Theidentifieroftheworkflowinstancetoabort.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfuloperation","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Errorabortingworkflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ErrorResponse":{"description":"TheErrorResponseobjectrepresentsacommonstructureforhandlingerrorsinAPIresponses.Itincludesessentialinformationabouttheerror,suchastheerrormessageandadditionaloptionaldetails.","type":"object","properties":{"message":{"description":"Astringprovidingaconciseandhuman-readabledescriptionoftheencounterederror.ThisfieldisrequiredintheErrorResponseobject.","type":"string","default":"internalservererror"},"additionalInfo":{"description":"Anoptionalfieldthatcancontainadditionalinformationorcontextabouttheerror.Itprovidesflexibilityforincludingextradetailsbasedonspecificerrorscenarios.","type":"string"}},"required":["message"]},"GetInstancesRequestParams":{"type":"object","properties":{"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"},"filterInfo":{"$ref":"#/components/schemas/FilterInfo"}}},"GetOverviewsRequestParams":{"type":"object","properties":{"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"},"filterInfo":{"$ref":"#/components/schemas/FilterInfo"}}},"WorkflowOverviewListResultDTO":{"type":"object","properties":{"overviews":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowOverviewDTO"},"minItems":0},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"WorkflowOverviewDTO":{"type":"object","properties":{"workflowId":{"type":"string","description":"Workflowuniqueidentifier","minLength":1},"name":{"type":"string","description":"Workflowname","minLength":1},"format":{"$ref":"#/components/schemas/WorkflowFormatDTO"},"lastRunId":{"type":"string"},"lastTriggeredMs":{"type":"number","minimum":0},"lastRunStatus":{"type":"string"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"avgDurationMs":{"type":"number","minimum":0},"description":{"type":"string"}},"required":["workflowId","format"]},"PaginationInfoDTO":{"type":"object","properties":{"pageSize":{"type":"number"},"offset":{"type":"number"},"totalCount":{"type":"number"},"orderDirection":{"enum":["ASC","DESC"]},"orderBy":{"type":"string"}},"additionalProperties":false},"FilterInfo":{"type":"object","properties":{"fieldName":{"description":"Thenameofthefieldtofilteron","type":"string"},"operator":{"$ref":"#/components/schemas/Operator"},"fieldValue":{"title":"FilterValue","oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}],"description":"Thevaluetofilterby,whichcanbeastring,number,boolean,orProcessInstanceStatusDTO"}},"required":["fieldName","operator","fieldValue"]},"Operator":{"type":"string","description":"Theoperatortouseforfiltering,suchasequalityorinclusion","enum":["equal","in"]},"WorkflowFormatDTO":{"type":"string","description":"Formatoftheworkflowdefinition","enum":["yaml","json"]},"WorkflowCategoryDTO":{"type":"string","description":"Categoryoftheworkflow","enum":["assessment","infrastructure"]},"WorkflowListResultDTO":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowDTO"}},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}},"required":["items","paginationInfo"]},"WorkflowDTO":{"type":"object","properties":{"id":{"type":"string","description":"Workflowuniqueidentifier","minLength":1},"name":{"type":"string","description":"Workflowname","minLength":1},"format":{"$ref":"#/components/schemas/WorkflowFormatDTO"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"description":{"type":"string","description":"Descriptionoftheworkflow"},"annotations":{"type":"array","items":{"type":"string"}}},"required":["id","category","format"]},"ProcessInstanceListResultDTO":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ProcessInstanceDTO"}},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"AssessedProcessInstanceDTO":{"type":"object","properties":{"instance":{"$ref":"#/components/schemas/ProcessInstanceDTO"},"assessedBy":{"$ref":"#/components/schemas/ProcessInstanceDTO"}},"required":["instance"]},"ProcessInstanceDTO":{"type":"object","properties":{"id":{"type":"string"},"processId":{"type":"string"},"processName":{"type":"string"},"status":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"endpoint":{"type":"string"},"serviceUrl":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"duration":{"type":"string"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"description":{"type":"string"},"workflowdata":{"$ref":"#/components/schemas/WorkflowDataDTO"},"businessKey":{"type":"string"},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/NodeInstanceDTO"}},"error":{"$ref":"#/components/schemas/ProcessInstanceErrorDTO"}},"required":["id","processId","nodes"]},"WorkflowDataDTO":{"type":"object","properties":{"result":{"$ref":"#/components/schemas/WorkflowResultDTO"}},"additionalProperties":true},"WorkflowResultDTO":{"description":"Resultofaworkflowexecution","type":"object","properties":{"completedWith":{"description":"Thestateofworkflowcompletion.","type":"string","enum":["error","success"]},"message":{"description":"High-levelsummaryofthecurrentstatus,free-formtext,humanreadable.","type":"string"},"nextWorkflows":{"description":"Listofworkflowssuggestedtorunnext.Itemsatlowerindexesareofhigherpriority.","type":"array","items":{"type":"object","properties":{"id":{"description":"Workflowidentifier","type":"string"},"name":{"description":"Humanreadabletitledescribingtheworkflow.","type":"string"}},"required":["id","name"]}},"outputs":{"description":"Additionalstructuredoutputofworkflowprocessing.Thiscancontainidentifiersofcreatedresources,linkstoresources,logsorotheroutput.","type":"array","items":{"type":"object","properties":{"key":{"description":"Uniqueidentifieroftheoption.Preferablyhuman-readable.","type":"string"},"value":{"description":"Freeformvalueoftheoption.","anyOf":[{"type":"string"},{"type":"number"}]},"format":{"description":"Moredetailedtypeofthe'value'property.Defaultsto'text'.","enum":["text","number","link"]}},"required":["key","value"]}}}},"ProcessInstanceStatusDTO":{"type":"string","description":"Statusoftheworkflowrun","enum":["Active","Error","Completed","Aborted","Suspended","Pending"]},"WorkflowRunStatusDTO":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}},"ExecuteWorkflowRequestDTO":{"type":"object","properties":{"inputData":{"type":"object","additionalProperties":true}},"required":["inputData"]},"ExecuteWorkflowResponseDTO":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"WorkflowProgressDTO":{"allOf":[{"$ref":"#/components/schemas/NodeInstanceDTO"},{"type":"object","properties":{"status":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"error":{"$ref":"#/components/schemas/ProcessInstanceErrorDTO"}}}]},"NodeInstanceDTO":{"type":"object","properties":{"__typename":{"type":"string","default":"NodeInstance","description":"Typename"},"id":{"type":"string","description":"NodeinstanceID"},"name":{"type":"string","description":"Nodename"},"type":{"type":"string","description":"Nodetype"},"enter":{"type":"string","description":"Datewhenthenodewasentered"},"exit":{"type":"string","description":"Datewhenthenodewasexited(optional)"},"definitionId":{"type":"string","description":"DefinitionID"},"nodeId":{"type":"string","description":"NodeID"}},"required":["id"]},"ProcessInstanceErrorDTO":{"type":"object","properties":{"__typename":{"type":"string","default":"ProcessInstanceError","description":"Typename"},"nodeDefinitionId":{"type":"string","description":"NodedefinitionID"},"message":{"type":"string","description":"Errormessage(optional)"}},"required":["nodeDefinitionId"]}}}}`; +const OPENAPI = `{"openapi":"3.1.0","info":{"title":"Orchestratorplugin","description":"APItointeractwithorchestratorplugin","license":{"name":"Apache2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"version":"0.0.1"},"servers":[{"url":"/"}],"paths":{"/v2/workflows/overview":{"post":{"operationId":"getWorkflowsOverview","description":"Returnsthekeyfieldsoftheworkflowincludingdataonthelastruninstance","requestBody":{"required":false,"description":"Paginationandfilters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOverviewsRequestParams"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOverviewListResultDTO"}}}},"500":{"description":"Errorfetchingworkflowoverviews","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/overview":{"get":{"operationId":"getWorkflowOverviewById","description":"Returnsthekeyfieldsoftheworkflowincludingdataonthelastruninstance","parameters":[{"name":"workflowId","in":"path","required":true,"description":"Uniqueidentifieroftheworkflow","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOverviewDTO"}}}},"500":{"description":"Errorfetchingworkflowoverview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}":{"get":{"operationId":"getWorkflowById","description":"Getfullworkflowinfo","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDTO"}}}},"500":{"description":"Errorfetchingworkflowbyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/source":{"get":{"operationId":"getWorkflowSourceById","description":"Gettheworkflow'sdefinition","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Errorfetchingworkflowsourcebyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/inputSchema":{"get":{"operationId":"getWorkflowInputSchemaById","description":"Gettheworkflowinputschema.Itdefinestheinputfieldsoftheworkflow","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}},{"name":"instanceId","in":"query","description":"IDofinstance","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Errorfetchingworkflowinputschemabyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances":{"post":{"operationId":"getInstances","summary":"Getinstances","description":"Retrieveanarrayofworkflowexecutions(instances)","requestBody":{"required":false,"description":"Parametersforretrievinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInstancesRequestParams"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessInstanceListResultDTO"}}}},"500":{"description":"Errorfetchinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/instances":{"post":{"operationId":"getWorkflowInstances","summary":"Getinstancesforaspecificworkflow","description":"Retrieveanarrayofworkflowexecutions(instances)forthegivenworkflow","parameters":[{"name":"workflowId","in":"path","required":true,"description":"IDoftheworkflow","schema":{"type":"string"}}],"requestBody":{"required":false,"description":"Parametersforretrievingworkflowinstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInstancesRequestParams"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessInstanceListResultDTO"}}}},"500":{"description":"Errorfetchinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/{instanceId}":{"get":{"summary":"GetWorkflowInstancebyID","description":"Getaworkflowexecution/run(instance)","operationId":"getInstanceById","parameters":[{"name":"instanceId","in":"path","required":true,"description":"IDoftheworkflowinstance","schema":{"type":"string"}},{"name":"includeAssessment","in":"query","required":false,"description":"Whethertoincludeassessment","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Successfulresponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssessedProcessInstanceDTO"}}}},"500":{"description":"Errorfetchinginstance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/statuses":{"get":{"operationId":"getWorkflowStatuses","summary":"Getworkflowstatuslist","description":"Retrievearraywiththestatusofallinstances","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowRunStatusDTO"}}}}},"500":{"description":"Errorfetchingworkflowstatuses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/execute":{"post":{"summary":"Executeaworkflow","description":"Executeaworkflow","operationId":"executeWorkflow","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtoexecute","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteWorkflowRequestDTO"}}}},"responses":{"200":{"description":"Successfulexecution","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteWorkflowResponseDTO"}}}},"500":{"description":"InternalServerError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/{instanceId}/abort":{"delete":{"summary":"Abortaworkflowinstance","operationId":"abortWorkflow","description":"AbortsaworkflowinstanceidentifiedbytheprovidedinstanceId.","parameters":[{"name":"instanceId","in":"path","required":true,"description":"Theidentifieroftheworkflowinstancetoabort.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfuloperation","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Errorabortingworkflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ErrorResponse":{"description":"TheErrorResponseobjectrepresentsacommonstructureforhandlingerrorsinAPIresponses.Itincludesessentialinformationabouttheerror,suchastheerrormessageandadditionaloptionaldetails.","type":"object","properties":{"message":{"description":"Astringprovidingaconciseandhuman-readabledescriptionoftheencounterederror.ThisfieldisrequiredintheErrorResponseobject.","type":"string","default":"internalservererror"},"additionalInfo":{"description":"Anoptionalfieldthatcancontainadditionalinformationorcontextabouttheerror.Itprovidesflexibilityforincludingextradetailsbasedonspecificerrorscenarios.","type":"string"}},"required":["message"]},"GetInstancesRequestParams":{"type":"object","properties":{"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"},"filterInfo":{"$ref":"#/components/schemas/FilterInfo"}}},"GetOverviewsRequestParams":{"type":"object","properties":{"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"},"filterInfo":{"$ref":"#/components/schemas/FilterInfo"}}},"WorkflowOverviewListResultDTO":{"type":"object","properties":{"overviews":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowOverviewDTO"},"minItems":0},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"WorkflowOverviewDTO":{"type":"object","properties":{"workflowId":{"type":"string","description":"Workflowuniqueidentifier","minLength":1},"name":{"type":"string","description":"Workflowname","minLength":1},"format":{"$ref":"#/components/schemas/WorkflowFormatDTO"},"lastRunId":{"type":"string"},"lastTriggeredMs":{"type":"number","minimum":0},"lastRunStatus":{"type":"string"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"avgDurationMs":{"type":"number","minimum":0},"description":{"type":"string"}},"required":["workflowId","format"]},"PaginationInfoDTO":{"type":"object","properties":{"pageSize":{"type":"number"},"offset":{"type":"number"},"totalCount":{"type":"number"},"orderDirection":{"enum":["ASC","DESC"]},"orderBy":{"type":"string"}},"additionalProperties":false},"FilterInfo":{"type":"object","properties":{"fieldName":{"description":"Thenameofthefieldtofilteron","type":"string"},"operator":{"$ref":"#/components/schemas/Operator"},"fieldValue":{"title":"FilterValue","oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}],"description":"Thevaluetofilterby,whichcanbeastring,number,boolean,orProcessInstanceStatusDTO"}},"required":["fieldName","operator","fieldValue"]},"Operator":{"type":"string","description":"Theoperatortouseforfiltering,suchasequalityorinclusion","enum":["equal","in"]},"WorkflowFormatDTO":{"type":"string","description":"Formatoftheworkflowdefinition","enum":["yaml","json"]},"WorkflowCategoryDTO":{"type":"string","description":"Categoryoftheworkflow","enum":["assessment","infrastructure"]},"WorkflowListResultDTO":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowDTO"}},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}},"required":["items","paginationInfo"]},"WorkflowDTO":{"type":"object","properties":{"id":{"type":"string","description":"Workflowuniqueidentifier","minLength":1},"name":{"type":"string","description":"Workflowname","minLength":1},"format":{"$ref":"#/components/schemas/WorkflowFormatDTO"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"description":{"type":"string","description":"Descriptionoftheworkflow"},"annotations":{"type":"array","items":{"type":"string"}}},"required":["id","category","format"]},"ProcessInstanceListResultDTO":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ProcessInstanceDTO"}},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"AssessedProcessInstanceDTO":{"type":"object","properties":{"instance":{"$ref":"#/components/schemas/ProcessInstanceDTO"},"assessedBy":{"$ref":"#/components/schemas/ProcessInstanceDTO"}},"required":["instance"]},"ProcessInstanceDTO":{"type":"object","properties":{"id":{"type":"string"},"processId":{"type":"string"},"processName":{"type":"string"},"status":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"endpoint":{"type":"string"},"serviceUrl":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"duration":{"type":"string"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"description":{"type":"string"},"workflowdata":{"$ref":"#/components/schemas/WorkflowDataDTO"},"businessKey":{"type":"string"},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/NodeInstanceDTO"}},"error":{"$ref":"#/components/schemas/ProcessInstanceErrorDTO"}},"required":["id","processId","nodes"]},"WorkflowDataDTO":{"type":"object","properties":{"result":{"$ref":"#/components/schemas/WorkflowResultDTO"}},"additionalProperties":true},"WorkflowResultDTO":{"description":"Resultofaworkflowexecution","type":"object","properties":{"completedWith":{"description":"Thestateofworkflowcompletion.","type":"string","enum":["error","success"]},"message":{"description":"High-levelsummaryofthecurrentstatus,free-formtext,humanreadable.","type":"string"},"nextWorkflows":{"description":"Listofworkflowssuggestedtorunnext.Itemsatlowerindexesareofhigherpriority.","type":"array","items":{"type":"object","properties":{"id":{"description":"Workflowidentifier","type":"string"},"name":{"description":"Humanreadabletitledescribingtheworkflow.","type":"string"}},"required":["id","name"]}},"outputs":{"description":"Additionalstructuredoutputofworkflowprocessing.Thiscancontainidentifiersofcreatedresources,linkstoresources,logsorotheroutput.","type":"array","items":{"type":"object","properties":{"key":{"description":"Uniqueidentifieroftheoption.Preferablyhuman-readable.","type":"string"},"value":{"description":"Freeformvalueoftheoption.","anyOf":[{"type":"string"},{"type":"number"}]},"format":{"description":"Moredetailedtypeofthe'value'property.Defaultsto'text'.","enum":["text","number","link"]}},"required":["key","value"]}}}},"ProcessInstanceStatusDTO":{"type":"string","description":"Statusoftheworkflowrun","enum":["Active","Error","Completed","Aborted","Suspended","Pending"]},"WorkflowRunStatusDTO":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}},"ExecuteWorkflowRequestDTO":{"type":"object","properties":{"inputData":{"type":"object","additionalProperties":true}},"required":["inputData"]},"ExecuteWorkflowResponseDTO":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"WorkflowProgressDTO":{"allOf":[{"$ref":"#/components/schemas/NodeInstanceDTO"},{"type":"object","properties":{"status":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"error":{"$ref":"#/components/schemas/ProcessInstanceErrorDTO"}}}]},"NodeInstanceDTO":{"type":"object","properties":{"__typename":{"type":"string","default":"NodeInstance","description":"Typename"},"id":{"type":"string","description":"NodeinstanceID"},"name":{"type":"string","description":"Nodename"},"type":{"type":"string","description":"Nodetype"},"enter":{"type":"string","description":"Datewhenthenodewasentered"},"exit":{"type":"string","description":"Datewhenthenodewasexited(optional)"},"definitionId":{"type":"string","description":"DefinitionID"},"nodeId":{"type":"string","description":"NodeID"}},"required":["id"]},"ProcessInstanceErrorDTO":{"type":"object","properties":{"__typename":{"type":"string","default":"ProcessInstanceError","description":"Typename"},"nodeDefinitionId":{"type":"string","description":"NodedefinitionID"},"message":{"type":"string","description":"Errormessage(optional)"}},"required":["nodeDefinitionId"]}}}}`; export const openApiDocument = JSON.parse(OPENAPI); diff --git a/plugins/orchestrator-common/src/generated/client/api.ts b/plugins/orchestrator-common/src/generated/client/api.ts index 2eee9fac81..a35f2d914a 100644 --- a/plugins/orchestrator-common/src/generated/client/api.ts +++ b/plugins/orchestrator-common/src/generated/client/api.ts @@ -1033,6 +1033,44 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati options: localVarRequestOptions, }; }, + /** + * Retrieve an array of workflow executions (instances) for the given workflow + * @summary Get instances for a specific workflow + * @param {string} workflowId ID of the workflow + * @param {GetInstancesRequestParams} [getInstancesRequestParams] Parameters for retrieving workflow instances + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkflowInstances: async (workflowId: string, getInstancesRequestParams?: GetInstancesRequestParams, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'workflowId' is not null or undefined + assertParamExists('getWorkflowInstances', 'workflowId', workflowId) + const localVarPath = `/v2/workflows/{workflowId}/instances` + .replace(`{${"workflowId"}}`, encodeURIComponent(String(workflowId))); + // 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(getInstancesRequestParams, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Returns the key fields of the workflow including data on the last run instance * @param {string} workflowId Unique identifier of the workflow @@ -1251,6 +1289,20 @@ export const DefaultApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['DefaultApi.getWorkflowInputSchemaById']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, + /** + * Retrieve an array of workflow executions (instances) for the given workflow + * @summary Get instances for a specific workflow + * @param {string} workflowId ID of the workflow + * @param {GetInstancesRequestParams} [getInstancesRequestParams] Parameters for retrieving workflow instances + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getWorkflowInstances(workflowId: string, getInstancesRequestParams?: GetInstancesRequestParams, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getWorkflowInstances(workflowId, getInstancesRequestParams, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['DefaultApi.getWorkflowInstances']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, /** * Returns the key fields of the workflow including data on the last run instance * @param {string} workflowId Unique identifier of the workflow @@ -1370,6 +1422,17 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa getWorkflowInputSchemaById(workflowId: string, instanceId?: string, options?: any): AxiosPromise { return localVarFp.getWorkflowInputSchemaById(workflowId, instanceId, options).then((request) => request(axios, basePath)); }, + /** + * Retrieve an array of workflow executions (instances) for the given workflow + * @summary Get instances for a specific workflow + * @param {string} workflowId ID of the workflow + * @param {GetInstancesRequestParams} [getInstancesRequestParams] Parameters for retrieving workflow instances + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkflowInstances(workflowId: string, getInstancesRequestParams?: GetInstancesRequestParams, options?: any): AxiosPromise { + return localVarFp.getWorkflowInstances(workflowId, getInstancesRequestParams, options).then((request) => request(axios, basePath)); + }, /** * Returns the key fields of the workflow including data on the last run instance * @param {string} workflowId Unique identifier of the workflow @@ -1489,6 +1552,19 @@ export class DefaultApi extends BaseAPI { return DefaultApiFp(this.configuration).getWorkflowInputSchemaById(workflowId, instanceId, options).then((request) => request(this.axios, this.basePath)); } + /** + * Retrieve an array of workflow executions (instances) for the given workflow + * @summary Get instances for a specific workflow + * @param {string} workflowId ID of the workflow + * @param {GetInstancesRequestParams} [getInstancesRequestParams] Parameters for retrieving workflow instances + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public getWorkflowInstances(workflowId: string, getInstancesRequestParams?: GetInstancesRequestParams, options?: RawAxiosRequestConfig) { + return DefaultApiFp(this.configuration).getWorkflowInstances(workflowId, getInstancesRequestParams, options).then((request) => request(this.axios, this.basePath)); + } + /** * Returns the key fields of the workflow including data on the last run instance * @param {string} workflowId Unique identifier of the workflow diff --git a/plugins/orchestrator-common/src/generated/docs/html/index.html b/plugins/orchestrator-common/src/generated/docs/html/index.html index 69e2b43066..e1791d40d1 100644 --- a/plugins/orchestrator-common/src/generated/docs/html/index.html +++ b/plugins/orchestrator-common/src/generated/docs/html/index.html @@ -1330,6 +1330,9 @@
  • getWorkflowInputSchemaById
  • +
  • + getWorkflowInstances +
  • getWorkflowOverviewById
  • @@ -4035,6 +4038,497 @@


    +
    +
    +
    +

    getWorkflowInstances

    +

    Get instances for a specific workflow

    +
    +
    +
    +

    +

    Retrieve an array of workflow executions (instances) for the given workflow

    +

    +
    +
    /v2/workflows/{workflowId}/instances
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST \
    + -H "Accept: application/json" \
    + -H "Content-Type: application/json" \
    + "http://localhost/v2/workflows/{workflowId}/instances" \
    + -d '{
    +  "paginationInfo" : {
    +    "offset" : 5.962133916683182,
    +    "pageSize" : 1.4658129805029452,
    +    "orderDirection" : "ASC",
    +    "orderBy" : "orderBy",
    +    "totalCount" : 5.637376656633329
    +  },
    +  "filterInfo" : {
    +    "fieldName" : "fieldName",
    +    "fieldValue" : "FilterValue"
    +  }
    +}'
    +
    +
    +
    +
    import org.openapitools.client.*;
    +import org.openapitools.client.auth.*;
    +import org.openapitools.client.model.*;
    +import org.openapitools.client.api.DefaultApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DefaultApiExample {
    +    public static void main(String[] args) {
    +
    +        // Create an instance of the API class
    +        DefaultApi apiInstance = new DefaultApi();
    +        String workflowId = workflowId_example; // String | ID of the workflow
    +        GetInstancesRequestParams getInstancesRequestParams = ; // GetInstancesRequestParams | 
    +
    +        try {
    +            ProcessInstanceListResultDTO result = apiInstance.getWorkflowInstances(workflowId, getInstancesRequestParams);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DefaultApi#getWorkflowInstances");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    +
    + +
    +
    import 'package:openapi/api.dart';
    +
    +final api_instance = DefaultApi();
    +
    +final String workflowId = new String(); // String | ID of the workflow
    +final GetInstancesRequestParams getInstancesRequestParams = new GetInstancesRequestParams(); // GetInstancesRequestParams | 
    +
    +try {
    +    final result = await api_instance.getWorkflowInstances(workflowId, getInstancesRequestParams);
    +    print(result);
    +} catch (e) {
    +    print('Exception when calling DefaultApi->getWorkflowInstances: $e\n');
    +}
    +
    +
    +
    + +
    +
    import org.openapitools.client.api.DefaultApi;
    +
    +public class DefaultApiExample {
    +    public static void main(String[] args) {
    +        DefaultApi apiInstance = new DefaultApi();
    +        String workflowId = workflowId_example; // String | ID of the workflow
    +        GetInstancesRequestParams getInstancesRequestParams = ; // GetInstancesRequestParams | 
    +
    +        try {
    +            ProcessInstanceListResultDTO result = apiInstance.getWorkflowInstances(workflowId, getInstancesRequestParams);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DefaultApi#getWorkflowInstances");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    
    +
    +// Create an instance of the API class
    +DefaultApi *apiInstance = [[DefaultApi alloc] init];
    +String *workflowId = workflowId_example; // ID of the workflow (default to null)
    +GetInstancesRequestParams *getInstancesRequestParams = ; //  (optional)
    +
    +// Get instances for a specific workflow
    +[apiInstance getWorkflowInstancesWith:workflowId
    +    getInstancesRequestParams:getInstancesRequestParams
    +              completionHandler: ^(ProcessInstanceListResultDTO output, NSError* error) {
    +    if (output) {
    +        NSLog(@"%@", output);
    +    }
    +    if (error) {
    +        NSLog(@"Error: %@", error);
    +    }
    +}];
    +
    +
    + +
    +
    var OrchestratorPlugin = require('orchestrator_plugin');
    +
    +// Create an instance of the API class
    +var api = new OrchestratorPlugin.DefaultApi()
    +var workflowId = workflowId_example; // {String} ID of the workflow
    +var opts = {
    +  'getInstancesRequestParams':  // {GetInstancesRequestParams} 
    +};
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.getWorkflowInstances(workflowId, opts, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using Org.OpenAPITools.Api;
    +using Org.OpenAPITools.Client;
    +using Org.OpenAPITools.Model;
    +
    +namespace Example
    +{
    +    public class getWorkflowInstancesExample
    +    {
    +        public void main()
    +        {
    +
    +            // Create an instance of the API class
    +            var apiInstance = new DefaultApi();
    +            var workflowId = workflowId_example;  // String | ID of the workflow (default to null)
    +            var getInstancesRequestParams = new GetInstancesRequestParams(); // GetInstancesRequestParams |  (optional) 
    +
    +            try {
    +                // Get instances for a specific workflow
    +                ProcessInstanceListResultDTO result = apiInstance.getWorkflowInstances(workflowId, getInstancesRequestParams);
    +                Debug.WriteLine(result);
    +            } catch (Exception e) {
    +                Debug.Print("Exception when calling DefaultApi.getWorkflowInstances: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +// Create an instance of the API class
    +$api_instance = new OpenAPITools\Client\Api\DefaultApi();
    +$workflowId = workflowId_example; // String | ID of the workflow
    +$getInstancesRequestParams = ; // GetInstancesRequestParams | 
    +
    +try {
    +    $result = $api_instance->getWorkflowInstances($workflowId, $getInstancesRequestParams);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DefaultApi->getWorkflowInstances: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use WWW::OPenAPIClient::Configuration;
    +use WWW::OPenAPIClient::DefaultApi;
    +
    +# Create an instance of the API class
    +my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
    +my $workflowId = workflowId_example; # String | ID of the workflow
    +my $getInstancesRequestParams = WWW::OPenAPIClient::Object::GetInstancesRequestParams->new(); # GetInstancesRequestParams | 
    +
    +eval {
    +    my $result = $api_instance->getWorkflowInstances(workflowId => $workflowId, getInstancesRequestParams => $getInstancesRequestParams);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DefaultApi->getWorkflowInstances: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import openapi_client
    +from openapi_client.rest import ApiException
    +from pprint import pprint
    +
    +# Create an instance of the API class
    +api_instance = openapi_client.DefaultApi()
    +workflowId = workflowId_example # String | ID of the workflow (default to null)
    +getInstancesRequestParams =  # GetInstancesRequestParams |  (optional)
    +
    +try:
    +    # Get instances for a specific workflow
    +    api_response = api_instance.get_workflow_instances(workflowId, getInstancesRequestParams=getInstancesRequestParams)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DefaultApi->getWorkflowInstances: %s\n" % e)
    +
    + +
    +
    extern crate DefaultApi;
    +
    +pub fn main() {
    +    let workflowId = workflowId_example; // String
    +    let getInstancesRequestParams = ; // GetInstancesRequestParams
    +
    +    let mut context = DefaultApi::Context::default();
    +    let result = client.getWorkflowInstances(workflowId, getInstancesRequestParams, &context).wait();
    +
    +    println!("{:?}", result);
    +}
    +
    +
    +
    + +

    Scopes

    + + +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    workflowId* + + +
    +
    +
    + + String + + +
    +ID of the workflow +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    getInstancesRequestParams +

    Parameters for retrieving workflow instances

    + +
    +
    + + + +

    Responses

    +

    +

    + + + + + + +
    +
    +
    + +
    + +
    +
    +

    +

    + + + + + + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    diff --git a/plugins/orchestrator-common/src/generated/docs/markdown/Apis/DefaultApi.md b/plugins/orchestrator-common/src/generated/docs/markdown/Apis/DefaultApi.md index f225a1b473..54cc603b2f 100644 --- a/plugins/orchestrator-common/src/generated/docs/markdown/Apis/DefaultApi.md +++ b/plugins/orchestrator-common/src/generated/docs/markdown/Apis/DefaultApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://localhost* | [**getInstances**](DefaultApi.md#getInstances) | **POST** /v2/workflows/instances | Get instances | | [**getWorkflowById**](DefaultApi.md#getWorkflowById) | **GET** /v2/workflows/{workflowId} | | | [**getWorkflowInputSchemaById**](DefaultApi.md#getWorkflowInputSchemaById) | **GET** /v2/workflows/{workflowId}/inputSchema | | +| [**getWorkflowInstances**](DefaultApi.md#getWorkflowInstances) | **POST** /v2/workflows/{workflowId}/instances | Get instances for a specific workflow | | [**getWorkflowOverviewById**](DefaultApi.md#getWorkflowOverviewById) | **GET** /v2/workflows/{workflowId}/overview | | | [**getWorkflowSourceById**](DefaultApi.md#getWorkflowSourceById) | **GET** /v2/workflows/{workflowId}/source | | | [**getWorkflowStatuses**](DefaultApi.md#getWorkflowStatuses) | **GET** /v2/workflows/instances/statuses | Get workflow status list | @@ -181,6 +182,34 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json + +# **getWorkflowInstances** +> ProcessInstanceListResultDTO getWorkflowInstances(workflowId, GetInstancesRequestParams) + +Get instances for a specific workflow + + Retrieve an array of workflow executions (instances) for the given workflow + +### Parameters + +|Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **workflowId** | **String**| ID of the workflow | [default to null] | +| **GetInstancesRequestParams** | [**GetInstancesRequestParams**](../Models/GetInstancesRequestParams.md)| Parameters for retrieving workflow instances | [optional] | + +### Return type + +[**ProcessInstanceListResultDTO**](../Models/ProcessInstanceListResultDTO.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + # **getWorkflowOverviewById** > WorkflowOverviewDTO getWorkflowOverviewById(workflowId) diff --git a/plugins/orchestrator-common/src/generated/docs/markdown/README.md b/plugins/orchestrator-common/src/generated/docs/markdown/README.md index 2d216c8a76..cfa04b025d 100644 --- a/plugins/orchestrator-common/src/generated/docs/markdown/README.md +++ b/plugins/orchestrator-common/src/generated/docs/markdown/README.md @@ -13,6 +13,7 @@ All URIs are relative to *http://localhost* *DefaultApi* | [**getInstances**](Apis/DefaultApi.md#getinstances) | **POST** /v2/workflows/instances | Get instances | *DefaultApi* | [**getWorkflowById**](Apis/DefaultApi.md#getworkflowbyid) | **GET** /v2/workflows/{workflowId} | Get full workflow info | *DefaultApi* | [**getWorkflowInputSchemaById**](Apis/DefaultApi.md#getworkflowinputschemabyid) | **GET** /v2/workflows/{workflowId}/inputSchema | Get the workflow input schema. It defines the input fields of the workflow | +*DefaultApi* | [**getWorkflowInstances**](Apis/DefaultApi.md#getworkflowinstances) | **POST** /v2/workflows/{workflowId}/instances | Get instances for a specific workflow | *DefaultApi* | [**getWorkflowOverviewById**](Apis/DefaultApi.md#getworkflowoverviewbyid) | **GET** /v2/workflows/{workflowId}/overview | Returns the key fields of the workflow including data on the last run instance | *DefaultApi* | [**getWorkflowSourceById**](Apis/DefaultApi.md#getworkflowsourcebyid) | **GET** /v2/workflows/{workflowId}/source | Get the workflow's definition | *DefaultApi* | [**getWorkflowStatuses**](Apis/DefaultApi.md#getworkflowstatuses) | **GET** /v2/workflows/instances/statuses | Get workflow status list | diff --git a/plugins/orchestrator-common/src/openapi/openapi.yaml b/plugins/orchestrator-common/src/openapi/openapi.yaml index 3bd63c91ed..82287012a0 100644 --- a/plugins/orchestrator-common/src/openapi/openapi.yaml +++ b/plugins/orchestrator-common/src/openapi/openapi.yaml @@ -159,6 +159,38 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + /v2/workflows/{workflowId}/instances: + post: + operationId: getWorkflowInstances + summary: Get instances for a specific workflow + description: Retrieve an array of workflow executions (instances) for the given workflow + parameters: + - name: workflowId + in: path + required: true + description: ID of the workflow + schema: + type: string + requestBody: + required: false + description: Parameters for retrieving workflow instances + content: + application/json: + schema: + $ref: '#/components/schemas/GetInstancesRequestParams' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ProcessInstanceListResultDTO' + '500': + description: Error fetching instances + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' /v2/workflows/instances/{instanceId}: get: summary: Get Workflow Instance by ID