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.

@@ -1,17 +1,32 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from .basesdk import BaseSDK
4
+ from .sdkconfiguration import SDKConfiguration
4
5
  from cribl_control_plane import errors, models, utils
5
6
  from cribl_control_plane._hooks import HookContext
7
+ from cribl_control_plane.destinations_pq import DestinationsPq
8
+ from cribl_control_plane.samples import Samples
6
9
  from cribl_control_plane.types import BaseModel, OptionalNullable, UNSET
7
10
  from cribl_control_plane.utils import get_security_from_env
8
11
  from cribl_control_plane.utils.unmarshal_json_response import unmarshal_json_response
9
- from typing import Any, List, Mapping, Optional, Union, cast
12
+ from typing import Any, Mapping, Optional, Union, cast
10
13
 
11
14
 
12
15
  class Destinations(BaseSDK):
13
16
  r"""Actions related to Destinations"""
14
17
 
18
+ pq: DestinationsPq
19
+ samples: Samples
20
+
21
+ def __init__(self, sdk_config: SDKConfiguration) -> None:
22
+ BaseSDK.__init__(self, sdk_config)
23
+ self.sdk_configuration = sdk_config
24
+ self._init_sdks()
25
+
26
+ def _init_sdks(self):
27
+ self.pq = DestinationsPq(self.sdk_configuration)
28
+ self.samples = Samples(self.sdk_configuration)
29
+
15
30
  def list(
16
31
  self,
17
32
  *,
@@ -885,731 +900,3 @@ class Destinations(BaseSDK):
885
900
  raise errors.APIError("API error occurred", http_res, http_res_text)
886
901
 
887
902
  raise errors.APIError("Unexpected response received", http_res)
888
-
889
- def clear_pq(
890
- self,
891
- *,
892
- id: str,
893
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
894
- server_url: Optional[str] = None,
895
- timeout_ms: Optional[int] = None,
896
- http_headers: Optional[Mapping[str, str]] = None,
897
- ) -> models.DeleteOutputPqByIDResponse:
898
- r"""Clear the persistent queue for a Destination
899
-
900
- Clears destination persistent queue
901
-
902
- :param id: Destination Id
903
- :param retries: Override the default retry configuration for this method
904
- :param server_url: Override the default server URL for this method
905
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
906
- :param http_headers: Additional headers to set or replace on requests.
907
- """
908
- base_url = None
909
- url_variables = None
910
- if timeout_ms is None:
911
- timeout_ms = self.sdk_configuration.timeout_ms
912
-
913
- if server_url is not None:
914
- base_url = server_url
915
- else:
916
- base_url = self._get_url(base_url, url_variables)
917
-
918
- request = models.DeleteOutputPqByIDRequest(
919
- id=id,
920
- )
921
-
922
- req = self._build_request(
923
- method="DELETE",
924
- path="/system/outputs/{id}/pq",
925
- base_url=base_url,
926
- url_variables=url_variables,
927
- request=request,
928
- request_body_required=False,
929
- request_has_path_params=True,
930
- request_has_query_params=True,
931
- user_agent_header="user-agent",
932
- accept_header_value="application/json",
933
- http_headers=http_headers,
934
- security=self.sdk_configuration.security,
935
- timeout_ms=timeout_ms,
936
- )
937
-
938
- if retries == UNSET:
939
- if self.sdk_configuration.retry_config is not UNSET:
940
- retries = self.sdk_configuration.retry_config
941
-
942
- retry_config = None
943
- if isinstance(retries, utils.RetryConfig):
944
- retry_config = (retries, ["429", "500", "502", "503", "504"])
945
-
946
- http_res = self.do_request(
947
- hook_ctx=HookContext(
948
- config=self.sdk_configuration,
949
- base_url=base_url or "",
950
- operation_id="deleteOutputPqById",
951
- oauth2_scopes=[],
952
- security_source=get_security_from_env(
953
- self.sdk_configuration.security, models.Security
954
- ),
955
- ),
956
- request=req,
957
- error_status_codes=["401", "4XX", "500", "5XX"],
958
- retry_config=retry_config,
959
- )
960
-
961
- response_data: Any = None
962
- if utils.match_response(http_res, "200", "application/json"):
963
- return unmarshal_json_response(models.DeleteOutputPqByIDResponse, http_res)
964
- if utils.match_response(http_res, "500", "application/json"):
965
- response_data = unmarshal_json_response(errors.ErrorData, http_res)
966
- raise errors.Error(response_data, http_res)
967
- if utils.match_response(http_res, ["401", "4XX"], "*"):
968
- http_res_text = utils.stream_to_text(http_res)
969
- raise errors.APIError("API error occurred", http_res, http_res_text)
970
- if utils.match_response(http_res, "5XX", "*"):
971
- http_res_text = utils.stream_to_text(http_res)
972
- raise errors.APIError("API error occurred", http_res, http_res_text)
973
-
974
- raise errors.APIError("Unexpected response received", http_res)
975
-
976
- async def clear_pq_async(
977
- self,
978
- *,
979
- id: str,
980
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
981
- server_url: Optional[str] = None,
982
- timeout_ms: Optional[int] = None,
983
- http_headers: Optional[Mapping[str, str]] = None,
984
- ) -> models.DeleteOutputPqByIDResponse:
985
- r"""Clear the persistent queue for a Destination
986
-
987
- Clears destination persistent queue
988
-
989
- :param id: Destination Id
990
- :param retries: Override the default retry configuration for this method
991
- :param server_url: Override the default server URL for this method
992
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
993
- :param http_headers: Additional headers to set or replace on requests.
994
- """
995
- base_url = None
996
- url_variables = None
997
- if timeout_ms is None:
998
- timeout_ms = self.sdk_configuration.timeout_ms
999
-
1000
- if server_url is not None:
1001
- base_url = server_url
1002
- else:
1003
- base_url = self._get_url(base_url, url_variables)
1004
-
1005
- request = models.DeleteOutputPqByIDRequest(
1006
- id=id,
1007
- )
1008
-
1009
- req = self._build_request_async(
1010
- method="DELETE",
1011
- path="/system/outputs/{id}/pq",
1012
- base_url=base_url,
1013
- url_variables=url_variables,
1014
- request=request,
1015
- request_body_required=False,
1016
- request_has_path_params=True,
1017
- request_has_query_params=True,
1018
- user_agent_header="user-agent",
1019
- accept_header_value="application/json",
1020
- http_headers=http_headers,
1021
- security=self.sdk_configuration.security,
1022
- timeout_ms=timeout_ms,
1023
- )
1024
-
1025
- if retries == UNSET:
1026
- if self.sdk_configuration.retry_config is not UNSET:
1027
- retries = self.sdk_configuration.retry_config
1028
-
1029
- retry_config = None
1030
- if isinstance(retries, utils.RetryConfig):
1031
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1032
-
1033
- http_res = await self.do_request_async(
1034
- hook_ctx=HookContext(
1035
- config=self.sdk_configuration,
1036
- base_url=base_url or "",
1037
- operation_id="deleteOutputPqById",
1038
- oauth2_scopes=[],
1039
- security_source=get_security_from_env(
1040
- self.sdk_configuration.security, models.Security
1041
- ),
1042
- ),
1043
- request=req,
1044
- error_status_codes=["401", "4XX", "500", "5XX"],
1045
- retry_config=retry_config,
1046
- )
1047
-
1048
- response_data: Any = None
1049
- if utils.match_response(http_res, "200", "application/json"):
1050
- return unmarshal_json_response(models.DeleteOutputPqByIDResponse, http_res)
1051
- if utils.match_response(http_res, "500", "application/json"):
1052
- response_data = unmarshal_json_response(errors.ErrorData, http_res)
1053
- raise errors.Error(response_data, http_res)
1054
- if utils.match_response(http_res, ["401", "4XX"], "*"):
1055
- http_res_text = await utils.stream_to_text_async(http_res)
1056
- raise errors.APIError("API error occurred", http_res, http_res_text)
1057
- if utils.match_response(http_res, "5XX", "*"):
1058
- http_res_text = await utils.stream_to_text_async(http_res)
1059
- raise errors.APIError("API error occurred", http_res, http_res_text)
1060
-
1061
- raise errors.APIError("Unexpected response received", http_res)
1062
-
1063
- def get_pq_status(
1064
- self,
1065
- *,
1066
- id: str,
1067
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
1068
- server_url: Optional[str] = None,
1069
- timeout_ms: Optional[int] = None,
1070
- http_headers: Optional[Mapping[str, str]] = None,
1071
- ) -> models.GetOutputPqByIDResponse:
1072
- r"""Retrieve information about the latest job to clear the persistent queue for a Destination
1073
-
1074
- Retrieves status of latest clear PQ job for a destination
1075
-
1076
- :param id: Destination Id
1077
- :param retries: Override the default retry configuration for this method
1078
- :param server_url: Override the default server URL for this method
1079
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1080
- :param http_headers: Additional headers to set or replace on requests.
1081
- """
1082
- base_url = None
1083
- url_variables = None
1084
- if timeout_ms is None:
1085
- timeout_ms = self.sdk_configuration.timeout_ms
1086
-
1087
- if server_url is not None:
1088
- base_url = server_url
1089
- else:
1090
- base_url = self._get_url(base_url, url_variables)
1091
-
1092
- request = models.GetOutputPqByIDRequest(
1093
- id=id,
1094
- )
1095
-
1096
- req = self._build_request(
1097
- method="GET",
1098
- path="/system/outputs/{id}/pq",
1099
- base_url=base_url,
1100
- url_variables=url_variables,
1101
- request=request,
1102
- request_body_required=False,
1103
- request_has_path_params=True,
1104
- request_has_query_params=True,
1105
- user_agent_header="user-agent",
1106
- accept_header_value="application/json",
1107
- http_headers=http_headers,
1108
- security=self.sdk_configuration.security,
1109
- timeout_ms=timeout_ms,
1110
- )
1111
-
1112
- if retries == UNSET:
1113
- if self.sdk_configuration.retry_config is not UNSET:
1114
- retries = self.sdk_configuration.retry_config
1115
-
1116
- retry_config = None
1117
- if isinstance(retries, utils.RetryConfig):
1118
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1119
-
1120
- http_res = self.do_request(
1121
- hook_ctx=HookContext(
1122
- config=self.sdk_configuration,
1123
- base_url=base_url or "",
1124
- operation_id="getOutputPqById",
1125
- oauth2_scopes=[],
1126
- security_source=get_security_from_env(
1127
- self.sdk_configuration.security, models.Security
1128
- ),
1129
- ),
1130
- request=req,
1131
- error_status_codes=["401", "4XX", "500", "5XX"],
1132
- retry_config=retry_config,
1133
- )
1134
-
1135
- response_data: Any = None
1136
- if utils.match_response(http_res, "200", "application/json"):
1137
- return unmarshal_json_response(models.GetOutputPqByIDResponse, http_res)
1138
- if utils.match_response(http_res, "500", "application/json"):
1139
- response_data = unmarshal_json_response(errors.ErrorData, http_res)
1140
- raise errors.Error(response_data, http_res)
1141
- if utils.match_response(http_res, ["401", "4XX"], "*"):
1142
- http_res_text = utils.stream_to_text(http_res)
1143
- raise errors.APIError("API error occurred", http_res, http_res_text)
1144
- if utils.match_response(http_res, "5XX", "*"):
1145
- http_res_text = utils.stream_to_text(http_res)
1146
- raise errors.APIError("API error occurred", http_res, http_res_text)
1147
-
1148
- raise errors.APIError("Unexpected response received", http_res)
1149
-
1150
- async def get_pq_status_async(
1151
- self,
1152
- *,
1153
- id: str,
1154
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
1155
- server_url: Optional[str] = None,
1156
- timeout_ms: Optional[int] = None,
1157
- http_headers: Optional[Mapping[str, str]] = None,
1158
- ) -> models.GetOutputPqByIDResponse:
1159
- r"""Retrieve information about the latest job to clear the persistent queue for a Destination
1160
-
1161
- Retrieves status of latest clear PQ job for a destination
1162
-
1163
- :param id: Destination Id
1164
- :param retries: Override the default retry configuration for this method
1165
- :param server_url: Override the default server URL for this method
1166
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1167
- :param http_headers: Additional headers to set or replace on requests.
1168
- """
1169
- base_url = None
1170
- url_variables = None
1171
- if timeout_ms is None:
1172
- timeout_ms = self.sdk_configuration.timeout_ms
1173
-
1174
- if server_url is not None:
1175
- base_url = server_url
1176
- else:
1177
- base_url = self._get_url(base_url, url_variables)
1178
-
1179
- request = models.GetOutputPqByIDRequest(
1180
- id=id,
1181
- )
1182
-
1183
- req = self._build_request_async(
1184
- method="GET",
1185
- path="/system/outputs/{id}/pq",
1186
- base_url=base_url,
1187
- url_variables=url_variables,
1188
- request=request,
1189
- request_body_required=False,
1190
- request_has_path_params=True,
1191
- request_has_query_params=True,
1192
- user_agent_header="user-agent",
1193
- accept_header_value="application/json",
1194
- http_headers=http_headers,
1195
- security=self.sdk_configuration.security,
1196
- timeout_ms=timeout_ms,
1197
- )
1198
-
1199
- if retries == UNSET:
1200
- if self.sdk_configuration.retry_config is not UNSET:
1201
- retries = self.sdk_configuration.retry_config
1202
-
1203
- retry_config = None
1204
- if isinstance(retries, utils.RetryConfig):
1205
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1206
-
1207
- http_res = await self.do_request_async(
1208
- hook_ctx=HookContext(
1209
- config=self.sdk_configuration,
1210
- base_url=base_url or "",
1211
- operation_id="getOutputPqById",
1212
- oauth2_scopes=[],
1213
- security_source=get_security_from_env(
1214
- self.sdk_configuration.security, models.Security
1215
- ),
1216
- ),
1217
- request=req,
1218
- error_status_codes=["401", "4XX", "500", "5XX"],
1219
- retry_config=retry_config,
1220
- )
1221
-
1222
- response_data: Any = None
1223
- if utils.match_response(http_res, "200", "application/json"):
1224
- return unmarshal_json_response(models.GetOutputPqByIDResponse, http_res)
1225
- if utils.match_response(http_res, "500", "application/json"):
1226
- response_data = unmarshal_json_response(errors.ErrorData, http_res)
1227
- raise errors.Error(response_data, http_res)
1228
- if utils.match_response(http_res, ["401", "4XX"], "*"):
1229
- http_res_text = await utils.stream_to_text_async(http_res)
1230
- raise errors.APIError("API error occurred", http_res, http_res_text)
1231
- if utils.match_response(http_res, "5XX", "*"):
1232
- http_res_text = await utils.stream_to_text_async(http_res)
1233
- raise errors.APIError("API error occurred", http_res, http_res_text)
1234
-
1235
- raise errors.APIError("Unexpected response received", http_res)
1236
-
1237
- def get_sample(
1238
- self,
1239
- *,
1240
- id: str,
1241
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
1242
- server_url: Optional[str] = None,
1243
- timeout_ms: Optional[int] = None,
1244
- http_headers: Optional[Mapping[str, str]] = None,
1245
- ) -> models.GetOutputSamplesByIDResponse:
1246
- r"""Retrieve sample event data for a Destination
1247
-
1248
- Retrieve samples data for the specified destination. Used to get sample data for the test action.
1249
-
1250
- :param id: Destination Id
1251
- :param retries: Override the default retry configuration for this method
1252
- :param server_url: Override the default server URL for this method
1253
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1254
- :param http_headers: Additional headers to set or replace on requests.
1255
- """
1256
- base_url = None
1257
- url_variables = None
1258
- if timeout_ms is None:
1259
- timeout_ms = self.sdk_configuration.timeout_ms
1260
-
1261
- if server_url is not None:
1262
- base_url = server_url
1263
- else:
1264
- base_url = self._get_url(base_url, url_variables)
1265
-
1266
- request = models.GetOutputSamplesByIDRequest(
1267
- id=id,
1268
- )
1269
-
1270
- req = self._build_request(
1271
- method="GET",
1272
- path="/system/outputs/{id}/samples",
1273
- base_url=base_url,
1274
- url_variables=url_variables,
1275
- request=request,
1276
- request_body_required=False,
1277
- request_has_path_params=True,
1278
- request_has_query_params=True,
1279
- user_agent_header="user-agent",
1280
- accept_header_value="application/json",
1281
- http_headers=http_headers,
1282
- security=self.sdk_configuration.security,
1283
- timeout_ms=timeout_ms,
1284
- )
1285
-
1286
- if retries == UNSET:
1287
- if self.sdk_configuration.retry_config is not UNSET:
1288
- retries = self.sdk_configuration.retry_config
1289
-
1290
- retry_config = None
1291
- if isinstance(retries, utils.RetryConfig):
1292
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1293
-
1294
- http_res = self.do_request(
1295
- hook_ctx=HookContext(
1296
- config=self.sdk_configuration,
1297
- base_url=base_url or "",
1298
- operation_id="getOutputSamplesById",
1299
- oauth2_scopes=[],
1300
- security_source=get_security_from_env(
1301
- self.sdk_configuration.security, models.Security
1302
- ),
1303
- ),
1304
- request=req,
1305
- error_status_codes=["401", "4XX", "500", "5XX"],
1306
- retry_config=retry_config,
1307
- )
1308
-
1309
- response_data: Any = None
1310
- if utils.match_response(http_res, "200", "application/json"):
1311
- return unmarshal_json_response(
1312
- models.GetOutputSamplesByIDResponse, http_res
1313
- )
1314
- if utils.match_response(http_res, "500", "application/json"):
1315
- response_data = unmarshal_json_response(errors.ErrorData, http_res)
1316
- raise errors.Error(response_data, http_res)
1317
- if utils.match_response(http_res, ["401", "4XX"], "*"):
1318
- http_res_text = utils.stream_to_text(http_res)
1319
- raise errors.APIError("API error occurred", http_res, http_res_text)
1320
- if utils.match_response(http_res, "5XX", "*"):
1321
- http_res_text = utils.stream_to_text(http_res)
1322
- raise errors.APIError("API error occurred", http_res, http_res_text)
1323
-
1324
- raise errors.APIError("Unexpected response received", http_res)
1325
-
1326
- async def get_sample_async(
1327
- self,
1328
- *,
1329
- id: str,
1330
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
1331
- server_url: Optional[str] = None,
1332
- timeout_ms: Optional[int] = None,
1333
- http_headers: Optional[Mapping[str, str]] = None,
1334
- ) -> models.GetOutputSamplesByIDResponse:
1335
- r"""Retrieve sample event data for a Destination
1336
-
1337
- Retrieve samples data for the specified destination. Used to get sample data for the test action.
1338
-
1339
- :param id: Destination Id
1340
- :param retries: Override the default retry configuration for this method
1341
- :param server_url: Override the default server URL for this method
1342
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1343
- :param http_headers: Additional headers to set or replace on requests.
1344
- """
1345
- base_url = None
1346
- url_variables = None
1347
- if timeout_ms is None:
1348
- timeout_ms = self.sdk_configuration.timeout_ms
1349
-
1350
- if server_url is not None:
1351
- base_url = server_url
1352
- else:
1353
- base_url = self._get_url(base_url, url_variables)
1354
-
1355
- request = models.GetOutputSamplesByIDRequest(
1356
- id=id,
1357
- )
1358
-
1359
- req = self._build_request_async(
1360
- method="GET",
1361
- path="/system/outputs/{id}/samples",
1362
- base_url=base_url,
1363
- url_variables=url_variables,
1364
- request=request,
1365
- request_body_required=False,
1366
- request_has_path_params=True,
1367
- request_has_query_params=True,
1368
- user_agent_header="user-agent",
1369
- accept_header_value="application/json",
1370
- http_headers=http_headers,
1371
- security=self.sdk_configuration.security,
1372
- timeout_ms=timeout_ms,
1373
- )
1374
-
1375
- if retries == UNSET:
1376
- if self.sdk_configuration.retry_config is not UNSET:
1377
- retries = self.sdk_configuration.retry_config
1378
-
1379
- retry_config = None
1380
- if isinstance(retries, utils.RetryConfig):
1381
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1382
-
1383
- http_res = await self.do_request_async(
1384
- hook_ctx=HookContext(
1385
- config=self.sdk_configuration,
1386
- base_url=base_url or "",
1387
- operation_id="getOutputSamplesById",
1388
- oauth2_scopes=[],
1389
- security_source=get_security_from_env(
1390
- self.sdk_configuration.security, models.Security
1391
- ),
1392
- ),
1393
- request=req,
1394
- error_status_codes=["401", "4XX", "500", "5XX"],
1395
- retry_config=retry_config,
1396
- )
1397
-
1398
- response_data: Any = None
1399
- if utils.match_response(http_res, "200", "application/json"):
1400
- return unmarshal_json_response(
1401
- models.GetOutputSamplesByIDResponse, http_res
1402
- )
1403
- if utils.match_response(http_res, "500", "application/json"):
1404
- response_data = unmarshal_json_response(errors.ErrorData, http_res)
1405
- raise errors.Error(response_data, http_res)
1406
- if utils.match_response(http_res, ["401", "4XX"], "*"):
1407
- http_res_text = await utils.stream_to_text_async(http_res)
1408
- raise errors.APIError("API error occurred", http_res, http_res_text)
1409
- if utils.match_response(http_res, "5XX", "*"):
1410
- http_res_text = await utils.stream_to_text_async(http_res)
1411
- raise errors.APIError("API error occurred", http_res, http_res_text)
1412
-
1413
- raise errors.APIError("Unexpected response received", http_res)
1414
-
1415
- def create_sample(
1416
- self,
1417
- *,
1418
- id: str,
1419
- events: Union[List[models.CriblEvent], List[models.CriblEventTypedDict]],
1420
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
1421
- server_url: Optional[str] = None,
1422
- timeout_ms: Optional[int] = None,
1423
- http_headers: Optional[Mapping[str, str]] = None,
1424
- ) -> models.CreateOutputTestByIDResponse:
1425
- r"""Send sample event data to a Destination
1426
-
1427
- Send sample data to a destination to validate configuration or test connectivity
1428
-
1429
- :param id: Destination Id
1430
- :param events:
1431
- :param retries: Override the default retry configuration for this method
1432
- :param server_url: Override the default server URL for this method
1433
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1434
- :param http_headers: Additional headers to set or replace on requests.
1435
- """
1436
- base_url = None
1437
- url_variables = None
1438
- if timeout_ms is None:
1439
- timeout_ms = self.sdk_configuration.timeout_ms
1440
-
1441
- if server_url is not None:
1442
- base_url = server_url
1443
- else:
1444
- base_url = self._get_url(base_url, url_variables)
1445
-
1446
- request = models.CreateOutputTestByIDRequest(
1447
- id=id,
1448
- output_test_request=models.OutputTestRequest(
1449
- events=utils.get_pydantic_model(events, List[models.CriblEvent]),
1450
- ),
1451
- )
1452
-
1453
- req = self._build_request(
1454
- method="POST",
1455
- path="/system/outputs/{id}/test",
1456
- base_url=base_url,
1457
- url_variables=url_variables,
1458
- request=request,
1459
- request_body_required=True,
1460
- request_has_path_params=True,
1461
- request_has_query_params=True,
1462
- user_agent_header="user-agent",
1463
- accept_header_value="application/json",
1464
- http_headers=http_headers,
1465
- security=self.sdk_configuration.security,
1466
- get_serialized_body=lambda: utils.serialize_request_body(
1467
- request.output_test_request,
1468
- False,
1469
- False,
1470
- "json",
1471
- models.OutputTestRequest,
1472
- ),
1473
- timeout_ms=timeout_ms,
1474
- )
1475
-
1476
- if retries == UNSET:
1477
- if self.sdk_configuration.retry_config is not UNSET:
1478
- retries = self.sdk_configuration.retry_config
1479
-
1480
- retry_config = None
1481
- if isinstance(retries, utils.RetryConfig):
1482
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1483
-
1484
- http_res = self.do_request(
1485
- hook_ctx=HookContext(
1486
- config=self.sdk_configuration,
1487
- base_url=base_url or "",
1488
- operation_id="createOutputTestById",
1489
- oauth2_scopes=[],
1490
- security_source=get_security_from_env(
1491
- self.sdk_configuration.security, models.Security
1492
- ),
1493
- ),
1494
- request=req,
1495
- error_status_codes=["401", "4XX", "500", "5XX"],
1496
- retry_config=retry_config,
1497
- )
1498
-
1499
- response_data: Any = None
1500
- if utils.match_response(http_res, "200", "application/json"):
1501
- return unmarshal_json_response(
1502
- models.CreateOutputTestByIDResponse, http_res
1503
- )
1504
- if utils.match_response(http_res, "500", "application/json"):
1505
- response_data = unmarshal_json_response(errors.ErrorData, http_res)
1506
- raise errors.Error(response_data, http_res)
1507
- if utils.match_response(http_res, ["401", "4XX"], "*"):
1508
- http_res_text = utils.stream_to_text(http_res)
1509
- raise errors.APIError("API error occurred", http_res, http_res_text)
1510
- if utils.match_response(http_res, "5XX", "*"):
1511
- http_res_text = utils.stream_to_text(http_res)
1512
- raise errors.APIError("API error occurred", http_res, http_res_text)
1513
-
1514
- raise errors.APIError("Unexpected response received", http_res)
1515
-
1516
- async def create_sample_async(
1517
- self,
1518
- *,
1519
- id: str,
1520
- events: Union[List[models.CriblEvent], List[models.CriblEventTypedDict]],
1521
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
1522
- server_url: Optional[str] = None,
1523
- timeout_ms: Optional[int] = None,
1524
- http_headers: Optional[Mapping[str, str]] = None,
1525
- ) -> models.CreateOutputTestByIDResponse:
1526
- r"""Send sample event data to a Destination
1527
-
1528
- Send sample data to a destination to validate configuration or test connectivity
1529
-
1530
- :param id: Destination Id
1531
- :param events:
1532
- :param retries: Override the default retry configuration for this method
1533
- :param server_url: Override the default server URL for this method
1534
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1535
- :param http_headers: Additional headers to set or replace on requests.
1536
- """
1537
- base_url = None
1538
- url_variables = None
1539
- if timeout_ms is None:
1540
- timeout_ms = self.sdk_configuration.timeout_ms
1541
-
1542
- if server_url is not None:
1543
- base_url = server_url
1544
- else:
1545
- base_url = self._get_url(base_url, url_variables)
1546
-
1547
- request = models.CreateOutputTestByIDRequest(
1548
- id=id,
1549
- output_test_request=models.OutputTestRequest(
1550
- events=utils.get_pydantic_model(events, List[models.CriblEvent]),
1551
- ),
1552
- )
1553
-
1554
- req = self._build_request_async(
1555
- method="POST",
1556
- path="/system/outputs/{id}/test",
1557
- base_url=base_url,
1558
- url_variables=url_variables,
1559
- request=request,
1560
- request_body_required=True,
1561
- request_has_path_params=True,
1562
- request_has_query_params=True,
1563
- user_agent_header="user-agent",
1564
- accept_header_value="application/json",
1565
- http_headers=http_headers,
1566
- security=self.sdk_configuration.security,
1567
- get_serialized_body=lambda: utils.serialize_request_body(
1568
- request.output_test_request,
1569
- False,
1570
- False,
1571
- "json",
1572
- models.OutputTestRequest,
1573
- ),
1574
- timeout_ms=timeout_ms,
1575
- )
1576
-
1577
- if retries == UNSET:
1578
- if self.sdk_configuration.retry_config is not UNSET:
1579
- retries = self.sdk_configuration.retry_config
1580
-
1581
- retry_config = None
1582
- if isinstance(retries, utils.RetryConfig):
1583
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1584
-
1585
- http_res = await self.do_request_async(
1586
- hook_ctx=HookContext(
1587
- config=self.sdk_configuration,
1588
- base_url=base_url or "",
1589
- operation_id="createOutputTestById",
1590
- oauth2_scopes=[],
1591
- security_source=get_security_from_env(
1592
- self.sdk_configuration.security, models.Security
1593
- ),
1594
- ),
1595
- request=req,
1596
- error_status_codes=["401", "4XX", "500", "5XX"],
1597
- retry_config=retry_config,
1598
- )
1599
-
1600
- response_data: Any = None
1601
- if utils.match_response(http_res, "200", "application/json"):
1602
- return unmarshal_json_response(
1603
- models.CreateOutputTestByIDResponse, http_res
1604
- )
1605
- if utils.match_response(http_res, "500", "application/json"):
1606
- response_data = unmarshal_json_response(errors.ErrorData, http_res)
1607
- raise errors.Error(response_data, http_res)
1608
- if utils.match_response(http_res, ["401", "4XX"], "*"):
1609
- http_res_text = await utils.stream_to_text_async(http_res)
1610
- raise errors.APIError("API error occurred", http_res, http_res_text)
1611
- if utils.match_response(http_res, "5XX", "*"):
1612
- http_res_text = await utils.stream_to_text_async(http_res)
1613
- raise errors.APIError("API error occurred", http_res, http_res_text)
1614
-
1615
- raise errors.APIError("Unexpected response received", http_res)