Skip to content

Commit 83ba070

Browse files
Merge pull request #336 from conductor-oss/feature_tags_field_for_event_handler
Tags field for event handler
2 parents a561d90 + e155a32 commit 83ba070

File tree

12 files changed

+1728
-6
lines changed

12 files changed

+1728
-6
lines changed

src/conductor/asyncio_client/configuration/configuration.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def __init__(
203203
"ca_cert_data": ca_cert_data or os.getenv("CONDUCTOR_SSL_CA_CERT_DATA"),
204204
"debug": debug,
205205
}
206-
206+
207207
# Add SSL parameters if they exist in HttpConfiguration
208208
if cert_file or os.getenv("CONDUCTOR_CERT_FILE"):
209209
http_config_kwargs["cert_file"] = cert_file or os.getenv("CONDUCTOR_CERT_FILE")
@@ -229,6 +229,12 @@ def __init__(
229229
if self.proxy_headers:
230230
self._http_config.proxy_headers = self.proxy_headers
231231

232+
# Set proxy configuration on the HTTP config
233+
if self.proxy:
234+
self._http_config.proxy = self.proxy
235+
if self.proxy_headers:
236+
self._http_config.proxy_headers = self.proxy_headers
237+
232238
# Debug switch and logging setup
233239
self.__debug = debug
234240
if self.__debug:

src/conductor/asyncio_client/event/event_client.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
from __future__ import annotations
2+
3+
from typing import List
4+
15
from conductor.asyncio_client.adapters.api.event_resource_api import (
26
EventResourceApiAdapter,
37
)
8+
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
49
from conductor.asyncio_client.adapters import ApiClient
510
from conductor.shared.event.configuration import QueueConfiguration
611

@@ -34,3 +39,91 @@ async def put_queue_configuration(self, queue_configuration: QueueConfiguration)
3439
queue_name=queue_configuration.queue_name,
3540
queue_type=queue_configuration.queue_type,
3641
)
42+
43+
async def get_event_handler_tags(self, name: str) -> List[TagAdapter]:
44+
"""Get tags for an event handler.
45+
46+
Retrieves all tags associated with a specific event handler.
47+
Tags are used for organizing and categorizing event handlers.
48+
49+
Parameters:
50+
-----------
51+
name : str
52+
The name of the event handler
53+
54+
Returns:
55+
--------
56+
List[TagAdapter]
57+
List of tags associated with the event handler
58+
59+
Example:
60+
--------
61+
```python
62+
# Get tags for an event handler
63+
tags = await event_client.get_event_handler_tags("workflow_trigger")
64+
for tag in tags:
65+
print(f"Tag: {tag.key} = {tag.value}")
66+
```
67+
"""
68+
return await self.client.get_tags_for_event_handler(name=name)
69+
70+
async def add_event_handler_tag(self, name: str, tags: List[TagAdapter]) -> None:
71+
"""Add tags to an event handler.
72+
73+
Associates one or more tags with an event handler for organization and categorization.
74+
75+
Parameters:
76+
-----------
77+
name : str
78+
The name of the event handler
79+
tags : List[TagAdapter]
80+
List of tags to add to the event handler
81+
82+
Example:
83+
--------
84+
```python
85+
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
86+
87+
# Add tags to an event handler
88+
tags = [
89+
TagAdapter(key="environment", value="production"),
90+
TagAdapter(key="team", value="platform"),
91+
TagAdapter(key="priority", value="high")
92+
]
93+
94+
await event_client.add_event_handler_tag("workflow_trigger", tags)
95+
```
96+
"""
97+
# Note: Async API uses (name=name, tag=tags) keyword args to match the server signature.
98+
# Sync API uses (tags, name) positional args due to swagger-codegen parameter ordering.
99+
return await self.client.put_tag_for_event_handler(name=name, tag=tags)
100+
101+
async def remove_event_handler_tag(self, name: str, tags: List[TagAdapter]) -> None:
102+
"""Remove tags from an event handler.
103+
104+
Removes one or more tags from an event handler.
105+
106+
Parameters:
107+
-----------
108+
name : str
109+
The name of the event handler
110+
tags : List[TagAdapter]
111+
List of tags to remove from the event handler
112+
113+
Example:
114+
--------
115+
```python
116+
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
117+
118+
# Remove specific tags from an event handler
119+
tags_to_remove = [
120+
TagAdapter(key="environment", value="production"),
121+
TagAdapter(key="priority", value="high")
122+
]
123+
124+
await event_client.remove_event_handler_tag("workflow_trigger", tags_to_remove)
125+
```
126+
"""
127+
# Note: Async API uses (name=name, tag=tags) keyword args to match the server signature.
128+
# Sync API uses (tags, name) positional args due to swagger-codegen parameter ordering.
129+
return await self.client.delete_tag_for_event_handler(name=name, tag=tags)

src/conductor/asyncio_client/orkes/orkes_base_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
ApplicationResourceApiAdapter
55
from conductor.asyncio_client.adapters.api.authorization_resource_api import \
66
AuthorizationResourceApiAdapter
7+
from conductor.asyncio_client.adapters.api.event_execution_resource_api import \
8+
EventExecutionResourceApiAdapter
9+
from conductor.asyncio_client.adapters.api.event_resource_api import \
10+
EventResourceApiAdapter
711
from conductor.asyncio_client.adapters.api.group_resource_api import \
812
GroupResourceApiAdapter
913
from conductor.asyncio_client.adapters.api.integration_resource_api import \
@@ -67,3 +71,5 @@ def __init__(self, configuration: Configuration, api_client: ApiClient):
6771
self.integration_api = IntegrationResourceApiAdapter(self.api_client)
6872
self.prompt_api = PromptResourceApiAdapter(self.api_client)
6973
self.schema_api = SchemaResourceApiAdapter(self.api_client)
74+
self.event_api = EventResourceApiAdapter(self.api_client)
75+
self.event_execution_api = EventExecutionResourceApiAdapter(self.api_client)

src/conductor/asyncio_client/orkes/orkes_clients.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from conductor.asyncio_client.adapters import ApiClient
77
from conductor.asyncio_client.orkes.orkes_authorization_client import \
88
OrkesAuthorizationClient
9+
from conductor.asyncio_client.orkes.orkes_event_client import OrkesEventClient
910
from conductor.asyncio_client.orkes.orkes_integration_client import \
1011
OrkesIntegrationClient
1112
from conductor.asyncio_client.orkes.orkes_metadata_client import \
@@ -273,6 +274,26 @@ def get_schema_client(self) -> OrkesSchemaClient:
273274
"""
274275
return OrkesSchemaClient(self.configuration, self.api_client)
275276

277+
def get_event_client(self) -> OrkesEventClient:
278+
"""
279+
Create and return an event management client.
280+
281+
The event client manages event handlers and event processing within the
282+
Conductor platform, allowing you to create, configure, and monitor
283+
event-driven workflows and integrations.
284+
285+
Returns:
286+
--------
287+
OrkesEventClient
288+
Client for event operations including:
289+
- Creating and managing event handlers
290+
- Configuring event processing rules
291+
- Monitoring event executions
292+
- Managing event handler tags and metadata
293+
- Configuring queue settings for event processing
294+
"""
295+
return OrkesEventClient(self.configuration, self.api_client)
296+
276297
def get_workflow_executor(self) -> AsyncWorkflowExecutor:
277298
"""
278299
Create and return an asynchronous workflow executor.

0 commit comments

Comments
 (0)