From 940b5d1f2862d0cdae73b118cd928affedaae58b Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:06:29 +0530 Subject: [PATCH 1/6] Scheduler api for tagging. --- .../conductor/client/SchedulerClient.java | 9 +- .../client/http/OrkesSchedulerClient.java | 11 ++ .../client/http/api/SchedulerResourceApi.java | 181 ++++++++++++++++++ 3 files changed, 200 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/orkes/conductor/client/SchedulerClient.java b/src/main/java/io/orkes/conductor/client/SchedulerClient.java index 2419c395..ae650f87 100644 --- a/src/main/java/io/orkes/conductor/client/SchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/SchedulerClient.java @@ -14,8 +14,10 @@ import java.util.List; +import io.orkes.conductor.client.http.ApiException; 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 { @@ -42,4 +44,9 @@ List getNextFewSchedules( SearchResultWorkflowScheduleExecutionModel searchV22( Integer start, Integer size, String sort, String freeText, String query); -} + + void putTagForSchedule(List body, String name); + + void deleteTagForSchedule(List body, String name); + + } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java index 6feeb23d..bd28cfbc 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java @@ -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 { @@ -89,4 +90,14 @@ public SearchResultWorkflowScheduleExecutionModel searchV22( throws ApiException { return schedulerResourceApi.searchV22(start, size, sort, freeText, query); } + + @Override + public void putTagForSchedule(List body, String name) { + schedulerResourceApi.putTagForSchedule(body, name); + } + + @Override + public void deleteTagForSchedule(List body, String name) { + schedulerResourceApi.deleteTagForSchedule(body, name); + } } diff --git a/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java index 7088a52a..f6cfeea3 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java @@ -23,6 +23,7 @@ import io.orkes.conductor.client.http.*; 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; import com.fasterxml.jackson.core.type.TypeReference; @@ -1454,4 +1455,184 @@ private ApiResponse testTimeoutWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = testTimeoutValidateBeforeCall(null, null); return apiClient.execute(call); } + + /** + * Delete a tag for schedule + * + * @param body (required) + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteTagForSchedule(List body, String name) throws ApiException { + deleteTagForScheduleWithHttpInfo(body, name); + } + + /** + * Delete a tag for schedule + * + * @param body (required) + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + private ApiResponse deleteTagForScheduleWithHttpInfo(List body, String name) throws ApiException { + com.squareup.okhttp.Call call = deleteTagForScheduleValidateBeforeCall(body, name, null, null); + return apiClient.execute(call); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call deleteTagForScheduleValidateBeforeCall(List body, String name, 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 deleteTagForSchedule(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling deleteTagForSchedule(Async)"); + } + + com.squareup.okhttp.Call call = deleteTagForScheduleCall(body, name, progressListener, progressRequestListener); + return call; + } + + /** + * Build call for deleteTagForSchedule + * @param body (required) + * @param name (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 deleteTagForScheduleCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/scheduler/schedules/{name}/tags" + .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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); + } + + /** + * Put a tag to schedule + * + * @param body (required) + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void putTagForSchedule(List body, String name) throws ApiException { + putTagForScheduleWithHttpInfo(body, name); + } + + /** + * Put a tag to schedule + * + * @param body (required) + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + private ApiResponse putTagForScheduleWithHttpInfo(List body, String name) throws ApiException { + com.squareup.okhttp.Call call = putTagForScheduleValidateBeforeCall(body, name, null, null); + return apiClient.execute(call); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call putTagForScheduleValidateBeforeCall(List body, String name, 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 putTagForSchedule(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling putTagForSchedule(Async)"); + } + + com.squareup.okhttp.Call call = putTagForScheduleCall(body, name, progressListener, progressRequestListener); + return call; + } + + /** + * Build call for putTagForSchedule + * @param body (required) + * @param name (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 putTagForScheduleCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/scheduler/schedules/{name}/tags" + .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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); + } } From b00e62db9dde631443d8846594e0940b9142f1fb Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:07:31 +0530 Subject: [PATCH 2/6] unused import --- src/main/java/io/orkes/conductor/client/SchedulerClient.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/orkes/conductor/client/SchedulerClient.java b/src/main/java/io/orkes/conductor/client/SchedulerClient.java index ae650f87..b34838b6 100644 --- a/src/main/java/io/orkes/conductor/client/SchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/SchedulerClient.java @@ -14,7 +14,6 @@ import java.util.List; -import io.orkes.conductor.client.http.ApiException; import io.orkes.conductor.client.model.SaveScheduleRequest; import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel; import io.orkes.conductor.client.model.TagObject; From 8f83127cfe17c22c64825e3fdcb253573f55441a Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:16:56 +0530 Subject: [PATCH 3/6] Get tags api --- .../conductor/client/SchedulerClient.java | 2 + .../client/http/OrkesSchedulerClient.java | 5 ++ .../client/http/api/SchedulerResourceApi.java | 86 +++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/src/main/java/io/orkes/conductor/client/SchedulerClient.java b/src/main/java/io/orkes/conductor/client/SchedulerClient.java index b34838b6..b99033e9 100644 --- a/src/main/java/io/orkes/conductor/client/SchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/SchedulerClient.java @@ -48,4 +48,6 @@ SearchResultWorkflowScheduleExecutionModel searchV22( void deleteTagForSchedule(List body, String name); + List getTagsForSchedule(String name); + } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java index bd28cfbc..c57f84c9 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java @@ -100,4 +100,9 @@ public void putTagForSchedule(List body, String name) { public void deleteTagForSchedule(List body, String name) { schedulerResourceApi.deleteTagForSchedule(body, name); } + + @Override + public List getTagsForSchedule(String name) { + return schedulerResourceApi.getTagsForSchedule(name); + } } diff --git a/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java index f6cfeea3..8035ee25 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java @@ -1635,4 +1635,90 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch String[] localVarAuthNames = new String[] { "api_key" }; return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } + + /** + * Get tags by schedule + * + * @param name (required) + * @return List<TagObject> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getTagsForSchedule(String name) throws ApiException { + ApiResponse> resp = getTagsForScheduleWithHttpInfo(name); + return resp.getData(); + } + + /** + * Get tags by schedule + * + * @param name (required) + * @return ApiResponse<List<TagObject>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getTagsForScheduleWithHttpInfo(String name) throws ApiException { + com.squareup.okhttp.Call call = getTagsForScheduleValidateBeforeCall(name, null, null); + Type localVarReturnType = new TypeReference>() {}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call getTagsForScheduleValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getTagsForSchedule(Async)"); + } + + com.squareup.okhttp.Call call = getTagsForScheduleCall(name, progressListener, progressRequestListener); + return call; + } + + /** + * Build call for getTagsForSchedule + * @param name (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 getTagsForScheduleCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/scheduler/schedules/{name}/tags" + .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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); + } } From ea06e7473271af049e8927db54d8898833fc4f18 Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:55:10 +0530 Subject: [PATCH 4/6] application tags --- .../conductor/client/AuthorizationClient.java | 6 + .../client/http/OrkesAuthorizationClient.java | 15 + .../http/api/ApplicationResourceApi.java | 265 ++++++++++++++++++ 3 files changed, 286 insertions(+) diff --git a/src/main/java/io/orkes/conductor/client/AuthorizationClient.java b/src/main/java/io/orkes/conductor/client/AuthorizationClient.java index 6b7a32dd..06b9833c 100644 --- a/src/main/java/io/orkes/conductor/client/AuthorizationClient.java +++ b/src/main/java/io/orkes/conductor/client/AuthorizationClient.java @@ -81,4 +81,10 @@ public interface AuthorizationClient { AccessKeyResponse toggleAccessKeyStatus(String applicationId, String keyId); ConductorApplication updateApplication(CreateOrUpdateApplicationRequest createOrUpdateApplicationRequest, String id); + + void putTagForApplication(List body, String applicationId); + + List getTagsForApplication(String applicationId); + + void deleteTagForApplication(List body, String applicationId); } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesAuthorizationClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesAuthorizationClient.java index 693d4a5b..63ac59e6 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesAuthorizationClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesAuthorizationClient.java @@ -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 putTagForApplication(List tags, String applicationId) { + applicationResourceApi.putTagForApplication(tags, applicationId); + } + + @Override + public List getTagsForApplication(String applicationId) { + return applicationResourceApi.getTagsForApplication(applicationId); + } + + @Override + public void deleteTagForApplication(List tags, String applicationId) { + applicationResourceApi.deleteTagForApplication(tags, applicationId); + } } diff --git a/src/main/java/io/orkes/conductor/client/http/api/ApplicationResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/ApplicationResourceApi.java index 920e4e28..99eda6fc 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/ApplicationResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/ApplicationResourceApi.java @@ -1385,4 +1385,269 @@ private ApiResponse updateApplicationWithHttpInfo( Type localVarReturnType = new TypeReference() {}.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 body, String id) throws ApiException { + putTagForApplicationWithHttpInfo(body, id); + } + /** + * Put a tag to application + * + * @param body (required) + * @param id (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + private ApiResponse putTagForApplicationWithHttpInfo(List 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 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 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 localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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<TagObject> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getTagsForApplication(String id) throws ApiException { + ApiResponse> resp = getTagsForApplicationWithHttpInfo(id); + return resp.getData(); + } + + /** + * Get tags by application + * + * @param id (required) + * @return ApiResponse<List<TagObject>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + private ApiResponse> getTagsForApplicationWithHttpInfo(String id) throws ApiException { + com.squareup.okhttp.Call call = getTagsForApplicationValidateBeforeCall(id, null, null); + Type localVarReturnType = new TypeReference>(){}.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 localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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 body, String id) throws ApiException { + deleteTagForApplicationWithHttpInfo(body, id); + } + + /** + * Delete a tag for application + * + * @param body (required) + * @param id (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + private ApiResponse deleteTagForApplicationWithHttpInfo(List 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 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 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 localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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); + } } From 06ca3c8c01c1daf52234d3ae7522100a37d8b15e Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Tue, 12 Sep 2023 22:29:29 +0530 Subject: [PATCH 5/6] Missing secret tags api and refactoring. --- .../conductor/client/AuthorizationClient.java | 6 +- .../conductor/client/SchedulerClient.java | 6 +- .../orkes/conductor/client/SecretClient.java | 5 +- .../client/http/OrkesAuthorizationClient.java | 6 +- .../client/http/OrkesSchedulerClient.java | 6 +- .../client/http/OrkesSecretClient.java | 12 +- .../client/http/api/SecretResourceApi.java | 174 ++++++++++++++++++ .../client/api/SecretClientTests.java | 2 +- 8 files changed, 202 insertions(+), 15 deletions(-) diff --git a/src/main/java/io/orkes/conductor/client/AuthorizationClient.java b/src/main/java/io/orkes/conductor/client/AuthorizationClient.java index 06b9833c..db5ea1e1 100644 --- a/src/main/java/io/orkes/conductor/client/AuthorizationClient.java +++ b/src/main/java/io/orkes/conductor/client/AuthorizationClient.java @@ -82,9 +82,9 @@ public interface AuthorizationClient { ConductorApplication updateApplication(CreateOrUpdateApplicationRequest createOrUpdateApplicationRequest, String id); - void putTagForApplication(List body, String applicationId); + void setApplicationTags(List body, String applicationId); - List getTagsForApplication(String applicationId); + List getApplicationTags(String applicationId); - void deleteTagForApplication(List body, String applicationId); + void deleteApplicationTags(List body, String applicationId); } diff --git a/src/main/java/io/orkes/conductor/client/SchedulerClient.java b/src/main/java/io/orkes/conductor/client/SchedulerClient.java index b99033e9..86eb1137 100644 --- a/src/main/java/io/orkes/conductor/client/SchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/SchedulerClient.java @@ -44,10 +44,10 @@ List getNextFewSchedules( SearchResultWorkflowScheduleExecutionModel searchV22( Integer start, Integer size, String sort, String freeText, String query); - void putTagForSchedule(List body, String name); + void setSchedulerTags(List body, String name); - void deleteTagForSchedule(List body, String name); + void deleteSchedulerTags(List body, String name); - List getTagsForSchedule(String name); + List getSchedulerTags(String name); } diff --git a/src/main/java/io/orkes/conductor/client/SecretClient.java b/src/main/java/io/orkes/conductor/client/SecretClient.java index 58745f6d..69314d10 100644 --- a/src/main/java/io/orkes/conductor/client/SecretClient.java +++ b/src/main/java/io/orkes/conductor/client/SecretClient.java @@ -29,5 +29,8 @@ public interface SecretClient { void putSecret(String value, String key); boolean secretExists(String key); - void putTagForSecret(List tags, String key); + void setSecretTags(List tags, String key); + + void deleteSecretTags(List body, String key); + List getSecretTags(String key); } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesAuthorizationClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesAuthorizationClient.java index 63ac59e6..8b866f64 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesAuthorizationClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesAuthorizationClient.java @@ -187,17 +187,17 @@ public ConductorApplication updateApplication(CreateOrUpdateApplicationRequest c } @Override - public void putTagForApplication(List tags, String applicationId) { + public void setApplicationTags(List tags, String applicationId) { applicationResourceApi.putTagForApplication(tags, applicationId); } @Override - public List getTagsForApplication(String applicationId) { + public List getApplicationTags(String applicationId) { return applicationResourceApi.getTagsForApplication(applicationId); } @Override - public void deleteTagForApplication(List tags, String applicationId) { + public void deleteApplicationTags(List tags, String applicationId) { applicationResourceApi.deleteTagForApplication(tags, applicationId); } } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java index c57f84c9..5b42c0d1 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java @@ -92,17 +92,17 @@ public SearchResultWorkflowScheduleExecutionModel searchV22( } @Override - public void putTagForSchedule(List body, String name) { + public void setSchedulerTags(List body, String name) { schedulerResourceApi.putTagForSchedule(body, name); } @Override - public void deleteTagForSchedule(List body, String name) { + public void deleteSchedulerTags(List body, String name) { schedulerResourceApi.deleteTagForSchedule(body, name); } @Override - public List getTagsForSchedule(String name) { + public List getSchedulerTags(String name) { return schedulerResourceApi.getTagsForSchedule(name); } } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesSecretClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesSecretClient.java index 285acca1..3d0428d4 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesSecretClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesSecretClient.java @@ -61,7 +61,17 @@ public boolean secretExists(String key) throws ApiException { } @Override - public void putTagForSecret(List tags, String key) { + public void setSecretTags(List tags, String key) { secretResourceApi.putTagForSecret(tags, key); } + + @Override + public void deleteSecretTags(List tags, String key) { + secretResourceApi.deleteTagForSecret(tags, key); + } + + @Override + public List getSecretTags(String key) { + return secretResourceApi.getTags(key); + } } diff --git a/src/main/java/io/orkes/conductor/client/http/api/SecretResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/SecretResourceApi.java index fc64e6f6..09436a73 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/SecretResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/SecretResourceApi.java @@ -808,4 +808,178 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } + /** + * Delete tags of the secret + * + * @param body (required) + * @param key (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteTagForSecret(List body, String key) throws ApiException { + deleteTagForSecretWithHttpInfo(body, key); + } + + /** + * Delete tags of the secret + * + * @param body (required) + * @param key (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + private ApiResponse deleteTagForSecretWithHttpInfo(List body, String key) throws ApiException { + com.squareup.okhttp.Call call = deleteTagForSecretValidateBeforeCall(body, key, null, null); + return apiClient.execute(call); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call deleteTagForSecretValidateBeforeCall(List body, String key, 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 deleteTagForSecret(Async)"); + } + // verify the required parameter 'key' is set + if (key == null) { + throw new ApiException("Missing the required parameter 'key' when calling deleteTagForSecret(Async)"); + } + + com.squareup.okhttp.Call call = deleteTagForSecretCall(body, key, progressListener, progressRequestListener); + return call; + } + /** + * Build call for deleteTagForSecret + * @param body (required) + * @param key (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 deleteTagForSecretCall(List body, String key, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/secrets/{key}/tags" + .replaceAll("\\{" + "key" + "\\}", apiClient.escapeString(key.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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); + } + + /** + * Get tags by secret + * + * @param key (required) + * @return List<TagObject> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getTags(String key) throws ApiException { + ApiResponse> resp = getTagsWithHttpInfo(key); + return resp.getData(); + } + + /** + * Get tags by secret + * + * @param key (required) + * @return ApiResponse<List<TagObject>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + private ApiResponse> getTagsWithHttpInfo(String key) throws ApiException { + com.squareup.okhttp.Call call = getTagsValidateBeforeCall(key, null, null); + Type localVarReturnType = new TypeReference>(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call getTagsValidateBeforeCall(String key, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'key' is set + if (key == null) { + throw new ApiException("Missing the required parameter 'key' when calling getTags(Async)"); + } + + com.squareup.okhttp.Call call = getTagsCall(key, progressListener, progressRequestListener); + return call; + } + + /** + * Build call for getTags + * @param key (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 getTagsCall(String key, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/secrets/{key}/tags" + .replaceAll("\\{" + "key" + "\\}", apiClient.escapeString(key.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + 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); + } } diff --git a/src/test/java/io/orkes/conductor/client/api/SecretClientTests.java b/src/test/java/io/orkes/conductor/client/api/SecretClientTests.java index 696d7b3e..0c8e195c 100644 --- a/src/test/java/io/orkes/conductor/client/api/SecretClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/SecretClientTests.java @@ -43,7 +43,7 @@ void testMethods() { } } secretClient.putSecret(SECRET_NAME, SECRET_KEY); - secretClient.putTagForSecret(List.of(getTagObject()), SECRET_KEY); + secretClient.setSecretTags(List.of(getTagObject()), SECRET_KEY); assertTrue(secretClient.listSecretsThatUserCanGrantAccessTo().contains(SECRET_KEY)); assertTrue(secretClient.listAllSecretNames().contains(SECRET_KEY)); assertEquals(SECRET_NAME, secretClient.getSecret(SECRET_KEY)); From f502a110c6bf327080ec99d14c9984bd1cbb6bf4 Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Tue, 12 Sep 2023 23:38:33 +0530 Subject: [PATCH 6/6] tests --- .../client/api/AuthorizationClientTests.java | 13 +++++++++++++ .../client/api/SchedulerClientTests.java | 15 +++++++++++++++ .../conductor/client/api/SecretClientTests.java | 5 +++++ 3 files changed, 33 insertions(+) diff --git a/src/test/java/io/orkes/conductor/client/api/AuthorizationClientTests.java b/src/test/java/io/orkes/conductor/client/api/AuthorizationClientTests.java index 64249032..c929fc51 100644 --- a/src/test/java/io/orkes/conductor/client/api/AuthorizationClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/AuthorizationClientTests.java @@ -32,6 +32,7 @@ import io.orkes.conductor.client.util.ApiUtil; import io.orkes.conductor.client.util.Commons; +import static io.orkes.conductor.client.util.Commons.getTagObject; import static org.junit.jupiter.api.Assertions.*; public class AuthorizationClientTests extends ClientTest { @@ -143,6 +144,10 @@ void testApplication() { assertEquals(1, accessKeyResponses.size()); authorizationClient.toggleAccessKeyStatus(application.getId(), accessKey.getId()); authorizationClient.deleteAccessKey(application.getId(), accessKey.getId()); + authorizationClient.setApplicationTags(getTagObject(), application.getId()); + assertEquals(getTagObject(), authorizationClient.getApplicationTags(application.getId())); + authorizationClient.deleteApplicationTags(getTagObject(), application.getId()); + assertEquals(0, authorizationClient.getApplicationTags(application.getId()).size()); accessKeyResponses = authorizationClient.getAccessKeys(application.getId()); assertEquals(0, accessKeyResponses.size()); @@ -317,4 +322,12 @@ AuthorizationRequest getAuthorizationRequest() { request.setTarget(target); return request; } + + private List getTagObject() { + TagObject tagObject = new TagObject(); + tagObject.setType(TagObject.TypeEnum.METADATA); + tagObject.setKey("department"); + tagObject.setValue("accounts"); + return List.of(tagObject); + } } diff --git a/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java b/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java index 0c638de8..07b82c8e 100644 --- a/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java @@ -12,6 +12,7 @@ */ package io.orkes.conductor.client.api; +import io.orkes.conductor.client.model.TagObject; import org.junit.jupiter.api.Test; import io.orkes.conductor.client.SchedulerClient; @@ -19,6 +20,8 @@ import io.orkes.conductor.client.model.WorkflowSchedule; import io.orkes.conductor.client.util.Commons; +import java.util.List; + import static org.junit.jupiter.api.Assertions.*; public class SchedulerClientTests extends ClientTest { @@ -41,6 +44,10 @@ void testMethods() { assertEquals(NAME, workflowSchedule.getName()); assertEquals(CRON_EXPRESSION, workflowSchedule.getCronExpression()); assertFalse(schedulerClient.searchV22(0, 10, "ASC", "*", "").getResults().isEmpty()); + schedulerClient.setSchedulerTags(getTagObject(), NAME); + assertEquals(getTagObject(), schedulerClient.getSchedulerTags(NAME)); + schedulerClient.deleteSchedulerTags(getTagObject(), NAME); + assertEquals(0, schedulerClient.getSchedulerTags(NAME).size()); schedulerClient.pauseSchedule(NAME); workflowSchedule = schedulerClient.getSchedule(NAME); assertTrue(workflowSchedule.isPaused()); @@ -63,4 +70,12 @@ SaveScheduleRequest getSaveScheduleRequest() { .cronExpression(CRON_EXPRESSION) .startWorkflowRequest(Commons.getStartWorkflowRequest()); } + + private List getTagObject() { + TagObject tagObject = new TagObject(); + tagObject.setType(TagObject.TypeEnum.METADATA); + tagObject.setKey("department"); + tagObject.setValue("accounts"); + return List.of(tagObject); + } } diff --git a/src/test/java/io/orkes/conductor/client/api/SecretClientTests.java b/src/test/java/io/orkes/conductor/client/api/SecretClientTests.java index 0c8e195c..ba23c490 100644 --- a/src/test/java/io/orkes/conductor/client/api/SecretClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/SecretClientTests.java @@ -44,6 +44,11 @@ void testMethods() { } secretClient.putSecret(SECRET_NAME, SECRET_KEY); secretClient.setSecretTags(List.of(getTagObject()), SECRET_KEY); + List tags = secretClient.getSecretTags(SECRET_KEY); + assertEquals(tags.size(), 1); + assertEquals(tags.get(0), getTagObject()); + secretClient.deleteSecretTags(List.of(getTagObject()), SECRET_KEY); + assertEquals(secretClient.getSecretTags(SECRET_KEY).size(), 0); assertTrue(secretClient.listSecretsThatUserCanGrantAccessTo().contains(SECRET_KEY)); assertTrue(secretClient.listAllSecretNames().contains(SECRET_KEY)); assertEquals(SECRET_NAME, secretClient.getSecret(SECRET_KEY));