cribl-control-plane 0.2.1rc8__py3-none-any.whl → 0.2.1rc10__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.

@@ -0,0 +1,1185 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from cribl_control_plane import errors, models, utils
5
+ from cribl_control_plane._hooks import HookContext
6
+ from cribl_control_plane.types import OptionalNullable, UNSET
7
+ from cribl_control_plane.utils import get_security_from_env
8
+ from cribl_control_plane.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Any, Mapping, Optional, Union
10
+
11
+
12
+ class Mappings(BaseSDK):
13
+ def activate(
14
+ self,
15
+ *,
16
+ product: models.ProductsCore,
17
+ id: str,
18
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
19
+ server_url: Optional[str] = None,
20
+ timeout_ms: Optional[int] = None,
21
+ http_headers: Optional[Mapping[str, str]] = None,
22
+ ) -> models.CreateAdminProductsMappingsActivateByProductResponse:
23
+ r"""Set a Mapping Ruleset as the active configuration for the specified Cribl product
24
+
25
+ Set a specific Mapping Ruleset as the currently active configuration for the specified Cribl product.
26
+
27
+ :param product: Name of the Cribl product to activate the Mapping Ruleset for
28
+ :param id:
29
+ :param retries: Override the default retry configuration for this method
30
+ :param server_url: Override the default server URL for this method
31
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
32
+ :param http_headers: Additional headers to set or replace on requests.
33
+ """
34
+ base_url = None
35
+ url_variables = None
36
+ if timeout_ms is None:
37
+ timeout_ms = self.sdk_configuration.timeout_ms
38
+
39
+ if server_url is not None:
40
+ base_url = server_url
41
+ else:
42
+ base_url = self._get_url(base_url, url_variables)
43
+
44
+ request = models.CreateAdminProductsMappingsActivateByProductRequest(
45
+ product=product,
46
+ ruleset_id=models.RulesetID(
47
+ id=id,
48
+ ),
49
+ )
50
+
51
+ req = self._build_request(
52
+ method="POST",
53
+ path="/admin/products/{product}/mappings/activate",
54
+ base_url=base_url,
55
+ url_variables=url_variables,
56
+ request=request,
57
+ request_body_required=True,
58
+ request_has_path_params=True,
59
+ request_has_query_params=True,
60
+ user_agent_header="user-agent",
61
+ accept_header_value="application/json",
62
+ http_headers=http_headers,
63
+ security=self.sdk_configuration.security,
64
+ get_serialized_body=lambda: utils.serialize_request_body(
65
+ request.ruleset_id, False, False, "json", models.RulesetID
66
+ ),
67
+ timeout_ms=timeout_ms,
68
+ )
69
+
70
+ if retries == UNSET:
71
+ if self.sdk_configuration.retry_config is not UNSET:
72
+ retries = self.sdk_configuration.retry_config
73
+
74
+ retry_config = None
75
+ if isinstance(retries, utils.RetryConfig):
76
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
77
+
78
+ http_res = self.do_request(
79
+ hook_ctx=HookContext(
80
+ config=self.sdk_configuration,
81
+ base_url=base_url or "",
82
+ operation_id="createAdminProductsMappingsActivateByProduct",
83
+ oauth2_scopes=[],
84
+ security_source=get_security_from_env(
85
+ self.sdk_configuration.security, models.Security
86
+ ),
87
+ ),
88
+ request=req,
89
+ error_status_codes=["401", "4XX", "500", "5XX"],
90
+ retry_config=retry_config,
91
+ )
92
+
93
+ response_data: Any = None
94
+ if utils.match_response(http_res, "200", "application/json"):
95
+ return unmarshal_json_response(
96
+ models.CreateAdminProductsMappingsActivateByProductResponse, http_res
97
+ )
98
+ if utils.match_response(http_res, "500", "application/json"):
99
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
100
+ raise errors.Error(response_data, http_res)
101
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
102
+ http_res_text = utils.stream_to_text(http_res)
103
+ raise errors.APIError("API error occurred", http_res, http_res_text)
104
+ if utils.match_response(http_res, "5XX", "*"):
105
+ http_res_text = utils.stream_to_text(http_res)
106
+ raise errors.APIError("API error occurred", http_res, http_res_text)
107
+
108
+ raise errors.APIError("Unexpected response received", http_res)
109
+
110
+ async def activate_async(
111
+ self,
112
+ *,
113
+ product: models.ProductsCore,
114
+ id: str,
115
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
116
+ server_url: Optional[str] = None,
117
+ timeout_ms: Optional[int] = None,
118
+ http_headers: Optional[Mapping[str, str]] = None,
119
+ ) -> models.CreateAdminProductsMappingsActivateByProductResponse:
120
+ r"""Set a Mapping Ruleset as the active configuration for the specified Cribl product
121
+
122
+ Set a specific Mapping Ruleset as the currently active configuration for the specified Cribl product.
123
+
124
+ :param product: Name of the Cribl product to activate the Mapping Ruleset for
125
+ :param id:
126
+ :param retries: Override the default retry configuration for this method
127
+ :param server_url: Override the default server URL for this method
128
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
129
+ :param http_headers: Additional headers to set or replace on requests.
130
+ """
131
+ base_url = None
132
+ url_variables = None
133
+ if timeout_ms is None:
134
+ timeout_ms = self.sdk_configuration.timeout_ms
135
+
136
+ if server_url is not None:
137
+ base_url = server_url
138
+ else:
139
+ base_url = self._get_url(base_url, url_variables)
140
+
141
+ request = models.CreateAdminProductsMappingsActivateByProductRequest(
142
+ product=product,
143
+ ruleset_id=models.RulesetID(
144
+ id=id,
145
+ ),
146
+ )
147
+
148
+ req = self._build_request_async(
149
+ method="POST",
150
+ path="/admin/products/{product}/mappings/activate",
151
+ base_url=base_url,
152
+ url_variables=url_variables,
153
+ request=request,
154
+ request_body_required=True,
155
+ request_has_path_params=True,
156
+ request_has_query_params=True,
157
+ user_agent_header="user-agent",
158
+ accept_header_value="application/json",
159
+ http_headers=http_headers,
160
+ security=self.sdk_configuration.security,
161
+ get_serialized_body=lambda: utils.serialize_request_body(
162
+ request.ruleset_id, False, False, "json", models.RulesetID
163
+ ),
164
+ timeout_ms=timeout_ms,
165
+ )
166
+
167
+ if retries == UNSET:
168
+ if self.sdk_configuration.retry_config is not UNSET:
169
+ retries = self.sdk_configuration.retry_config
170
+
171
+ retry_config = None
172
+ if isinstance(retries, utils.RetryConfig):
173
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
174
+
175
+ http_res = await self.do_request_async(
176
+ hook_ctx=HookContext(
177
+ config=self.sdk_configuration,
178
+ base_url=base_url or "",
179
+ operation_id="createAdminProductsMappingsActivateByProduct",
180
+ oauth2_scopes=[],
181
+ security_source=get_security_from_env(
182
+ self.sdk_configuration.security, models.Security
183
+ ),
184
+ ),
185
+ request=req,
186
+ error_status_codes=["401", "4XX", "500", "5XX"],
187
+ retry_config=retry_config,
188
+ )
189
+
190
+ response_data: Any = None
191
+ if utils.match_response(http_res, "200", "application/json"):
192
+ return unmarshal_json_response(
193
+ models.CreateAdminProductsMappingsActivateByProductResponse, http_res
194
+ )
195
+ if utils.match_response(http_res, "500", "application/json"):
196
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
197
+ raise errors.Error(response_data, http_res)
198
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
199
+ http_res_text = await utils.stream_to_text_async(http_res)
200
+ raise errors.APIError("API error occurred", http_res, http_res_text)
201
+ if utils.match_response(http_res, "5XX", "*"):
202
+ http_res_text = await utils.stream_to_text_async(http_res)
203
+ raise errors.APIError("API error occurred", http_res, http_res_text)
204
+
205
+ raise errors.APIError("Unexpected response received", http_res)
206
+
207
+ def create(
208
+ self,
209
+ *,
210
+ product: models.ProductsCore,
211
+ id: str,
212
+ conf: Optional[
213
+ Union[models.MappingRulesetConf, models.MappingRulesetConfTypedDict]
214
+ ] = None,
215
+ active: Optional[bool] = None,
216
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
217
+ server_url: Optional[str] = None,
218
+ timeout_ms: Optional[int] = None,
219
+ http_headers: Optional[Mapping[str, str]] = None,
220
+ ) -> models.CreateAdminProductsMappingsByProductResponse:
221
+ r"""Create a new Mapping Ruleset for the specified Cribl product
222
+
223
+ Create and save a new Mapping Ruleset for the specified Cribl product.
224
+
225
+ :param product: Name of the Cribl product to create the Mapping Ruleset for
226
+ :param id:
227
+ :param conf:
228
+ :param active:
229
+ :param retries: Override the default retry configuration for this method
230
+ :param server_url: Override the default server URL for this method
231
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
232
+ :param http_headers: Additional headers to set or replace on requests.
233
+ """
234
+ base_url = None
235
+ url_variables = None
236
+ if timeout_ms is None:
237
+ timeout_ms = self.sdk_configuration.timeout_ms
238
+
239
+ if server_url is not None:
240
+ base_url = server_url
241
+ else:
242
+ base_url = self._get_url(base_url, url_variables)
243
+
244
+ request = models.CreateAdminProductsMappingsByProductRequest(
245
+ product=product,
246
+ mapping_ruleset=models.MappingRuleset(
247
+ id=id,
248
+ conf=utils.get_pydantic_model(
249
+ conf, Optional[models.MappingRulesetConf]
250
+ ),
251
+ active=active,
252
+ ),
253
+ )
254
+
255
+ req = self._build_request(
256
+ method="POST",
257
+ path="/admin/products/{product}/mappings",
258
+ base_url=base_url,
259
+ url_variables=url_variables,
260
+ request=request,
261
+ request_body_required=True,
262
+ request_has_path_params=True,
263
+ request_has_query_params=True,
264
+ user_agent_header="user-agent",
265
+ accept_header_value="application/json",
266
+ http_headers=http_headers,
267
+ security=self.sdk_configuration.security,
268
+ get_serialized_body=lambda: utils.serialize_request_body(
269
+ request.mapping_ruleset, False, False, "json", models.MappingRuleset
270
+ ),
271
+ timeout_ms=timeout_ms,
272
+ )
273
+
274
+ if retries == UNSET:
275
+ if self.sdk_configuration.retry_config is not UNSET:
276
+ retries = self.sdk_configuration.retry_config
277
+
278
+ retry_config = None
279
+ if isinstance(retries, utils.RetryConfig):
280
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
281
+
282
+ http_res = self.do_request(
283
+ hook_ctx=HookContext(
284
+ config=self.sdk_configuration,
285
+ base_url=base_url or "",
286
+ operation_id="createAdminProductsMappingsByProduct",
287
+ oauth2_scopes=[],
288
+ security_source=get_security_from_env(
289
+ self.sdk_configuration.security, models.Security
290
+ ),
291
+ ),
292
+ request=req,
293
+ error_status_codes=["401", "4XX", "500", "5XX"],
294
+ retry_config=retry_config,
295
+ )
296
+
297
+ response_data: Any = None
298
+ if utils.match_response(http_res, "200", "application/json"):
299
+ return unmarshal_json_response(
300
+ models.CreateAdminProductsMappingsByProductResponse, http_res
301
+ )
302
+ if utils.match_response(http_res, "500", "application/json"):
303
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
304
+ raise errors.Error(response_data, http_res)
305
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
306
+ http_res_text = utils.stream_to_text(http_res)
307
+ raise errors.APIError("API error occurred", http_res, http_res_text)
308
+ if utils.match_response(http_res, "5XX", "*"):
309
+ http_res_text = utils.stream_to_text(http_res)
310
+ raise errors.APIError("API error occurred", http_res, http_res_text)
311
+
312
+ raise errors.APIError("Unexpected response received", http_res)
313
+
314
+ async def create_async(
315
+ self,
316
+ *,
317
+ product: models.ProductsCore,
318
+ id: str,
319
+ conf: Optional[
320
+ Union[models.MappingRulesetConf, models.MappingRulesetConfTypedDict]
321
+ ] = None,
322
+ active: Optional[bool] = None,
323
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
324
+ server_url: Optional[str] = None,
325
+ timeout_ms: Optional[int] = None,
326
+ http_headers: Optional[Mapping[str, str]] = None,
327
+ ) -> models.CreateAdminProductsMappingsByProductResponse:
328
+ r"""Create a new Mapping Ruleset for the specified Cribl product
329
+
330
+ Create and save a new Mapping Ruleset for the specified Cribl product.
331
+
332
+ :param product: Name of the Cribl product to create the Mapping Ruleset for
333
+ :param id:
334
+ :param conf:
335
+ :param active:
336
+ :param retries: Override the default retry configuration for this method
337
+ :param server_url: Override the default server URL for this method
338
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
339
+ :param http_headers: Additional headers to set or replace on requests.
340
+ """
341
+ base_url = None
342
+ url_variables = None
343
+ if timeout_ms is None:
344
+ timeout_ms = self.sdk_configuration.timeout_ms
345
+
346
+ if server_url is not None:
347
+ base_url = server_url
348
+ else:
349
+ base_url = self._get_url(base_url, url_variables)
350
+
351
+ request = models.CreateAdminProductsMappingsByProductRequest(
352
+ product=product,
353
+ mapping_ruleset=models.MappingRuleset(
354
+ id=id,
355
+ conf=utils.get_pydantic_model(
356
+ conf, Optional[models.MappingRulesetConf]
357
+ ),
358
+ active=active,
359
+ ),
360
+ )
361
+
362
+ req = self._build_request_async(
363
+ method="POST",
364
+ path="/admin/products/{product}/mappings",
365
+ base_url=base_url,
366
+ url_variables=url_variables,
367
+ request=request,
368
+ request_body_required=True,
369
+ request_has_path_params=True,
370
+ request_has_query_params=True,
371
+ user_agent_header="user-agent",
372
+ accept_header_value="application/json",
373
+ http_headers=http_headers,
374
+ security=self.sdk_configuration.security,
375
+ get_serialized_body=lambda: utils.serialize_request_body(
376
+ request.mapping_ruleset, False, False, "json", models.MappingRuleset
377
+ ),
378
+ timeout_ms=timeout_ms,
379
+ )
380
+
381
+ if retries == UNSET:
382
+ if self.sdk_configuration.retry_config is not UNSET:
383
+ retries = self.sdk_configuration.retry_config
384
+
385
+ retry_config = None
386
+ if isinstance(retries, utils.RetryConfig):
387
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
388
+
389
+ http_res = await self.do_request_async(
390
+ hook_ctx=HookContext(
391
+ config=self.sdk_configuration,
392
+ base_url=base_url or "",
393
+ operation_id="createAdminProductsMappingsByProduct",
394
+ oauth2_scopes=[],
395
+ security_source=get_security_from_env(
396
+ self.sdk_configuration.security, models.Security
397
+ ),
398
+ ),
399
+ request=req,
400
+ error_status_codes=["401", "4XX", "500", "5XX"],
401
+ retry_config=retry_config,
402
+ )
403
+
404
+ response_data: Any = None
405
+ if utils.match_response(http_res, "200", "application/json"):
406
+ return unmarshal_json_response(
407
+ models.CreateAdminProductsMappingsByProductResponse, http_res
408
+ )
409
+ if utils.match_response(http_res, "500", "application/json"):
410
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
411
+ raise errors.Error(response_data, http_res)
412
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
413
+ http_res_text = await utils.stream_to_text_async(http_res)
414
+ raise errors.APIError("API error occurred", http_res, http_res_text)
415
+ if utils.match_response(http_res, "5XX", "*"):
416
+ http_res_text = await utils.stream_to_text_async(http_res)
417
+ raise errors.APIError("API error occurred", http_res, http_res_text)
418
+
419
+ raise errors.APIError("Unexpected response received", http_res)
420
+
421
+ def list(
422
+ self,
423
+ *,
424
+ product: models.ProductsCore,
425
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
426
+ server_url: Optional[str] = None,
427
+ timeout_ms: Optional[int] = None,
428
+ http_headers: Optional[Mapping[str, str]] = None,
429
+ ) -> models.GetAdminProductsMappingsByProductResponse:
430
+ r"""List all Mapping Rulesets for the specified Cribl product
431
+
432
+ Retrieve a list of all existing Mapping Rulesets for the specified Cribl product.
433
+
434
+ :param product: Name of the Cribl product to list the Mapping Rulesets for
435
+ :param retries: Override the default retry configuration for this method
436
+ :param server_url: Override the default server URL for this method
437
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
438
+ :param http_headers: Additional headers to set or replace on requests.
439
+ """
440
+ base_url = None
441
+ url_variables = None
442
+ if timeout_ms is None:
443
+ timeout_ms = self.sdk_configuration.timeout_ms
444
+
445
+ if server_url is not None:
446
+ base_url = server_url
447
+ else:
448
+ base_url = self._get_url(base_url, url_variables)
449
+
450
+ request = models.GetAdminProductsMappingsByProductRequest(
451
+ product=product,
452
+ )
453
+
454
+ req = self._build_request(
455
+ method="GET",
456
+ path="/admin/products/{product}/mappings",
457
+ base_url=base_url,
458
+ url_variables=url_variables,
459
+ request=request,
460
+ request_body_required=False,
461
+ request_has_path_params=True,
462
+ request_has_query_params=True,
463
+ user_agent_header="user-agent",
464
+ accept_header_value="application/json",
465
+ http_headers=http_headers,
466
+ security=self.sdk_configuration.security,
467
+ timeout_ms=timeout_ms,
468
+ )
469
+
470
+ if retries == UNSET:
471
+ if self.sdk_configuration.retry_config is not UNSET:
472
+ retries = self.sdk_configuration.retry_config
473
+
474
+ retry_config = None
475
+ if isinstance(retries, utils.RetryConfig):
476
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
477
+
478
+ http_res = self.do_request(
479
+ hook_ctx=HookContext(
480
+ config=self.sdk_configuration,
481
+ base_url=base_url or "",
482
+ operation_id="getAdminProductsMappingsByProduct",
483
+ oauth2_scopes=[],
484
+ security_source=get_security_from_env(
485
+ self.sdk_configuration.security, models.Security
486
+ ),
487
+ ),
488
+ request=req,
489
+ error_status_codes=["401", "4XX", "500", "5XX"],
490
+ retry_config=retry_config,
491
+ )
492
+
493
+ response_data: Any = None
494
+ if utils.match_response(http_res, "200", "application/json"):
495
+ return unmarshal_json_response(
496
+ models.GetAdminProductsMappingsByProductResponse, http_res
497
+ )
498
+ if utils.match_response(http_res, "500", "application/json"):
499
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
500
+ raise errors.Error(response_data, http_res)
501
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
502
+ http_res_text = utils.stream_to_text(http_res)
503
+ raise errors.APIError("API error occurred", http_res, http_res_text)
504
+ if utils.match_response(http_res, "5XX", "*"):
505
+ http_res_text = utils.stream_to_text(http_res)
506
+ raise errors.APIError("API error occurred", http_res, http_res_text)
507
+
508
+ raise errors.APIError("Unexpected response received", http_res)
509
+
510
+ async def list_async(
511
+ self,
512
+ *,
513
+ product: models.ProductsCore,
514
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
515
+ server_url: Optional[str] = None,
516
+ timeout_ms: Optional[int] = None,
517
+ http_headers: Optional[Mapping[str, str]] = None,
518
+ ) -> models.GetAdminProductsMappingsByProductResponse:
519
+ r"""List all Mapping Rulesets for the specified Cribl product
520
+
521
+ Retrieve a list of all existing Mapping Rulesets for the specified Cribl product.
522
+
523
+ :param product: Name of the Cribl product to list the Mapping Rulesets for
524
+ :param retries: Override the default retry configuration for this method
525
+ :param server_url: Override the default server URL for this method
526
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
527
+ :param http_headers: Additional headers to set or replace on requests.
528
+ """
529
+ base_url = None
530
+ url_variables = None
531
+ if timeout_ms is None:
532
+ timeout_ms = self.sdk_configuration.timeout_ms
533
+
534
+ if server_url is not None:
535
+ base_url = server_url
536
+ else:
537
+ base_url = self._get_url(base_url, url_variables)
538
+
539
+ request = models.GetAdminProductsMappingsByProductRequest(
540
+ product=product,
541
+ )
542
+
543
+ req = self._build_request_async(
544
+ method="GET",
545
+ path="/admin/products/{product}/mappings",
546
+ base_url=base_url,
547
+ url_variables=url_variables,
548
+ request=request,
549
+ request_body_required=False,
550
+ request_has_path_params=True,
551
+ request_has_query_params=True,
552
+ user_agent_header="user-agent",
553
+ accept_header_value="application/json",
554
+ http_headers=http_headers,
555
+ security=self.sdk_configuration.security,
556
+ timeout_ms=timeout_ms,
557
+ )
558
+
559
+ if retries == UNSET:
560
+ if self.sdk_configuration.retry_config is not UNSET:
561
+ retries = self.sdk_configuration.retry_config
562
+
563
+ retry_config = None
564
+ if isinstance(retries, utils.RetryConfig):
565
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
566
+
567
+ http_res = await self.do_request_async(
568
+ hook_ctx=HookContext(
569
+ config=self.sdk_configuration,
570
+ base_url=base_url or "",
571
+ operation_id="getAdminProductsMappingsByProduct",
572
+ oauth2_scopes=[],
573
+ security_source=get_security_from_env(
574
+ self.sdk_configuration.security, models.Security
575
+ ),
576
+ ),
577
+ request=req,
578
+ error_status_codes=["401", "4XX", "500", "5XX"],
579
+ retry_config=retry_config,
580
+ )
581
+
582
+ response_data: Any = None
583
+ if utils.match_response(http_res, "200", "application/json"):
584
+ return unmarshal_json_response(
585
+ models.GetAdminProductsMappingsByProductResponse, http_res
586
+ )
587
+ if utils.match_response(http_res, "500", "application/json"):
588
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
589
+ raise errors.Error(response_data, http_res)
590
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
591
+ http_res_text = await utils.stream_to_text_async(http_res)
592
+ raise errors.APIError("API error occurred", http_res, http_res_text)
593
+ if utils.match_response(http_res, "5XX", "*"):
594
+ http_res_text = await utils.stream_to_text_async(http_res)
595
+ raise errors.APIError("API error occurred", http_res, http_res_text)
596
+
597
+ raise errors.APIError("Unexpected response received", http_res)
598
+
599
+ def delete(
600
+ self,
601
+ *,
602
+ product: models.ProductsCore,
603
+ id: str,
604
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
605
+ server_url: Optional[str] = None,
606
+ timeout_ms: Optional[int] = None,
607
+ http_headers: Optional[Mapping[str, str]] = None,
608
+ ) -> models.DeleteAdminProductsMappingsByProductAndIDResponse:
609
+ r"""Delete the specified Mapping Ruleset from the Worker Group or Edge Fleet
610
+
611
+ Permanently remove the specified Mapping Ruleset from the Worker Group or Edge Fleet.
612
+
613
+ :param product: Name of the Cribl product to delete the Mapping Ruleset for
614
+ :param id: The <code>id</code> of the Mapping Ruleset to delete.
615
+ :param retries: Override the default retry configuration for this method
616
+ :param server_url: Override the default server URL for this method
617
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
618
+ :param http_headers: Additional headers to set or replace on requests.
619
+ """
620
+ base_url = None
621
+ url_variables = None
622
+ if timeout_ms is None:
623
+ timeout_ms = self.sdk_configuration.timeout_ms
624
+
625
+ if server_url is not None:
626
+ base_url = server_url
627
+ else:
628
+ base_url = self._get_url(base_url, url_variables)
629
+
630
+ request = models.DeleteAdminProductsMappingsByProductAndIDRequest(
631
+ product=product,
632
+ id=id,
633
+ )
634
+
635
+ req = self._build_request(
636
+ method="DELETE",
637
+ path="/admin/products/{product}/mappings/{id}",
638
+ base_url=base_url,
639
+ url_variables=url_variables,
640
+ request=request,
641
+ request_body_required=False,
642
+ request_has_path_params=True,
643
+ request_has_query_params=True,
644
+ user_agent_header="user-agent",
645
+ accept_header_value="application/json",
646
+ http_headers=http_headers,
647
+ security=self.sdk_configuration.security,
648
+ timeout_ms=timeout_ms,
649
+ )
650
+
651
+ if retries == UNSET:
652
+ if self.sdk_configuration.retry_config is not UNSET:
653
+ retries = self.sdk_configuration.retry_config
654
+
655
+ retry_config = None
656
+ if isinstance(retries, utils.RetryConfig):
657
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
658
+
659
+ http_res = self.do_request(
660
+ hook_ctx=HookContext(
661
+ config=self.sdk_configuration,
662
+ base_url=base_url or "",
663
+ operation_id="deleteAdminProductsMappingsByProductAndId",
664
+ oauth2_scopes=[],
665
+ security_source=get_security_from_env(
666
+ self.sdk_configuration.security, models.Security
667
+ ),
668
+ ),
669
+ request=req,
670
+ error_status_codes=["401", "4XX", "500", "5XX"],
671
+ retry_config=retry_config,
672
+ )
673
+
674
+ response_data: Any = None
675
+ if utils.match_response(http_res, "200", "application/json"):
676
+ return unmarshal_json_response(
677
+ models.DeleteAdminProductsMappingsByProductAndIDResponse, http_res
678
+ )
679
+ if utils.match_response(http_res, "500", "application/json"):
680
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
681
+ raise errors.Error(response_data, http_res)
682
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
683
+ http_res_text = utils.stream_to_text(http_res)
684
+ raise errors.APIError("API error occurred", http_res, http_res_text)
685
+ if utils.match_response(http_res, "5XX", "*"):
686
+ http_res_text = utils.stream_to_text(http_res)
687
+ raise errors.APIError("API error occurred", http_res, http_res_text)
688
+
689
+ raise errors.APIError("Unexpected response received", http_res)
690
+
691
+ async def delete_async(
692
+ self,
693
+ *,
694
+ product: models.ProductsCore,
695
+ id: str,
696
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
697
+ server_url: Optional[str] = None,
698
+ timeout_ms: Optional[int] = None,
699
+ http_headers: Optional[Mapping[str, str]] = None,
700
+ ) -> models.DeleteAdminProductsMappingsByProductAndIDResponse:
701
+ r"""Delete the specified Mapping Ruleset from the Worker Group or Edge Fleet
702
+
703
+ Permanently remove the specified Mapping Ruleset from the Worker Group or Edge Fleet.
704
+
705
+ :param product: Name of the Cribl product to delete the Mapping Ruleset for
706
+ :param id: The <code>id</code> of the Mapping Ruleset to delete.
707
+ :param retries: Override the default retry configuration for this method
708
+ :param server_url: Override the default server URL for this method
709
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
710
+ :param http_headers: Additional headers to set or replace on requests.
711
+ """
712
+ base_url = None
713
+ url_variables = None
714
+ if timeout_ms is None:
715
+ timeout_ms = self.sdk_configuration.timeout_ms
716
+
717
+ if server_url is not None:
718
+ base_url = server_url
719
+ else:
720
+ base_url = self._get_url(base_url, url_variables)
721
+
722
+ request = models.DeleteAdminProductsMappingsByProductAndIDRequest(
723
+ product=product,
724
+ id=id,
725
+ )
726
+
727
+ req = self._build_request_async(
728
+ method="DELETE",
729
+ path="/admin/products/{product}/mappings/{id}",
730
+ base_url=base_url,
731
+ url_variables=url_variables,
732
+ request=request,
733
+ request_body_required=False,
734
+ request_has_path_params=True,
735
+ request_has_query_params=True,
736
+ user_agent_header="user-agent",
737
+ accept_header_value="application/json",
738
+ http_headers=http_headers,
739
+ security=self.sdk_configuration.security,
740
+ timeout_ms=timeout_ms,
741
+ )
742
+
743
+ if retries == UNSET:
744
+ if self.sdk_configuration.retry_config is not UNSET:
745
+ retries = self.sdk_configuration.retry_config
746
+
747
+ retry_config = None
748
+ if isinstance(retries, utils.RetryConfig):
749
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
750
+
751
+ http_res = await self.do_request_async(
752
+ hook_ctx=HookContext(
753
+ config=self.sdk_configuration,
754
+ base_url=base_url or "",
755
+ operation_id="deleteAdminProductsMappingsByProductAndId",
756
+ oauth2_scopes=[],
757
+ security_source=get_security_from_env(
758
+ self.sdk_configuration.security, models.Security
759
+ ),
760
+ ),
761
+ request=req,
762
+ error_status_codes=["401", "4XX", "500", "5XX"],
763
+ retry_config=retry_config,
764
+ )
765
+
766
+ response_data: Any = None
767
+ if utils.match_response(http_res, "200", "application/json"):
768
+ return unmarshal_json_response(
769
+ models.DeleteAdminProductsMappingsByProductAndIDResponse, http_res
770
+ )
771
+ if utils.match_response(http_res, "500", "application/json"):
772
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
773
+ raise errors.Error(response_data, http_res)
774
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
775
+ http_res_text = await utils.stream_to_text_async(http_res)
776
+ raise errors.APIError("API error occurred", http_res, http_res_text)
777
+ if utils.match_response(http_res, "5XX", "*"):
778
+ http_res_text = await utils.stream_to_text_async(http_res)
779
+ raise errors.APIError("API error occurred", http_res, http_res_text)
780
+
781
+ raise errors.APIError("Unexpected response received", http_res)
782
+
783
+ def get(
784
+ self,
785
+ *,
786
+ product: models.ProductsCore,
787
+ id: str,
788
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
789
+ server_url: Optional[str] = None,
790
+ timeout_ms: Optional[int] = None,
791
+ http_headers: Optional[Mapping[str, str]] = None,
792
+ ) -> models.GetAdminProductsMappingsByProductAndIDResponse:
793
+ r"""Retrieve a Specific Mapping Ruleset
794
+
795
+ Get the details for a single Mapping Ruleset, identified by its id, for a Worker Group or Edge Fleet.
796
+
797
+ :param product: Name of the Cribl product to get the Mappings for
798
+ :param id: The <code>id</code> of the Worker Group or Edge Fleet Mapping Ruleset to get
799
+ :param retries: Override the default retry configuration for this method
800
+ :param server_url: Override the default server URL for this method
801
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
802
+ :param http_headers: Additional headers to set or replace on requests.
803
+ """
804
+ base_url = None
805
+ url_variables = None
806
+ if timeout_ms is None:
807
+ timeout_ms = self.sdk_configuration.timeout_ms
808
+
809
+ if server_url is not None:
810
+ base_url = server_url
811
+ else:
812
+ base_url = self._get_url(base_url, url_variables)
813
+
814
+ request = models.GetAdminProductsMappingsByProductAndIDRequest(
815
+ product=product,
816
+ id=id,
817
+ )
818
+
819
+ req = self._build_request(
820
+ method="GET",
821
+ path="/admin/products/{product}/mappings/{id}",
822
+ base_url=base_url,
823
+ url_variables=url_variables,
824
+ request=request,
825
+ request_body_required=False,
826
+ request_has_path_params=True,
827
+ request_has_query_params=True,
828
+ user_agent_header="user-agent",
829
+ accept_header_value="application/json",
830
+ http_headers=http_headers,
831
+ security=self.sdk_configuration.security,
832
+ timeout_ms=timeout_ms,
833
+ )
834
+
835
+ if retries == UNSET:
836
+ if self.sdk_configuration.retry_config is not UNSET:
837
+ retries = self.sdk_configuration.retry_config
838
+
839
+ retry_config = None
840
+ if isinstance(retries, utils.RetryConfig):
841
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
842
+
843
+ http_res = self.do_request(
844
+ hook_ctx=HookContext(
845
+ config=self.sdk_configuration,
846
+ base_url=base_url or "",
847
+ operation_id="getAdminProductsMappingsByProductAndId",
848
+ oauth2_scopes=[],
849
+ security_source=get_security_from_env(
850
+ self.sdk_configuration.security, models.Security
851
+ ),
852
+ ),
853
+ request=req,
854
+ error_status_codes=["401", "4XX", "500", "5XX"],
855
+ retry_config=retry_config,
856
+ )
857
+
858
+ response_data: Any = None
859
+ if utils.match_response(http_res, "200", "application/json"):
860
+ return unmarshal_json_response(
861
+ models.GetAdminProductsMappingsByProductAndIDResponse, http_res
862
+ )
863
+ if utils.match_response(http_res, "500", "application/json"):
864
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
865
+ raise errors.Error(response_data, http_res)
866
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
867
+ http_res_text = utils.stream_to_text(http_res)
868
+ raise errors.APIError("API error occurred", http_res, http_res_text)
869
+ if utils.match_response(http_res, "5XX", "*"):
870
+ http_res_text = utils.stream_to_text(http_res)
871
+ raise errors.APIError("API error occurred", http_res, http_res_text)
872
+
873
+ raise errors.APIError("Unexpected response received", http_res)
874
+
875
+ async def get_async(
876
+ self,
877
+ *,
878
+ product: models.ProductsCore,
879
+ id: str,
880
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
881
+ server_url: Optional[str] = None,
882
+ timeout_ms: Optional[int] = None,
883
+ http_headers: Optional[Mapping[str, str]] = None,
884
+ ) -> models.GetAdminProductsMappingsByProductAndIDResponse:
885
+ r"""Retrieve a Specific Mapping Ruleset
886
+
887
+ Get the details for a single Mapping Ruleset, identified by its id, for a Worker Group or Edge Fleet.
888
+
889
+ :param product: Name of the Cribl product to get the Mappings for
890
+ :param id: The <code>id</code> of the Worker Group or Edge Fleet Mapping Ruleset to get
891
+ :param retries: Override the default retry configuration for this method
892
+ :param server_url: Override the default server URL for this method
893
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
894
+ :param http_headers: Additional headers to set or replace on requests.
895
+ """
896
+ base_url = None
897
+ url_variables = None
898
+ if timeout_ms is None:
899
+ timeout_ms = self.sdk_configuration.timeout_ms
900
+
901
+ if server_url is not None:
902
+ base_url = server_url
903
+ else:
904
+ base_url = self._get_url(base_url, url_variables)
905
+
906
+ request = models.GetAdminProductsMappingsByProductAndIDRequest(
907
+ product=product,
908
+ id=id,
909
+ )
910
+
911
+ req = self._build_request_async(
912
+ method="GET",
913
+ path="/admin/products/{product}/mappings/{id}",
914
+ base_url=base_url,
915
+ url_variables=url_variables,
916
+ request=request,
917
+ request_body_required=False,
918
+ request_has_path_params=True,
919
+ request_has_query_params=True,
920
+ user_agent_header="user-agent",
921
+ accept_header_value="application/json",
922
+ http_headers=http_headers,
923
+ security=self.sdk_configuration.security,
924
+ timeout_ms=timeout_ms,
925
+ )
926
+
927
+ if retries == UNSET:
928
+ if self.sdk_configuration.retry_config is not UNSET:
929
+ retries = self.sdk_configuration.retry_config
930
+
931
+ retry_config = None
932
+ if isinstance(retries, utils.RetryConfig):
933
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
934
+
935
+ http_res = await self.do_request_async(
936
+ hook_ctx=HookContext(
937
+ config=self.sdk_configuration,
938
+ base_url=base_url or "",
939
+ operation_id="getAdminProductsMappingsByProductAndId",
940
+ oauth2_scopes=[],
941
+ security_source=get_security_from_env(
942
+ self.sdk_configuration.security, models.Security
943
+ ),
944
+ ),
945
+ request=req,
946
+ error_status_codes=["401", "4XX", "500", "5XX"],
947
+ retry_config=retry_config,
948
+ )
949
+
950
+ response_data: Any = None
951
+ if utils.match_response(http_res, "200", "application/json"):
952
+ return unmarshal_json_response(
953
+ models.GetAdminProductsMappingsByProductAndIDResponse, http_res
954
+ )
955
+ if utils.match_response(http_res, "500", "application/json"):
956
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
957
+ raise errors.Error(response_data, http_res)
958
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
959
+ http_res_text = await utils.stream_to_text_async(http_res)
960
+ raise errors.APIError("API error occurred", http_res, http_res_text)
961
+ if utils.match_response(http_res, "5XX", "*"):
962
+ http_res_text = await utils.stream_to_text_async(http_res)
963
+ raise errors.APIError("API error occurred", http_res, http_res_text)
964
+
965
+ raise errors.APIError("Unexpected response received", http_res)
966
+
967
+ def update(
968
+ self,
969
+ *,
970
+ product: models.ProductsCore,
971
+ id_param: str,
972
+ id: str,
973
+ conf: Optional[
974
+ Union[models.MappingRulesetConf, models.MappingRulesetConfTypedDict]
975
+ ] = None,
976
+ active: Optional[bool] = None,
977
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
978
+ server_url: Optional[str] = None,
979
+ timeout_ms: Optional[int] = None,
980
+ http_headers: Optional[Mapping[str, str]] = None,
981
+ ) -> models.UpdateAdminProductsMappingsByProductAndIDResponse:
982
+ r"""Update an existing Mapping Ruleset for a Worker Group or Edge Fleet
983
+
984
+ Modify the configuration of the specified Mapping Ruleset for a Worker Group or Edge Fleet.
985
+
986
+ :param product: Name of the Cribl product to update the Mapping Ruleset for
987
+ :param id_param: The <code>id</code> of the Mapping Ruleset to update.
988
+ :param id:
989
+ :param conf:
990
+ :param active:
991
+ :param retries: Override the default retry configuration for this method
992
+ :param server_url: Override the default server URL for this method
993
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
994
+ :param http_headers: Additional headers to set or replace on requests.
995
+ """
996
+ base_url = None
997
+ url_variables = None
998
+ if timeout_ms is None:
999
+ timeout_ms = self.sdk_configuration.timeout_ms
1000
+
1001
+ if server_url is not None:
1002
+ base_url = server_url
1003
+ else:
1004
+ base_url = self._get_url(base_url, url_variables)
1005
+
1006
+ request = models.UpdateAdminProductsMappingsByProductAndIDRequest(
1007
+ product=product,
1008
+ id_param=id_param,
1009
+ mapping_ruleset=models.MappingRuleset(
1010
+ id=id,
1011
+ conf=utils.get_pydantic_model(
1012
+ conf, Optional[models.MappingRulesetConf]
1013
+ ),
1014
+ active=active,
1015
+ ),
1016
+ )
1017
+
1018
+ req = self._build_request(
1019
+ method="PATCH",
1020
+ path="/admin/products/{product}/mappings/{id}",
1021
+ base_url=base_url,
1022
+ url_variables=url_variables,
1023
+ request=request,
1024
+ request_body_required=True,
1025
+ request_has_path_params=True,
1026
+ request_has_query_params=True,
1027
+ user_agent_header="user-agent",
1028
+ accept_header_value="application/json",
1029
+ http_headers=http_headers,
1030
+ security=self.sdk_configuration.security,
1031
+ get_serialized_body=lambda: utils.serialize_request_body(
1032
+ request.mapping_ruleset, False, False, "json", models.MappingRuleset
1033
+ ),
1034
+ timeout_ms=timeout_ms,
1035
+ )
1036
+
1037
+ if retries == UNSET:
1038
+ if self.sdk_configuration.retry_config is not UNSET:
1039
+ retries = self.sdk_configuration.retry_config
1040
+
1041
+ retry_config = None
1042
+ if isinstance(retries, utils.RetryConfig):
1043
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1044
+
1045
+ http_res = self.do_request(
1046
+ hook_ctx=HookContext(
1047
+ config=self.sdk_configuration,
1048
+ base_url=base_url or "",
1049
+ operation_id="updateAdminProductsMappingsByProductAndId",
1050
+ oauth2_scopes=[],
1051
+ security_source=get_security_from_env(
1052
+ self.sdk_configuration.security, models.Security
1053
+ ),
1054
+ ),
1055
+ request=req,
1056
+ error_status_codes=["401", "4XX", "500", "5XX"],
1057
+ retry_config=retry_config,
1058
+ )
1059
+
1060
+ response_data: Any = None
1061
+ if utils.match_response(http_res, "200", "application/json"):
1062
+ return unmarshal_json_response(
1063
+ models.UpdateAdminProductsMappingsByProductAndIDResponse, http_res
1064
+ )
1065
+ if utils.match_response(http_res, "500", "application/json"):
1066
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
1067
+ raise errors.Error(response_data, http_res)
1068
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
1069
+ http_res_text = utils.stream_to_text(http_res)
1070
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1071
+ if utils.match_response(http_res, "5XX", "*"):
1072
+ http_res_text = utils.stream_to_text(http_res)
1073
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1074
+
1075
+ raise errors.APIError("Unexpected response received", http_res)
1076
+
1077
+ async def update_async(
1078
+ self,
1079
+ *,
1080
+ product: models.ProductsCore,
1081
+ id_param: str,
1082
+ id: str,
1083
+ conf: Optional[
1084
+ Union[models.MappingRulesetConf, models.MappingRulesetConfTypedDict]
1085
+ ] = None,
1086
+ active: Optional[bool] = None,
1087
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1088
+ server_url: Optional[str] = None,
1089
+ timeout_ms: Optional[int] = None,
1090
+ http_headers: Optional[Mapping[str, str]] = None,
1091
+ ) -> models.UpdateAdminProductsMappingsByProductAndIDResponse:
1092
+ r"""Update an existing Mapping Ruleset for a Worker Group or Edge Fleet
1093
+
1094
+ Modify the configuration of the specified Mapping Ruleset for a Worker Group or Edge Fleet.
1095
+
1096
+ :param product: Name of the Cribl product to update the Mapping Ruleset for
1097
+ :param id_param: The <code>id</code> of the Mapping Ruleset to update.
1098
+ :param id:
1099
+ :param conf:
1100
+ :param active:
1101
+ :param retries: Override the default retry configuration for this method
1102
+ :param server_url: Override the default server URL for this method
1103
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1104
+ :param http_headers: Additional headers to set or replace on requests.
1105
+ """
1106
+ base_url = None
1107
+ url_variables = None
1108
+ if timeout_ms is None:
1109
+ timeout_ms = self.sdk_configuration.timeout_ms
1110
+
1111
+ if server_url is not None:
1112
+ base_url = server_url
1113
+ else:
1114
+ base_url = self._get_url(base_url, url_variables)
1115
+
1116
+ request = models.UpdateAdminProductsMappingsByProductAndIDRequest(
1117
+ product=product,
1118
+ id_param=id_param,
1119
+ mapping_ruleset=models.MappingRuleset(
1120
+ id=id,
1121
+ conf=utils.get_pydantic_model(
1122
+ conf, Optional[models.MappingRulesetConf]
1123
+ ),
1124
+ active=active,
1125
+ ),
1126
+ )
1127
+
1128
+ req = self._build_request_async(
1129
+ method="PATCH",
1130
+ path="/admin/products/{product}/mappings/{id}",
1131
+ base_url=base_url,
1132
+ url_variables=url_variables,
1133
+ request=request,
1134
+ request_body_required=True,
1135
+ request_has_path_params=True,
1136
+ request_has_query_params=True,
1137
+ user_agent_header="user-agent",
1138
+ accept_header_value="application/json",
1139
+ http_headers=http_headers,
1140
+ security=self.sdk_configuration.security,
1141
+ get_serialized_body=lambda: utils.serialize_request_body(
1142
+ request.mapping_ruleset, False, False, "json", models.MappingRuleset
1143
+ ),
1144
+ timeout_ms=timeout_ms,
1145
+ )
1146
+
1147
+ if retries == UNSET:
1148
+ if self.sdk_configuration.retry_config is not UNSET:
1149
+ retries = self.sdk_configuration.retry_config
1150
+
1151
+ retry_config = None
1152
+ if isinstance(retries, utils.RetryConfig):
1153
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1154
+
1155
+ http_res = await self.do_request_async(
1156
+ hook_ctx=HookContext(
1157
+ config=self.sdk_configuration,
1158
+ base_url=base_url or "",
1159
+ operation_id="updateAdminProductsMappingsByProductAndId",
1160
+ oauth2_scopes=[],
1161
+ security_source=get_security_from_env(
1162
+ self.sdk_configuration.security, models.Security
1163
+ ),
1164
+ ),
1165
+ request=req,
1166
+ error_status_codes=["401", "4XX", "500", "5XX"],
1167
+ retry_config=retry_config,
1168
+ )
1169
+
1170
+ response_data: Any = None
1171
+ if utils.match_response(http_res, "200", "application/json"):
1172
+ return unmarshal_json_response(
1173
+ models.UpdateAdminProductsMappingsByProductAndIDResponse, http_res
1174
+ )
1175
+ if utils.match_response(http_res, "500", "application/json"):
1176
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
1177
+ raise errors.Error(response_data, http_res)
1178
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
1179
+ http_res_text = await utils.stream_to_text_async(http_res)
1180
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1181
+ if utils.match_response(http_res, "5XX", "*"):
1182
+ http_res_text = await utils.stream_to_text_async(http_res)
1183
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1184
+
1185
+ raise errors.APIError("Unexpected response received", http_res)