diff --git a/integration-tests/src/test/java/com/redhat/parodos/flows/ComplexWorkFlowTest.java b/integration-tests/src/test/java/com/redhat/parodos/flows/ComplexWorkFlowTest.java
index 336d576de..0fdc085c7 100644
--- a/integration-tests/src/test/java/com/redhat/parodos/flows/ComplexWorkFlowTest.java
+++ b/integration-tests/src/test/java/com/redhat/parodos/flows/ComplexWorkFlowTest.java
@@ -11,9 +11,9 @@
import com.redhat.parodos.sdk.model.ArgumentRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowContextResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
@@ -49,7 +49,7 @@ public void runComplexWorkFlow() throws ApiException, InterruptedException {
log.info("Running the Assessment to see what WorkFlows are eligible for this situation:");
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
- WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
+ WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
assertEquals(WorkStatusEnum.IN_PROGRESS, workFlowResponseDTO.getWorkStatus());
log.info("workflow submitted successfully with response: {}", workFlowResponseDTO);
@@ -103,7 +103,7 @@ public void runComplexWorkFlow() throws ApiException, InterruptedException {
workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
assertNotNull("There is no valid WorkFlowExecutionId", workFlowResponseDTO.getWorkFlowExecutionId());
- assertEquals(workFlowResponseDTO.getWorkStatus(), WorkStatusEnum.IN_PROGRESS);
+ assertEquals(WorkStatusEnum.IN_PROGRESS, workFlowResponseDTO.getWorkStatus());
log.info("Onboarding workflow execution id: {}", workFlowResponseDTO.getWorkFlowExecutionId());
workFlowStatusResponseDTO = SdkUtils.waitWorkflowStatusAsync(workflowApi,
diff --git a/integration-tests/src/test/java/com/redhat/parodos/flows/EscalationFlowTest.java b/integration-tests/src/test/java/com/redhat/parodos/flows/EscalationFlowTest.java
index 80c331651..c0b923369 100644
--- a/integration-tests/src/test/java/com/redhat/parodos/flows/EscalationFlowTest.java
+++ b/integration-tests/src/test/java/com/redhat/parodos/flows/EscalationFlowTest.java
@@ -4,13 +4,14 @@
import com.redhat.parodos.flows.common.WorkFlowTestBuilder.TestComponents;
import com.redhat.parodos.sdk.api.WorkflowApi;
import com.redhat.parodos.sdk.invoker.ApiException;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
+import static com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -35,10 +36,10 @@ public void runEscalationFlow() throws ApiException, InterruptedException {
log.info("executes 1 task with a WorkFlowChecker");
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
- WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
+ WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
assertNotNull("There is no valid WorkFlowExecutionId", workFlowResponseDTO.getWorkFlowExecutionId());
- assertEquals(workFlowResponseDTO.getWorkStatus(), WorkFlowResponseDTO.WorkStatusEnum.IN_PROGRESS);
+ assertEquals(workFlowResponseDTO.getWorkStatus(), WorkStatusEnum.IN_PROGRESS);
log.info("Escalation workflow execution id: {}", workFlowResponseDTO.getWorkFlowExecutionId());
log.info("Escalation workFlow {}", workFlowResponseDTO.getWorkStatus());
log.info("Waiting for checkers to complete...");
diff --git a/integration-tests/src/test/java/com/redhat/parodos/flows/PrebuiltWorkFlowTest.java b/integration-tests/src/test/java/com/redhat/parodos/flows/PrebuiltWorkFlowTest.java
index f695dfa0c..0b492f7f6 100644
--- a/integration-tests/src/test/java/com/redhat/parodos/flows/PrebuiltWorkFlowTest.java
+++ b/integration-tests/src/test/java/com/redhat/parodos/flows/PrebuiltWorkFlowTest.java
@@ -11,8 +11,9 @@
import com.redhat.parodos.sdk.model.ArgumentRequestDTO;
import com.redhat.parodos.sdk.model.WorkDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
@@ -54,11 +55,11 @@ public void runPreBuiltWorkFlow() throws ApiException, InterruptedException {
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
log.info("******** Running The PreBuilt Flow ********");
- WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
+ WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
assertNotNull(workFlowResponseDTO.getWorkFlowExecutionId());
assertNotNull(workFlowResponseDTO.getWorkStatus());
- assertEquals(WorkFlowResponseDTO.WorkStatusEnum.IN_PROGRESS, workFlowResponseDTO.getWorkStatus());
+ assertEquals(WorkStatusEnum.IN_PROGRESS, workFlowResponseDTO.getWorkStatus());
WorkFlowStatusResponseDTO workFlowStatusResponseDTO = SdkUtils.waitWorkflowStatusAsync(workflowApi,
workFlowResponseDTO.getWorkFlowExecutionId());
diff --git a/integration-tests/src/test/java/com/redhat/parodos/flows/SimpleRollbackWorkFlowTest.java b/integration-tests/src/test/java/com/redhat/parodos/flows/SimpleRollbackWorkFlowTest.java
index 34eed1bdd..a57a650b1 100644
--- a/integration-tests/src/test/java/com/redhat/parodos/flows/SimpleRollbackWorkFlowTest.java
+++ b/integration-tests/src/test/java/com/redhat/parodos/flows/SimpleRollbackWorkFlowTest.java
@@ -8,9 +8,9 @@
import com.redhat.parodos.sdk.api.WorkflowApi;
import com.redhat.parodos.sdk.invoker.ApiException;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
import com.redhat.parodos.workflow.consts.WorkFlowConstants;
@@ -44,7 +44,7 @@ public void runRollbackWorkFlow() throws ApiException, InterruptedException {
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
log.info("******** Running The Simple Failed Flow ********");
- WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
+ WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
assertNotNull(workFlowResponseDTO.getWorkFlowExecutionId());
assertNotNull(workFlowResponseDTO.getWorkStatus());
diff --git a/integration-tests/src/test/java/com/redhat/parodos/flows/SimpleWorkFlowTest.java b/integration-tests/src/test/java/com/redhat/parodos/flows/SimpleWorkFlowTest.java
index dd08c8de1..b4cd75078 100644
--- a/integration-tests/src/test/java/com/redhat/parodos/flows/SimpleWorkFlowTest.java
+++ b/integration-tests/src/test/java/com/redhat/parodos/flows/SimpleWorkFlowTest.java
@@ -14,9 +14,9 @@
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO.ProcessingTypeEnum;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO.TypeEnum;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO.WorkStatusEnum;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.sdkutils.SdkUtils;
@@ -64,7 +64,7 @@ public void runSimpleWorkFlow() throws ApiException, InterruptedException {
log.info("******** Running The Simple Sequence Flow ********");
WorkflowApi workflowApi = new WorkflowApi(components.apiClient());
- WorkFlowResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
+ WorkFlowExecutionResponseDTO workFlowResponseDTO = workflowApi.execute(workFlowRequestDTO);
assertNotNull(workFlowResponseDTO.getWorkFlowExecutionId());
assertNotNull(workFlowResponseDTO.getWorkStatus());
diff --git a/workflow-examples/src/test/java/com/redhat/parodos/examples/kubeapi/KubeapiWorkFlow.java b/workflow-examples/src/test/java/com/redhat/parodos/examples/kubeapi/KubeapiWorkFlow.java
index c048b218c..f68c1586a 100644
--- a/workflow-examples/src/test/java/com/redhat/parodos/examples/kubeapi/KubeapiWorkFlow.java
+++ b/workflow-examples/src/test/java/com/redhat/parodos/examples/kubeapi/KubeapiWorkFlow.java
@@ -12,8 +12,8 @@
import com.redhat.parodos.sdk.model.ArgumentRequestDTO;
import com.redhat.parodos.sdk.model.ProjectResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.workflow.utils.CredUtils;
import org.junit.Test;
@@ -103,7 +103,7 @@ public void runFlow() {
// 3 - Execute WorkFlowRequests
for (WorkFlowRequestDTO workFlowRequest : workFlowRequests) {
- WorkFlowResponseDTO execute = workflowApi.execute(workFlowRequest);
+ WorkFlowExecutionResponseDTO execute = workflowApi.execute(workFlowRequest);
assertNotNull(execute.getWorkFlowExecutionId());
}
diff --git a/workflow-examples/src/test/java/com/redhat/parodos/examples/rest/RestWorkFlow.java b/workflow-examples/src/test/java/com/redhat/parodos/examples/rest/RestWorkFlow.java
index 6754f42af..07eb37cf6 100644
--- a/workflow-examples/src/test/java/com/redhat/parodos/examples/rest/RestWorkFlow.java
+++ b/workflow-examples/src/test/java/com/redhat/parodos/examples/rest/RestWorkFlow.java
@@ -11,8 +11,8 @@
import com.redhat.parodos.sdk.model.ArgumentRequestDTO;
import com.redhat.parodos.sdk.model.ProjectResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
-import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkRequestDTO;
import com.redhat.parodos.workflow.utils.CredUtils;
import org.junit.Test;
@@ -65,7 +65,7 @@ public void runFlow() throws InterruptedException, ApiException {
WorkFlowRequestDTO workFlowRequests[] = new WorkFlowRequestDTO[] { workFlowRequestGet };
for (WorkFlowRequestDTO workFlowRequest : workFlowRequests) {
- WorkFlowResponseDTO execute = workflowApi.execute(workFlowRequest);
+ WorkFlowExecutionResponseDTO execute = workflowApi.execute(workFlowRequest);
assertNotNull(execute.getWorkFlowExecutionId());
}
diff --git a/workflow-service-sdk/README.md b/workflow-service-sdk/README.md
index e9d49a287..c01deba0c 100644
--- a/workflow-service-sdk/README.md
+++ b/workflow-service-sdk/README.md
@@ -140,6 +140,7 @@ Class | Method | HTTP request | Description
- [WorkFlowCheckerTaskRequestDTO](docs/WorkFlowCheckerTaskRequestDTO.md)
- [WorkFlowContextResponseDTO](docs/WorkFlowContextResponseDTO.md)
- [WorkFlowDefinitionResponseDTO](docs/WorkFlowDefinitionResponseDTO.md)
+ - [WorkFlowExecutionResponseDTO](docs/WorkFlowExecutionResponseDTO.md)
- [WorkFlowOption](docs/WorkFlowOption.md)
- [WorkFlowOptionsResponseDTO](docs/WorkFlowOptionsResponseDTO.md)
- [WorkFlowPropertiesDefinitionDTO](docs/WorkFlowPropertiesDefinitionDTO.md)
diff --git a/workflow-service-sdk/api/openapi.yaml b/workflow-service-sdk/api/openapi.yaml
index 53a4883e5..17cc65f7c 100644
--- a/workflow-service-sdk/api/openapi.yaml
+++ b/workflow-service-sdk/api/openapi.yaml
@@ -477,7 +477,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/WorkFlowResponseDTO'
+ $ref: '#/components/schemas/WorkFlowExecutionResponseDTO'
description: Accepted
"400":
content:
@@ -1035,6 +1035,23 @@ components:
$ref: '#/components/schemas/WorkDefinitionResponseDTO'
type: array
type: object
+ WorkFlowExecutionResponseDTO:
+ example:
+ workStatus: FAILED
+ workFlowExecutionId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
+ properties:
+ workFlowExecutionId:
+ format: uuid
+ type: string
+ workStatus:
+ enum:
+ - FAILED
+ - COMPLETED
+ - IN_PROGRESS
+ - REJECTED
+ - PENDING
+ type: string
+ type: object
WorkFlowOption:
example:
identifier: identifier
diff --git a/workflow-service-sdk/docs/WorkFlowExecutionResponseDTO.md b/workflow-service-sdk/docs/WorkFlowExecutionResponseDTO.md
new file mode 100644
index 000000000..d228600fd
--- /dev/null
+++ b/workflow-service-sdk/docs/WorkFlowExecutionResponseDTO.md
@@ -0,0 +1,26 @@
+
+
+# WorkFlowExecutionResponseDTO
+
+
+## Properties
+
+| Name | Type | Description | Notes |
+|------------ | ------------- | ------------- | -------------|
+|**workFlowExecutionId** | **UUID** | | [optional] |
+|**workStatus** | [**WorkStatusEnum**](#WorkStatusEnum) | | [optional] |
+
+
+
+## Enum: WorkStatusEnum
+
+| Name | Value |
+|---- | -----|
+| FAILED | "FAILED" |
+| COMPLETED | "COMPLETED" |
+| IN_PROGRESS | "IN_PROGRESS" |
+| REJECTED | "REJECTED" |
+| PENDING | "PENDING" |
+
+
+
diff --git a/workflow-service-sdk/docs/WorkflowApi.md b/workflow-service-sdk/docs/WorkflowApi.md
index 130202b37..75ff230e8 100644
--- a/workflow-service-sdk/docs/WorkflowApi.md
+++ b/workflow-service-sdk/docs/WorkflowApi.md
@@ -13,7 +13,7 @@ All URIs are relative to *http://localhost:8080*
# **execute**
-> WorkFlowResponseDTO execute(workFlowRequestDTO)
+> WorkFlowExecutionResponseDTO execute(workFlowRequestDTO)
Executes a workflow
@@ -34,7 +34,7 @@ public class Example {
WorkflowApi apiInstance = new WorkflowApi(defaultClient);
WorkFlowRequestDTO workFlowRequestDTO = new WorkFlowRequestDTO(); // WorkFlowRequestDTO |
try {
- WorkFlowResponseDTO result = apiInstance.execute(workFlowRequestDTO);
+ WorkFlowExecutionResponseDTO result = apiInstance.execute(workFlowRequestDTO);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkflowApi#execute");
@@ -55,7 +55,7 @@ public class Example {
### Return type
-[**WorkFlowResponseDTO**](WorkFlowResponseDTO.md)
+[**WorkFlowExecutionResponseDTO**](WorkFlowExecutionResponseDTO.md)
### Authorization
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/WorkflowApi.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/WorkflowApi.java
index 627162025..ace5d8009 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/WorkflowApi.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/WorkflowApi.java
@@ -28,6 +28,7 @@
import com.redhat.parodos.sdk.invoker.Pair;
import com.redhat.parodos.sdk.model.WorkFlowCheckerTaskRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowContextResponseDTO;
+import com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowRequestDTO;
import com.redhat.parodos.sdk.model.WorkFlowResponseDTO;
import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO;
@@ -178,7 +179,7 @@ private okhttp3.Call executeValidateBeforeCall(WorkFlowRequestDTO workFlowReques
/**
* Executes a workflow
* @param workFlowRequestDTO (required)
- * @return WorkFlowResponseDTO
+ * @return WorkFlowExecutionResponseDTO
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
* @http.response.details
@@ -220,15 +221,15 @@ private okhttp3.Call executeValidateBeforeCall(WorkFlowRequestDTO workFlowReques
*
*
*/
- public WorkFlowResponseDTO execute(WorkFlowRequestDTO workFlowRequestDTO) throws ApiException {
- ApiResponse localVarResp = executeWithHttpInfo(workFlowRequestDTO);
+ public WorkFlowExecutionResponseDTO execute(WorkFlowRequestDTO workFlowRequestDTO) throws ApiException {
+ ApiResponse localVarResp = executeWithHttpInfo(workFlowRequestDTO);
return localVarResp.getData();
}
/**
* Executes a workflow
* @param workFlowRequestDTO (required)
- * @return ApiResponse<WorkFlowResponseDTO>
+ * @return ApiResponse<WorkFlowExecutionResponseDTO>
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
* @http.response.details
@@ -270,10 +271,10 @@ public WorkFlowResponseDTO execute(WorkFlowRequestDTO workFlowRequestDTO) throws
*
*
*/
- public ApiResponse executeWithHttpInfo(WorkFlowRequestDTO workFlowRequestDTO)
+ public ApiResponse executeWithHttpInfo(WorkFlowRequestDTO workFlowRequestDTO)
throws ApiException {
okhttp3.Call localVarCall = executeValidateBeforeCall(workFlowRequestDTO, null);
- Type localVarReturnType = new TypeToken() {
+ Type localVarReturnType = new TypeToken() {
}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@@ -325,10 +326,10 @@ public ApiResponse executeWithHttpInfo(WorkFlowRequestDTO w
*
*/
public okhttp3.Call executeAsync(WorkFlowRequestDTO workFlowRequestDTO,
- final ApiCallback _callback) throws ApiException {
+ final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = executeValidateBeforeCall(workFlowRequestDTO, _callback);
- Type localVarReturnType = new TypeToken() {
+ Type localVarReturnType = new TypeToken() {
}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/invoker/JSON.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/invoker/JSON.java
index 63ed165ec..9bdaf7e47 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/invoker/JSON.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/invoker/JSON.java
@@ -107,6 +107,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri
new com.redhat.parodos.sdk.model.WorkFlowContextResponseDTO.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO.CustomTypeAdapterFactory());
+ gsonBuilder.registerTypeAdapterFactory(
+ new com.redhat.parodos.sdk.model.WorkFlowExecutionResponseDTO.CustomTypeAdapterFactory());
gsonBuilder
.registerTypeAdapterFactory(new com.redhat.parodos.sdk.model.WorkFlowOption.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkFlowExecutionResponseDTO.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkFlowExecutionResponseDTO.java
new file mode 100644
index 000000000..2596fe583
--- /dev/null
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkFlowExecutionResponseDTO.java
@@ -0,0 +1,299 @@
+/*
+ * Parodos Workflow Service API
+ * This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
+ *
+ * The version of the OpenAPI document: v1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.redhat.parodos.sdk.model;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Set;
+import java.util.UUID;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import com.redhat.parodos.sdk.invoker.JSON;
+
+/**
+ * WorkFlowExecutionResponseDTO
+ */
+@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
+public class WorkFlowExecutionResponseDTO {
+
+ public static final String SERIALIZED_NAME_WORK_FLOW_EXECUTION_ID = "workFlowExecutionId";
+
+ @SerializedName(SERIALIZED_NAME_WORK_FLOW_EXECUTION_ID)
+ private UUID workFlowExecutionId;
+
+ /**
+ * Gets or Sets workStatus
+ */
+ @JsonAdapter(WorkStatusEnum.Adapter.class)
+ public enum WorkStatusEnum {
+
+ FAILED("FAILED"),
+
+ COMPLETED("COMPLETED"),
+
+ IN_PROGRESS("IN_PROGRESS"),
+
+ REJECTED("REJECTED"),
+
+ PENDING("PENDING");
+
+ private String value;
+
+ WorkStatusEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ public static WorkStatusEnum fromValue(String value) {
+ for (WorkStatusEnum b : WorkStatusEnum.values()) {
+ if (b.value.equals(value)) {
+ return b;
+ }
+ }
+ throw new IllegalArgumentException("Unexpected value '" + value + "'");
+ }
+
+ public static class Adapter extends TypeAdapter {
+
+ @Override
+ public void write(final JsonWriter jsonWriter, final WorkStatusEnum enumeration) throws IOException {
+ jsonWriter.value(enumeration.getValue());
+ }
+
+ @Override
+ public WorkStatusEnum read(final JsonReader jsonReader) throws IOException {
+ String value = jsonReader.nextString();
+ return WorkStatusEnum.fromValue(value);
+ }
+
+ }
+
+ }
+
+ public static final String SERIALIZED_NAME_WORK_STATUS = "workStatus";
+
+ @SerializedName(SERIALIZED_NAME_WORK_STATUS)
+ private WorkStatusEnum workStatus;
+
+ public WorkFlowExecutionResponseDTO() {
+ }
+
+ public WorkFlowExecutionResponseDTO workFlowExecutionId(UUID workFlowExecutionId) {
+
+ this.workFlowExecutionId = workFlowExecutionId;
+ return this;
+ }
+
+ /**
+ * Get workFlowExecutionId
+ * @return workFlowExecutionId
+ **/
+ @javax.annotation.Nullable
+
+ public UUID getWorkFlowExecutionId() {
+ return workFlowExecutionId;
+ }
+
+ public void setWorkFlowExecutionId(UUID workFlowExecutionId) {
+ this.workFlowExecutionId = workFlowExecutionId;
+ }
+
+ public WorkFlowExecutionResponseDTO workStatus(WorkStatusEnum workStatus) {
+
+ this.workStatus = workStatus;
+ return this;
+ }
+
+ /**
+ * Get workStatus
+ * @return workStatus
+ **/
+ @javax.annotation.Nullable
+
+ public WorkStatusEnum getWorkStatus() {
+ return workStatus;
+ }
+
+ public void setWorkStatus(WorkStatusEnum workStatus) {
+ this.workStatus = workStatus;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ WorkFlowExecutionResponseDTO workFlowExecutionResponseDTO = (WorkFlowExecutionResponseDTO) o;
+ return Objects.equals(this.workFlowExecutionId, workFlowExecutionResponseDTO.workFlowExecutionId)
+ && Objects.equals(this.workStatus, workFlowExecutionResponseDTO.workStatus);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(workFlowExecutionId, workStatus);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class WorkFlowExecutionResponseDTO {\n");
+ sb.append(" workFlowExecutionId: ").append(toIndentedString(workFlowExecutionId)).append("\n");
+ sb.append(" workStatus: ").append(toIndentedString(workStatus)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the
+ * first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+ public static HashSet openapiFields;
+
+ public static HashSet openapiRequiredFields;
+
+ static {
+ // a set of all properties/fields (JSON key names)
+ openapiFields = new HashSet();
+ openapiFields.add("workFlowExecutionId");
+ openapiFields.add("workStatus");
+
+ // a set of required properties/fields (JSON key names)
+ openapiRequiredFields = new HashSet();
+ }
+
+ /**
+ * Validates the JSON Object and throws an exception if issues found
+ * @param jsonObj JSON Object
+ * @throws IOException if the JSON Object is invalid with respect to
+ * WorkFlowExecutionResponseDTO
+ */
+ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
+ if (jsonObj == null) {
+ if (!WorkFlowExecutionResponseDTO.openapiRequiredFields.isEmpty()) { // has
+ // required
+ // fields
+ // but
+ // JSON
+ // object
+ // is
+ // null
+ throw new IllegalArgumentException(String.format(
+ "The required field(s) %s in WorkFlowExecutionResponseDTO is not found in the empty JSON string",
+ WorkFlowExecutionResponseDTO.openapiRequiredFields.toString()));
+ }
+ }
+
+ Set> entries = jsonObj.entrySet();
+ // check to see if the JSON string contains additional fields
+ for (Entry entry : entries) {
+ if (!WorkFlowExecutionResponseDTO.openapiFields.contains(entry.getKey())) {
+ throw new IllegalArgumentException(String.format(
+ "The field `%s` in the JSON string is not defined in the `WorkFlowExecutionResponseDTO` properties. JSON: %s",
+ entry.getKey(), jsonObj.toString()));
+ }
+ }
+ if ((jsonObj.get("workFlowExecutionId") != null && !jsonObj.get("workFlowExecutionId").isJsonNull())
+ && !jsonObj.get("workFlowExecutionId").isJsonPrimitive()) {
+ throw new IllegalArgumentException(String.format(
+ "Expected the field `workFlowExecutionId` to be a primitive type in the JSON string but got `%s`",
+ jsonObj.get("workFlowExecutionId").toString()));
+ }
+ if ((jsonObj.get("workStatus") != null && !jsonObj.get("workStatus").isJsonNull())
+ && !jsonObj.get("workStatus").isJsonPrimitive()) {
+ throw new IllegalArgumentException(String.format(
+ "Expected the field `workStatus` to be a primitive type in the JSON string but got `%s`",
+ jsonObj.get("workStatus").toString()));
+ }
+ }
+
+ public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public TypeAdapter create(Gson gson, TypeToken type) {
+ if (!WorkFlowExecutionResponseDTO.class.isAssignableFrom(type.getRawType())) {
+ return null; // this class only serializes 'WorkFlowExecutionResponseDTO'
+ // and its subtypes
+ }
+ final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
+ final TypeAdapter thisAdapter = gson.getDelegateAdapter(this,
+ TypeToken.get(WorkFlowExecutionResponseDTO.class));
+
+ return (TypeAdapter) new TypeAdapter() {
+ @Override
+ public void write(JsonWriter out, WorkFlowExecutionResponseDTO value) throws IOException {
+ JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
+ elementAdapter.write(out, obj);
+ }
+
+ @Override
+ public WorkFlowExecutionResponseDTO read(JsonReader in) throws IOException {
+ JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
+ validateJsonObject(jsonObj);
+ return thisAdapter.fromJsonTree(jsonObj);
+ }
+
+ }.nullSafe();
+ }
+
+ }
+
+ /**
+ * Create an instance of WorkFlowExecutionResponseDTO given an JSON string
+ * @param jsonString JSON string
+ * @return An instance of WorkFlowExecutionResponseDTO
+ * @throws IOException if the JSON string is invalid with respect to
+ * WorkFlowExecutionResponseDTO
+ */
+ public static WorkFlowExecutionResponseDTO fromJson(String jsonString) throws IOException {
+ return JSON.getGson().fromJson(jsonString, WorkFlowExecutionResponseDTO.class);
+ }
+
+ /**
+ * Convert an instance of WorkFlowExecutionResponseDTO to an JSON string
+ * @return JSON string
+ */
+ public String toJson() {
+ return JSON.getGson().toJson(this);
+ }
+
+}
diff --git a/workflow-service/generated/openapi/openapi.json b/workflow-service/generated/openapi/openapi.json
index 39962a3db..e5c81fa4d 100644
--- a/workflow-service/generated/openapi/openapi.json
+++ b/workflow-service/generated/openapi/openapi.json
@@ -669,7 +669,7 @@
"content" : {
"application/json" : {
"schema" : {
- "$ref" : "#/components/schemas/WorkFlowResponseDTO"
+ "$ref" : "#/components/schemas/WorkFlowExecutionResponseDTO"
}
}
},
@@ -1164,6 +1164,19 @@
}
}
},
+ "WorkFlowExecutionResponseDTO" : {
+ "type" : "object",
+ "properties" : {
+ "workFlowExecutionId" : {
+ "type" : "string",
+ "format" : "uuid"
+ },
+ "workStatus" : {
+ "type" : "string",
+ "enum" : [ "FAILED", "COMPLETED", "IN_PROGRESS", "REJECTED", "PENDING" ]
+ }
+ }
+ },
"WorkFlowOption" : {
"type" : "object",
"properties" : {
diff --git a/workflow-service/src/main/java/com/redhat/parodos/workflow/execution/controller/WorkFlowController.java b/workflow-service/src/main/java/com/redhat/parodos/workflow/execution/controller/WorkFlowController.java
index 3f14f460c..3e656855d 100644
--- a/workflow-service/src/main/java/com/redhat/parodos/workflow/execution/controller/WorkFlowController.java
+++ b/workflow-service/src/main/java/com/redhat/parodos/workflow/execution/controller/WorkFlowController.java
@@ -24,6 +24,7 @@
import com.redhat.parodos.workflow.context.WorkContextDelegate;
import com.redhat.parodos.workflow.execution.dto.WorkFlowCheckerTaskRequestDTO;
import com.redhat.parodos.workflow.execution.dto.WorkFlowContextResponseDTO;
+import com.redhat.parodos.workflow.execution.dto.WorkFlowExecutionResponseDTO;
import com.redhat.parodos.workflow.execution.dto.WorkFlowRequestDTO;
import com.redhat.parodos.workflow.execution.dto.WorkFlowResponseDTO;
import com.redhat.parodos.workflow.execution.dto.WorkFlowStatusResponseDTO;
@@ -75,16 +76,17 @@ public WorkFlowController(WorkFlowService workFlowService) {
@ApiResponses(value = {
@ApiResponse(responseCode = "202", description = "Accepted",
content = { @Content(mediaType = "application/json",
- schema = @Schema(implementation = WorkFlowResponseDTO.class)) }),
+ schema = @Schema(implementation = WorkFlowExecutionResponseDTO.class)) }),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content),
@ApiResponse(responseCode = "403", description = "Forbidden", content = @Content) })
@PostMapping
- public ResponseEntity execute(@RequestBody @Valid WorkFlowRequestDTO workFlowRequestDTO) {
+ public ResponseEntity execute(
+ @RequestBody @Valid WorkFlowRequestDTO workFlowRequestDTO) {
WorkReport workReport = workFlowService.execute(workFlowRequestDTO);
if (workReport.getStatus() == WorkStatus.FAILED) {
return ResponseEntity.status(500).build();
}
- return ResponseEntity.ok(WorkFlowResponseDTO.builder()
+ return ResponseEntity.ok(WorkFlowExecutionResponseDTO.builder()
.workFlowExecutionId(WorkContextUtils.getMainExecutionId(workReport.getWorkContext()))
.workStatus(workReport.getStatus()).build());
}
diff --git a/workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkFlowExecutionResponseDTO.java b/workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkFlowExecutionResponseDTO.java
new file mode 100644
index 000000000..68fe95cf1
--- /dev/null
+++ b/workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkFlowExecutionResponseDTO.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2022 Red Hat Developer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.redhat.parodos.workflow.execution.dto;
+
+import java.util.UUID;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.redhat.parodos.workflows.work.WorkStatus;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Builder
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+public class WorkFlowExecutionResponseDTO {
+
+ private UUID workFlowExecutionId;
+
+ private WorkStatus workStatus;
+
+}