-
Notifications
You must be signed in to change notification settings - Fork 4
SignalAPI and Execute API refactoring + Introduced CB Enabled for Service Registry #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shaileshpadave
wants to merge
18
commits into
main
Choose a base branch
from
CCOR-12562-Fixed
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5e753ec
Introduce isCBEnabled flag for Service Registry
a59cc94
spotless applied
2318b4e
Few more changes
fc251c9
moved logic to conductor-client
3bbdb13
few more changes
364c9ed
few more changes
fc5acd9
applied spotless
a892e72
Few changes in taskClient
b36b949
spotless applied
9c6fdb5
few changes
41e0093
Added new client
164ae03
Added API n ConflictException
7820f05
Added Kafka consumer
7e85898
Applied spotless
0b3498b
Added conductorClient
5ab0753
code chnge to add grpc sup[port back to java sdk
35fdf59
Kept only ConductorClientException
3319ba0
spotless applied
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
conductor-client/src/main/java/com/netflix/conductor/client/http/IncomingWebhookClient.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* | ||
| * Copyright 2020 Conductor Authors. | ||
| * <p> | ||
| * 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 | ||
| * <p> | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * <p> | ||
| * 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.netflix.conductor.client.http; | ||
|
|
||
|
|
||
| import org.apache.commons.lang3.Validate; | ||
|
|
||
| import com.netflix.conductor.client.http.ConductorClientRequest.Method; | ||
|
|
||
| import com.fasterxml.jackson.core.type.TypeReference; | ||
|
|
||
| /** | ||
| * Client for incoming webhook operations in Conductor | ||
| */ | ||
| public final class IncomingWebhookClient { | ||
|
|
||
| private ConductorClient client; | ||
|
|
||
| /** Creates a default incoming webhook client */ | ||
| public IncomingWebhookClient() { | ||
| } | ||
|
|
||
| public IncomingWebhookClient(ConductorClient client) { | ||
| this.client = client; | ||
| } | ||
|
|
||
| /** | ||
| * Kept only for backwards compatibility | ||
| * | ||
| * @param rootUri basePath for the ApiClient | ||
| */ | ||
| @Deprecated | ||
| public void setRootURI(String rootUri) { | ||
| if (client != null) { | ||
| client.shutdown(); | ||
| } | ||
| client = new ConductorClient(rootUri); | ||
| } | ||
|
|
||
| /** | ||
| * Handle incoming webhook with POST method | ||
| * | ||
| * @param id The webhook ID | ||
| * @param payload The webhook payload as string | ||
| * @return The response from the webhook handler | ||
| */ | ||
| public String handleWebhook(String id, String payload) { | ||
| Validate.notBlank(id, "Webhook ID cannot be blank"); | ||
| Validate.notNull(payload, "Payload cannot be null"); | ||
|
|
||
| ConductorClientRequest.Builder requestBuilder = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/webhook/{id}") | ||
| .addPathParam("id", id) | ||
| .body(payload); | ||
|
|
||
| ConductorClientRequest request = requestBuilder.build(); | ||
|
|
||
| ConductorClientResponse<String> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| /** | ||
| * Handle incoming webhook with GET method (typically for ping/health checks) | ||
| * | ||
| * @param id The webhook ID | ||
| * @return The response from the webhook handler | ||
| */ | ||
| public String handlePing(String id) { | ||
| Validate.notBlank(id, "Webhook ID cannot be blank"); | ||
|
|
||
| ConductorClientRequest.Builder requestBuilder = ConductorClientRequest.builder() | ||
| .method(Method.GET) | ||
| .path("/webhook/{id}") | ||
| .addPathParam("id", id); | ||
|
|
||
| ConductorClientRequest request = requestBuilder.build(); | ||
|
|
||
| ConductorClientResponse<String> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
| } | ||
151 changes: 151 additions & 0 deletions
151
conductor-client/src/main/java/com/netflix/conductor/client/http/ResourceSharingClient.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| /* | ||
| * Copyright 2020 Conductor Authors. | ||
| * <p> | ||
| * 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 | ||
| * <p> | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * <p> | ||
| * 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.netflix.conductor.client.http; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import org.apache.commons.lang3.Validate; | ||
|
|
||
| import com.netflix.conductor.client.http.ConductorClientRequest.Method; | ||
| import com.netflix.conductor.common.metadata.workflow.SharedResourceModel; | ||
|
|
||
| import com.fasterxml.jackson.core.type.TypeReference; | ||
|
|
||
| /** | ||
| * Client for resource sharing operations in Conductor | ||
| */ | ||
| public final class ResourceSharingClient { | ||
|
|
||
| private ConductorClient client; | ||
|
|
||
| /** Creates a default resource sharing client */ | ||
| public ResourceSharingClient() { | ||
| } | ||
|
|
||
| public ResourceSharingClient(ConductorClient client) { | ||
| this.client = client; | ||
| } | ||
|
|
||
| /** | ||
| * Kept only for backwards compatibility | ||
| * | ||
| * @param rootUri basePath for the ApiClient | ||
| */ | ||
| @Deprecated | ||
| public void setRootURI(String rootUri) { | ||
| if (client != null) { | ||
| client.shutdown(); | ||
| } | ||
| client = new ConductorClient(rootUri); | ||
| } | ||
|
|
||
| /** | ||
| * Share a resource with another user or group | ||
| * | ||
| * @param resourceType Type of resource to share (e.g., "WORKFLOW", "TASK") | ||
| * @param resourceName Name of the resource to share | ||
| * @param sharedWith User or group to share the resource with | ||
| */ | ||
| public void shareResource(String resourceType, String resourceName, String sharedWith) { | ||
| Validate.notBlank(resourceType, "ResourceType cannot be blank"); | ||
| Validate.notBlank(resourceName, "ResourceName cannot be blank"); | ||
| Validate.notBlank(sharedWith, "SharedWith cannot be blank"); | ||
|
|
||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.POST) | ||
| .path("/share/shareResource") | ||
| .addQueryParam("resourceType", resourceType) | ||
| .addQueryParam("resourceName", resourceName) | ||
| .addQueryParam("sharedWith", sharedWith) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| /** | ||
| * Remove sharing of a resource with a user or group | ||
| * | ||
| * @param resourceType Type of resource to unshare | ||
| * @param resourceName Name of the resource to unshare | ||
| * @param sharedWith User or group to remove sharing from | ||
| */ | ||
| public void removeSharingResource(String resourceType, String resourceName, String sharedWith) { | ||
| Validate.notBlank(resourceType, "ResourceType cannot be blank"); | ||
| Validate.notBlank(resourceName, "ResourceName cannot be blank"); | ||
| Validate.notBlank(sharedWith, "SharedWith cannot be blank"); | ||
|
|
||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.DELETE) | ||
| .path("/share/removeSharingResource") | ||
| .addQueryParam("resourceType", resourceType) | ||
| .addQueryParam("resourceName", resourceName) | ||
| .addQueryParam("sharedWith", sharedWith) | ||
| .build(); | ||
|
|
||
| client.execute(request); | ||
| } | ||
|
|
||
| /** | ||
| * Get all shared resources accessible to the current user | ||
| * | ||
| * @return List of shared resources | ||
| */ | ||
| public List<SharedResourceModel> getSharedResources() { | ||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.GET) | ||
| .path("/share/getSharedResources") | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<List<SharedResourceModel>> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| /** | ||
| * Get shared resources filtered by resource type | ||
| * | ||
| * @param resourceType Type of resource to filter by | ||
| * @return List of shared resources of the specified type | ||
| */ | ||
| public List<SharedResourceModel> getSharedResources(String resourceType) { | ||
| Validate.notBlank(resourceType, "ResourceType cannot be blank"); | ||
|
|
||
| ConductorClientRequest request = ConductorClientRequest.builder() | ||
| .method(Method.GET) | ||
| .path("/share/getSharedResources") | ||
| .addQueryParam("resourceType", resourceType) | ||
| .build(); | ||
|
|
||
| ConductorClientResponse<List<SharedResourceModel>> resp = client.execute(request, new TypeReference<>() { | ||
| }); | ||
|
|
||
| return resp.getData(); | ||
| } | ||
|
|
||
| /** | ||
| * Check if a specific resource is shared with a user or group | ||
| * | ||
| * @param resourceType Type of resource | ||
| * @param resourceName Name of the resource | ||
| * @param sharedWith User or group to check | ||
| * @return true if the resource is shared, false otherwise | ||
| */ | ||
| public boolean isResourceShared(String resourceType, String resourceName, String sharedWith) { | ||
| List<SharedResourceModel> sharedResources = getSharedResources(resourceType); | ||
| return sharedResources.stream() | ||
| .anyMatch(resource -> | ||
| resource.getResourceName().equals(resourceName) && | ||
| resource.getSharedWith().equals(sharedWith)); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it part of conductor or orkes API? I don't see these endpoints here https://github.com/conductor-oss/conductor/tree/main/rest/src/main/java/com/netflix/conductor/rest/controllers .
If it is part of orkes API it should go to orkes-client project, from my standpoint