hatchet-sdk 1.18.1__py3-none-any.whl → 1.19.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hatchet-sdk might be problematic. Click here for more details.

Files changed (225) hide show
  1. {hatchet_sdk-1.18.1.dist-info → hatchet_sdk-1.19.0.dist-info}/METADATA +2 -3
  2. {hatchet_sdk-1.18.1.dist-info → hatchet_sdk-1.19.0.dist-info}/RECORD +4 -225
  3. hatchet_sdk/v0/__init__.py +0 -251
  4. hatchet_sdk/v0/client.py +0 -119
  5. hatchet_sdk/v0/clients/admin.py +0 -541
  6. hatchet_sdk/v0/clients/dispatcher/action_listener.py +0 -422
  7. hatchet_sdk/v0/clients/dispatcher/dispatcher.py +0 -204
  8. hatchet_sdk/v0/clients/event_ts.py +0 -28
  9. hatchet_sdk/v0/clients/events.py +0 -182
  10. hatchet_sdk/v0/clients/rest/__init__.py +0 -307
  11. hatchet_sdk/v0/clients/rest/api/__init__.py +0 -19
  12. hatchet_sdk/v0/clients/rest/api/api_token_api.py +0 -858
  13. hatchet_sdk/v0/clients/rest/api/default_api.py +0 -2259
  14. hatchet_sdk/v0/clients/rest/api/event_api.py +0 -2548
  15. hatchet_sdk/v0/clients/rest/api/github_api.py +0 -331
  16. hatchet_sdk/v0/clients/rest/api/healthcheck_api.py +0 -483
  17. hatchet_sdk/v0/clients/rest/api/log_api.py +0 -449
  18. hatchet_sdk/v0/clients/rest/api/metadata_api.py +0 -728
  19. hatchet_sdk/v0/clients/rest/api/rate_limits_api.py +0 -423
  20. hatchet_sdk/v0/clients/rest/api/slack_api.py +0 -577
  21. hatchet_sdk/v0/clients/rest/api/sns_api.py +0 -872
  22. hatchet_sdk/v0/clients/rest/api/step_run_api.py +0 -2202
  23. hatchet_sdk/v0/clients/rest/api/tenant_api.py +0 -4430
  24. hatchet_sdk/v0/clients/rest/api/user_api.py +0 -2888
  25. hatchet_sdk/v0/clients/rest/api/worker_api.py +0 -858
  26. hatchet_sdk/v0/clients/rest/api/workflow_api.py +0 -6312
  27. hatchet_sdk/v0/clients/rest/api/workflow_run_api.py +0 -1932
  28. hatchet_sdk/v0/clients/rest/api/workflow_runs_api.py +0 -610
  29. hatchet_sdk/v0/clients/rest/api_client.py +0 -759
  30. hatchet_sdk/v0/clients/rest/api_response.py +0 -22
  31. hatchet_sdk/v0/clients/rest/configuration.py +0 -611
  32. hatchet_sdk/v0/clients/rest/exceptions.py +0 -200
  33. hatchet_sdk/v0/clients/rest/models/__init__.py +0 -274
  34. hatchet_sdk/v0/clients/rest/models/accept_invite_request.py +0 -83
  35. hatchet_sdk/v0/clients/rest/models/api_error.py +0 -102
  36. hatchet_sdk/v0/clients/rest/models/api_errors.py +0 -100
  37. hatchet_sdk/v0/clients/rest/models/api_meta.py +0 -144
  38. hatchet_sdk/v0/clients/rest/models/api_meta_auth.py +0 -85
  39. hatchet_sdk/v0/clients/rest/models/api_meta_integration.py +0 -88
  40. hatchet_sdk/v0/clients/rest/models/api_meta_posthog.py +0 -90
  41. hatchet_sdk/v0/clients/rest/models/api_resource_meta.py +0 -98
  42. hatchet_sdk/v0/clients/rest/models/api_token.py +0 -105
  43. hatchet_sdk/v0/clients/rest/models/bulk_create_event_request.py +0 -100
  44. hatchet_sdk/v0/clients/rest/models/bulk_create_event_response.py +0 -110
  45. hatchet_sdk/v0/clients/rest/models/cancel_event_request.py +0 -85
  46. hatchet_sdk/v0/clients/rest/models/cancel_step_run_request.py +0 -83
  47. hatchet_sdk/v0/clients/rest/models/concurrency_limit_strategy.py +0 -39
  48. hatchet_sdk/v0/clients/rest/models/create_api_token_request.py +0 -92
  49. hatchet_sdk/v0/clients/rest/models/create_api_token_response.py +0 -83
  50. hatchet_sdk/v0/clients/rest/models/create_cron_workflow_trigger_request.py +0 -98
  51. hatchet_sdk/v0/clients/rest/models/create_event_request.py +0 -95
  52. hatchet_sdk/v0/clients/rest/models/create_pull_request_from_step_run.py +0 -83
  53. hatchet_sdk/v0/clients/rest/models/create_sns_integration_request.py +0 -85
  54. hatchet_sdk/v0/clients/rest/models/create_tenant_alert_email_group_request.py +0 -83
  55. hatchet_sdk/v0/clients/rest/models/create_tenant_invite_request.py +0 -86
  56. hatchet_sdk/v0/clients/rest/models/create_tenant_request.py +0 -84
  57. hatchet_sdk/v0/clients/rest/models/cron_workflows.py +0 -131
  58. hatchet_sdk/v0/clients/rest/models/cron_workflows_list.py +0 -110
  59. hatchet_sdk/v0/clients/rest/models/cron_workflows_method.py +0 -37
  60. hatchet_sdk/v0/clients/rest/models/cron_workflows_order_by_field.py +0 -37
  61. hatchet_sdk/v0/clients/rest/models/event.py +0 -143
  62. hatchet_sdk/v0/clients/rest/models/event_data.py +0 -83
  63. hatchet_sdk/v0/clients/rest/models/event_key_list.py +0 -98
  64. hatchet_sdk/v0/clients/rest/models/event_list.py +0 -110
  65. hatchet_sdk/v0/clients/rest/models/event_order_by_direction.py +0 -37
  66. hatchet_sdk/v0/clients/rest/models/event_order_by_field.py +0 -36
  67. hatchet_sdk/v0/clients/rest/models/event_update_cancel200_response.py +0 -85
  68. hatchet_sdk/v0/clients/rest/models/event_workflow_run_summary.py +0 -116
  69. hatchet_sdk/v0/clients/rest/models/events.py +0 -110
  70. hatchet_sdk/v0/clients/rest/models/get_step_run_diff_response.py +0 -100
  71. hatchet_sdk/v0/clients/rest/models/github_app_installation.py +0 -107
  72. hatchet_sdk/v0/clients/rest/models/github_branch.py +0 -86
  73. hatchet_sdk/v0/clients/rest/models/github_repo.py +0 -86
  74. hatchet_sdk/v0/clients/rest/models/info_get_version200_response.py +0 -83
  75. hatchet_sdk/v0/clients/rest/models/job.py +0 -132
  76. hatchet_sdk/v0/clients/rest/models/job_run.py +0 -176
  77. hatchet_sdk/v0/clients/rest/models/job_run_status.py +0 -41
  78. hatchet_sdk/v0/clients/rest/models/link_github_repository_request.py +0 -106
  79. hatchet_sdk/v0/clients/rest/models/list_api_tokens_response.py +0 -110
  80. hatchet_sdk/v0/clients/rest/models/list_github_app_installations_response.py +0 -112
  81. hatchet_sdk/v0/clients/rest/models/list_pull_requests_response.py +0 -100
  82. hatchet_sdk/v0/clients/rest/models/list_slack_webhooks.py +0 -110
  83. hatchet_sdk/v0/clients/rest/models/list_sns_integrations.py +0 -110
  84. hatchet_sdk/v0/clients/rest/models/log_line.py +0 -94
  85. hatchet_sdk/v0/clients/rest/models/log_line_level.py +0 -39
  86. hatchet_sdk/v0/clients/rest/models/log_line_list.py +0 -110
  87. hatchet_sdk/v0/clients/rest/models/log_line_order_by_direction.py +0 -37
  88. hatchet_sdk/v0/clients/rest/models/log_line_order_by_field.py +0 -36
  89. hatchet_sdk/v0/clients/rest/models/pagination_response.py +0 -95
  90. hatchet_sdk/v0/clients/rest/models/pull_request.py +0 -112
  91. hatchet_sdk/v0/clients/rest/models/pull_request_state.py +0 -37
  92. hatchet_sdk/v0/clients/rest/models/queue_metrics.py +0 -97
  93. hatchet_sdk/v0/clients/rest/models/rate_limit.py +0 -117
  94. hatchet_sdk/v0/clients/rest/models/rate_limit_list.py +0 -110
  95. hatchet_sdk/v0/clients/rest/models/rate_limit_order_by_direction.py +0 -37
  96. hatchet_sdk/v0/clients/rest/models/rate_limit_order_by_field.py +0 -38
  97. hatchet_sdk/v0/clients/rest/models/recent_step_runs.py +0 -118
  98. hatchet_sdk/v0/clients/rest/models/reject_invite_request.py +0 -83
  99. hatchet_sdk/v0/clients/rest/models/replay_event_request.py +0 -85
  100. hatchet_sdk/v0/clients/rest/models/replay_workflow_runs_request.py +0 -85
  101. hatchet_sdk/v0/clients/rest/models/replay_workflow_runs_response.py +0 -100
  102. hatchet_sdk/v0/clients/rest/models/rerun_step_run_request.py +0 -83
  103. hatchet_sdk/v0/clients/rest/models/schedule_workflow_run_request.py +0 -92
  104. hatchet_sdk/v0/clients/rest/models/scheduled_run_status.py +0 -42
  105. hatchet_sdk/v0/clients/rest/models/scheduled_workflows.py +0 -149
  106. hatchet_sdk/v0/clients/rest/models/scheduled_workflows_list.py +0 -110
  107. hatchet_sdk/v0/clients/rest/models/scheduled_workflows_method.py +0 -37
  108. hatchet_sdk/v0/clients/rest/models/scheduled_workflows_order_by_field.py +0 -37
  109. hatchet_sdk/v0/clients/rest/models/semaphore_slots.py +0 -113
  110. hatchet_sdk/v0/clients/rest/models/slack_webhook.py +0 -127
  111. hatchet_sdk/v0/clients/rest/models/sns_integration.py +0 -114
  112. hatchet_sdk/v0/clients/rest/models/step.py +0 -123
  113. hatchet_sdk/v0/clients/rest/models/step_run.py +0 -202
  114. hatchet_sdk/v0/clients/rest/models/step_run_archive.py +0 -142
  115. hatchet_sdk/v0/clients/rest/models/step_run_archive_list.py +0 -110
  116. hatchet_sdk/v0/clients/rest/models/step_run_diff.py +0 -91
  117. hatchet_sdk/v0/clients/rest/models/step_run_event.py +0 -122
  118. hatchet_sdk/v0/clients/rest/models/step_run_event_list.py +0 -110
  119. hatchet_sdk/v0/clients/rest/models/step_run_event_reason.py +0 -52
  120. hatchet_sdk/v0/clients/rest/models/step_run_event_severity.py +0 -38
  121. hatchet_sdk/v0/clients/rest/models/step_run_status.py +0 -44
  122. hatchet_sdk/v0/clients/rest/models/tenant.py +0 -118
  123. hatchet_sdk/v0/clients/rest/models/tenant_alert_email_group.py +0 -98
  124. hatchet_sdk/v0/clients/rest/models/tenant_alert_email_group_list.py +0 -112
  125. hatchet_sdk/v0/clients/rest/models/tenant_alerting_settings.py +0 -143
  126. hatchet_sdk/v0/clients/rest/models/tenant_invite.py +0 -120
  127. hatchet_sdk/v0/clients/rest/models/tenant_invite_list.py +0 -110
  128. hatchet_sdk/v0/clients/rest/models/tenant_list.py +0 -110
  129. hatchet_sdk/v0/clients/rest/models/tenant_member.py +0 -123
  130. hatchet_sdk/v0/clients/rest/models/tenant_member_list.py +0 -110
  131. hatchet_sdk/v0/clients/rest/models/tenant_member_role.py +0 -38
  132. hatchet_sdk/v0/clients/rest/models/tenant_queue_metrics.py +0 -116
  133. hatchet_sdk/v0/clients/rest/models/tenant_resource.py +0 -40
  134. hatchet_sdk/v0/clients/rest/models/tenant_resource_limit.py +0 -135
  135. hatchet_sdk/v0/clients/rest/models/tenant_resource_policy.py +0 -102
  136. hatchet_sdk/v0/clients/rest/models/tenant_step_run_queue_metrics.py +0 -83
  137. hatchet_sdk/v0/clients/rest/models/trigger_workflow_run_request.py +0 -91
  138. hatchet_sdk/v0/clients/rest/models/update_tenant_alert_email_group_request.py +0 -83
  139. hatchet_sdk/v0/clients/rest/models/update_tenant_invite_request.py +0 -85
  140. hatchet_sdk/v0/clients/rest/models/update_tenant_request.py +0 -137
  141. hatchet_sdk/v0/clients/rest/models/update_worker_request.py +0 -87
  142. hatchet_sdk/v0/clients/rest/models/user.py +0 -126
  143. hatchet_sdk/v0/clients/rest/models/user_change_password_request.py +0 -88
  144. hatchet_sdk/v0/clients/rest/models/user_login_request.py +0 -86
  145. hatchet_sdk/v0/clients/rest/models/user_register_request.py +0 -91
  146. hatchet_sdk/v0/clients/rest/models/user_tenant_memberships_list.py +0 -110
  147. hatchet_sdk/v0/clients/rest/models/user_tenant_public.py +0 -86
  148. hatchet_sdk/v0/clients/rest/models/webhook_worker.py +0 -100
  149. hatchet_sdk/v0/clients/rest/models/webhook_worker_create_request.py +0 -94
  150. hatchet_sdk/v0/clients/rest/models/webhook_worker_create_response.py +0 -98
  151. hatchet_sdk/v0/clients/rest/models/webhook_worker_created.py +0 -102
  152. hatchet_sdk/v0/clients/rest/models/webhook_worker_list_response.py +0 -110
  153. hatchet_sdk/v0/clients/rest/models/webhook_worker_request.py +0 -102
  154. hatchet_sdk/v0/clients/rest/models/webhook_worker_request_list_response.py +0 -104
  155. hatchet_sdk/v0/clients/rest/models/webhook_worker_request_method.py +0 -38
  156. hatchet_sdk/v0/clients/rest/models/worker.py +0 -239
  157. hatchet_sdk/v0/clients/rest/models/worker_label.py +0 -102
  158. hatchet_sdk/v0/clients/rest/models/worker_list.py +0 -110
  159. hatchet_sdk/v0/clients/rest/models/worker_runtime_info.py +0 -103
  160. hatchet_sdk/v0/clients/rest/models/worker_runtime_sdks.py +0 -38
  161. hatchet_sdk/v0/clients/rest/models/worker_type.py +0 -38
  162. hatchet_sdk/v0/clients/rest/models/workflow.py +0 -165
  163. hatchet_sdk/v0/clients/rest/models/workflow_concurrency.py +0 -107
  164. hatchet_sdk/v0/clients/rest/models/workflow_deployment_config.py +0 -136
  165. hatchet_sdk/v0/clients/rest/models/workflow_kind.py +0 -38
  166. hatchet_sdk/v0/clients/rest/models/workflow_list.py +0 -120
  167. hatchet_sdk/v0/clients/rest/models/workflow_metrics.py +0 -97
  168. hatchet_sdk/v0/clients/rest/models/workflow_run.py +0 -188
  169. hatchet_sdk/v0/clients/rest/models/workflow_run_cancel200_response.py +0 -85
  170. hatchet_sdk/v0/clients/rest/models/workflow_run_list.py +0 -110
  171. hatchet_sdk/v0/clients/rest/models/workflow_run_order_by_direction.py +0 -37
  172. hatchet_sdk/v0/clients/rest/models/workflow_run_order_by_field.py +0 -39
  173. hatchet_sdk/v0/clients/rest/models/workflow_run_shape.py +0 -186
  174. hatchet_sdk/v0/clients/rest/models/workflow_run_status.py +0 -42
  175. hatchet_sdk/v0/clients/rest/models/workflow_run_triggered_by.py +0 -112
  176. hatchet_sdk/v0/clients/rest/models/workflow_runs_cancel_request.py +0 -85
  177. hatchet_sdk/v0/clients/rest/models/workflow_runs_metrics.py +0 -94
  178. hatchet_sdk/v0/clients/rest/models/workflow_runs_metrics_counts.py +0 -104
  179. hatchet_sdk/v0/clients/rest/models/workflow_tag.py +0 -84
  180. hatchet_sdk/v0/clients/rest/models/workflow_trigger_cron_ref.py +0 -86
  181. hatchet_sdk/v0/clients/rest/models/workflow_trigger_event_ref.py +0 -86
  182. hatchet_sdk/v0/clients/rest/models/workflow_triggers.py +0 -141
  183. hatchet_sdk/v0/clients/rest/models/workflow_update_request.py +0 -85
  184. hatchet_sdk/v0/clients/rest/models/workflow_version.py +0 -170
  185. hatchet_sdk/v0/clients/rest/models/workflow_version_concurrency.py +0 -114
  186. hatchet_sdk/v0/clients/rest/models/workflow_version_definition.py +0 -85
  187. hatchet_sdk/v0/clients/rest/models/workflow_version_meta.py +0 -123
  188. hatchet_sdk/v0/clients/rest/models/workflow_workers_count.py +0 -95
  189. hatchet_sdk/v0/clients/rest/rest.py +0 -187
  190. hatchet_sdk/v0/clients/rest/tenacity_utils.py +0 -39
  191. hatchet_sdk/v0/clients/rest_client.py +0 -622
  192. hatchet_sdk/v0/clients/run_event_listener.py +0 -260
  193. hatchet_sdk/v0/clients/workflow_listener.py +0 -277
  194. hatchet_sdk/v0/connection.py +0 -63
  195. hatchet_sdk/v0/context/__init__.py +0 -1
  196. hatchet_sdk/v0/context/context.py +0 -446
  197. hatchet_sdk/v0/context/worker_context.py +0 -28
  198. hatchet_sdk/v0/features/cron.py +0 -286
  199. hatchet_sdk/v0/features/scheduled.py +0 -248
  200. hatchet_sdk/v0/hatchet.py +0 -310
  201. hatchet_sdk/v0/labels.py +0 -10
  202. hatchet_sdk/v0/loader.py +0 -244
  203. hatchet_sdk/v0/metadata.py +0 -2
  204. hatchet_sdk/v0/opentelemetry/instrumentor.py +0 -393
  205. hatchet_sdk/v0/rate_limit.py +0 -126
  206. hatchet_sdk/v0/semver.py +0 -30
  207. hatchet_sdk/v0/token.py +0 -27
  208. hatchet_sdk/v0/utils/aio_utils.py +0 -137
  209. hatchet_sdk/v0/utils/backoff.py +0 -9
  210. hatchet_sdk/v0/utils/types.py +0 -8
  211. hatchet_sdk/v0/utils/typing.py +0 -12
  212. hatchet_sdk/v0/v2/callable.py +0 -202
  213. hatchet_sdk/v0/v2/concurrency.py +0 -47
  214. hatchet_sdk/v0/v2/hatchet.py +0 -224
  215. hatchet_sdk/v0/worker/__init__.py +0 -1
  216. hatchet_sdk/v0/worker/action_listener_process.py +0 -294
  217. hatchet_sdk/v0/worker/runner/run_loop_manager.py +0 -112
  218. hatchet_sdk/v0/worker/runner/runner.py +0 -460
  219. hatchet_sdk/v0/worker/runner/utils/capture_logs.py +0 -81
  220. hatchet_sdk/v0/worker/runner/utils/error_with_traceback.py +0 -6
  221. hatchet_sdk/v0/worker/worker.py +0 -391
  222. hatchet_sdk/v0/workflow.py +0 -261
  223. hatchet_sdk/v0/workflow_run.py +0 -59
  224. {hatchet_sdk-1.18.1.dist-info → hatchet_sdk-1.19.0.dist-info}/WHEEL +0 -0
  225. {hatchet_sdk-1.18.1.dist-info → hatchet_sdk-1.19.0.dist-info}/entry_points.txt +0 -0
@@ -1,22 +0,0 @@
1
- """API response object."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Generic, Mapping, Optional, TypeVar
6
-
7
- from pydantic import BaseModel, Field, StrictBytes, StrictInt
8
-
9
- T = TypeVar("T")
10
-
11
-
12
- class ApiResponse(BaseModel, Generic[T]):
13
- """
14
- API response object
15
- """
16
-
17
- status_code: StrictInt = Field(description="HTTP status code")
18
- headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
19
- data: T = Field(description="Deserialized data given the data type")
20
- raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
21
-
22
- model_config = {"arbitrary_types_allowed": True}
@@ -1,611 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Hatchet API
5
-
6
- The Hatchet API
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- import copy
16
- import http.client as httplib
17
- import logging
18
- import sys
19
- from logging import FileHandler
20
- from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
21
-
22
- import urllib3
23
- from typing_extensions import NotRequired, Self
24
-
25
- JSON_SCHEMA_VALIDATION_KEYWORDS = {
26
- "multipleOf",
27
- "maximum",
28
- "exclusiveMaximum",
29
- "minimum",
30
- "exclusiveMinimum",
31
- "maxLength",
32
- "minLength",
33
- "pattern",
34
- "maxItems",
35
- "minItems",
36
- }
37
-
38
- ServerVariablesT = Dict[str, str]
39
-
40
- GenericAuthSetting = TypedDict(
41
- "GenericAuthSetting",
42
- {
43
- "type": str,
44
- "in": str,
45
- "key": str,
46
- "value": str,
47
- },
48
- )
49
-
50
-
51
- OAuth2AuthSetting = TypedDict(
52
- "OAuth2AuthSetting",
53
- {
54
- "type": Literal["oauth2"],
55
- "in": Literal["header"],
56
- "key": Literal["Authorization"],
57
- "value": str,
58
- },
59
- )
60
-
61
-
62
- APIKeyAuthSetting = TypedDict(
63
- "APIKeyAuthSetting",
64
- {
65
- "type": Literal["api_key"],
66
- "in": str,
67
- "key": str,
68
- "value": Optional[str],
69
- },
70
- )
71
-
72
-
73
- BasicAuthSetting = TypedDict(
74
- "BasicAuthSetting",
75
- {
76
- "type": Literal["basic"],
77
- "in": Literal["header"],
78
- "key": Literal["Authorization"],
79
- "value": Optional[str],
80
- },
81
- )
82
-
83
-
84
- BearerFormatAuthSetting = TypedDict(
85
- "BearerFormatAuthSetting",
86
- {
87
- "type": Literal["bearer"],
88
- "in": Literal["header"],
89
- "format": Literal["JWT"],
90
- "key": Literal["Authorization"],
91
- "value": str,
92
- },
93
- )
94
-
95
-
96
- BearerAuthSetting = TypedDict(
97
- "BearerAuthSetting",
98
- {
99
- "type": Literal["bearer"],
100
- "in": Literal["header"],
101
- "key": Literal["Authorization"],
102
- "value": str,
103
- },
104
- )
105
-
106
-
107
- HTTPSignatureAuthSetting = TypedDict(
108
- "HTTPSignatureAuthSetting",
109
- {
110
- "type": Literal["http-signature"],
111
- "in": Literal["header"],
112
- "key": Literal["Authorization"],
113
- "value": None,
114
- },
115
- )
116
-
117
-
118
- AuthSettings = TypedDict(
119
- "AuthSettings",
120
- {
121
- "bearerAuth": BearerAuthSetting,
122
- "cookieAuth": APIKeyAuthSetting,
123
- },
124
- total=False,
125
- )
126
-
127
-
128
- class HostSettingVariable(TypedDict):
129
- description: str
130
- default_value: str
131
- enum_values: List[str]
132
-
133
-
134
- class HostSetting(TypedDict):
135
- url: str
136
- description: str
137
- variables: NotRequired[Dict[str, HostSettingVariable]]
138
-
139
-
140
- class Configuration:
141
- """This class contains various settings of the API client.
142
-
143
- :param host: Base url.
144
- :param ignore_operation_servers
145
- Boolean to ignore operation servers for the API client.
146
- Config will use `host` as the base url regardless of the operation servers.
147
- :param api_key: Dict to store API key(s).
148
- Each entry in the dict specifies an API key.
149
- The dict key is the name of the security scheme in the OAS specification.
150
- The dict value is the API key secret.
151
- :param api_key_prefix: Dict to store API prefix (e.g. Bearer).
152
- The dict key is the name of the security scheme in the OAS specification.
153
- The dict value is an API key prefix when generating the auth data.
154
- :param username: Username for HTTP basic authentication.
155
- :param password: Password for HTTP basic authentication.
156
- :param access_token: Access token.
157
- :param server_index: Index to servers configuration.
158
- :param server_variables: Mapping with string values to replace variables in
159
- templated server configuration. The validation of enums is performed for
160
- variables with defined enum values before.
161
- :param server_operation_index: Mapping from operation ID to an index to server
162
- configuration.
163
- :param server_operation_variables: Mapping from operation ID to a mapping with
164
- string values to replace variables in templated server configuration.
165
- The validation of enums is performed for variables with defined enum
166
- values before.
167
- :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
168
- in PEM format.
169
- :param retries: Number of retries for API requests.
170
-
171
- :Example:
172
-
173
- API Key Authentication Example.
174
- Given the following security scheme in the OpenAPI specification:
175
- components:
176
- securitySchemes:
177
- cookieAuth: # name for the security scheme
178
- type: apiKey
179
- in: cookie
180
- name: JSESSIONID # cookie name
181
-
182
- You can programmatically set the cookie:
183
-
184
- conf = hatchet_sdk.clients.rest.Configuration(
185
- api_key={'cookieAuth': 'abc123'}
186
- api_key_prefix={'cookieAuth': 'JSESSIONID'}
187
- )
188
-
189
- The following cookie will be added to the HTTP request:
190
- Cookie: JSESSIONID abc123
191
- """
192
-
193
- _default: ClassVar[Optional[Self]] = None
194
-
195
- def __init__(
196
- self,
197
- host: Optional[str] = None,
198
- api_key: Optional[Dict[str, str]] = None,
199
- api_key_prefix: Optional[Dict[str, str]] = None,
200
- username: Optional[str] = None,
201
- password: Optional[str] = None,
202
- access_token: Optional[str] = None,
203
- server_index: Optional[int] = None,
204
- server_variables: Optional[ServerVariablesT] = None,
205
- server_operation_index: Optional[Dict[int, int]] = None,
206
- server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None,
207
- ignore_operation_servers: bool = False,
208
- ssl_ca_cert: Optional[str] = None,
209
- retries: Optional[int] = None,
210
- *,
211
- debug: Optional[bool] = None,
212
- ) -> None:
213
- """Constructor"""
214
- self._base_path = "http://localhost" if host is None else host
215
- """Default Base url
216
- """
217
- self.server_index = 0 if server_index is None and host is None else server_index
218
- self.server_operation_index = server_operation_index or {}
219
- """Default server index
220
- """
221
- self.server_variables = server_variables or {}
222
- self.server_operation_variables = server_operation_variables or {}
223
- """Default server variables
224
- """
225
- self.ignore_operation_servers = ignore_operation_servers
226
- """Ignore operation servers
227
- """
228
- self.temp_folder_path = None
229
- """Temp file folder for downloading files
230
- """
231
- # Authentication Settings
232
- self.api_key = {}
233
- if api_key:
234
- self.api_key = api_key
235
- """dict to store API key(s)
236
- """
237
- self.api_key_prefix = {}
238
- if api_key_prefix:
239
- self.api_key_prefix = api_key_prefix
240
- """dict to store API prefix (e.g. Bearer)
241
- """
242
- self.refresh_api_key_hook = None
243
- """function hook to refresh API key if expired
244
- """
245
- self.username = username
246
- """Username for HTTP basic authentication
247
- """
248
- self.password = password
249
- """Password for HTTP basic authentication
250
- """
251
- self.access_token = access_token
252
- """Access token
253
- """
254
- self.logger = {}
255
- """Logging Settings
256
- """
257
- self.logger["package_logger"] = logging.getLogger("hatchet_sdk.clients.rest")
258
- self.logger["urllib3_logger"] = logging.getLogger("urllib3")
259
- self.logger_format = "%(asctime)s %(levelname)s %(message)s"
260
- """Log format
261
- """
262
- self.logger_stream_handler = None
263
- """Log stream handler
264
- """
265
- self.logger_file_handler: Optional[FileHandler] = None
266
- """Log file handler
267
- """
268
- self.logger_file = None
269
- """Debug file location
270
- """
271
- if debug is not None:
272
- self.debug = debug
273
- else:
274
- self.__debug = False
275
- """Debug switch
276
- """
277
-
278
- self.verify_ssl = True
279
- """SSL/TLS verification
280
- Set this to false to skip verifying SSL certificate when calling API
281
- from https server.
282
- """
283
- self.ssl_ca_cert = ssl_ca_cert
284
- """Set this to customize the certificate file to verify the peer.
285
- """
286
- self.cert_file = None
287
- """client certificate file
288
- """
289
- self.key_file = None
290
- """client key file
291
- """
292
- self.assert_hostname = None
293
- """Set this to True/False to enable/disable SSL hostname verification.
294
- """
295
- self.tls_server_name = None
296
- """SSL/TLS Server Name Indication (SNI)
297
- Set this to the SNI value expected by the server.
298
- """
299
-
300
- self.connection_pool_maxsize = 100
301
- """This value is passed to the aiohttp to limit simultaneous connections.
302
- Default values is 100, None means no-limit.
303
- """
304
-
305
- self.proxy: Optional[str] = None
306
- """Proxy URL
307
- """
308
- self.proxy_headers = None
309
- """Proxy headers
310
- """
311
- self.safe_chars_for_path_param = ""
312
- """Safe chars for path_param
313
- """
314
- self.retries = retries
315
- """Adding retries to override urllib3 default value 3
316
- """
317
- # Enable client side validation
318
- self.client_side_validation = True
319
-
320
- self.socket_options = None
321
- """Options to pass down to the underlying urllib3 socket
322
- """
323
-
324
- self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
325
- """datetime format
326
- """
327
-
328
- self.date_format = "%Y-%m-%d"
329
- """date format
330
- """
331
-
332
- def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
333
- cls = self.__class__
334
- result = cls.__new__(cls)
335
- memo[id(self)] = result
336
- for k, v in self.__dict__.items():
337
- if k not in ("logger", "logger_file_handler"):
338
- setattr(result, k, copy.deepcopy(v, memo))
339
- # shallow copy of loggers
340
- result.logger = copy.copy(self.logger)
341
- # use setters to configure loggers
342
- result.logger_file = self.logger_file
343
- result.debug = self.debug
344
- return result
345
-
346
- def __setattr__(self, name: str, value: Any) -> None:
347
- object.__setattr__(self, name, value)
348
-
349
- @classmethod
350
- def set_default(cls, default: Optional[Self]) -> None:
351
- """Set default instance of configuration.
352
-
353
- It stores default configuration, which can be
354
- returned by get_default_copy method.
355
-
356
- :param default: object of Configuration
357
- """
358
- cls._default = default
359
-
360
- @classmethod
361
- def get_default_copy(cls) -> Self:
362
- """Deprecated. Please use `get_default` instead.
363
-
364
- Deprecated. Please use `get_default` instead.
365
-
366
- :return: The configuration object.
367
- """
368
- return cls.get_default()
369
-
370
- @classmethod
371
- def get_default(cls) -> Self:
372
- """Return the default configuration.
373
-
374
- This method returns newly created, based on default constructor,
375
- object of Configuration class or returns a copy of default
376
- configuration.
377
-
378
- :return: The configuration object.
379
- """
380
- if cls._default is None:
381
- cls._default = cls()
382
- return cls._default
383
-
384
- @property
385
- def logger_file(self) -> Optional[str]:
386
- """The logger file.
387
-
388
- If the logger_file is None, then add stream handler and remove file
389
- handler. Otherwise, add file handler and remove stream handler.
390
-
391
- :param value: The logger_file path.
392
- :type: str
393
- """
394
- return self.__logger_file
395
-
396
- @logger_file.setter
397
- def logger_file(self, value: Optional[str]) -> None:
398
- """The logger file.
399
-
400
- If the logger_file is None, then add stream handler and remove file
401
- handler. Otherwise, add file handler and remove stream handler.
402
-
403
- :param value: The logger_file path.
404
- :type: str
405
- """
406
- self.__logger_file = value
407
- if self.__logger_file:
408
- # If set logging file,
409
- # then add file handler and remove stream handler.
410
- self.logger_file_handler = logging.FileHandler(self.__logger_file)
411
- self.logger_file_handler.setFormatter(self.logger_formatter)
412
- for _, logger in self.logger.items():
413
- logger.addHandler(self.logger_file_handler)
414
-
415
- @property
416
- def debug(self) -> bool:
417
- """Debug status
418
-
419
- :param value: The debug status, True or False.
420
- :type: bool
421
- """
422
- return self.__debug
423
-
424
- @debug.setter
425
- def debug(self, value: bool) -> None:
426
- """Debug status
427
-
428
- :param value: The debug status, True or False.
429
- :type: bool
430
- """
431
- self.__debug = value
432
- if self.__debug:
433
- # if debug status is True, turn on debug logging
434
- for _, logger in self.logger.items():
435
- logger.setLevel(logging.DEBUG)
436
- # turn on httplib debug
437
- httplib.HTTPConnection.debuglevel = 1
438
- else:
439
- # if debug status is False, turn off debug logging,
440
- # setting log level to default `logging.WARNING`
441
- for _, logger in self.logger.items():
442
- logger.setLevel(logging.WARNING)
443
- # turn off httplib debug
444
- httplib.HTTPConnection.debuglevel = 0
445
-
446
- @property
447
- def logger_format(self) -> str:
448
- """The logger format.
449
-
450
- The logger_formatter will be updated when sets logger_format.
451
-
452
- :param value: The format string.
453
- :type: str
454
- """
455
- return self.__logger_format
456
-
457
- @logger_format.setter
458
- def logger_format(self, value: str) -> None:
459
- """The logger format.
460
-
461
- The logger_formatter will be updated when sets logger_format.
462
-
463
- :param value: The format string.
464
- :type: str
465
- """
466
- self.__logger_format = value
467
- self.logger_formatter = logging.Formatter(self.__logger_format)
468
-
469
- def get_api_key_with_prefix(
470
- self, identifier: str, alias: Optional[str] = None
471
- ) -> Optional[str]:
472
- """Gets API key (with prefix if set).
473
-
474
- :param identifier: The identifier of apiKey.
475
- :param alias: The alternative identifier of apiKey.
476
- :return: The token for api key authentication.
477
- """
478
- if self.refresh_api_key_hook is not None:
479
- self.refresh_api_key_hook(self)
480
- key = self.api_key.get(
481
- identifier, self.api_key.get(alias) if alias is not None else None
482
- )
483
- if key:
484
- prefix = self.api_key_prefix.get(identifier)
485
- if prefix:
486
- return "%s %s" % (prefix, key)
487
- else:
488
- return key
489
-
490
- return None
491
-
492
- def get_basic_auth_token(self) -> Optional[str]:
493
- """Gets HTTP basic authentication header (string).
494
-
495
- :return: The token for basic HTTP authentication.
496
- """
497
- username = ""
498
- if self.username is not None:
499
- username = self.username
500
- password = ""
501
- if self.password is not None:
502
- password = self.password
503
- return urllib3.util.make_headers(basic_auth=username + ":" + password).get(
504
- "authorization"
505
- )
506
-
507
- def auth_settings(self) -> AuthSettings:
508
- """Gets Auth Settings dict for api client.
509
-
510
- :return: The Auth Settings information dict.
511
- """
512
- auth: AuthSettings = {}
513
- if self.access_token is not None:
514
- auth["bearerAuth"] = {
515
- "type": "bearer",
516
- "in": "header",
517
- "key": "Authorization",
518
- "value": "Bearer " + self.access_token,
519
- }
520
- if "cookieAuth" in self.api_key:
521
- auth["cookieAuth"] = {
522
- "type": "api_key",
523
- "in": "cookie",
524
- "key": "hatchet",
525
- "value": self.get_api_key_with_prefix(
526
- "cookieAuth",
527
- ),
528
- }
529
- return auth
530
-
531
- def to_debug_report(self) -> str:
532
- """Gets the essential information for debugging.
533
-
534
- :return: The report for debugging.
535
- """
536
- return (
537
- "Python SDK Debug Report:\n"
538
- "OS: {env}\n"
539
- "Python Version: {pyversion}\n"
540
- "Version of the API: 1.0.0\n"
541
- "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version)
542
- )
543
-
544
- def get_host_settings(self) -> List[HostSetting]:
545
- """Gets an array of host settings
546
-
547
- :return: An array of host settings
548
- """
549
- return [
550
- {
551
- "url": "",
552
- "description": "No description provided",
553
- }
554
- ]
555
-
556
- def get_host_from_settings(
557
- self,
558
- index: Optional[int],
559
- variables: Optional[ServerVariablesT] = None,
560
- servers: Optional[List[HostSetting]] = None,
561
- ) -> str:
562
- """Gets host URL based on the index and variables
563
- :param index: array index of the host settings
564
- :param variables: hash of variable and the corresponding value
565
- :param servers: an array of host settings or None
566
- :return: URL based on host settings
567
- """
568
- if index is None:
569
- return self._base_path
570
-
571
- variables = {} if variables is None else variables
572
- servers = self.get_host_settings() if servers is None else servers
573
-
574
- try:
575
- server = servers[index]
576
- except IndexError:
577
- raise ValueError(
578
- "Invalid index {0} when selecting the host settings. "
579
- "Must be less than {1}".format(index, len(servers))
580
- )
581
-
582
- url = server["url"]
583
-
584
- # go through variables and replace placeholders
585
- for variable_name, variable in server.get("variables", {}).items():
586
- used_value = variables.get(variable_name, variable["default_value"])
587
-
588
- if "enum_values" in variable and used_value not in variable["enum_values"]:
589
- raise ValueError(
590
- "The variable `{0}` in the host URL has invalid value "
591
- "{1}. Must be {2}.".format(
592
- variable_name, variables[variable_name], variable["enum_values"]
593
- )
594
- )
595
-
596
- url = url.replace("{" + variable_name + "}", used_value)
597
-
598
- return url
599
-
600
- @property
601
- def host(self) -> str:
602
- """Return generated host."""
603
- return self.get_host_from_settings(
604
- self.server_index, variables=self.server_variables
605
- )
606
-
607
- @host.setter
608
- def host(self, value: str) -> None:
609
- """Fix base path."""
610
- self._base_path = value
611
- self.server_index = None