cribl-control-plane 0.0.13__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 cribl-control-plane might be problematic. Click here for more details.

Files changed (197) hide show
  1. cribl_control_plane/__init__.py +17 -0
  2. cribl_control_plane/_hooks/__init__.py +5 -0
  3. cribl_control_plane/_hooks/clientcredentials.py +211 -0
  4. cribl_control_plane/_hooks/registration.py +13 -0
  5. cribl_control_plane/_hooks/sdkhooks.py +81 -0
  6. cribl_control_plane/_hooks/types.py +112 -0
  7. cribl_control_plane/_version.py +15 -0
  8. cribl_control_plane/auth_sdk.py +184 -0
  9. cribl_control_plane/basesdk.py +358 -0
  10. cribl_control_plane/errors/__init__.py +60 -0
  11. cribl_control_plane/errors/apierror.py +38 -0
  12. cribl_control_plane/errors/criblcontrolplaneerror.py +26 -0
  13. cribl_control_plane/errors/error.py +24 -0
  14. cribl_control_plane/errors/healthstatus_error.py +38 -0
  15. cribl_control_plane/errors/no_response_error.py +13 -0
  16. cribl_control_plane/errors/responsevalidationerror.py +25 -0
  17. cribl_control_plane/health.py +166 -0
  18. cribl_control_plane/httpclient.py +126 -0
  19. cribl_control_plane/models/__init__.py +7305 -0
  20. cribl_control_plane/models/addhectokenrequest.py +34 -0
  21. cribl_control_plane/models/authtoken.py +13 -0
  22. cribl_control_plane/models/createinputhectokenbyidop.py +45 -0
  23. cribl_control_plane/models/createinputop.py +24 -0
  24. cribl_control_plane/models/createoutputop.py +24 -0
  25. cribl_control_plane/models/createoutputtestbyidop.py +46 -0
  26. cribl_control_plane/models/criblevent.py +14 -0
  27. cribl_control_plane/models/deleteinputbyidop.py +37 -0
  28. cribl_control_plane/models/deleteoutputbyidop.py +37 -0
  29. cribl_control_plane/models/deleteoutputpqbyidop.py +36 -0
  30. cribl_control_plane/models/getinputbyidop.py +37 -0
  31. cribl_control_plane/models/getoutputbyidop.py +37 -0
  32. cribl_control_plane/models/getoutputpqbyidop.py +36 -0
  33. cribl_control_plane/models/getoutputsamplesbyidop.py +37 -0
  34. cribl_control_plane/models/healthstatus.py +36 -0
  35. cribl_control_plane/models/input.py +199 -0
  36. cribl_control_plane/models/inputappscope.py +448 -0
  37. cribl_control_plane/models/inputazureblob.py +308 -0
  38. cribl_control_plane/models/inputcollection.py +208 -0
  39. cribl_control_plane/models/inputconfluentcloud.py +585 -0
  40. cribl_control_plane/models/inputcribl.py +165 -0
  41. cribl_control_plane/models/inputcriblhttp.py +341 -0
  42. cribl_control_plane/models/inputcribllakehttp.py +342 -0
  43. cribl_control_plane/models/inputcriblmetrics.py +175 -0
  44. cribl_control_plane/models/inputcribltcp.py +299 -0
  45. cribl_control_plane/models/inputcrowdstrike.py +410 -0
  46. cribl_control_plane/models/inputdatadogagent.py +364 -0
  47. cribl_control_plane/models/inputdatagen.py +180 -0
  48. cribl_control_plane/models/inputedgeprometheus.py +551 -0
  49. cribl_control_plane/models/inputelastic.py +494 -0
  50. cribl_control_plane/models/inputeventhub.py +360 -0
  51. cribl_control_plane/models/inputexec.py +213 -0
  52. cribl_control_plane/models/inputfile.py +259 -0
  53. cribl_control_plane/models/inputfirehose.py +341 -0
  54. cribl_control_plane/models/inputgooglepubsub.py +247 -0
  55. cribl_control_plane/models/inputgrafana_union.py +1247 -0
  56. cribl_control_plane/models/inputhttp.py +403 -0
  57. cribl_control_plane/models/inputhttpraw.py +407 -0
  58. cribl_control_plane/models/inputjournalfiles.py +208 -0
  59. cribl_control_plane/models/inputkafka.py +581 -0
  60. cribl_control_plane/models/inputkinesis.py +363 -0
  61. cribl_control_plane/models/inputkubeevents.py +182 -0
  62. cribl_control_plane/models/inputkubelogs.py +256 -0
  63. cribl_control_plane/models/inputkubemetrics.py +233 -0
  64. cribl_control_plane/models/inputloki.py +468 -0
  65. cribl_control_plane/models/inputmetrics.py +290 -0
  66. cribl_control_plane/models/inputmodeldriventelemetry.py +274 -0
  67. cribl_control_plane/models/inputmsk.py +654 -0
  68. cribl_control_plane/models/inputnetflow.py +224 -0
  69. cribl_control_plane/models/inputoffice365mgmt.py +384 -0
  70. cribl_control_plane/models/inputoffice365msgtrace.py +449 -0
  71. cribl_control_plane/models/inputoffice365service.py +377 -0
  72. cribl_control_plane/models/inputopentelemetry.py +516 -0
  73. cribl_control_plane/models/inputprometheus.py +464 -0
  74. cribl_control_plane/models/inputprometheusrw.py +470 -0
  75. cribl_control_plane/models/inputrawudp.py +207 -0
  76. cribl_control_plane/models/inputs3.py +416 -0
  77. cribl_control_plane/models/inputs3inventory.py +440 -0
  78. cribl_control_plane/models/inputsecuritylake.py +425 -0
  79. cribl_control_plane/models/inputsnmp.py +274 -0
  80. cribl_control_plane/models/inputsplunk.py +387 -0
  81. cribl_control_plane/models/inputsplunkhec.py +478 -0
  82. cribl_control_plane/models/inputsplunksearch.py +537 -0
  83. cribl_control_plane/models/inputsqs.py +320 -0
  84. cribl_control_plane/models/inputsyslog_union.py +759 -0
  85. cribl_control_plane/models/inputsystemmetrics.py +533 -0
  86. cribl_control_plane/models/inputsystemstate.py +417 -0
  87. cribl_control_plane/models/inputtcp.py +359 -0
  88. cribl_control_plane/models/inputtcpjson.py +334 -0
  89. cribl_control_plane/models/inputwef.py +498 -0
  90. cribl_control_plane/models/inputwindowsmetrics.py +457 -0
  91. cribl_control_plane/models/inputwineventlogs.py +222 -0
  92. cribl_control_plane/models/inputwiz.py +334 -0
  93. cribl_control_plane/models/inputzscalerhec.py +439 -0
  94. cribl_control_plane/models/listinputop.py +24 -0
  95. cribl_control_plane/models/listoutputop.py +24 -0
  96. cribl_control_plane/models/logininfo.py +16 -0
  97. cribl_control_plane/models/output.py +229 -0
  98. cribl_control_plane/models/outputazureblob.py +471 -0
  99. cribl_control_plane/models/outputazuredataexplorer.py +660 -0
  100. cribl_control_plane/models/outputazureeventhub.py +321 -0
  101. cribl_control_plane/models/outputazurelogs.py +386 -0
  102. cribl_control_plane/models/outputclickhouse.py +650 -0
  103. cribl_control_plane/models/outputcloudwatch.py +273 -0
  104. cribl_control_plane/models/outputconfluentcloud.py +591 -0
  105. cribl_control_plane/models/outputcriblhttp.py +494 -0
  106. cribl_control_plane/models/outputcribllake.py +396 -0
  107. cribl_control_plane/models/outputcribltcp.py +387 -0
  108. cribl_control_plane/models/outputcrowdstrikenextgensiem.py +410 -0
  109. cribl_control_plane/models/outputdatadog.py +472 -0
  110. cribl_control_plane/models/outputdataset.py +437 -0
  111. cribl_control_plane/models/outputdefault.py +55 -0
  112. cribl_control_plane/models/outputdevnull.py +50 -0
  113. cribl_control_plane/models/outputdiskspool.py +89 -0
  114. cribl_control_plane/models/outputdls3.py +560 -0
  115. cribl_control_plane/models/outputdynatracehttp.py +454 -0
  116. cribl_control_plane/models/outputdynatraceotlp.py +486 -0
  117. cribl_control_plane/models/outputelastic.py +494 -0
  118. cribl_control_plane/models/outputelasticcloud.py +407 -0
  119. cribl_control_plane/models/outputexabeam.py +297 -0
  120. cribl_control_plane/models/outputfilesystem.py +357 -0
  121. cribl_control_plane/models/outputgooglechronicle.py +486 -0
  122. cribl_control_plane/models/outputgooglecloudlogging.py +557 -0
  123. cribl_control_plane/models/outputgooglecloudstorage.py +499 -0
  124. cribl_control_plane/models/outputgooglepubsub.py +274 -0
  125. cribl_control_plane/models/outputgrafanacloud_union.py +1024 -0
  126. cribl_control_plane/models/outputgraphite.py +225 -0
  127. cribl_control_plane/models/outputhoneycomb.py +369 -0
  128. cribl_control_plane/models/outputhumiohec.py +389 -0
  129. cribl_control_plane/models/outputinfluxdb.py +523 -0
  130. cribl_control_plane/models/outputkafka.py +581 -0
  131. cribl_control_plane/models/outputkinesis.py +312 -0
  132. cribl_control_plane/models/outputloki.py +425 -0
  133. cribl_control_plane/models/outputminio.py +512 -0
  134. cribl_control_plane/models/outputmsk.py +654 -0
  135. cribl_control_plane/models/outputnetflow.py +80 -0
  136. cribl_control_plane/models/outputnewrelic.py +424 -0
  137. cribl_control_plane/models/outputnewrelicevents.py +401 -0
  138. cribl_control_plane/models/outputopentelemetry.py +669 -0
  139. cribl_control_plane/models/outputprometheus.py +485 -0
  140. cribl_control_plane/models/outputring.py +121 -0
  141. cribl_control_plane/models/outputrouter.py +83 -0
  142. cribl_control_plane/models/outputs3.py +556 -0
  143. cribl_control_plane/models/outputsamplesresponse.py +14 -0
  144. cribl_control_plane/models/outputsecuritylake.py +505 -0
  145. cribl_control_plane/models/outputsentinel.py +488 -0
  146. cribl_control_plane/models/outputsentineloneaisiem.py +505 -0
  147. cribl_control_plane/models/outputservicenow.py +543 -0
  148. cribl_control_plane/models/outputsignalfx.py +369 -0
  149. cribl_control_plane/models/outputsnmp.py +80 -0
  150. cribl_control_plane/models/outputsns.py +274 -0
  151. cribl_control_plane/models/outputsplunk.py +383 -0
  152. cribl_control_plane/models/outputsplunkhec.py +434 -0
  153. cribl_control_plane/models/outputsplunklb.py +558 -0
  154. cribl_control_plane/models/outputsqs.py +328 -0
  155. cribl_control_plane/models/outputstatsd.py +224 -0
  156. cribl_control_plane/models/outputstatsdext.py +225 -0
  157. cribl_control_plane/models/outputsumologic.py +378 -0
  158. cribl_control_plane/models/outputsyslog.py +415 -0
  159. cribl_control_plane/models/outputtcpjson.py +413 -0
  160. cribl_control_plane/models/outputtestrequest.py +15 -0
  161. cribl_control_plane/models/outputtestresponse.py +29 -0
  162. cribl_control_plane/models/outputwavefront.py +369 -0
  163. cribl_control_plane/models/outputwebhook.py +689 -0
  164. cribl_control_plane/models/outputxsiam.py +415 -0
  165. cribl_control_plane/models/schemeclientoauth.py +24 -0
  166. cribl_control_plane/models/security.py +36 -0
  167. cribl_control_plane/models/updatehectokenrequest.py +31 -0
  168. cribl_control_plane/models/updateinputbyidop.py +44 -0
  169. cribl_control_plane/models/updateinputhectokenbyidandtokenop.py +52 -0
  170. cribl_control_plane/models/updateoutputbyidop.py +44 -0
  171. cribl_control_plane/outputs.py +1615 -0
  172. cribl_control_plane/py.typed +1 -0
  173. cribl_control_plane/sdk.py +164 -0
  174. cribl_control_plane/sdkconfiguration.py +36 -0
  175. cribl_control_plane/sources.py +1355 -0
  176. cribl_control_plane/types/__init__.py +21 -0
  177. cribl_control_plane/types/basemodel.py +39 -0
  178. cribl_control_plane/utils/__init__.py +187 -0
  179. cribl_control_plane/utils/annotations.py +55 -0
  180. cribl_control_plane/utils/datetimes.py +23 -0
  181. cribl_control_plane/utils/enums.py +74 -0
  182. cribl_control_plane/utils/eventstreaming.py +238 -0
  183. cribl_control_plane/utils/forms.py +223 -0
  184. cribl_control_plane/utils/headers.py +136 -0
  185. cribl_control_plane/utils/logger.py +27 -0
  186. cribl_control_plane/utils/metadata.py +118 -0
  187. cribl_control_plane/utils/queryparams.py +205 -0
  188. cribl_control_plane/utils/requestbodies.py +66 -0
  189. cribl_control_plane/utils/retries.py +217 -0
  190. cribl_control_plane/utils/security.py +207 -0
  191. cribl_control_plane/utils/serializers.py +249 -0
  192. cribl_control_plane/utils/unmarshal_json_response.py +24 -0
  193. cribl_control_plane/utils/url.py +155 -0
  194. cribl_control_plane/utils/values.py +137 -0
  195. cribl_control_plane-0.0.13.dist-info/METADATA +489 -0
  196. cribl_control_plane-0.0.13.dist-info/RECORD +197 -0
  197. cribl_control_plane-0.0.13.dist-info/WHEEL +4 -0
@@ -0,0 +1,358 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .sdkconfiguration import SDKConfiguration
4
+ from cribl_control_plane import errors, models, utils
5
+ from cribl_control_plane._hooks import (
6
+ AfterErrorContext,
7
+ AfterSuccessContext,
8
+ BeforeRequestContext,
9
+ )
10
+ from cribl_control_plane.utils import (
11
+ RetryConfig,
12
+ SerializedRequestBody,
13
+ get_body_content,
14
+ )
15
+ import httpx
16
+ from typing import Callable, List, Mapping, Optional, Tuple
17
+ from urllib.parse import parse_qs, urlparse
18
+
19
+
20
+ class BaseSDK:
21
+ sdk_configuration: SDKConfiguration
22
+
23
+ def __init__(self, sdk_config: SDKConfiguration) -> None:
24
+ self.sdk_configuration = sdk_config
25
+
26
+ def _get_url(self, base_url, url_variables):
27
+ sdk_url, sdk_variables = self.sdk_configuration.get_server_details()
28
+
29
+ if base_url is None:
30
+ base_url = sdk_url
31
+
32
+ if url_variables is None:
33
+ url_variables = sdk_variables
34
+
35
+ return utils.template_url(base_url, url_variables)
36
+
37
+ def _build_request_async(
38
+ self,
39
+ method,
40
+ path,
41
+ base_url,
42
+ url_variables,
43
+ request,
44
+ request_body_required,
45
+ request_has_path_params,
46
+ request_has_query_params,
47
+ user_agent_header,
48
+ accept_header_value,
49
+ _globals=None,
50
+ security=None,
51
+ timeout_ms: Optional[int] = None,
52
+ get_serialized_body: Optional[
53
+ Callable[[], Optional[SerializedRequestBody]]
54
+ ] = None,
55
+ url_override: Optional[str] = None,
56
+ http_headers: Optional[Mapping[str, str]] = None,
57
+ ) -> httpx.Request:
58
+ client = self.sdk_configuration.async_client
59
+ return self._build_request_with_client(
60
+ client,
61
+ method,
62
+ path,
63
+ base_url,
64
+ url_variables,
65
+ request,
66
+ request_body_required,
67
+ request_has_path_params,
68
+ request_has_query_params,
69
+ user_agent_header,
70
+ accept_header_value,
71
+ _globals,
72
+ security,
73
+ timeout_ms,
74
+ get_serialized_body,
75
+ url_override,
76
+ http_headers,
77
+ )
78
+
79
+ def _build_request(
80
+ self,
81
+ method,
82
+ path,
83
+ base_url,
84
+ url_variables,
85
+ request,
86
+ request_body_required,
87
+ request_has_path_params,
88
+ request_has_query_params,
89
+ user_agent_header,
90
+ accept_header_value,
91
+ _globals=None,
92
+ security=None,
93
+ timeout_ms: Optional[int] = None,
94
+ get_serialized_body: Optional[
95
+ Callable[[], Optional[SerializedRequestBody]]
96
+ ] = None,
97
+ url_override: Optional[str] = None,
98
+ http_headers: Optional[Mapping[str, str]] = None,
99
+ ) -> httpx.Request:
100
+ client = self.sdk_configuration.client
101
+ return self._build_request_with_client(
102
+ client,
103
+ method,
104
+ path,
105
+ base_url,
106
+ url_variables,
107
+ request,
108
+ request_body_required,
109
+ request_has_path_params,
110
+ request_has_query_params,
111
+ user_agent_header,
112
+ accept_header_value,
113
+ _globals,
114
+ security,
115
+ timeout_ms,
116
+ get_serialized_body,
117
+ url_override,
118
+ http_headers,
119
+ )
120
+
121
+ def _build_request_with_client(
122
+ self,
123
+ client,
124
+ method,
125
+ path,
126
+ base_url,
127
+ url_variables,
128
+ request,
129
+ request_body_required,
130
+ request_has_path_params,
131
+ request_has_query_params,
132
+ user_agent_header,
133
+ accept_header_value,
134
+ _globals=None,
135
+ security=None,
136
+ timeout_ms: Optional[int] = None,
137
+ get_serialized_body: Optional[
138
+ Callable[[], Optional[SerializedRequestBody]]
139
+ ] = None,
140
+ url_override: Optional[str] = None,
141
+ http_headers: Optional[Mapping[str, str]] = None,
142
+ ) -> httpx.Request:
143
+ query_params = {}
144
+
145
+ url = url_override
146
+ if url is None:
147
+ url = utils.generate_url(
148
+ self._get_url(base_url, url_variables),
149
+ path,
150
+ request if request_has_path_params else None,
151
+ _globals if request_has_path_params else None,
152
+ )
153
+
154
+ query_params = utils.get_query_params(
155
+ request if request_has_query_params else None,
156
+ _globals if request_has_query_params else None,
157
+ )
158
+ else:
159
+ # Pick up the query parameter from the override so they can be
160
+ # preserved when building the request later on (necessary as of
161
+ # httpx 0.28).
162
+ parsed_override = urlparse(str(url_override))
163
+ query_params = parse_qs(parsed_override.query, keep_blank_values=True)
164
+
165
+ headers = utils.get_headers(request, _globals)
166
+ headers["Accept"] = accept_header_value
167
+ headers[user_agent_header] = self.sdk_configuration.user_agent
168
+
169
+ if security is not None:
170
+ if callable(security):
171
+ security = security()
172
+ security = utils.get_security_from_env(security, models.Security)
173
+ if security is not None:
174
+ security_headers, security_query_params = utils.get_security(security)
175
+ headers = {**headers, **security_headers}
176
+ query_params = {**query_params, **security_query_params}
177
+
178
+ serialized_request_body = SerializedRequestBody()
179
+ if get_serialized_body is not None:
180
+ rb = get_serialized_body()
181
+ if request_body_required and rb is None:
182
+ raise ValueError("request body is required")
183
+
184
+ if rb is not None:
185
+ serialized_request_body = rb
186
+
187
+ if (
188
+ serialized_request_body.media_type is not None
189
+ and serialized_request_body.media_type
190
+ not in (
191
+ "multipart/form-data",
192
+ "multipart/mixed",
193
+ )
194
+ ):
195
+ headers["content-type"] = serialized_request_body.media_type
196
+
197
+ if http_headers is not None:
198
+ for header, value in http_headers.items():
199
+ headers[header] = value
200
+
201
+ timeout = timeout_ms / 1000 if timeout_ms is not None else None
202
+
203
+ return client.build_request(
204
+ method,
205
+ url,
206
+ params=query_params,
207
+ content=serialized_request_body.content,
208
+ data=serialized_request_body.data,
209
+ files=serialized_request_body.files,
210
+ headers=headers,
211
+ timeout=timeout,
212
+ )
213
+
214
+ def do_request(
215
+ self,
216
+ hook_ctx,
217
+ request,
218
+ error_status_codes,
219
+ stream=False,
220
+ retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
221
+ ) -> httpx.Response:
222
+ client = self.sdk_configuration.client
223
+ logger = self.sdk_configuration.debug_logger
224
+
225
+ hooks = self.sdk_configuration.__dict__["_hooks"]
226
+
227
+ def do():
228
+ http_res = None
229
+ try:
230
+ req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
231
+ logger.debug(
232
+ "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
233
+ req.method,
234
+ req.url,
235
+ req.headers,
236
+ get_body_content(req),
237
+ )
238
+
239
+ if client is None:
240
+ raise ValueError("client is required")
241
+
242
+ http_res = client.send(req, stream=stream)
243
+ except Exception as e:
244
+ _, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
245
+ if e is not None:
246
+ logger.debug("Request Exception", exc_info=True)
247
+ raise e
248
+
249
+ if http_res is None:
250
+ logger.debug("Raising no response SDK error")
251
+ raise errors.NoResponseError("No response received")
252
+
253
+ logger.debug(
254
+ "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
255
+ http_res.status_code,
256
+ http_res.url,
257
+ http_res.headers,
258
+ "<streaming response>" if stream else http_res.text,
259
+ )
260
+
261
+ if utils.match_status_codes(error_status_codes, http_res.status_code):
262
+ result, err = hooks.after_error(
263
+ AfterErrorContext(hook_ctx), http_res, None
264
+ )
265
+ if err is not None:
266
+ logger.debug("Request Exception", exc_info=True)
267
+ raise err
268
+ if result is not None:
269
+ http_res = result
270
+ else:
271
+ logger.debug("Raising unexpected SDK error")
272
+ raise errors.APIError("Unexpected error occurred", http_res)
273
+
274
+ return http_res
275
+
276
+ if retry_config is not None:
277
+ http_res = utils.retry(do, utils.Retries(retry_config[0], retry_config[1]))
278
+ else:
279
+ http_res = do()
280
+
281
+ if not utils.match_status_codes(error_status_codes, http_res.status_code):
282
+ http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
283
+
284
+ return http_res
285
+
286
+ async def do_request_async(
287
+ self,
288
+ hook_ctx,
289
+ request,
290
+ error_status_codes,
291
+ stream=False,
292
+ retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
293
+ ) -> httpx.Response:
294
+ client = self.sdk_configuration.async_client
295
+ logger = self.sdk_configuration.debug_logger
296
+
297
+ hooks = self.sdk_configuration.__dict__["_hooks"]
298
+
299
+ async def do():
300
+ http_res = None
301
+ try:
302
+ req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
303
+ logger.debug(
304
+ "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
305
+ req.method,
306
+ req.url,
307
+ req.headers,
308
+ get_body_content(req),
309
+ )
310
+
311
+ if client is None:
312
+ raise ValueError("client is required")
313
+
314
+ http_res = await client.send(req, stream=stream)
315
+ except Exception as e:
316
+ _, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
317
+ if e is not None:
318
+ logger.debug("Request Exception", exc_info=True)
319
+ raise e
320
+
321
+ if http_res is None:
322
+ logger.debug("Raising no response SDK error")
323
+ raise errors.NoResponseError("No response received")
324
+
325
+ logger.debug(
326
+ "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
327
+ http_res.status_code,
328
+ http_res.url,
329
+ http_res.headers,
330
+ "<streaming response>" if stream else http_res.text,
331
+ )
332
+
333
+ if utils.match_status_codes(error_status_codes, http_res.status_code):
334
+ result, err = hooks.after_error(
335
+ AfterErrorContext(hook_ctx), http_res, None
336
+ )
337
+ if err is not None:
338
+ logger.debug("Request Exception", exc_info=True)
339
+ raise err
340
+ if result is not None:
341
+ http_res = result
342
+ else:
343
+ logger.debug("Raising unexpected SDK error")
344
+ raise errors.APIError("Unexpected error occurred", http_res)
345
+
346
+ return http_res
347
+
348
+ if retry_config is not None:
349
+ http_res = await utils.retry_async(
350
+ do, utils.Retries(retry_config[0], retry_config[1])
351
+ )
352
+ else:
353
+ http_res = await do()
354
+
355
+ if not utils.match_status_codes(error_status_codes, http_res.status_code):
356
+ http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
357
+
358
+ return http_res
@@ -0,0 +1,60 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from typing import TYPE_CHECKING
4
+ from importlib import import_module
5
+
6
+ if TYPE_CHECKING:
7
+ from .apierror import APIError
8
+ from .criblcontrolplaneerror import CriblControlPlaneError
9
+ from .error import Error, ErrorData
10
+ from .healthstatus_error import HealthStatusError, HealthStatusErrorData
11
+ from .no_response_error import NoResponseError
12
+ from .responsevalidationerror import ResponseValidationError
13
+
14
+ __all__ = [
15
+ "APIError",
16
+ "CriblControlPlaneError",
17
+ "Error",
18
+ "ErrorData",
19
+ "HealthStatusError",
20
+ "HealthStatusErrorData",
21
+ "NoResponseError",
22
+ "ResponseValidationError",
23
+ ]
24
+
25
+ _dynamic_imports: dict[str, str] = {
26
+ "APIError": ".apierror",
27
+ "CriblControlPlaneError": ".criblcontrolplaneerror",
28
+ "Error": ".error",
29
+ "ErrorData": ".error",
30
+ "HealthStatusError": ".healthstatus_error",
31
+ "HealthStatusErrorData": ".healthstatus_error",
32
+ "NoResponseError": ".no_response_error",
33
+ "ResponseValidationError": ".responsevalidationerror",
34
+ }
35
+
36
+
37
+ def __getattr__(attr_name: str) -> object:
38
+ module_name = _dynamic_imports.get(attr_name)
39
+ if module_name is None:
40
+ raise AttributeError(
41
+ f"No {attr_name} found in _dynamic_imports for module name -> {__name__} "
42
+ )
43
+
44
+ try:
45
+ module = import_module(module_name, __package__)
46
+ result = getattr(module, attr_name)
47
+ return result
48
+ except ImportError as e:
49
+ raise ImportError(
50
+ f"Failed to import {attr_name} from {module_name}: {e}"
51
+ ) from e
52
+ except AttributeError as e:
53
+ raise AttributeError(
54
+ f"Failed to get {attr_name} from {module_name}: {e}"
55
+ ) from e
56
+
57
+
58
+ def __dir__():
59
+ lazy_attrs = list(_dynamic_imports.keys())
60
+ return sorted(lazy_attrs)
@@ -0,0 +1,38 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import httpx
4
+ from typing import Optional
5
+
6
+ from cribl_control_plane.errors import CriblControlPlaneError
7
+
8
+ MAX_MESSAGE_LEN = 10_000
9
+
10
+
11
+ class APIError(CriblControlPlaneError):
12
+ """The fallback error class if no more specific error class is matched."""
13
+
14
+ def __init__(
15
+ self, message: str, raw_response: httpx.Response, body: Optional[str] = None
16
+ ):
17
+ body_display = body or raw_response.text or '""'
18
+
19
+ if message:
20
+ message += ": "
21
+ message += f"Status {raw_response.status_code}"
22
+
23
+ headers = raw_response.headers
24
+ content_type = headers.get("content-type", '""')
25
+ if content_type != "application/json":
26
+ if " " in content_type:
27
+ content_type = f'"{content_type}"'
28
+ message += f" Content-Type {content_type}"
29
+
30
+ if len(body_display) > MAX_MESSAGE_LEN:
31
+ truncated = body_display[:MAX_MESSAGE_LEN]
32
+ remaining = len(body_display) - MAX_MESSAGE_LEN
33
+ body_display = f"{truncated}...and {remaining} more chars"
34
+
35
+ message += f". Body: {body_display}"
36
+ message = message.strip()
37
+
38
+ super().__init__(message, raw_response, body)
@@ -0,0 +1,26 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import httpx
4
+ from typing import Optional
5
+
6
+
7
+ class CriblControlPlaneError(Exception):
8
+ """The base class for all HTTP error responses."""
9
+
10
+ message: str
11
+ status_code: int
12
+ body: str
13
+ headers: httpx.Headers
14
+ raw_response: httpx.Response
15
+
16
+ def __init__(
17
+ self, message: str, raw_response: httpx.Response, body: Optional[str] = None
18
+ ):
19
+ self.message = message
20
+ self.status_code = raw_response.status_code
21
+ self.body = body if body is not None else raw_response.text
22
+ self.headers = raw_response.headers
23
+ self.raw_response = raw_response
24
+
25
+ def __str__(self):
26
+ return self.message
@@ -0,0 +1,24 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from cribl_control_plane.errors import CriblControlPlaneError
5
+ from cribl_control_plane.types import BaseModel
6
+ import httpx
7
+ from typing import Optional
8
+
9
+
10
+ class ErrorData(BaseModel):
11
+ message: Optional[str] = None
12
+ r"""Error message"""
13
+
14
+
15
+ class Error(CriblControlPlaneError):
16
+ data: ErrorData
17
+
18
+ def __init__(
19
+ self, data: ErrorData, raw_response: httpx.Response, body: Optional[str] = None
20
+ ):
21
+ fallback = body or raw_response.text
22
+ message = str(data.message) or fallback
23
+ super().__init__(message, raw_response, body)
24
+ self.data = data
@@ -0,0 +1,38 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from cribl_control_plane.errors import CriblControlPlaneError
5
+ from cribl_control_plane.models import healthstatus as models_healthstatus
6
+ from cribl_control_plane.types import BaseModel
7
+ from cribl_control_plane.utils import validate_open_enum
8
+ import httpx
9
+ import pydantic
10
+ from pydantic.functional_validators import PlainValidator
11
+ from typing import Optional
12
+ from typing_extensions import Annotated
13
+
14
+
15
+ class HealthStatusErrorData(BaseModel):
16
+ status: Annotated[
17
+ models_healthstatus.Status, PlainValidator(validate_open_enum(False))
18
+ ]
19
+
20
+ start_time: Annotated[float, pydantic.Field(alias="startTime")]
21
+
22
+ role: Annotated[
23
+ Optional[models_healthstatus.Role], PlainValidator(validate_open_enum(False))
24
+ ] = None
25
+
26
+
27
+ class HealthStatusError(CriblControlPlaneError):
28
+ data: HealthStatusErrorData
29
+
30
+ def __init__(
31
+ self,
32
+ data: HealthStatusErrorData,
33
+ raw_response: httpx.Response,
34
+ body: Optional[str] = None,
35
+ ):
36
+ message = body or raw_response.text
37
+ super().__init__(message, raw_response, body)
38
+ self.data = data
@@ -0,0 +1,13 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ class NoResponseError(Exception):
4
+ """Error raised when no HTTP response is received from the server."""
5
+
6
+ message: str
7
+
8
+ def __init__(self, message: str = "No response received"):
9
+ self.message = message
10
+ super().__init__(message)
11
+
12
+ def __str__(self):
13
+ return self.message
@@ -0,0 +1,25 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import httpx
4
+ from typing import Optional
5
+
6
+ from cribl_control_plane.errors import CriblControlPlaneError
7
+
8
+
9
+ class ResponseValidationError(CriblControlPlaneError):
10
+ """Error raised when there is a type mismatch between the response data and the expected Pydantic model."""
11
+
12
+ def __init__(
13
+ self,
14
+ message: str,
15
+ raw_response: httpx.Response,
16
+ cause: Exception,
17
+ body: Optional[str] = None,
18
+ ):
19
+ message = f"{message}: {cause}"
20
+ super().__init__(message, raw_response, body)
21
+
22
+ @property
23
+ def cause(self):
24
+ """Normally the Pydantic ValidationError"""
25
+ return self.__cause__