Skip to content

Commit

Permalink
Merge pull request #147 from orkes-io/upgrade_api
Browse files Browse the repository at this point in the history
Upgrade api changes.
  • Loading branch information
manan164 authored Sep 20, 2023
2 parents a56caba + 53a4ac0 commit f9e45a6
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ext {
versions = [
awaitility : '4.2.0',
commonsLang : '3.12.0',
conductor : '3.9.12-orkes',
conductor : '3.9.21-orkes',
jackson : '2.11.4!!',
junit : '5.9.0',
slf4j : '1.7.36',
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/io/orkes/conductor/client/WorkflowClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.concurrent.TimeoutException;

import com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest;
import com.netflix.conductor.common.metadata.workflow.UpgradeWorkflowRequest;
import com.netflix.conductor.common.model.BulkResponse;
import com.netflix.conductor.common.run.Workflow;
import com.netflix.conductor.common.run.WorkflowTestRequest;
Expand Down Expand Up @@ -92,4 +93,6 @@ public abstract Map<String, List<Workflow>> getWorkflowsByNamesAndCorrelationIds
public abstract Workflow updateVariables(String workflowId, Map<String, Object> variables);

public abstract void jumpToTask(String workflowId, String taskReferenceName, Map<String, Object> input);

public abstract void upgradeRunningWorkflow(String workflowId, UpgradeWorkflowRequest body);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.UUID;
import java.util.concurrent.*;

import com.netflix.conductor.common.metadata.workflow.UpgradeWorkflowRequest;
import org.apache.commons.lang.StringUtils;

import com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest;
Expand Down Expand Up @@ -348,6 +349,11 @@ public void jumpToTask(String workflowId, String taskReferenceName, Map<String,
httpClient.jumpToTaskWithHttpInfo(workflowId, taskReferenceName, input);
}

@Override
public void upgradeRunningWorkflow(String workflowId, UpgradeWorkflowRequest upgradeWorkflowRequest ) {
httpClient.upgradeRunningWorkflow(upgradeWorkflowRequest, workflowId);
}

@Override
public void close() {
shutdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest;
import com.netflix.conductor.common.metadata.workflow.SkipTaskRequest;
import com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest;
import com.netflix.conductor.common.metadata.workflow.UpgradeWorkflowRequest;
import com.netflix.conductor.common.run.Workflow;
import com.netflix.conductor.common.run.WorkflowTestRequest;

Expand Down Expand Up @@ -3930,4 +3931,94 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

/**
* Upgrade running workflow to newer version
* Upgrade running workflow to newer version
* @param body (required)
* @param workflowId (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void upgradeRunningWorkflow(UpgradeWorkflowRequest body, String workflowId) throws ApiException {
upgradeRunningWorkflowWithHttpInfo(body, workflowId);
}

/**
* Upgrade running workflow to newer version
* Upgrade running workflow to newer version
* @param body (required)
* @param workflowId (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> upgradeRunningWorkflowWithHttpInfo(UpgradeWorkflowRequest body, String workflowId) throws ApiException {
com.squareup.okhttp.Call call = upgradeRunningWorkflowValidateBeforeCall(body, workflowId, null, null);
return apiClient.execute(call);
}

@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call upgradeRunningWorkflowValidateBeforeCall(UpgradeWorkflowRequest body, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException("Missing the required parameter 'body' when calling upgradeRunningWorkflow(Async)");
}
// verify the required parameter 'workflowId' is set
if (workflowId == null) {
throw new ApiException("Missing the required parameter 'workflowId' when calling upgradeRunningWorkflow(Async)");
}

com.squareup.okhttp.Call call = upgradeRunningWorkflowCall(body, workflowId, progressListener, progressRequestListener);
return call;
}

/**
* Build call for upgradeRunningWorkflow
* @param body (required)
* @param workflowId (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call upgradeRunningWorkflowCall(UpgradeWorkflowRequest body, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = body;

// create path and map variables
String localVarPath = "/workflow/{workflowId}/upgrade"
.replaceAll("\\{" + "workflowId" + "\\}", apiClient.escapeString(workflowId.toString()));

List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Map<String, Object> localVarFormParams = new HashMap<String, Object>();

final String[] localVarAccepts = {

};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}

String[] localVarAuthNames = new String[] { "api_key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

}

0 comments on commit f9e45a6

Please sign in to comment.