cribl-control-plane 0.0.26__py3-none-any.whl → 0.0.27__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,479 @@
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, List, Mapping, Optional, Union
10
+
11
+
12
+ class HecTokens(BaseSDK):
13
+ def create(
14
+ self,
15
+ *,
16
+ id: str,
17
+ token: str,
18
+ description: Optional[str] = None,
19
+ enabled: Optional[bool] = None,
20
+ metadata: Optional[
21
+ Union[
22
+ List[models.AddHecTokenRequestMetadatum],
23
+ List[models.AddHecTokenRequestMetadatumTypedDict],
24
+ ]
25
+ ] = None,
26
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
27
+ server_url: Optional[str] = None,
28
+ timeout_ms: Optional[int] = None,
29
+ http_headers: Optional[Mapping[str, str]] = None,
30
+ ) -> models.CreateInputHecTokenByIDResponse:
31
+ r"""Add an HEC token and optional metadata to a Splunk HEC Source
32
+
33
+ Add token and optional metadata to an existing HEC Source
34
+
35
+ :param id: HEC Source id
36
+ :param token:
37
+ :param description:
38
+ :param enabled:
39
+ :param metadata:
40
+ :param retries: Override the default retry configuration for this method
41
+ :param server_url: Override the default server URL for this method
42
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
43
+ :param http_headers: Additional headers to set or replace on requests.
44
+ """
45
+ base_url = None
46
+ url_variables = None
47
+ if timeout_ms is None:
48
+ timeout_ms = self.sdk_configuration.timeout_ms
49
+
50
+ if server_url is not None:
51
+ base_url = server_url
52
+ else:
53
+ base_url = self._get_url(base_url, url_variables)
54
+
55
+ request = models.CreateInputHecTokenByIDRequest(
56
+ id=id,
57
+ add_hec_token_request=models.AddHecTokenRequest(
58
+ description=description,
59
+ enabled=enabled,
60
+ metadata=utils.get_pydantic_model(
61
+ metadata, Optional[List[models.AddHecTokenRequestMetadatum]]
62
+ ),
63
+ token=token,
64
+ ),
65
+ )
66
+
67
+ req = self._build_request(
68
+ method="POST",
69
+ path="/system/inputs/{id}/hectoken",
70
+ base_url=base_url,
71
+ url_variables=url_variables,
72
+ request=request,
73
+ request_body_required=True,
74
+ request_has_path_params=True,
75
+ request_has_query_params=True,
76
+ user_agent_header="user-agent",
77
+ accept_header_value="application/json",
78
+ http_headers=http_headers,
79
+ security=self.sdk_configuration.security,
80
+ get_serialized_body=lambda: utils.serialize_request_body(
81
+ request.add_hec_token_request,
82
+ False,
83
+ False,
84
+ "json",
85
+ models.AddHecTokenRequest,
86
+ ),
87
+ timeout_ms=timeout_ms,
88
+ )
89
+
90
+ if retries == UNSET:
91
+ if self.sdk_configuration.retry_config is not UNSET:
92
+ retries = self.sdk_configuration.retry_config
93
+
94
+ retry_config = None
95
+ if isinstance(retries, utils.RetryConfig):
96
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
97
+
98
+ http_res = self.do_request(
99
+ hook_ctx=HookContext(
100
+ config=self.sdk_configuration,
101
+ base_url=base_url or "",
102
+ operation_id="createInputHecTokenById",
103
+ oauth2_scopes=[],
104
+ security_source=get_security_from_env(
105
+ self.sdk_configuration.security, models.Security
106
+ ),
107
+ ),
108
+ request=req,
109
+ error_status_codes=["401", "4XX", "500", "5XX"],
110
+ retry_config=retry_config,
111
+ )
112
+
113
+ response_data: Any = None
114
+ if utils.match_response(http_res, "200", "application/json"):
115
+ return unmarshal_json_response(
116
+ models.CreateInputHecTokenByIDResponse, http_res
117
+ )
118
+ if utils.match_response(http_res, "500", "application/json"):
119
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
120
+ raise errors.Error(response_data, http_res)
121
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
122
+ http_res_text = utils.stream_to_text(http_res)
123
+ raise errors.APIError("API error occurred", http_res, http_res_text)
124
+ if utils.match_response(http_res, "5XX", "*"):
125
+ http_res_text = utils.stream_to_text(http_res)
126
+ raise errors.APIError("API error occurred", http_res, http_res_text)
127
+
128
+ raise errors.APIError("Unexpected response received", http_res)
129
+
130
+ async def create_async(
131
+ self,
132
+ *,
133
+ id: str,
134
+ token: str,
135
+ description: Optional[str] = None,
136
+ enabled: Optional[bool] = None,
137
+ metadata: Optional[
138
+ Union[
139
+ List[models.AddHecTokenRequestMetadatum],
140
+ List[models.AddHecTokenRequestMetadatumTypedDict],
141
+ ]
142
+ ] = None,
143
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
144
+ server_url: Optional[str] = None,
145
+ timeout_ms: Optional[int] = None,
146
+ http_headers: Optional[Mapping[str, str]] = None,
147
+ ) -> models.CreateInputHecTokenByIDResponse:
148
+ r"""Add an HEC token and optional metadata to a Splunk HEC Source
149
+
150
+ Add token and optional metadata to an existing HEC Source
151
+
152
+ :param id: HEC Source id
153
+ :param token:
154
+ :param description:
155
+ :param enabled:
156
+ :param metadata:
157
+ :param retries: Override the default retry configuration for this method
158
+ :param server_url: Override the default server URL for this method
159
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
160
+ :param http_headers: Additional headers to set or replace on requests.
161
+ """
162
+ base_url = None
163
+ url_variables = None
164
+ if timeout_ms is None:
165
+ timeout_ms = self.sdk_configuration.timeout_ms
166
+
167
+ if server_url is not None:
168
+ base_url = server_url
169
+ else:
170
+ base_url = self._get_url(base_url, url_variables)
171
+
172
+ request = models.CreateInputHecTokenByIDRequest(
173
+ id=id,
174
+ add_hec_token_request=models.AddHecTokenRequest(
175
+ description=description,
176
+ enabled=enabled,
177
+ metadata=utils.get_pydantic_model(
178
+ metadata, Optional[List[models.AddHecTokenRequestMetadatum]]
179
+ ),
180
+ token=token,
181
+ ),
182
+ )
183
+
184
+ req = self._build_request_async(
185
+ method="POST",
186
+ path="/system/inputs/{id}/hectoken",
187
+ base_url=base_url,
188
+ url_variables=url_variables,
189
+ request=request,
190
+ request_body_required=True,
191
+ request_has_path_params=True,
192
+ request_has_query_params=True,
193
+ user_agent_header="user-agent",
194
+ accept_header_value="application/json",
195
+ http_headers=http_headers,
196
+ security=self.sdk_configuration.security,
197
+ get_serialized_body=lambda: utils.serialize_request_body(
198
+ request.add_hec_token_request,
199
+ False,
200
+ False,
201
+ "json",
202
+ models.AddHecTokenRequest,
203
+ ),
204
+ timeout_ms=timeout_ms,
205
+ )
206
+
207
+ if retries == UNSET:
208
+ if self.sdk_configuration.retry_config is not UNSET:
209
+ retries = self.sdk_configuration.retry_config
210
+
211
+ retry_config = None
212
+ if isinstance(retries, utils.RetryConfig):
213
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
214
+
215
+ http_res = await self.do_request_async(
216
+ hook_ctx=HookContext(
217
+ config=self.sdk_configuration,
218
+ base_url=base_url or "",
219
+ operation_id="createInputHecTokenById",
220
+ oauth2_scopes=[],
221
+ security_source=get_security_from_env(
222
+ self.sdk_configuration.security, models.Security
223
+ ),
224
+ ),
225
+ request=req,
226
+ error_status_codes=["401", "4XX", "500", "5XX"],
227
+ retry_config=retry_config,
228
+ )
229
+
230
+ response_data: Any = None
231
+ if utils.match_response(http_res, "200", "application/json"):
232
+ return unmarshal_json_response(
233
+ models.CreateInputHecTokenByIDResponse, http_res
234
+ )
235
+ if utils.match_response(http_res, "500", "application/json"):
236
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
237
+ raise errors.Error(response_data, http_res)
238
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
239
+ http_res_text = await utils.stream_to_text_async(http_res)
240
+ raise errors.APIError("API error occurred", http_res, http_res_text)
241
+ if utils.match_response(http_res, "5XX", "*"):
242
+ http_res_text = await utils.stream_to_text_async(http_res)
243
+ raise errors.APIError("API error occurred", http_res, http_res_text)
244
+
245
+ raise errors.APIError("Unexpected response received", http_res)
246
+
247
+ def update(
248
+ self,
249
+ *,
250
+ id: str,
251
+ token: str,
252
+ description: Optional[str] = None,
253
+ enabled: Optional[bool] = None,
254
+ metadata: Optional[
255
+ Union[
256
+ List[models.UpdateHecTokenRequestMetadatum],
257
+ List[models.UpdateHecTokenRequestMetadatumTypedDict],
258
+ ]
259
+ ] = None,
260
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
261
+ server_url: Optional[str] = None,
262
+ timeout_ms: Optional[int] = None,
263
+ http_headers: Optional[Mapping[str, str]] = None,
264
+ ) -> models.UpdateInputHecTokenByIDAndTokenResponse:
265
+ r"""Update metadata for an HEC token for a Splunk HEC Source
266
+
267
+ Update token metadata on existing HEC Source
268
+
269
+ :param id: HEC Source id
270
+ :param token: token to update
271
+ :param description:
272
+ :param enabled:
273
+ :param metadata:
274
+ :param retries: Override the default retry configuration for this method
275
+ :param server_url: Override the default server URL for this method
276
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
277
+ :param http_headers: Additional headers to set or replace on requests.
278
+ """
279
+ base_url = None
280
+ url_variables = None
281
+ if timeout_ms is None:
282
+ timeout_ms = self.sdk_configuration.timeout_ms
283
+
284
+ if server_url is not None:
285
+ base_url = server_url
286
+ else:
287
+ base_url = self._get_url(base_url, url_variables)
288
+
289
+ request = models.UpdateInputHecTokenByIDAndTokenRequest(
290
+ id=id,
291
+ token=token,
292
+ update_hec_token_request=models.UpdateHecTokenRequest(
293
+ description=description,
294
+ enabled=enabled,
295
+ metadata=utils.get_pydantic_model(
296
+ metadata, Optional[List[models.UpdateHecTokenRequestMetadatum]]
297
+ ),
298
+ ),
299
+ )
300
+
301
+ req = self._build_request(
302
+ method="PATCH",
303
+ path="/system/inputs/{id}/hectoken/{token}",
304
+ base_url=base_url,
305
+ url_variables=url_variables,
306
+ request=request,
307
+ request_body_required=True,
308
+ request_has_path_params=True,
309
+ request_has_query_params=True,
310
+ user_agent_header="user-agent",
311
+ accept_header_value="application/json",
312
+ http_headers=http_headers,
313
+ security=self.sdk_configuration.security,
314
+ get_serialized_body=lambda: utils.serialize_request_body(
315
+ request.update_hec_token_request,
316
+ False,
317
+ False,
318
+ "json",
319
+ models.UpdateHecTokenRequest,
320
+ ),
321
+ timeout_ms=timeout_ms,
322
+ )
323
+
324
+ if retries == UNSET:
325
+ if self.sdk_configuration.retry_config is not UNSET:
326
+ retries = self.sdk_configuration.retry_config
327
+
328
+ retry_config = None
329
+ if isinstance(retries, utils.RetryConfig):
330
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
331
+
332
+ http_res = self.do_request(
333
+ hook_ctx=HookContext(
334
+ config=self.sdk_configuration,
335
+ base_url=base_url or "",
336
+ operation_id="updateInputHecTokenByIdAndToken",
337
+ oauth2_scopes=[],
338
+ security_source=get_security_from_env(
339
+ self.sdk_configuration.security, models.Security
340
+ ),
341
+ ),
342
+ request=req,
343
+ error_status_codes=["401", "4XX", "500", "5XX"],
344
+ retry_config=retry_config,
345
+ )
346
+
347
+ response_data: Any = None
348
+ if utils.match_response(http_res, "200", "application/json"):
349
+ return unmarshal_json_response(
350
+ models.UpdateInputHecTokenByIDAndTokenResponse, http_res
351
+ )
352
+ if utils.match_response(http_res, "500", "application/json"):
353
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
354
+ raise errors.Error(response_data, http_res)
355
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
356
+ http_res_text = utils.stream_to_text(http_res)
357
+ raise errors.APIError("API error occurred", http_res, http_res_text)
358
+ if utils.match_response(http_res, "5XX", "*"):
359
+ http_res_text = utils.stream_to_text(http_res)
360
+ raise errors.APIError("API error occurred", http_res, http_res_text)
361
+
362
+ raise errors.APIError("Unexpected response received", http_res)
363
+
364
+ async def update_async(
365
+ self,
366
+ *,
367
+ id: str,
368
+ token: str,
369
+ description: Optional[str] = None,
370
+ enabled: Optional[bool] = None,
371
+ metadata: Optional[
372
+ Union[
373
+ List[models.UpdateHecTokenRequestMetadatum],
374
+ List[models.UpdateHecTokenRequestMetadatumTypedDict],
375
+ ]
376
+ ] = None,
377
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
378
+ server_url: Optional[str] = None,
379
+ timeout_ms: Optional[int] = None,
380
+ http_headers: Optional[Mapping[str, str]] = None,
381
+ ) -> models.UpdateInputHecTokenByIDAndTokenResponse:
382
+ r"""Update metadata for an HEC token for a Splunk HEC Source
383
+
384
+ Update token metadata on existing HEC Source
385
+
386
+ :param id: HEC Source id
387
+ :param token: token to update
388
+ :param description:
389
+ :param enabled:
390
+ :param metadata:
391
+ :param retries: Override the default retry configuration for this method
392
+ :param server_url: Override the default server URL for this method
393
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
394
+ :param http_headers: Additional headers to set or replace on requests.
395
+ """
396
+ base_url = None
397
+ url_variables = None
398
+ if timeout_ms is None:
399
+ timeout_ms = self.sdk_configuration.timeout_ms
400
+
401
+ if server_url is not None:
402
+ base_url = server_url
403
+ else:
404
+ base_url = self._get_url(base_url, url_variables)
405
+
406
+ request = models.UpdateInputHecTokenByIDAndTokenRequest(
407
+ id=id,
408
+ token=token,
409
+ update_hec_token_request=models.UpdateHecTokenRequest(
410
+ description=description,
411
+ enabled=enabled,
412
+ metadata=utils.get_pydantic_model(
413
+ metadata, Optional[List[models.UpdateHecTokenRequestMetadatum]]
414
+ ),
415
+ ),
416
+ )
417
+
418
+ req = self._build_request_async(
419
+ method="PATCH",
420
+ path="/system/inputs/{id}/hectoken/{token}",
421
+ base_url=base_url,
422
+ url_variables=url_variables,
423
+ request=request,
424
+ request_body_required=True,
425
+ request_has_path_params=True,
426
+ request_has_query_params=True,
427
+ user_agent_header="user-agent",
428
+ accept_header_value="application/json",
429
+ http_headers=http_headers,
430
+ security=self.sdk_configuration.security,
431
+ get_serialized_body=lambda: utils.serialize_request_body(
432
+ request.update_hec_token_request,
433
+ False,
434
+ False,
435
+ "json",
436
+ models.UpdateHecTokenRequest,
437
+ ),
438
+ timeout_ms=timeout_ms,
439
+ )
440
+
441
+ if retries == UNSET:
442
+ if self.sdk_configuration.retry_config is not UNSET:
443
+ retries = self.sdk_configuration.retry_config
444
+
445
+ retry_config = None
446
+ if isinstance(retries, utils.RetryConfig):
447
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
448
+
449
+ http_res = await self.do_request_async(
450
+ hook_ctx=HookContext(
451
+ config=self.sdk_configuration,
452
+ base_url=base_url or "",
453
+ operation_id="updateInputHecTokenByIdAndToken",
454
+ oauth2_scopes=[],
455
+ security_source=get_security_from_env(
456
+ self.sdk_configuration.security, models.Security
457
+ ),
458
+ ),
459
+ request=req,
460
+ error_status_codes=["401", "4XX", "500", "5XX"],
461
+ retry_config=retry_config,
462
+ )
463
+
464
+ response_data: Any = None
465
+ if utils.match_response(http_res, "200", "application/json"):
466
+ return unmarshal_json_response(
467
+ models.UpdateInputHecTokenByIDAndTokenResponse, http_res
468
+ )
469
+ if utils.match_response(http_res, "500", "application/json"):
470
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
471
+ raise errors.Error(response_data, http_res)
472
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
473
+ http_res_text = await utils.stream_to_text_async(http_res)
474
+ raise errors.APIError("API error occurred", http_res, http_res_text)
475
+ if utils.match_response(http_res, "5XX", "*"):
476
+ http_res_text = await utils.stream_to_text_async(http_res)
477
+ raise errors.APIError("API error occurred", http_res, http_res_text)
478
+
479
+ raise errors.APIError("Unexpected response received", http_res)
@@ -82,10 +82,6 @@ if TYPE_CHECKING:
82
82
  CreateVersionRevertResponse,
83
83
  CreateVersionRevertResponseTypedDict,
84
84
  )
85
- from .createversionsyncop import (
86
- CreateVersionSyncResponse,
87
- CreateVersionSyncResponseTypedDict,
88
- )
89
85
  from .createversionundoop import (
90
86
  CreateVersionUndoRequest,
91
87
  CreateVersionUndoRequestTypedDict,
@@ -3109,8 +3105,6 @@ __all__ = [
3109
3105
  "CreateVersionRevertRequestTypedDict",
3110
3106
  "CreateVersionRevertResponse",
3111
3107
  "CreateVersionRevertResponseTypedDict",
3112
- "CreateVersionSyncResponse",
3113
- "CreateVersionSyncResponseTypedDict",
3114
3108
  "CreateVersionUndoRequest",
3115
3109
  "CreateVersionUndoRequestTypedDict",
3116
3110
  "CreateVersionUndoResponse",
@@ -5756,8 +5750,6 @@ _dynamic_imports: dict[str, str] = {
5756
5750
  "CreateVersionRevertRequestTypedDict": ".createversionrevertop",
5757
5751
  "CreateVersionRevertResponse": ".createversionrevertop",
5758
5752
  "CreateVersionRevertResponseTypedDict": ".createversionrevertop",
5759
- "CreateVersionSyncResponse": ".createversionsyncop",
5760
- "CreateVersionSyncResponseTypedDict": ".createversionsyncop",
5761
5753
  "CreateVersionUndoRequest": ".createversionundoop",
5762
5754
  "CreateVersionUndoRequestTypedDict": ".createversionundoop",
5763
5755
  "CreateVersionUndoResponse": ".createversionundoop",