Skip to content

Commit

Permalink
Merge pull request #146 from orkes-io/tag_scheduler
Browse files Browse the repository at this point in the history
Tag api for scheduler and application
  • Loading branch information
manan164 authored Sep 14, 2023
2 parents 0bc7ead + f502a11 commit a56caba
Show file tree
Hide file tree
Showing 12 changed files with 801 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,10 @@ public interface AuthorizationClient {
AccessKeyResponse toggleAccessKeyStatus(String applicationId, String keyId);

ConductorApplication updateApplication(CreateOrUpdateApplicationRequest createOrUpdateApplicationRequest, String id);

void setApplicationTags(List<TagObject> body, String applicationId);

List<TagObject> getApplicationTags(String applicationId);

void deleteApplicationTags(List<TagObject> body, String applicationId);
}
10 changes: 9 additions & 1 deletion src/main/java/io/orkes/conductor/client/SchedulerClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import io.orkes.conductor.client.model.SaveScheduleRequest;
import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel;
import io.orkes.conductor.client.model.TagObject;
import io.orkes.conductor.client.model.WorkflowSchedule;

public interface SchedulerClient {
Expand All @@ -42,4 +43,11 @@ List<Long> getNextFewSchedules(

SearchResultWorkflowScheduleExecutionModel searchV22(
Integer start, Integer size, String sort, String freeText, String query);
}

void setSchedulerTags(List<TagObject> body, String name);

void deleteSchedulerTags(List<TagObject> body, String name);

List<TagObject> getSchedulerTags(String name);

}
5 changes: 4 additions & 1 deletion src/main/java/io/orkes/conductor/client/SecretClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ public interface SecretClient {
void putSecret(String value, String key);

boolean secretExists(String key);
void putTagForSecret(List<TagObject> tags, String key);
void setSecretTags(List<TagObject> tags, String key);

void deleteSecretTags(List<TagObject> body, String key);
List<TagObject> getSecretTags(String key);
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,19 @@ public AccessKeyResponse toggleAccessKeyStatus(String applicationId, String keyI
public ConductorApplication updateApplication(CreateOrUpdateApplicationRequest createOrUpdateApplicationRequest, String id) throws ApiException {
return applicationResourceApi.updateApplication(createOrUpdateApplicationRequest, id);
}

@Override
public void setApplicationTags(List<TagObject> tags, String applicationId) {
applicationResourceApi.putTagForApplication(tags, applicationId);
}

@Override
public List<TagObject> getApplicationTags(String applicationId) {
return applicationResourceApi.getTagsForApplication(applicationId);
}

@Override
public void deleteApplicationTags(List<TagObject> tags, String applicationId) {
applicationResourceApi.deleteTagForApplication(tags, applicationId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.orkes.conductor.client.http.api.SchedulerResourceApi;
import io.orkes.conductor.client.model.SaveScheduleRequest;
import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel;
import io.orkes.conductor.client.model.TagObject;
import io.orkes.conductor.client.model.WorkflowSchedule;

public class OrkesSchedulerClient extends OrkesClient implements SchedulerClient {
Expand Down Expand Up @@ -89,4 +90,19 @@ public SearchResultWorkflowScheduleExecutionModel searchV22(
throws ApiException {
return schedulerResourceApi.searchV22(start, size, sort, freeText, query);
}

@Override
public void setSchedulerTags(List<TagObject> body, String name) {
schedulerResourceApi.putTagForSchedule(body, name);
}

@Override
public void deleteSchedulerTags(List<TagObject> body, String name) {
schedulerResourceApi.deleteTagForSchedule(body, name);
}

@Override
public List<TagObject> getSchedulerTags(String name) {
return schedulerResourceApi.getTagsForSchedule(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,17 @@ public boolean secretExists(String key) throws ApiException {
}

@Override
public void putTagForSecret(List<TagObject> tags, String key) {
public void setSecretTags(List<TagObject> tags, String key) {
secretResourceApi.putTagForSecret(tags, key);
}

@Override
public void deleteSecretTags(List<TagObject> tags, String key) {
secretResourceApi.deleteTagForSecret(tags, key);
}

@Override
public List<TagObject> getSecretTags(String key) {
return secretResourceApi.getTags(key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1385,4 +1385,269 @@ private ApiResponse<ConductorApplication> updateApplicationWithHttpInfo(
Type localVarReturnType = new TypeReference<ConductorApplication>() {}.getType();
return apiClient.execute(call, localVarReturnType);
}

/**
* Put a tag to application
*
* @param body (required)
* @param id (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void putTagForApplication(List<TagObject> body, String id) throws ApiException {
putTagForApplicationWithHttpInfo(body, id);
}
/**
* Put a tag to application
*
* @param body (required)
* @param id (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
private ApiResponse<Void> putTagForApplicationWithHttpInfo(List<TagObject> body, String id) throws ApiException {
com.squareup.okhttp.Call call = putTagForApplicationValidateBeforeCall(body, id, null, null);
return apiClient.execute(call);
}

@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call putTagForApplicationValidateBeforeCall(List<TagObject> body, String id, 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 putTagForApplication(Async)");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException("Missing the required parameter 'id' when calling putTagForApplication(Async)");
}

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

/**
* Build call for putTagForApplication
* @param body (required)
* @param id (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
private com.squareup.okhttp.Call putTagForApplicationCall(List<TagObject> body, String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = body;

// create path and map variables
String localVarPath = "/applications/{id}/tags"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

/**
* Get tags by application
*
* @param id (required)
* @return List&lt;TagObject&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List<TagObject> getTagsForApplication(String id) throws ApiException {
ApiResponse<List<TagObject>> resp = getTagsForApplicationWithHttpInfo(id);
return resp.getData();
}

/**
* Get tags by application
*
* @param id (required)
* @return ApiResponse&lt;List&lt;TagObject&gt;&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
private ApiResponse<List<TagObject>> getTagsForApplicationWithHttpInfo(String id) throws ApiException {
com.squareup.okhttp.Call call = getTagsForApplicationValidateBeforeCall(id, null, null);
Type localVarReturnType = new TypeReference<List<TagObject>>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}

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

com.squareup.okhttp.Call call = getTagsForApplicationCall(id, progressListener, progressRequestListener);
return call;
}

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

// create path and map variables
String localVarPath = "/applications/{id}/tags"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.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 = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

final String[] localVarContentTypes = {

};
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, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

/**
* Delete a tag for application
*
* @param body (required)
* @param id (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void deleteTagForApplication(List<TagObject> body, String id) throws ApiException {
deleteTagForApplicationWithHttpInfo(body, id);
}

/**
* Delete a tag for application
*
* @param body (required)
* @param id (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
private ApiResponse<Void> deleteTagForApplicationWithHttpInfo(List<TagObject> body, String id) throws ApiException {
com.squareup.okhttp.Call call = deleteTagForApplicationValidateBeforeCall(body, id, null, null);
return apiClient.execute(call);
}

@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call deleteTagForApplicationValidateBeforeCall(List<TagObject> body, String id, 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 deleteTagForApplication(Async)");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException("Missing the required parameter 'id' when calling deleteTagForApplication(Async)");
}

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

/**
* Build call for deleteTagForApplication
* @param body (required)
* @param id (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
private com.squareup.okhttp.Call deleteTagForApplicationCall(List<TagObject> body, String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = body;

// create path and map variables
String localVarPath = "/applications/{id}/tags"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.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, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
}
Loading

0 comments on commit a56caba

Please sign in to comment.