Skip to content

Commit 7a13813

Browse files
Orkes clients refactoring example
1 parent 6bd5468 commit 7a13813

3 files changed

Lines changed: 329 additions & 38 deletions

File tree

src/conductor/asyncio_client/orkes/orkes_base_client.py

Lines changed: 302 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import logging
2+
import warnings
3+
from deprecated import deprecated
4+
from typing_extensions import deprecated as typing_deprecated
25

36
from conductor.asyncio_client.adapters import ApiClient
47
from conductor.asyncio_client.adapters.api.application_resource_api import (
@@ -48,16 +51,302 @@ def __init__(self, configuration: Configuration, api_client: ApiClient):
4851
self.logger = logging.getLogger(__name__)
4952

5053
# Initialize all API clients
51-
self.metadata_api = MetadataResourceApiAdapter(self.api_client)
52-
self.task_api = TaskResourceApiAdapter(self.api_client)
53-
self.workflow_api = WorkflowResourceApiAdapter(self.api_client)
54-
self.application_api = ApplicationResourceApiAdapter(self.api_client)
55-
self.secret_api = SecretResourceApiAdapter(self.api_client)
56-
self.user_api = UserResourceApiAdapter(self.api_client)
57-
self.group_api = GroupResourceApiAdapter(self.api_client)
58-
self.authorization_api = AuthorizationResourceApiAdapter(self.api_client)
59-
self.scheduler_api = SchedulerResourceApiAdapter(self.api_client)
60-
self.tags_api = TagsApiAdapter(self.api_client)
61-
self.integration_api = IntegrationResourceApiAdapter(self.api_client)
62-
self.prompt_api = PromptResourceApiAdapter(self.api_client)
63-
self.schema_api = SchemaResourceApiAdapter(self.api_client)
54+
self._metadata_api = MetadataResourceApiAdapter(self.api_client)
55+
self.__task_api = TaskResourceApiAdapter(self.api_client)
56+
self.__workflow_api = WorkflowResourceApiAdapter(self.api_client)
57+
self.__application_api = ApplicationResourceApiAdapter(self.api_client)
58+
self.__secret_api = SecretResourceApiAdapter(self.api_client)
59+
self.__user_api = UserResourceApiAdapter(self.api_client)
60+
self.__group_api = GroupResourceApiAdapter(self.api_client)
61+
self.__authorization_api = AuthorizationResourceApiAdapter(self.api_client)
62+
self.__scheduler_api = SchedulerResourceApiAdapter(self.api_client)
63+
self.__tags_api = TagsApiAdapter(self.api_client)
64+
self.__integration_api = IntegrationResourceApiAdapter(self.api_client)
65+
self.__prompt_api = PromptResourceApiAdapter(self.api_client)
66+
self.__schema_api = SchemaResourceApiAdapter(self.api_client)
67+
68+
@property
69+
@typing_deprecated(
70+
"metadata_api is deprecated; use OrkesMetadataClient instead. "
71+
"This attribute will be removed in a future version."
72+
)
73+
@deprecated(
74+
"metadata_api is deprecated; use OrkesMetadataClient instead. "
75+
"This attribute will be removed in a future version."
76+
)
77+
def metadata_api(self) -> MetadataResourceApiAdapter:
78+
"""
79+
Deprecated: attribute-style access maintained for backward compatibility.
80+
Prefer using `OrkesMetadataClient` methods instead.
81+
"""
82+
warnings.warn(
83+
"'metadata_api' is deprecated and will be removed in a future release. "
84+
"Use `OrkesMetadataClient` instead.",
85+
DeprecationWarning,
86+
stacklevel=2,
87+
)
88+
return self._metadata_api
89+
90+
@property
91+
@typing_deprecated(
92+
"task_api is deprecated; use OrkesTaskClient instead. "
93+
"This attribute will be removed in a future version."
94+
)
95+
@deprecated(
96+
"task_api is deprecated; use OrkesTaskClient instead. "
97+
"This attribute will be removed in a future version."
98+
)
99+
def task_api(self) -> TaskResourceApiAdapter:
100+
"""
101+
Deprecated: attribute-style access maintained for backward compatibility.
102+
Prefer using `OrkesTaskClient` methods instead.
103+
"""
104+
warnings.warn(
105+
"'task_api' is deprecated and will be removed in a future release. "
106+
"Use `OrkesTaskClient` instead.",
107+
DeprecationWarning,
108+
stacklevel=2,
109+
)
110+
return self.__task_api
111+
112+
@property
113+
@typing_deprecated(
114+
"workflow_api is deprecated; use OrkesWorkflowClient instead. "
115+
"This attribute will be removed in a future version."
116+
)
117+
@deprecated(
118+
"workflow_api is deprecated; use OrkesWorkflowClient instead. "
119+
"This attribute will be removed in a future version."
120+
)
121+
def workflow_api(self) -> WorkflowResourceApiAdapter:
122+
"""
123+
Deprecated: attribute-style access maintained for backward compatibility.
124+
Prefer using `OrkesWorkflowClient` methods instead.
125+
"""
126+
warnings.warn(
127+
"'workflow_api' is deprecated and will be removed in a future release. "
128+
"Use `OrkesWorkflowClient` instead.",
129+
DeprecationWarning,
130+
stacklevel=2,
131+
)
132+
return self.__workflow_api
133+
134+
@property
135+
@typing_deprecated(
136+
"application_api is deprecated; use OrkesAuthorizationClient instead. "
137+
"This attribute will be removed in a future version."
138+
)
139+
@deprecated(
140+
"application_api is deprecated; use OrkesAuthorizationClient instead. "
141+
"This attribute will be removed in a future version."
142+
)
143+
def application_api(self) -> ApplicationResourceApiAdapter:
144+
"""
145+
Deprecated: attribute-style access maintained for backward compatibility.
146+
Prefer using `OrkesAuthorizationClient` methods instead.
147+
"""
148+
warnings.warn(
149+
"'application_api' is deprecated and will be removed in a future release. "
150+
"Use `OrkesAuthorizationClient` instead.",
151+
DeprecationWarning,
152+
stacklevel=2,
153+
)
154+
return self.__application_api
155+
156+
@property
157+
@typing_deprecated(
158+
"secret_api is deprecated; use OrkesSecretClient instead. "
159+
"This attribute will be removed in a future version."
160+
)
161+
@deprecated(
162+
"secret_api is deprecated; use OrkesSecretClient instead. "
163+
"This attribute will be removed in a future version."
164+
)
165+
def secret_api(self) -> SecretResourceApiAdapter:
166+
"""
167+
Deprecated: attribute-style access maintained for backward compatibility.
168+
Prefer using `OrkesSecretClient` methods instead.
169+
"""
170+
warnings.warn(
171+
"'secret_api' is deprecated and will be removed in a future release. "
172+
"Use `OrkesSecretClient` instead.",
173+
DeprecationWarning,
174+
stacklevel=2,
175+
)
176+
return self.__secret_api
177+
178+
@property
179+
@typing_deprecated(
180+
"user_api is deprecated; use OrkesAuthorizationClient instead. "
181+
"This attribute will be removed in a future version."
182+
)
183+
@deprecated(
184+
"user_api is deprecated; use OrkesAuthorizationClient instead. "
185+
"This attribute will be removed in a future version."
186+
)
187+
def user_api(self) -> UserResourceApiAdapter:
188+
"""
189+
Deprecated: attribute-style access maintained for backward compatibility.
190+
Prefer using `OrkesAuthorizationClient` methods instead.
191+
"""
192+
warnings.warn(
193+
"'user_api' is deprecated and will be removed in a future release. "
194+
"Use `OrkesAuthorizationClient` instead.",
195+
DeprecationWarning,
196+
stacklevel=2,
197+
)
198+
return self.__user_api
199+
200+
@property
201+
@typing_deprecated(
202+
"group_api is deprecated; use OrkesAuthorizationClient instead. "
203+
"This attribute will be removed in a future version."
204+
)
205+
@deprecated(
206+
"group_api is deprecated; use OrkesAuthorizationClient instead. "
207+
"This attribute will be removed in a future version."
208+
)
209+
def group_api(self) -> GroupResourceApiAdapter:
210+
"""
211+
Deprecated: attribute-style access maintained for backward compatibility.
212+
Prefer using `OrkesAuthorizationClient` methods instead.
213+
"""
214+
warnings.warn(
215+
"'group_api' is deprecated and will be removed in a future release. "
216+
"Use `OrkesAuthorizationClient` instead.",
217+
DeprecationWarning,
218+
stacklevel=2,
219+
)
220+
return self.__group_api
221+
222+
@property
223+
@typing_deprecated(
224+
"authorization_api is deprecated; use OrkesAuthorizationClient instead. "
225+
"This attribute will be removed in a future version."
226+
)
227+
@deprecated(
228+
"authorization_api is deprecated; use OrkesAuthorizationClient instead. "
229+
"This attribute will be removed in a future version."
230+
)
231+
def authorization_api(self) -> AuthorizationResourceApiAdapter:
232+
"""
233+
Deprecated: attribute-style access maintained for backward compatibility.
234+
Prefer using `OrkesAuthorizationClient` methods instead.
235+
"""
236+
warnings.warn(
237+
"'authorization_api' is deprecated and will be removed in a future release. "
238+
"Use `OrkesAuthorizationClient` instead.",
239+
DeprecationWarning,
240+
stacklevel=2,
241+
)
242+
return self.__authorization_api
243+
244+
@property
245+
@typing_deprecated(
246+
"scheduler_api is deprecated; use OrkesSchedulerClient instead. "
247+
"This attribute will be removed in a future version."
248+
)
249+
@deprecated(
250+
"scheduler_api is deprecated; use OrkesSchedulerClient instead. "
251+
"This attribute will be removed in a future version."
252+
)
253+
def scheduler_api(self) -> SchedulerResourceApiAdapter:
254+
"""
255+
Deprecated: attribute-style access maintained for backward compatibility.
256+
Prefer using `OrkesSchedulerClient` methods instead.
257+
"""
258+
warnings.warn(
259+
"'scheduler_api' is deprecated and will be removed in a future release. "
260+
"Use `OrkesSchedulerClient` instead.",
261+
DeprecationWarning,
262+
stacklevel=2,
263+
)
264+
return self.__scheduler_api
265+
266+
@property
267+
@typing_deprecated(
268+
"tags_api is deprecated; use OrkesTagsClient instead. "
269+
"This attribute will be removed in a future version."
270+
)
271+
@deprecated(
272+
"tags_api is deprecated; use OrkesTagsClient instead. "
273+
"This attribute will be removed in a future version."
274+
)
275+
def tags_api(self) -> TagsApiAdapter:
276+
"""
277+
Deprecated: attribute-style access maintained for backward compatibility.
278+
Prefer using `OrkesTagsClient` methods instead.
279+
"""
280+
warnings.warn(
281+
"'tags_api' is deprecated and will be removed in a future release. "
282+
"Use `OrkesTagsClient` instead.",
283+
DeprecationWarning,
284+
stacklevel=2,
285+
)
286+
return self.__tags_api
287+
288+
@property
289+
@typing_deprecated(
290+
"integration_api is deprecated; use OrkesIntegrationClient instead. "
291+
"This attribute will be removed in a future version."
292+
)
293+
@deprecated(
294+
"integration_api is deprecated; use OrkesIntegrationClient instead. "
295+
"This attribute will be removed in a future version."
296+
)
297+
def integration_api(self) -> IntegrationResourceApiAdapter:
298+
"""
299+
Deprecated: attribute-style access maintained for backward compatibility.
300+
Prefer using `OrkesIntegrationClient` methods instead.
301+
"""
302+
warnings.warn(
303+
"'integration_api' is deprecated and will be removed in a future release. "
304+
"Use `OrkesIntegrationClient` instead.",
305+
DeprecationWarning,
306+
stacklevel=2,
307+
)
308+
return self.__integration_api
309+
310+
@property
311+
@typing_deprecated(
312+
"prompt_api is deprecated; use OrkesPromptClient instead. "
313+
"This attribute will be removed in a future version."
314+
)
315+
@deprecated(
316+
"prompt_api is deprecated; use OrkesPromptClient instead. "
317+
"This attribute will be removed in a future version."
318+
)
319+
def prompt_api(self) -> PromptResourceApiAdapter:
320+
"""
321+
Deprecated: attribute-style access maintained for backward compatibility.
322+
Prefer using `OrkesPromptClient` methods instead.
323+
"""
324+
warnings.warn(
325+
"'prompt_api' is deprecated and will be removed in a future release. "
326+
"Use `OrkesPromptClient` instead.",
327+
DeprecationWarning,
328+
stacklevel=2,
329+
)
330+
return self.__prompt_api
331+
332+
@property
333+
@typing_deprecated(
334+
"schema_api is deprecated; use OrkesSchemaClient instead. "
335+
"This attribute will be removed in a future version."
336+
)
337+
@deprecated(
338+
"schema_api is deprecated; use OrkesSchemaClient instead. "
339+
"This attribute will be removed in a future version."
340+
)
341+
def schema_api(self) -> SchemaResourceApiAdapter:
342+
"""
343+
Deprecated: attribute-style access maintained for backward compatibility.
344+
Prefer using `OrkesSchemaClient` methods instead.
345+
"""
346+
warnings.warn(
347+
"'schema_api' is deprecated and will be removed in a future release. "
348+
"Use `OrkesSchemaClient` instead.",
349+
DeprecationWarning,
350+
stacklevel=2,
351+
)
352+
return self.__schema_api

0 commit comments

Comments
 (0)