darkhunt-api 0.1.1__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.
Files changed (83) hide show
  1. darkhunt_api/__init__.py +21 -0
  2. darkhunt_api/guardrail_manager/__init__.py +63 -0
  3. darkhunt_api/guardrail_manager/api/__init__.py +7 -0
  4. darkhunt_api/guardrail_manager/api/analytics_api.py +605 -0
  5. darkhunt_api/guardrail_manager/api/guardrail_rules_api.py +1768 -0
  6. darkhunt_api/guardrail_manager/api/integrations_api.py +589 -0
  7. darkhunt_api/guardrail_manager/api_client.py +731 -0
  8. darkhunt_api/guardrail_manager/api_response.py +21 -0
  9. darkhunt_api/guardrail_manager/configuration.py +443 -0
  10. darkhunt_api/guardrail_manager/exceptions.py +200 -0
  11. darkhunt_api/guardrail_manager/models/__init__.py +44 -0
  12. darkhunt_api/guardrail_manager/models/aggregation.py +94 -0
  13. darkhunt_api/guardrail_manager/models/aggregation_function.py +49 -0
  14. darkhunt_api/guardrail_manager/models/analytics_request.py +130 -0
  15. darkhunt_api/guardrail_manager/models/analytics_request_group_by_inner.py +150 -0
  16. darkhunt_api/guardrail_manager/models/analytics_response.py +89 -0
  17. darkhunt_api/guardrail_manager/models/dataset_definition.py +113 -0
  18. darkhunt_api/guardrail_manager/models/dataset_registry.py +96 -0
  19. darkhunt_api/guardrail_manager/models/email_integration_config.py +95 -0
  20. darkhunt_api/guardrail_manager/models/error_response.py +95 -0
  21. darkhunt_api/guardrail_manager/models/field_definition.py +105 -0
  22. darkhunt_api/guardrail_manager/models/field_type.py +53 -0
  23. darkhunt_api/guardrail_manager/models/guardrail_rule.py +140 -0
  24. darkhunt_api/guardrail_manager/models/guardrail_rule_action.py +108 -0
  25. darkhunt_api/guardrail_manager/models/guardrail_rule_create_request.py +130 -0
  26. darkhunt_api/guardrail_manager/models/guardrail_rule_field_definition.py +105 -0
  27. darkhunt_api/guardrail_manager/models/guardrail_rule_update_request.py +124 -0
  28. darkhunt_api/guardrail_manager/models/http_integration_config.py +93 -0
  29. darkhunt_api/guardrail_manager/models/integration.py +120 -0
  30. darkhunt_api/guardrail_manager/models/integration_type.py +46 -0
  31. darkhunt_api/guardrail_manager/models/join_cardinality.py +47 -0
  32. darkhunt_api/guardrail_manager/models/join_config.py +117 -0
  33. darkhunt_api/guardrail_manager/models/join_on.py +91 -0
  34. darkhunt_api/guardrail_manager/models/join_order_by.py +101 -0
  35. darkhunt_api/guardrail_manager/models/join_relationship.py +100 -0
  36. darkhunt_api/guardrail_manager/models/operator_type.py +64 -0
  37. darkhunt_api/guardrail_manager/models/order_by.py +101 -0
  38. darkhunt_api/guardrail_manager/models/slack_integration_config.py +93 -0
  39. darkhunt_api/guardrail_manager/models/time_bucket_group_by.py +92 -0
  40. darkhunt_api/guardrail_manager/rest.py +267 -0
  41. darkhunt_api/workflow_manager/__init__.py +63 -0
  42. darkhunt_api/workflow_manager/api/__init__.py +7 -0
  43. darkhunt_api/workflow_manager/api/analytics_api.py +608 -0
  44. darkhunt_api/workflow_manager/api/applications_api.py +1556 -0
  45. darkhunt_api/workflow_manager/api/workspaces_api.py +1475 -0
  46. darkhunt_api/workflow_manager/api_client.py +731 -0
  47. darkhunt_api/workflow_manager/api_response.py +21 -0
  48. darkhunt_api/workflow_manager/configuration.py +443 -0
  49. darkhunt_api/workflow_manager/exceptions.py +200 -0
  50. darkhunt_api/workflow_manager/models/__init__.py +44 -0
  51. darkhunt_api/workflow_manager/models/aggregation.py +94 -0
  52. darkhunt_api/workflow_manager/models/aggregation_function.py +49 -0
  53. darkhunt_api/workflow_manager/models/analytics_request.py +130 -0
  54. darkhunt_api/workflow_manager/models/analytics_request_group_by_inner.py +150 -0
  55. darkhunt_api/workflow_manager/models/analytics_response.py +97 -0
  56. darkhunt_api/workflow_manager/models/analytics_row.py +106 -0
  57. darkhunt_api/workflow_manager/models/application.py +124 -0
  58. darkhunt_api/workflow_manager/models/application_create_request.py +97 -0
  59. darkhunt_api/workflow_manager/models/application_status.py +48 -0
  60. darkhunt_api/workflow_manager/models/application_type.py +46 -0
  61. darkhunt_api/workflow_manager/models/application_update_request.py +94 -0
  62. darkhunt_api/workflow_manager/models/dataset_definition.py +113 -0
  63. darkhunt_api/workflow_manager/models/dataset_registry.py +96 -0
  64. darkhunt_api/workflow_manager/models/drill_down.py +97 -0
  65. darkhunt_api/workflow_manager/models/error_response.py +101 -0
  66. darkhunt_api/workflow_manager/models/field_definition.py +105 -0
  67. darkhunt_api/workflow_manager/models/field_type.py +53 -0
  68. darkhunt_api/workflow_manager/models/join_cardinality.py +47 -0
  69. darkhunt_api/workflow_manager/models/join_config.py +117 -0
  70. darkhunt_api/workflow_manager/models/join_on.py +91 -0
  71. darkhunt_api/workflow_manager/models/join_order_by.py +101 -0
  72. darkhunt_api/workflow_manager/models/join_relationship.py +100 -0
  73. darkhunt_api/workflow_manager/models/operator_type.py +64 -0
  74. darkhunt_api/workflow_manager/models/order_by.py +101 -0
  75. darkhunt_api/workflow_manager/models/time_bucket_group_by.py +92 -0
  76. darkhunt_api/workflow_manager/models/workspace.py +102 -0
  77. darkhunt_api/workflow_manager/models/workspace_create_request.py +94 -0
  78. darkhunt_api/workflow_manager/models/workspace_update_request.py +94 -0
  79. darkhunt_api/workflow_manager/rest.py +267 -0
  80. darkhunt_api-0.1.1.dist-info/METADATA +99 -0
  81. darkhunt_api-0.1.1.dist-info/RECORD +83 -0
  82. darkhunt_api-0.1.1.dist-info/WHEEL +4 -0
  83. darkhunt_api-0.1.1.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,1768 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Guardrail Manager API
5
+
6
+ API for managing guardrail rules, enforcement logs, and integrations
7
+
8
+ The version of the OpenAPI document: 0.5.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ import io
16
+ import warnings
17
+
18
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
19
+ from typing import Dict, List, Optional, Tuple, Union, Any
20
+
21
+ try:
22
+ from typing import Annotated
23
+ except ImportError:
24
+ from typing_extensions import Annotated
25
+
26
+ from pydantic import Field
27
+ from typing_extensions import Annotated
28
+ from pydantic import StrictStr
29
+
30
+ from typing import Dict, List, Optional
31
+
32
+ from darkhunt_api.guardrail_manager.models.guardrail_rule import GuardrailRule
33
+ from darkhunt_api.guardrail_manager.models.guardrail_rule_create_request import GuardrailRuleCreateRequest
34
+ from darkhunt_api.guardrail_manager.models.guardrail_rule_field_definition import GuardrailRuleFieldDefinition
35
+ from darkhunt_api.guardrail_manager.models.guardrail_rule_update_request import GuardrailRuleUpdateRequest
36
+
37
+ from darkhunt_api.guardrail_manager.api_client import ApiClient
38
+ from darkhunt_api.guardrail_manager.api_response import ApiResponse
39
+ from darkhunt_api.guardrail_manager.rest import RESTResponseType
40
+
41
+
42
+ class GuardrailRulesApi:
43
+ """NOTE: This class is auto generated by OpenAPI Generator
44
+ Ref: https://openapi-generator.tech
45
+
46
+ Do not edit the class manually.
47
+ """
48
+
49
+ def __init__(self, api_client=None) -> None:
50
+ if api_client is None:
51
+ api_client = ApiClient.get_default()
52
+ self.api_client = api_client
53
+
54
+
55
+ @validate_call
56
+ def create_guardrail_rule(
57
+ self,
58
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
59
+ guardrail_rule_create_request: GuardrailRuleCreateRequest,
60
+ _request_timeout: Union[
61
+ None,
62
+ Annotated[StrictFloat, Field(gt=0)],
63
+ Tuple[
64
+ Annotated[StrictFloat, Field(gt=0)],
65
+ Annotated[StrictFloat, Field(gt=0)]
66
+ ]
67
+ ] = None,
68
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
69
+ _content_type: Optional[StrictStr] = None,
70
+ _headers: Optional[Dict[StrictStr, Any]] = None,
71
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
72
+ ) -> GuardrailRule:
73
+ """Create guardrail rule
74
+
75
+ Creates a new guardrail rule. The condition field must be a valid HuntQL expression compatible with the specified factType schema (SESSION_SEGMENT or USER_PROFILE). If workspaceId is omitted, the rule applies to all workspaces. If applicationId is omitted, the rule applies to all applications.
76
+
77
+ :param tenant_id: Unique tenant identifier (required)
78
+ :type tenant_id: str
79
+ :param guardrail_rule_create_request: (required)
80
+ :type guardrail_rule_create_request: GuardrailRuleCreateRequest
81
+ :param _request_timeout: timeout setting for this request. If one
82
+ number provided, it will be total request
83
+ timeout. It can also be a pair (tuple) of
84
+ (connection, read) timeouts.
85
+ :type _request_timeout: int, tuple(int, int), optional
86
+ :param _request_auth: set to override the auth_settings for an a single
87
+ request; this effectively ignores the
88
+ authentication in the spec for a single request.
89
+ :type _request_auth: dict, optional
90
+ :param _content_type: force content-type for the request.
91
+ :type _content_type: str, Optional
92
+ :param _headers: set to override the headers for a single
93
+ request; this effectively ignores the headers
94
+ in the spec for a single request.
95
+ :type _headers: dict, optional
96
+ :param _host_index: set to override the host_index for a single
97
+ request; this effectively ignores the host_index
98
+ in the spec for a single request.
99
+ :type _host_index: int, optional
100
+ :return: Returns the result object.
101
+ """ # noqa: E501
102
+
103
+ _param = self._create_guardrail_rule_serialize(
104
+ tenant_id=tenant_id,
105
+ guardrail_rule_create_request=guardrail_rule_create_request,
106
+ _request_auth=_request_auth,
107
+ _content_type=_content_type,
108
+ _headers=_headers,
109
+ _host_index=_host_index
110
+ )
111
+
112
+ _response_types_map: Dict[str, Optional[str]] = {
113
+ '201': "GuardrailRule",
114
+ '400': "ErrorResponse",
115
+ '500': "ErrorResponse",
116
+ }
117
+ response_data = self.api_client.call_api(
118
+ *_param,
119
+ _request_timeout=_request_timeout
120
+ )
121
+ response_data.read()
122
+ return self.api_client.response_deserialize(
123
+ response_data=response_data,
124
+ response_types_map=_response_types_map,
125
+ ).data
126
+
127
+
128
+ @validate_call
129
+ def create_guardrail_rule_with_http_info(
130
+ self,
131
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
132
+ guardrail_rule_create_request: GuardrailRuleCreateRequest,
133
+ _request_timeout: Union[
134
+ None,
135
+ Annotated[StrictFloat, Field(gt=0)],
136
+ Tuple[
137
+ Annotated[StrictFloat, Field(gt=0)],
138
+ Annotated[StrictFloat, Field(gt=0)]
139
+ ]
140
+ ] = None,
141
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
142
+ _content_type: Optional[StrictStr] = None,
143
+ _headers: Optional[Dict[StrictStr, Any]] = None,
144
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
145
+ ) -> ApiResponse[GuardrailRule]:
146
+ """Create guardrail rule
147
+
148
+ Creates a new guardrail rule. The condition field must be a valid HuntQL expression compatible with the specified factType schema (SESSION_SEGMENT or USER_PROFILE). If workspaceId is omitted, the rule applies to all workspaces. If applicationId is omitted, the rule applies to all applications.
149
+
150
+ :param tenant_id: Unique tenant identifier (required)
151
+ :type tenant_id: str
152
+ :param guardrail_rule_create_request: (required)
153
+ :type guardrail_rule_create_request: GuardrailRuleCreateRequest
154
+ :param _request_timeout: timeout setting for this request. If one
155
+ number provided, it will be total request
156
+ timeout. It can also be a pair (tuple) of
157
+ (connection, read) timeouts.
158
+ :type _request_timeout: int, tuple(int, int), optional
159
+ :param _request_auth: set to override the auth_settings for an a single
160
+ request; this effectively ignores the
161
+ authentication in the spec for a single request.
162
+ :type _request_auth: dict, optional
163
+ :param _content_type: force content-type for the request.
164
+ :type _content_type: str, Optional
165
+ :param _headers: set to override the headers for a single
166
+ request; this effectively ignores the headers
167
+ in the spec for a single request.
168
+ :type _headers: dict, optional
169
+ :param _host_index: set to override the host_index for a single
170
+ request; this effectively ignores the host_index
171
+ in the spec for a single request.
172
+ :type _host_index: int, optional
173
+ :return: Returns the result object.
174
+ """ # noqa: E501
175
+
176
+ _param = self._create_guardrail_rule_serialize(
177
+ tenant_id=tenant_id,
178
+ guardrail_rule_create_request=guardrail_rule_create_request,
179
+ _request_auth=_request_auth,
180
+ _content_type=_content_type,
181
+ _headers=_headers,
182
+ _host_index=_host_index
183
+ )
184
+
185
+ _response_types_map: Dict[str, Optional[str]] = {
186
+ '201': "GuardrailRule",
187
+ '400': "ErrorResponse",
188
+ '500': "ErrorResponse",
189
+ }
190
+ response_data = self.api_client.call_api(
191
+ *_param,
192
+ _request_timeout=_request_timeout
193
+ )
194
+ response_data.read()
195
+ return self.api_client.response_deserialize(
196
+ response_data=response_data,
197
+ response_types_map=_response_types_map,
198
+ )
199
+
200
+
201
+ @validate_call
202
+ def create_guardrail_rule_without_preload_content(
203
+ self,
204
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
205
+ guardrail_rule_create_request: GuardrailRuleCreateRequest,
206
+ _request_timeout: Union[
207
+ None,
208
+ Annotated[StrictFloat, Field(gt=0)],
209
+ Tuple[
210
+ Annotated[StrictFloat, Field(gt=0)],
211
+ Annotated[StrictFloat, Field(gt=0)]
212
+ ]
213
+ ] = None,
214
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
215
+ _content_type: Optional[StrictStr] = None,
216
+ _headers: Optional[Dict[StrictStr, Any]] = None,
217
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
218
+ ) -> RESTResponseType:
219
+ """Create guardrail rule
220
+
221
+ Creates a new guardrail rule. The condition field must be a valid HuntQL expression compatible with the specified factType schema (SESSION_SEGMENT or USER_PROFILE). If workspaceId is omitted, the rule applies to all workspaces. If applicationId is omitted, the rule applies to all applications.
222
+
223
+ :param tenant_id: Unique tenant identifier (required)
224
+ :type tenant_id: str
225
+ :param guardrail_rule_create_request: (required)
226
+ :type guardrail_rule_create_request: GuardrailRuleCreateRequest
227
+ :param _request_timeout: timeout setting for this request. If one
228
+ number provided, it will be total request
229
+ timeout. It can also be a pair (tuple) of
230
+ (connection, read) timeouts.
231
+ :type _request_timeout: int, tuple(int, int), optional
232
+ :param _request_auth: set to override the auth_settings for an a single
233
+ request; this effectively ignores the
234
+ authentication in the spec for a single request.
235
+ :type _request_auth: dict, optional
236
+ :param _content_type: force content-type for the request.
237
+ :type _content_type: str, Optional
238
+ :param _headers: set to override the headers for a single
239
+ request; this effectively ignores the headers
240
+ in the spec for a single request.
241
+ :type _headers: dict, optional
242
+ :param _host_index: set to override the host_index for a single
243
+ request; this effectively ignores the host_index
244
+ in the spec for a single request.
245
+ :type _host_index: int, optional
246
+ :return: Returns the result object.
247
+ """ # noqa: E501
248
+
249
+ _param = self._create_guardrail_rule_serialize(
250
+ tenant_id=tenant_id,
251
+ guardrail_rule_create_request=guardrail_rule_create_request,
252
+ _request_auth=_request_auth,
253
+ _content_type=_content_type,
254
+ _headers=_headers,
255
+ _host_index=_host_index
256
+ )
257
+
258
+ _response_types_map: Dict[str, Optional[str]] = {
259
+ '201': "GuardrailRule",
260
+ '400': "ErrorResponse",
261
+ '500': "ErrorResponse",
262
+ }
263
+ response_data = self.api_client.call_api(
264
+ *_param,
265
+ _request_timeout=_request_timeout
266
+ )
267
+ return response_data.response
268
+
269
+
270
+ def _create_guardrail_rule_serialize(
271
+ self,
272
+ tenant_id,
273
+ guardrail_rule_create_request,
274
+ _request_auth,
275
+ _content_type,
276
+ _headers,
277
+ _host_index,
278
+ ) -> Tuple:
279
+
280
+ _host = None
281
+
282
+ _collection_formats: Dict[str, str] = {
283
+ }
284
+
285
+ _path_params: Dict[str, str] = {}
286
+ _query_params: List[Tuple[str, str]] = []
287
+ _header_params: Dict[str, Optional[str]] = _headers or {}
288
+ _form_params: List[Tuple[str, str]] = []
289
+ _files: Dict[str, str] = {}
290
+ _body_params: Optional[bytes] = None
291
+
292
+ # process the path parameters
293
+ if tenant_id is not None:
294
+ _path_params['tenantId'] = tenant_id
295
+ # process the query parameters
296
+ # process the header parameters
297
+ # process the form parameters
298
+ # process the body parameter
299
+ if guardrail_rule_create_request is not None:
300
+ _body_params = guardrail_rule_create_request
301
+
302
+
303
+ # set the HTTP header `Accept`
304
+ _header_params['Accept'] = self.api_client.select_header_accept(
305
+ [
306
+ 'application/json'
307
+ ]
308
+ )
309
+
310
+ # set the HTTP header `Content-Type`
311
+ if _content_type:
312
+ _header_params['Content-Type'] = _content_type
313
+ else:
314
+ _default_content_type = (
315
+ self.api_client.select_header_content_type(
316
+ [
317
+ 'application/json'
318
+ ]
319
+ )
320
+ )
321
+ if _default_content_type is not None:
322
+ _header_params['Content-Type'] = _default_content_type
323
+
324
+ # authentication setting
325
+ _auth_settings: List[str] = [
326
+ 'bearerHttpAuthentication'
327
+ ]
328
+
329
+ return self.api_client.param_serialize(
330
+ method='POST',
331
+ resource_path='/api/t/{tenantId}/guardrail-rules',
332
+ path_params=_path_params,
333
+ query_params=_query_params,
334
+ header_params=_header_params,
335
+ body=_body_params,
336
+ post_params=_form_params,
337
+ files=_files,
338
+ auth_settings=_auth_settings,
339
+ collection_formats=_collection_formats,
340
+ _host=_host,
341
+ _request_auth=_request_auth
342
+ )
343
+
344
+
345
+
346
+
347
+ @validate_call
348
+ def delete_guardrail_rule(
349
+ self,
350
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
351
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
352
+ _request_timeout: Union[
353
+ None,
354
+ Annotated[StrictFloat, Field(gt=0)],
355
+ Tuple[
356
+ Annotated[StrictFloat, Field(gt=0)],
357
+ Annotated[StrictFloat, Field(gt=0)]
358
+ ]
359
+ ] = None,
360
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
361
+ _content_type: Optional[StrictStr] = None,
362
+ _headers: Optional[Dict[StrictStr, Any]] = None,
363
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
364
+ ) -> None:
365
+ """Delete guardrail rule
366
+
367
+ Deletes a guardrail rule.
368
+
369
+ :param tenant_id: Unique tenant identifier (required)
370
+ :type tenant_id: str
371
+ :param rule_id: Guardrail rule identifier (required)
372
+ :type rule_id: str
373
+ :param _request_timeout: timeout setting for this request. If one
374
+ number provided, it will be total request
375
+ timeout. It can also be a pair (tuple) of
376
+ (connection, read) timeouts.
377
+ :type _request_timeout: int, tuple(int, int), optional
378
+ :param _request_auth: set to override the auth_settings for an a single
379
+ request; this effectively ignores the
380
+ authentication in the spec for a single request.
381
+ :type _request_auth: dict, optional
382
+ :param _content_type: force content-type for the request.
383
+ :type _content_type: str, Optional
384
+ :param _headers: set to override the headers for a single
385
+ request; this effectively ignores the headers
386
+ in the spec for a single request.
387
+ :type _headers: dict, optional
388
+ :param _host_index: set to override the host_index for a single
389
+ request; this effectively ignores the host_index
390
+ in the spec for a single request.
391
+ :type _host_index: int, optional
392
+ :return: Returns the result object.
393
+ """ # noqa: E501
394
+
395
+ _param = self._delete_guardrail_rule_serialize(
396
+ tenant_id=tenant_id,
397
+ rule_id=rule_id,
398
+ _request_auth=_request_auth,
399
+ _content_type=_content_type,
400
+ _headers=_headers,
401
+ _host_index=_host_index
402
+ )
403
+
404
+ _response_types_map: Dict[str, Optional[str]] = {
405
+ '204': None,
406
+ '404': "ErrorResponse",
407
+ '500': "ErrorResponse",
408
+ }
409
+ response_data = self.api_client.call_api(
410
+ *_param,
411
+ _request_timeout=_request_timeout
412
+ )
413
+ response_data.read()
414
+ return self.api_client.response_deserialize(
415
+ response_data=response_data,
416
+ response_types_map=_response_types_map,
417
+ ).data
418
+
419
+
420
+ @validate_call
421
+ def delete_guardrail_rule_with_http_info(
422
+ self,
423
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
424
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
425
+ _request_timeout: Union[
426
+ None,
427
+ Annotated[StrictFloat, Field(gt=0)],
428
+ Tuple[
429
+ Annotated[StrictFloat, Field(gt=0)],
430
+ Annotated[StrictFloat, Field(gt=0)]
431
+ ]
432
+ ] = None,
433
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
434
+ _content_type: Optional[StrictStr] = None,
435
+ _headers: Optional[Dict[StrictStr, Any]] = None,
436
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
437
+ ) -> ApiResponse[None]:
438
+ """Delete guardrail rule
439
+
440
+ Deletes a guardrail rule.
441
+
442
+ :param tenant_id: Unique tenant identifier (required)
443
+ :type tenant_id: str
444
+ :param rule_id: Guardrail rule identifier (required)
445
+ :type rule_id: str
446
+ :param _request_timeout: timeout setting for this request. If one
447
+ number provided, it will be total request
448
+ timeout. It can also be a pair (tuple) of
449
+ (connection, read) timeouts.
450
+ :type _request_timeout: int, tuple(int, int), optional
451
+ :param _request_auth: set to override the auth_settings for an a single
452
+ request; this effectively ignores the
453
+ authentication in the spec for a single request.
454
+ :type _request_auth: dict, optional
455
+ :param _content_type: force content-type for the request.
456
+ :type _content_type: str, Optional
457
+ :param _headers: set to override the headers for a single
458
+ request; this effectively ignores the headers
459
+ in the spec for a single request.
460
+ :type _headers: dict, optional
461
+ :param _host_index: set to override the host_index for a single
462
+ request; this effectively ignores the host_index
463
+ in the spec for a single request.
464
+ :type _host_index: int, optional
465
+ :return: Returns the result object.
466
+ """ # noqa: E501
467
+
468
+ _param = self._delete_guardrail_rule_serialize(
469
+ tenant_id=tenant_id,
470
+ rule_id=rule_id,
471
+ _request_auth=_request_auth,
472
+ _content_type=_content_type,
473
+ _headers=_headers,
474
+ _host_index=_host_index
475
+ )
476
+
477
+ _response_types_map: Dict[str, Optional[str]] = {
478
+ '204': None,
479
+ '404': "ErrorResponse",
480
+ '500': "ErrorResponse",
481
+ }
482
+ response_data = self.api_client.call_api(
483
+ *_param,
484
+ _request_timeout=_request_timeout
485
+ )
486
+ response_data.read()
487
+ return self.api_client.response_deserialize(
488
+ response_data=response_data,
489
+ response_types_map=_response_types_map,
490
+ )
491
+
492
+
493
+ @validate_call
494
+ def delete_guardrail_rule_without_preload_content(
495
+ self,
496
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
497
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
498
+ _request_timeout: Union[
499
+ None,
500
+ Annotated[StrictFloat, Field(gt=0)],
501
+ Tuple[
502
+ Annotated[StrictFloat, Field(gt=0)],
503
+ Annotated[StrictFloat, Field(gt=0)]
504
+ ]
505
+ ] = None,
506
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
507
+ _content_type: Optional[StrictStr] = None,
508
+ _headers: Optional[Dict[StrictStr, Any]] = None,
509
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
510
+ ) -> RESTResponseType:
511
+ """Delete guardrail rule
512
+
513
+ Deletes a guardrail rule.
514
+
515
+ :param tenant_id: Unique tenant identifier (required)
516
+ :type tenant_id: str
517
+ :param rule_id: Guardrail rule identifier (required)
518
+ :type rule_id: str
519
+ :param _request_timeout: timeout setting for this request. If one
520
+ number provided, it will be total request
521
+ timeout. It can also be a pair (tuple) of
522
+ (connection, read) timeouts.
523
+ :type _request_timeout: int, tuple(int, int), optional
524
+ :param _request_auth: set to override the auth_settings for an a single
525
+ request; this effectively ignores the
526
+ authentication in the spec for a single request.
527
+ :type _request_auth: dict, optional
528
+ :param _content_type: force content-type for the request.
529
+ :type _content_type: str, Optional
530
+ :param _headers: set to override the headers for a single
531
+ request; this effectively ignores the headers
532
+ in the spec for a single request.
533
+ :type _headers: dict, optional
534
+ :param _host_index: set to override the host_index for a single
535
+ request; this effectively ignores the host_index
536
+ in the spec for a single request.
537
+ :type _host_index: int, optional
538
+ :return: Returns the result object.
539
+ """ # noqa: E501
540
+
541
+ _param = self._delete_guardrail_rule_serialize(
542
+ tenant_id=tenant_id,
543
+ rule_id=rule_id,
544
+ _request_auth=_request_auth,
545
+ _content_type=_content_type,
546
+ _headers=_headers,
547
+ _host_index=_host_index
548
+ )
549
+
550
+ _response_types_map: Dict[str, Optional[str]] = {
551
+ '204': None,
552
+ '404': "ErrorResponse",
553
+ '500': "ErrorResponse",
554
+ }
555
+ response_data = self.api_client.call_api(
556
+ *_param,
557
+ _request_timeout=_request_timeout
558
+ )
559
+ return response_data.response
560
+
561
+
562
+ def _delete_guardrail_rule_serialize(
563
+ self,
564
+ tenant_id,
565
+ rule_id,
566
+ _request_auth,
567
+ _content_type,
568
+ _headers,
569
+ _host_index,
570
+ ) -> Tuple:
571
+
572
+ _host = None
573
+
574
+ _collection_formats: Dict[str, str] = {
575
+ }
576
+
577
+ _path_params: Dict[str, str] = {}
578
+ _query_params: List[Tuple[str, str]] = []
579
+ _header_params: Dict[str, Optional[str]] = _headers or {}
580
+ _form_params: List[Tuple[str, str]] = []
581
+ _files: Dict[str, str] = {}
582
+ _body_params: Optional[bytes] = None
583
+
584
+ # process the path parameters
585
+ if tenant_id is not None:
586
+ _path_params['tenantId'] = tenant_id
587
+ if rule_id is not None:
588
+ _path_params['ruleId'] = rule_id
589
+ # process the query parameters
590
+ # process the header parameters
591
+ # process the form parameters
592
+ # process the body parameter
593
+
594
+
595
+ # set the HTTP header `Accept`
596
+ _header_params['Accept'] = self.api_client.select_header_accept(
597
+ [
598
+ 'application/json'
599
+ ]
600
+ )
601
+
602
+
603
+ # authentication setting
604
+ _auth_settings: List[str] = [
605
+ 'bearerHttpAuthentication'
606
+ ]
607
+
608
+ return self.api_client.param_serialize(
609
+ method='DELETE',
610
+ resource_path='/api/t/{tenantId}/guardrail-rules/{ruleId}',
611
+ path_params=_path_params,
612
+ query_params=_query_params,
613
+ header_params=_header_params,
614
+ body=_body_params,
615
+ post_params=_form_params,
616
+ files=_files,
617
+ auth_settings=_auth_settings,
618
+ collection_formats=_collection_formats,
619
+ _host=_host,
620
+ _request_auth=_request_auth
621
+ )
622
+
623
+
624
+
625
+
626
+ @validate_call
627
+ def get_guardrail_rule(
628
+ self,
629
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
630
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
631
+ _request_timeout: Union[
632
+ None,
633
+ Annotated[StrictFloat, Field(gt=0)],
634
+ Tuple[
635
+ Annotated[StrictFloat, Field(gt=0)],
636
+ Annotated[StrictFloat, Field(gt=0)]
637
+ ]
638
+ ] = None,
639
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
640
+ _content_type: Optional[StrictStr] = None,
641
+ _headers: Optional[Dict[StrictStr, Any]] = None,
642
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
643
+ ) -> GuardrailRule:
644
+ """Get guardrail rule
645
+
646
+ Retrieves a specific guardrail rule by ID
647
+
648
+ :param tenant_id: Unique tenant identifier (required)
649
+ :type tenant_id: str
650
+ :param rule_id: Guardrail rule identifier (required)
651
+ :type rule_id: str
652
+ :param _request_timeout: timeout setting for this request. If one
653
+ number provided, it will be total request
654
+ timeout. It can also be a pair (tuple) of
655
+ (connection, read) timeouts.
656
+ :type _request_timeout: int, tuple(int, int), optional
657
+ :param _request_auth: set to override the auth_settings for an a single
658
+ request; this effectively ignores the
659
+ authentication in the spec for a single request.
660
+ :type _request_auth: dict, optional
661
+ :param _content_type: force content-type for the request.
662
+ :type _content_type: str, Optional
663
+ :param _headers: set to override the headers for a single
664
+ request; this effectively ignores the headers
665
+ in the spec for a single request.
666
+ :type _headers: dict, optional
667
+ :param _host_index: set to override the host_index for a single
668
+ request; this effectively ignores the host_index
669
+ in the spec for a single request.
670
+ :type _host_index: int, optional
671
+ :return: Returns the result object.
672
+ """ # noqa: E501
673
+
674
+ _param = self._get_guardrail_rule_serialize(
675
+ tenant_id=tenant_id,
676
+ rule_id=rule_id,
677
+ _request_auth=_request_auth,
678
+ _content_type=_content_type,
679
+ _headers=_headers,
680
+ _host_index=_host_index
681
+ )
682
+
683
+ _response_types_map: Dict[str, Optional[str]] = {
684
+ '200': "GuardrailRule",
685
+ '404': "ErrorResponse",
686
+ '500': "ErrorResponse",
687
+ }
688
+ response_data = self.api_client.call_api(
689
+ *_param,
690
+ _request_timeout=_request_timeout
691
+ )
692
+ response_data.read()
693
+ return self.api_client.response_deserialize(
694
+ response_data=response_data,
695
+ response_types_map=_response_types_map,
696
+ ).data
697
+
698
+
699
+ @validate_call
700
+ def get_guardrail_rule_with_http_info(
701
+ self,
702
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
703
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
704
+ _request_timeout: Union[
705
+ None,
706
+ Annotated[StrictFloat, Field(gt=0)],
707
+ Tuple[
708
+ Annotated[StrictFloat, Field(gt=0)],
709
+ Annotated[StrictFloat, Field(gt=0)]
710
+ ]
711
+ ] = None,
712
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
713
+ _content_type: Optional[StrictStr] = None,
714
+ _headers: Optional[Dict[StrictStr, Any]] = None,
715
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
716
+ ) -> ApiResponse[GuardrailRule]:
717
+ """Get guardrail rule
718
+
719
+ Retrieves a specific guardrail rule by ID
720
+
721
+ :param tenant_id: Unique tenant identifier (required)
722
+ :type tenant_id: str
723
+ :param rule_id: Guardrail rule identifier (required)
724
+ :type rule_id: str
725
+ :param _request_timeout: timeout setting for this request. If one
726
+ number provided, it will be total request
727
+ timeout. It can also be a pair (tuple) of
728
+ (connection, read) timeouts.
729
+ :type _request_timeout: int, tuple(int, int), optional
730
+ :param _request_auth: set to override the auth_settings for an a single
731
+ request; this effectively ignores the
732
+ authentication in the spec for a single request.
733
+ :type _request_auth: dict, optional
734
+ :param _content_type: force content-type for the request.
735
+ :type _content_type: str, Optional
736
+ :param _headers: set to override the headers for a single
737
+ request; this effectively ignores the headers
738
+ in the spec for a single request.
739
+ :type _headers: dict, optional
740
+ :param _host_index: set to override the host_index for a single
741
+ request; this effectively ignores the host_index
742
+ in the spec for a single request.
743
+ :type _host_index: int, optional
744
+ :return: Returns the result object.
745
+ """ # noqa: E501
746
+
747
+ _param = self._get_guardrail_rule_serialize(
748
+ tenant_id=tenant_id,
749
+ rule_id=rule_id,
750
+ _request_auth=_request_auth,
751
+ _content_type=_content_type,
752
+ _headers=_headers,
753
+ _host_index=_host_index
754
+ )
755
+
756
+ _response_types_map: Dict[str, Optional[str]] = {
757
+ '200': "GuardrailRule",
758
+ '404': "ErrorResponse",
759
+ '500': "ErrorResponse",
760
+ }
761
+ response_data = self.api_client.call_api(
762
+ *_param,
763
+ _request_timeout=_request_timeout
764
+ )
765
+ response_data.read()
766
+ return self.api_client.response_deserialize(
767
+ response_data=response_data,
768
+ response_types_map=_response_types_map,
769
+ )
770
+
771
+
772
+ @validate_call
773
+ def get_guardrail_rule_without_preload_content(
774
+ self,
775
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
776
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
777
+ _request_timeout: Union[
778
+ None,
779
+ Annotated[StrictFloat, Field(gt=0)],
780
+ Tuple[
781
+ Annotated[StrictFloat, Field(gt=0)],
782
+ Annotated[StrictFloat, Field(gt=0)]
783
+ ]
784
+ ] = None,
785
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
786
+ _content_type: Optional[StrictStr] = None,
787
+ _headers: Optional[Dict[StrictStr, Any]] = None,
788
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
789
+ ) -> RESTResponseType:
790
+ """Get guardrail rule
791
+
792
+ Retrieves a specific guardrail rule by ID
793
+
794
+ :param tenant_id: Unique tenant identifier (required)
795
+ :type tenant_id: str
796
+ :param rule_id: Guardrail rule identifier (required)
797
+ :type rule_id: str
798
+ :param _request_timeout: timeout setting for this request. If one
799
+ number provided, it will be total request
800
+ timeout. It can also be a pair (tuple) of
801
+ (connection, read) timeouts.
802
+ :type _request_timeout: int, tuple(int, int), optional
803
+ :param _request_auth: set to override the auth_settings for an a single
804
+ request; this effectively ignores the
805
+ authentication in the spec for a single request.
806
+ :type _request_auth: dict, optional
807
+ :param _content_type: force content-type for the request.
808
+ :type _content_type: str, Optional
809
+ :param _headers: set to override the headers for a single
810
+ request; this effectively ignores the headers
811
+ in the spec for a single request.
812
+ :type _headers: dict, optional
813
+ :param _host_index: set to override the host_index for a single
814
+ request; this effectively ignores the host_index
815
+ in the spec for a single request.
816
+ :type _host_index: int, optional
817
+ :return: Returns the result object.
818
+ """ # noqa: E501
819
+
820
+ _param = self._get_guardrail_rule_serialize(
821
+ tenant_id=tenant_id,
822
+ rule_id=rule_id,
823
+ _request_auth=_request_auth,
824
+ _content_type=_content_type,
825
+ _headers=_headers,
826
+ _host_index=_host_index
827
+ )
828
+
829
+ _response_types_map: Dict[str, Optional[str]] = {
830
+ '200': "GuardrailRule",
831
+ '404': "ErrorResponse",
832
+ '500': "ErrorResponse",
833
+ }
834
+ response_data = self.api_client.call_api(
835
+ *_param,
836
+ _request_timeout=_request_timeout
837
+ )
838
+ return response_data.response
839
+
840
+
841
+ def _get_guardrail_rule_serialize(
842
+ self,
843
+ tenant_id,
844
+ rule_id,
845
+ _request_auth,
846
+ _content_type,
847
+ _headers,
848
+ _host_index,
849
+ ) -> Tuple:
850
+
851
+ _host = None
852
+
853
+ _collection_formats: Dict[str, str] = {
854
+ }
855
+
856
+ _path_params: Dict[str, str] = {}
857
+ _query_params: List[Tuple[str, str]] = []
858
+ _header_params: Dict[str, Optional[str]] = _headers or {}
859
+ _form_params: List[Tuple[str, str]] = []
860
+ _files: Dict[str, str] = {}
861
+ _body_params: Optional[bytes] = None
862
+
863
+ # process the path parameters
864
+ if tenant_id is not None:
865
+ _path_params['tenantId'] = tenant_id
866
+ if rule_id is not None:
867
+ _path_params['ruleId'] = rule_id
868
+ # process the query parameters
869
+ # process the header parameters
870
+ # process the form parameters
871
+ # process the body parameter
872
+
873
+
874
+ # set the HTTP header `Accept`
875
+ _header_params['Accept'] = self.api_client.select_header_accept(
876
+ [
877
+ 'application/json'
878
+ ]
879
+ )
880
+
881
+
882
+ # authentication setting
883
+ _auth_settings: List[str] = [
884
+ 'bearerHttpAuthentication'
885
+ ]
886
+
887
+ return self.api_client.param_serialize(
888
+ method='GET',
889
+ resource_path='/api/t/{tenantId}/guardrail-rules/{ruleId}',
890
+ path_params=_path_params,
891
+ query_params=_query_params,
892
+ header_params=_header_params,
893
+ body=_body_params,
894
+ post_params=_form_params,
895
+ files=_files,
896
+ auth_settings=_auth_settings,
897
+ collection_formats=_collection_formats,
898
+ _host=_host,
899
+ _request_auth=_request_auth
900
+ )
901
+
902
+
903
+
904
+
905
+ @validate_call
906
+ def get_guardrail_rule_schema(
907
+ self,
908
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
909
+ workspace_id: Annotated[Optional[StrictStr], Field(description="Filter schema by workspace. Omit to return the global schema.")] = None,
910
+ _request_timeout: Union[
911
+ None,
912
+ Annotated[StrictFloat, Field(gt=0)],
913
+ Tuple[
914
+ Annotated[StrictFloat, Field(gt=0)],
915
+ Annotated[StrictFloat, Field(gt=0)]
916
+ ]
917
+ ] = None,
918
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
919
+ _content_type: Optional[StrictStr] = None,
920
+ _headers: Optional[Dict[StrictStr, Any]] = None,
921
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
922
+ ) -> Dict[str, List[GuardrailRuleFieldDefinition]]:
923
+ """Get guardrail rule schema
924
+
925
+ Returns the available fields for each fact type (SESSION_SEGMENT, USER_PROFILE) that can be used in HuntQL conditions. COUNT_MAP fields include known keys sourced from the tenant's policy templates catalog.
926
+
927
+ :param tenant_id: Unique tenant identifier (required)
928
+ :type tenant_id: str
929
+ :param workspace_id: Filter schema by workspace. Omit to return the global schema.
930
+ :type workspace_id: str
931
+ :param _request_timeout: timeout setting for this request. If one
932
+ number provided, it will be total request
933
+ timeout. It can also be a pair (tuple) of
934
+ (connection, read) timeouts.
935
+ :type _request_timeout: int, tuple(int, int), optional
936
+ :param _request_auth: set to override the auth_settings for an a single
937
+ request; this effectively ignores the
938
+ authentication in the spec for a single request.
939
+ :type _request_auth: dict, optional
940
+ :param _content_type: force content-type for the request.
941
+ :type _content_type: str, Optional
942
+ :param _headers: set to override the headers for a single
943
+ request; this effectively ignores the headers
944
+ in the spec for a single request.
945
+ :type _headers: dict, optional
946
+ :param _host_index: set to override the host_index for a single
947
+ request; this effectively ignores the host_index
948
+ in the spec for a single request.
949
+ :type _host_index: int, optional
950
+ :return: Returns the result object.
951
+ """ # noqa: E501
952
+
953
+ _param = self._get_guardrail_rule_schema_serialize(
954
+ tenant_id=tenant_id,
955
+ workspace_id=workspace_id,
956
+ _request_auth=_request_auth,
957
+ _content_type=_content_type,
958
+ _headers=_headers,
959
+ _host_index=_host_index
960
+ )
961
+
962
+ _response_types_map: Dict[str, Optional[str]] = {
963
+ '200': "Dict[str, List[GuardrailRuleFieldDefinition]]",
964
+ '500': "ErrorResponse",
965
+ }
966
+ response_data = self.api_client.call_api(
967
+ *_param,
968
+ _request_timeout=_request_timeout
969
+ )
970
+ response_data.read()
971
+ return self.api_client.response_deserialize(
972
+ response_data=response_data,
973
+ response_types_map=_response_types_map,
974
+ ).data
975
+
976
+
977
+ @validate_call
978
+ def get_guardrail_rule_schema_with_http_info(
979
+ self,
980
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
981
+ workspace_id: Annotated[Optional[StrictStr], Field(description="Filter schema by workspace. Omit to return the global schema.")] = None,
982
+ _request_timeout: Union[
983
+ None,
984
+ Annotated[StrictFloat, Field(gt=0)],
985
+ Tuple[
986
+ Annotated[StrictFloat, Field(gt=0)],
987
+ Annotated[StrictFloat, Field(gt=0)]
988
+ ]
989
+ ] = None,
990
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
991
+ _content_type: Optional[StrictStr] = None,
992
+ _headers: Optional[Dict[StrictStr, Any]] = None,
993
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
994
+ ) -> ApiResponse[Dict[str, List[GuardrailRuleFieldDefinition]]]:
995
+ """Get guardrail rule schema
996
+
997
+ Returns the available fields for each fact type (SESSION_SEGMENT, USER_PROFILE) that can be used in HuntQL conditions. COUNT_MAP fields include known keys sourced from the tenant's policy templates catalog.
998
+
999
+ :param tenant_id: Unique tenant identifier (required)
1000
+ :type tenant_id: str
1001
+ :param workspace_id: Filter schema by workspace. Omit to return the global schema.
1002
+ :type workspace_id: str
1003
+ :param _request_timeout: timeout setting for this request. If one
1004
+ number provided, it will be total request
1005
+ timeout. It can also be a pair (tuple) of
1006
+ (connection, read) timeouts.
1007
+ :type _request_timeout: int, tuple(int, int), optional
1008
+ :param _request_auth: set to override the auth_settings for an a single
1009
+ request; this effectively ignores the
1010
+ authentication in the spec for a single request.
1011
+ :type _request_auth: dict, optional
1012
+ :param _content_type: force content-type for the request.
1013
+ :type _content_type: str, Optional
1014
+ :param _headers: set to override the headers for a single
1015
+ request; this effectively ignores the headers
1016
+ in the spec for a single request.
1017
+ :type _headers: dict, optional
1018
+ :param _host_index: set to override the host_index for a single
1019
+ request; this effectively ignores the host_index
1020
+ in the spec for a single request.
1021
+ :type _host_index: int, optional
1022
+ :return: Returns the result object.
1023
+ """ # noqa: E501
1024
+
1025
+ _param = self._get_guardrail_rule_schema_serialize(
1026
+ tenant_id=tenant_id,
1027
+ workspace_id=workspace_id,
1028
+ _request_auth=_request_auth,
1029
+ _content_type=_content_type,
1030
+ _headers=_headers,
1031
+ _host_index=_host_index
1032
+ )
1033
+
1034
+ _response_types_map: Dict[str, Optional[str]] = {
1035
+ '200': "Dict[str, List[GuardrailRuleFieldDefinition]]",
1036
+ '500': "ErrorResponse",
1037
+ }
1038
+ response_data = self.api_client.call_api(
1039
+ *_param,
1040
+ _request_timeout=_request_timeout
1041
+ )
1042
+ response_data.read()
1043
+ return self.api_client.response_deserialize(
1044
+ response_data=response_data,
1045
+ response_types_map=_response_types_map,
1046
+ )
1047
+
1048
+
1049
+ @validate_call
1050
+ def get_guardrail_rule_schema_without_preload_content(
1051
+ self,
1052
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
1053
+ workspace_id: Annotated[Optional[StrictStr], Field(description="Filter schema by workspace. Omit to return the global schema.")] = None,
1054
+ _request_timeout: Union[
1055
+ None,
1056
+ Annotated[StrictFloat, Field(gt=0)],
1057
+ Tuple[
1058
+ Annotated[StrictFloat, Field(gt=0)],
1059
+ Annotated[StrictFloat, Field(gt=0)]
1060
+ ]
1061
+ ] = None,
1062
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1063
+ _content_type: Optional[StrictStr] = None,
1064
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1065
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1066
+ ) -> RESTResponseType:
1067
+ """Get guardrail rule schema
1068
+
1069
+ Returns the available fields for each fact type (SESSION_SEGMENT, USER_PROFILE) that can be used in HuntQL conditions. COUNT_MAP fields include known keys sourced from the tenant's policy templates catalog.
1070
+
1071
+ :param tenant_id: Unique tenant identifier (required)
1072
+ :type tenant_id: str
1073
+ :param workspace_id: Filter schema by workspace. Omit to return the global schema.
1074
+ :type workspace_id: str
1075
+ :param _request_timeout: timeout setting for this request. If one
1076
+ number provided, it will be total request
1077
+ timeout. It can also be a pair (tuple) of
1078
+ (connection, read) timeouts.
1079
+ :type _request_timeout: int, tuple(int, int), optional
1080
+ :param _request_auth: set to override the auth_settings for an a single
1081
+ request; this effectively ignores the
1082
+ authentication in the spec for a single request.
1083
+ :type _request_auth: dict, optional
1084
+ :param _content_type: force content-type for the request.
1085
+ :type _content_type: str, Optional
1086
+ :param _headers: set to override the headers for a single
1087
+ request; this effectively ignores the headers
1088
+ in the spec for a single request.
1089
+ :type _headers: dict, optional
1090
+ :param _host_index: set to override the host_index for a single
1091
+ request; this effectively ignores the host_index
1092
+ in the spec for a single request.
1093
+ :type _host_index: int, optional
1094
+ :return: Returns the result object.
1095
+ """ # noqa: E501
1096
+
1097
+ _param = self._get_guardrail_rule_schema_serialize(
1098
+ tenant_id=tenant_id,
1099
+ workspace_id=workspace_id,
1100
+ _request_auth=_request_auth,
1101
+ _content_type=_content_type,
1102
+ _headers=_headers,
1103
+ _host_index=_host_index
1104
+ )
1105
+
1106
+ _response_types_map: Dict[str, Optional[str]] = {
1107
+ '200': "Dict[str, List[GuardrailRuleFieldDefinition]]",
1108
+ '500': "ErrorResponse",
1109
+ }
1110
+ response_data = self.api_client.call_api(
1111
+ *_param,
1112
+ _request_timeout=_request_timeout
1113
+ )
1114
+ return response_data.response
1115
+
1116
+
1117
+ def _get_guardrail_rule_schema_serialize(
1118
+ self,
1119
+ tenant_id,
1120
+ workspace_id,
1121
+ _request_auth,
1122
+ _content_type,
1123
+ _headers,
1124
+ _host_index,
1125
+ ) -> Tuple:
1126
+
1127
+ _host = None
1128
+
1129
+ _collection_formats: Dict[str, str] = {
1130
+ }
1131
+
1132
+ _path_params: Dict[str, str] = {}
1133
+ _query_params: List[Tuple[str, str]] = []
1134
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1135
+ _form_params: List[Tuple[str, str]] = []
1136
+ _files: Dict[str, str] = {}
1137
+ _body_params: Optional[bytes] = None
1138
+
1139
+ # process the path parameters
1140
+ if tenant_id is not None:
1141
+ _path_params['tenantId'] = tenant_id
1142
+ # process the query parameters
1143
+ if workspace_id is not None:
1144
+
1145
+ _query_params.append(('workspaceId', workspace_id))
1146
+
1147
+ # process the header parameters
1148
+ # process the form parameters
1149
+ # process the body parameter
1150
+
1151
+
1152
+ # set the HTTP header `Accept`
1153
+ _header_params['Accept'] = self.api_client.select_header_accept(
1154
+ [
1155
+ 'application/json'
1156
+ ]
1157
+ )
1158
+
1159
+
1160
+ # authentication setting
1161
+ _auth_settings: List[str] = [
1162
+ 'bearerHttpAuthentication'
1163
+ ]
1164
+
1165
+ return self.api_client.param_serialize(
1166
+ method='GET',
1167
+ resource_path='/api/t/{tenantId}/guardrail-rules/schema',
1168
+ path_params=_path_params,
1169
+ query_params=_query_params,
1170
+ header_params=_header_params,
1171
+ body=_body_params,
1172
+ post_params=_form_params,
1173
+ files=_files,
1174
+ auth_settings=_auth_settings,
1175
+ collection_formats=_collection_formats,
1176
+ _host=_host,
1177
+ _request_auth=_request_auth
1178
+ )
1179
+
1180
+
1181
+
1182
+
1183
+ @validate_call
1184
+ def list_guardrail_rules(
1185
+ self,
1186
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
1187
+ workspace_id: Annotated[Optional[StrictStr], Field(description="Filter rules by workspace. Omit to return all rules.")] = None,
1188
+ _request_timeout: Union[
1189
+ None,
1190
+ Annotated[StrictFloat, Field(gt=0)],
1191
+ Tuple[
1192
+ Annotated[StrictFloat, Field(gt=0)],
1193
+ Annotated[StrictFloat, Field(gt=0)]
1194
+ ]
1195
+ ] = None,
1196
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1197
+ _content_type: Optional[StrictStr] = None,
1198
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1199
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1200
+ ) -> List[GuardrailRule]:
1201
+ """List guardrail rules
1202
+
1203
+ Retrieves all guardrail rules for the tenant.
1204
+
1205
+ :param tenant_id: Unique tenant identifier (required)
1206
+ :type tenant_id: str
1207
+ :param workspace_id: Filter rules by workspace. Omit to return all rules.
1208
+ :type workspace_id: str
1209
+ :param _request_timeout: timeout setting for this request. If one
1210
+ number provided, it will be total request
1211
+ timeout. It can also be a pair (tuple) of
1212
+ (connection, read) timeouts.
1213
+ :type _request_timeout: int, tuple(int, int), optional
1214
+ :param _request_auth: set to override the auth_settings for an a single
1215
+ request; this effectively ignores the
1216
+ authentication in the spec for a single request.
1217
+ :type _request_auth: dict, optional
1218
+ :param _content_type: force content-type for the request.
1219
+ :type _content_type: str, Optional
1220
+ :param _headers: set to override the headers for a single
1221
+ request; this effectively ignores the headers
1222
+ in the spec for a single request.
1223
+ :type _headers: dict, optional
1224
+ :param _host_index: set to override the host_index for a single
1225
+ request; this effectively ignores the host_index
1226
+ in the spec for a single request.
1227
+ :type _host_index: int, optional
1228
+ :return: Returns the result object.
1229
+ """ # noqa: E501
1230
+
1231
+ _param = self._list_guardrail_rules_serialize(
1232
+ tenant_id=tenant_id,
1233
+ workspace_id=workspace_id,
1234
+ _request_auth=_request_auth,
1235
+ _content_type=_content_type,
1236
+ _headers=_headers,
1237
+ _host_index=_host_index
1238
+ )
1239
+
1240
+ _response_types_map: Dict[str, Optional[str]] = {
1241
+ '200': "List[GuardrailRule]",
1242
+ '500': "ErrorResponse",
1243
+ }
1244
+ response_data = self.api_client.call_api(
1245
+ *_param,
1246
+ _request_timeout=_request_timeout
1247
+ )
1248
+ response_data.read()
1249
+ return self.api_client.response_deserialize(
1250
+ response_data=response_data,
1251
+ response_types_map=_response_types_map,
1252
+ ).data
1253
+
1254
+
1255
+ @validate_call
1256
+ def list_guardrail_rules_with_http_info(
1257
+ self,
1258
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
1259
+ workspace_id: Annotated[Optional[StrictStr], Field(description="Filter rules by workspace. Omit to return all rules.")] = None,
1260
+ _request_timeout: Union[
1261
+ None,
1262
+ Annotated[StrictFloat, Field(gt=0)],
1263
+ Tuple[
1264
+ Annotated[StrictFloat, Field(gt=0)],
1265
+ Annotated[StrictFloat, Field(gt=0)]
1266
+ ]
1267
+ ] = None,
1268
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1269
+ _content_type: Optional[StrictStr] = None,
1270
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1271
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1272
+ ) -> ApiResponse[List[GuardrailRule]]:
1273
+ """List guardrail rules
1274
+
1275
+ Retrieves all guardrail rules for the tenant.
1276
+
1277
+ :param tenant_id: Unique tenant identifier (required)
1278
+ :type tenant_id: str
1279
+ :param workspace_id: Filter rules by workspace. Omit to return all rules.
1280
+ :type workspace_id: str
1281
+ :param _request_timeout: timeout setting for this request. If one
1282
+ number provided, it will be total request
1283
+ timeout. It can also be a pair (tuple) of
1284
+ (connection, read) timeouts.
1285
+ :type _request_timeout: int, tuple(int, int), optional
1286
+ :param _request_auth: set to override the auth_settings for an a single
1287
+ request; this effectively ignores the
1288
+ authentication in the spec for a single request.
1289
+ :type _request_auth: dict, optional
1290
+ :param _content_type: force content-type for the request.
1291
+ :type _content_type: str, Optional
1292
+ :param _headers: set to override the headers for a single
1293
+ request; this effectively ignores the headers
1294
+ in the spec for a single request.
1295
+ :type _headers: dict, optional
1296
+ :param _host_index: set to override the host_index for a single
1297
+ request; this effectively ignores the host_index
1298
+ in the spec for a single request.
1299
+ :type _host_index: int, optional
1300
+ :return: Returns the result object.
1301
+ """ # noqa: E501
1302
+
1303
+ _param = self._list_guardrail_rules_serialize(
1304
+ tenant_id=tenant_id,
1305
+ workspace_id=workspace_id,
1306
+ _request_auth=_request_auth,
1307
+ _content_type=_content_type,
1308
+ _headers=_headers,
1309
+ _host_index=_host_index
1310
+ )
1311
+
1312
+ _response_types_map: Dict[str, Optional[str]] = {
1313
+ '200': "List[GuardrailRule]",
1314
+ '500': "ErrorResponse",
1315
+ }
1316
+ response_data = self.api_client.call_api(
1317
+ *_param,
1318
+ _request_timeout=_request_timeout
1319
+ )
1320
+ response_data.read()
1321
+ return self.api_client.response_deserialize(
1322
+ response_data=response_data,
1323
+ response_types_map=_response_types_map,
1324
+ )
1325
+
1326
+
1327
+ @validate_call
1328
+ def list_guardrail_rules_without_preload_content(
1329
+ self,
1330
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
1331
+ workspace_id: Annotated[Optional[StrictStr], Field(description="Filter rules by workspace. Omit to return all rules.")] = None,
1332
+ _request_timeout: Union[
1333
+ None,
1334
+ Annotated[StrictFloat, Field(gt=0)],
1335
+ Tuple[
1336
+ Annotated[StrictFloat, Field(gt=0)],
1337
+ Annotated[StrictFloat, Field(gt=0)]
1338
+ ]
1339
+ ] = None,
1340
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1341
+ _content_type: Optional[StrictStr] = None,
1342
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1343
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1344
+ ) -> RESTResponseType:
1345
+ """List guardrail rules
1346
+
1347
+ Retrieves all guardrail rules for the tenant.
1348
+
1349
+ :param tenant_id: Unique tenant identifier (required)
1350
+ :type tenant_id: str
1351
+ :param workspace_id: Filter rules by workspace. Omit to return all rules.
1352
+ :type workspace_id: str
1353
+ :param _request_timeout: timeout setting for this request. If one
1354
+ number provided, it will be total request
1355
+ timeout. It can also be a pair (tuple) of
1356
+ (connection, read) timeouts.
1357
+ :type _request_timeout: int, tuple(int, int), optional
1358
+ :param _request_auth: set to override the auth_settings for an a single
1359
+ request; this effectively ignores the
1360
+ authentication in the spec for a single request.
1361
+ :type _request_auth: dict, optional
1362
+ :param _content_type: force content-type for the request.
1363
+ :type _content_type: str, Optional
1364
+ :param _headers: set to override the headers for a single
1365
+ request; this effectively ignores the headers
1366
+ in the spec for a single request.
1367
+ :type _headers: dict, optional
1368
+ :param _host_index: set to override the host_index for a single
1369
+ request; this effectively ignores the host_index
1370
+ in the spec for a single request.
1371
+ :type _host_index: int, optional
1372
+ :return: Returns the result object.
1373
+ """ # noqa: E501
1374
+
1375
+ _param = self._list_guardrail_rules_serialize(
1376
+ tenant_id=tenant_id,
1377
+ workspace_id=workspace_id,
1378
+ _request_auth=_request_auth,
1379
+ _content_type=_content_type,
1380
+ _headers=_headers,
1381
+ _host_index=_host_index
1382
+ )
1383
+
1384
+ _response_types_map: Dict[str, Optional[str]] = {
1385
+ '200': "List[GuardrailRule]",
1386
+ '500': "ErrorResponse",
1387
+ }
1388
+ response_data = self.api_client.call_api(
1389
+ *_param,
1390
+ _request_timeout=_request_timeout
1391
+ )
1392
+ return response_data.response
1393
+
1394
+
1395
+ def _list_guardrail_rules_serialize(
1396
+ self,
1397
+ tenant_id,
1398
+ workspace_id,
1399
+ _request_auth,
1400
+ _content_type,
1401
+ _headers,
1402
+ _host_index,
1403
+ ) -> Tuple:
1404
+
1405
+ _host = None
1406
+
1407
+ _collection_formats: Dict[str, str] = {
1408
+ }
1409
+
1410
+ _path_params: Dict[str, str] = {}
1411
+ _query_params: List[Tuple[str, str]] = []
1412
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1413
+ _form_params: List[Tuple[str, str]] = []
1414
+ _files: Dict[str, str] = {}
1415
+ _body_params: Optional[bytes] = None
1416
+
1417
+ # process the path parameters
1418
+ if tenant_id is not None:
1419
+ _path_params['tenantId'] = tenant_id
1420
+ # process the query parameters
1421
+ if workspace_id is not None:
1422
+
1423
+ _query_params.append(('workspaceId', workspace_id))
1424
+
1425
+ # process the header parameters
1426
+ # process the form parameters
1427
+ # process the body parameter
1428
+
1429
+
1430
+ # set the HTTP header `Accept`
1431
+ _header_params['Accept'] = self.api_client.select_header_accept(
1432
+ [
1433
+ 'application/json'
1434
+ ]
1435
+ )
1436
+
1437
+
1438
+ # authentication setting
1439
+ _auth_settings: List[str] = [
1440
+ 'bearerHttpAuthentication'
1441
+ ]
1442
+
1443
+ return self.api_client.param_serialize(
1444
+ method='GET',
1445
+ resource_path='/api/t/{tenantId}/guardrail-rules',
1446
+ path_params=_path_params,
1447
+ query_params=_query_params,
1448
+ header_params=_header_params,
1449
+ body=_body_params,
1450
+ post_params=_form_params,
1451
+ files=_files,
1452
+ auth_settings=_auth_settings,
1453
+ collection_formats=_collection_formats,
1454
+ _host=_host,
1455
+ _request_auth=_request_auth
1456
+ )
1457
+
1458
+
1459
+
1460
+
1461
+ @validate_call
1462
+ def update_guardrail_rule(
1463
+ self,
1464
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
1465
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
1466
+ guardrail_rule_update_request: GuardrailRuleUpdateRequest,
1467
+ _request_timeout: Union[
1468
+ None,
1469
+ Annotated[StrictFloat, Field(gt=0)],
1470
+ Tuple[
1471
+ Annotated[StrictFloat, Field(gt=0)],
1472
+ Annotated[StrictFloat, Field(gt=0)]
1473
+ ]
1474
+ ] = None,
1475
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1476
+ _content_type: Optional[StrictStr] = None,
1477
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1478
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1479
+ ) -> GuardrailRule:
1480
+ """Update guardrail rule
1481
+
1482
+ Updates an existing guardrail rule. If the condition is updated, it must be a valid HuntQL expression compatible with the factType.
1483
+
1484
+ :param tenant_id: Unique tenant identifier (required)
1485
+ :type tenant_id: str
1486
+ :param rule_id: Guardrail rule identifier (required)
1487
+ :type rule_id: str
1488
+ :param guardrail_rule_update_request: (required)
1489
+ :type guardrail_rule_update_request: GuardrailRuleUpdateRequest
1490
+ :param _request_timeout: timeout setting for this request. If one
1491
+ number provided, it will be total request
1492
+ timeout. It can also be a pair (tuple) of
1493
+ (connection, read) timeouts.
1494
+ :type _request_timeout: int, tuple(int, int), optional
1495
+ :param _request_auth: set to override the auth_settings for an a single
1496
+ request; this effectively ignores the
1497
+ authentication in the spec for a single request.
1498
+ :type _request_auth: dict, optional
1499
+ :param _content_type: force content-type for the request.
1500
+ :type _content_type: str, Optional
1501
+ :param _headers: set to override the headers for a single
1502
+ request; this effectively ignores the headers
1503
+ in the spec for a single request.
1504
+ :type _headers: dict, optional
1505
+ :param _host_index: set to override the host_index for a single
1506
+ request; this effectively ignores the host_index
1507
+ in the spec for a single request.
1508
+ :type _host_index: int, optional
1509
+ :return: Returns the result object.
1510
+ """ # noqa: E501
1511
+
1512
+ _param = self._update_guardrail_rule_serialize(
1513
+ tenant_id=tenant_id,
1514
+ rule_id=rule_id,
1515
+ guardrail_rule_update_request=guardrail_rule_update_request,
1516
+ _request_auth=_request_auth,
1517
+ _content_type=_content_type,
1518
+ _headers=_headers,
1519
+ _host_index=_host_index
1520
+ )
1521
+
1522
+ _response_types_map: Dict[str, Optional[str]] = {
1523
+ '200': "GuardrailRule",
1524
+ '400': "ErrorResponse",
1525
+ '404': "ErrorResponse",
1526
+ '500': "ErrorResponse",
1527
+ }
1528
+ response_data = self.api_client.call_api(
1529
+ *_param,
1530
+ _request_timeout=_request_timeout
1531
+ )
1532
+ response_data.read()
1533
+ return self.api_client.response_deserialize(
1534
+ response_data=response_data,
1535
+ response_types_map=_response_types_map,
1536
+ ).data
1537
+
1538
+
1539
+ @validate_call
1540
+ def update_guardrail_rule_with_http_info(
1541
+ self,
1542
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
1543
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
1544
+ guardrail_rule_update_request: GuardrailRuleUpdateRequest,
1545
+ _request_timeout: Union[
1546
+ None,
1547
+ Annotated[StrictFloat, Field(gt=0)],
1548
+ Tuple[
1549
+ Annotated[StrictFloat, Field(gt=0)],
1550
+ Annotated[StrictFloat, Field(gt=0)]
1551
+ ]
1552
+ ] = None,
1553
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1554
+ _content_type: Optional[StrictStr] = None,
1555
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1556
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1557
+ ) -> ApiResponse[GuardrailRule]:
1558
+ """Update guardrail rule
1559
+
1560
+ Updates an existing guardrail rule. If the condition is updated, it must be a valid HuntQL expression compatible with the factType.
1561
+
1562
+ :param tenant_id: Unique tenant identifier (required)
1563
+ :type tenant_id: str
1564
+ :param rule_id: Guardrail rule identifier (required)
1565
+ :type rule_id: str
1566
+ :param guardrail_rule_update_request: (required)
1567
+ :type guardrail_rule_update_request: GuardrailRuleUpdateRequest
1568
+ :param _request_timeout: timeout setting for this request. If one
1569
+ number provided, it will be total request
1570
+ timeout. It can also be a pair (tuple) of
1571
+ (connection, read) timeouts.
1572
+ :type _request_timeout: int, tuple(int, int), optional
1573
+ :param _request_auth: set to override the auth_settings for an a single
1574
+ request; this effectively ignores the
1575
+ authentication in the spec for a single request.
1576
+ :type _request_auth: dict, optional
1577
+ :param _content_type: force content-type for the request.
1578
+ :type _content_type: str, Optional
1579
+ :param _headers: set to override the headers for a single
1580
+ request; this effectively ignores the headers
1581
+ in the spec for a single request.
1582
+ :type _headers: dict, optional
1583
+ :param _host_index: set to override the host_index for a single
1584
+ request; this effectively ignores the host_index
1585
+ in the spec for a single request.
1586
+ :type _host_index: int, optional
1587
+ :return: Returns the result object.
1588
+ """ # noqa: E501
1589
+
1590
+ _param = self._update_guardrail_rule_serialize(
1591
+ tenant_id=tenant_id,
1592
+ rule_id=rule_id,
1593
+ guardrail_rule_update_request=guardrail_rule_update_request,
1594
+ _request_auth=_request_auth,
1595
+ _content_type=_content_type,
1596
+ _headers=_headers,
1597
+ _host_index=_host_index
1598
+ )
1599
+
1600
+ _response_types_map: Dict[str, Optional[str]] = {
1601
+ '200': "GuardrailRule",
1602
+ '400': "ErrorResponse",
1603
+ '404': "ErrorResponse",
1604
+ '500': "ErrorResponse",
1605
+ }
1606
+ response_data = self.api_client.call_api(
1607
+ *_param,
1608
+ _request_timeout=_request_timeout
1609
+ )
1610
+ response_data.read()
1611
+ return self.api_client.response_deserialize(
1612
+ response_data=response_data,
1613
+ response_types_map=_response_types_map,
1614
+ )
1615
+
1616
+
1617
+ @validate_call
1618
+ def update_guardrail_rule_without_preload_content(
1619
+ self,
1620
+ tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
1621
+ rule_id: Annotated[StrictStr, Field(description="Guardrail rule identifier")],
1622
+ guardrail_rule_update_request: GuardrailRuleUpdateRequest,
1623
+ _request_timeout: Union[
1624
+ None,
1625
+ Annotated[StrictFloat, Field(gt=0)],
1626
+ Tuple[
1627
+ Annotated[StrictFloat, Field(gt=0)],
1628
+ Annotated[StrictFloat, Field(gt=0)]
1629
+ ]
1630
+ ] = None,
1631
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1632
+ _content_type: Optional[StrictStr] = None,
1633
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1634
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1635
+ ) -> RESTResponseType:
1636
+ """Update guardrail rule
1637
+
1638
+ Updates an existing guardrail rule. If the condition is updated, it must be a valid HuntQL expression compatible with the factType.
1639
+
1640
+ :param tenant_id: Unique tenant identifier (required)
1641
+ :type tenant_id: str
1642
+ :param rule_id: Guardrail rule identifier (required)
1643
+ :type rule_id: str
1644
+ :param guardrail_rule_update_request: (required)
1645
+ :type guardrail_rule_update_request: GuardrailRuleUpdateRequest
1646
+ :param _request_timeout: timeout setting for this request. If one
1647
+ number provided, it will be total request
1648
+ timeout. It can also be a pair (tuple) of
1649
+ (connection, read) timeouts.
1650
+ :type _request_timeout: int, tuple(int, int), optional
1651
+ :param _request_auth: set to override the auth_settings for an a single
1652
+ request; this effectively ignores the
1653
+ authentication in the spec for a single request.
1654
+ :type _request_auth: dict, optional
1655
+ :param _content_type: force content-type for the request.
1656
+ :type _content_type: str, Optional
1657
+ :param _headers: set to override the headers for a single
1658
+ request; this effectively ignores the headers
1659
+ in the spec for a single request.
1660
+ :type _headers: dict, optional
1661
+ :param _host_index: set to override the host_index for a single
1662
+ request; this effectively ignores the host_index
1663
+ in the spec for a single request.
1664
+ :type _host_index: int, optional
1665
+ :return: Returns the result object.
1666
+ """ # noqa: E501
1667
+
1668
+ _param = self._update_guardrail_rule_serialize(
1669
+ tenant_id=tenant_id,
1670
+ rule_id=rule_id,
1671
+ guardrail_rule_update_request=guardrail_rule_update_request,
1672
+ _request_auth=_request_auth,
1673
+ _content_type=_content_type,
1674
+ _headers=_headers,
1675
+ _host_index=_host_index
1676
+ )
1677
+
1678
+ _response_types_map: Dict[str, Optional[str]] = {
1679
+ '200': "GuardrailRule",
1680
+ '400': "ErrorResponse",
1681
+ '404': "ErrorResponse",
1682
+ '500': "ErrorResponse",
1683
+ }
1684
+ response_data = self.api_client.call_api(
1685
+ *_param,
1686
+ _request_timeout=_request_timeout
1687
+ )
1688
+ return response_data.response
1689
+
1690
+
1691
+ def _update_guardrail_rule_serialize(
1692
+ self,
1693
+ tenant_id,
1694
+ rule_id,
1695
+ guardrail_rule_update_request,
1696
+ _request_auth,
1697
+ _content_type,
1698
+ _headers,
1699
+ _host_index,
1700
+ ) -> Tuple:
1701
+
1702
+ _host = None
1703
+
1704
+ _collection_formats: Dict[str, str] = {
1705
+ }
1706
+
1707
+ _path_params: Dict[str, str] = {}
1708
+ _query_params: List[Tuple[str, str]] = []
1709
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1710
+ _form_params: List[Tuple[str, str]] = []
1711
+ _files: Dict[str, str] = {}
1712
+ _body_params: Optional[bytes] = None
1713
+
1714
+ # process the path parameters
1715
+ if tenant_id is not None:
1716
+ _path_params['tenantId'] = tenant_id
1717
+ if rule_id is not None:
1718
+ _path_params['ruleId'] = rule_id
1719
+ # process the query parameters
1720
+ # process the header parameters
1721
+ # process the form parameters
1722
+ # process the body parameter
1723
+ if guardrail_rule_update_request is not None:
1724
+ _body_params = guardrail_rule_update_request
1725
+
1726
+
1727
+ # set the HTTP header `Accept`
1728
+ _header_params['Accept'] = self.api_client.select_header_accept(
1729
+ [
1730
+ 'application/json'
1731
+ ]
1732
+ )
1733
+
1734
+ # set the HTTP header `Content-Type`
1735
+ if _content_type:
1736
+ _header_params['Content-Type'] = _content_type
1737
+ else:
1738
+ _default_content_type = (
1739
+ self.api_client.select_header_content_type(
1740
+ [
1741
+ 'application/json'
1742
+ ]
1743
+ )
1744
+ )
1745
+ if _default_content_type is not None:
1746
+ _header_params['Content-Type'] = _default_content_type
1747
+
1748
+ # authentication setting
1749
+ _auth_settings: List[str] = [
1750
+ 'bearerHttpAuthentication'
1751
+ ]
1752
+
1753
+ return self.api_client.param_serialize(
1754
+ method='PUT',
1755
+ resource_path='/api/t/{tenantId}/guardrail-rules/{ruleId}',
1756
+ path_params=_path_params,
1757
+ query_params=_query_params,
1758
+ header_params=_header_params,
1759
+ body=_body_params,
1760
+ post_params=_form_params,
1761
+ files=_files,
1762
+ auth_settings=_auth_settings,
1763
+ collection_formats=_collection_formats,
1764
+ _host=_host,
1765
+ _request_auth=_request_auth
1766
+ )
1767
+
1768
+