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.
- darkhunt_api/__init__.py +21 -0
- darkhunt_api/guardrail_manager/__init__.py +63 -0
- darkhunt_api/guardrail_manager/api/__init__.py +7 -0
- darkhunt_api/guardrail_manager/api/analytics_api.py +605 -0
- darkhunt_api/guardrail_manager/api/guardrail_rules_api.py +1768 -0
- darkhunt_api/guardrail_manager/api/integrations_api.py +589 -0
- darkhunt_api/guardrail_manager/api_client.py +731 -0
- darkhunt_api/guardrail_manager/api_response.py +21 -0
- darkhunt_api/guardrail_manager/configuration.py +443 -0
- darkhunt_api/guardrail_manager/exceptions.py +200 -0
- darkhunt_api/guardrail_manager/models/__init__.py +44 -0
- darkhunt_api/guardrail_manager/models/aggregation.py +94 -0
- darkhunt_api/guardrail_manager/models/aggregation_function.py +49 -0
- darkhunt_api/guardrail_manager/models/analytics_request.py +130 -0
- darkhunt_api/guardrail_manager/models/analytics_request_group_by_inner.py +150 -0
- darkhunt_api/guardrail_manager/models/analytics_response.py +89 -0
- darkhunt_api/guardrail_manager/models/dataset_definition.py +113 -0
- darkhunt_api/guardrail_manager/models/dataset_registry.py +96 -0
- darkhunt_api/guardrail_manager/models/email_integration_config.py +95 -0
- darkhunt_api/guardrail_manager/models/error_response.py +95 -0
- darkhunt_api/guardrail_manager/models/field_definition.py +105 -0
- darkhunt_api/guardrail_manager/models/field_type.py +53 -0
- darkhunt_api/guardrail_manager/models/guardrail_rule.py +140 -0
- darkhunt_api/guardrail_manager/models/guardrail_rule_action.py +108 -0
- darkhunt_api/guardrail_manager/models/guardrail_rule_create_request.py +130 -0
- darkhunt_api/guardrail_manager/models/guardrail_rule_field_definition.py +105 -0
- darkhunt_api/guardrail_manager/models/guardrail_rule_update_request.py +124 -0
- darkhunt_api/guardrail_manager/models/http_integration_config.py +93 -0
- darkhunt_api/guardrail_manager/models/integration.py +120 -0
- darkhunt_api/guardrail_manager/models/integration_type.py +46 -0
- darkhunt_api/guardrail_manager/models/join_cardinality.py +47 -0
- darkhunt_api/guardrail_manager/models/join_config.py +117 -0
- darkhunt_api/guardrail_manager/models/join_on.py +91 -0
- darkhunt_api/guardrail_manager/models/join_order_by.py +101 -0
- darkhunt_api/guardrail_manager/models/join_relationship.py +100 -0
- darkhunt_api/guardrail_manager/models/operator_type.py +64 -0
- darkhunt_api/guardrail_manager/models/order_by.py +101 -0
- darkhunt_api/guardrail_manager/models/slack_integration_config.py +93 -0
- darkhunt_api/guardrail_manager/models/time_bucket_group_by.py +92 -0
- darkhunt_api/guardrail_manager/rest.py +267 -0
- darkhunt_api/workflow_manager/__init__.py +63 -0
- darkhunt_api/workflow_manager/api/__init__.py +7 -0
- darkhunt_api/workflow_manager/api/analytics_api.py +608 -0
- darkhunt_api/workflow_manager/api/applications_api.py +1556 -0
- darkhunt_api/workflow_manager/api/workspaces_api.py +1475 -0
- darkhunt_api/workflow_manager/api_client.py +731 -0
- darkhunt_api/workflow_manager/api_response.py +21 -0
- darkhunt_api/workflow_manager/configuration.py +443 -0
- darkhunt_api/workflow_manager/exceptions.py +200 -0
- darkhunt_api/workflow_manager/models/__init__.py +44 -0
- darkhunt_api/workflow_manager/models/aggregation.py +94 -0
- darkhunt_api/workflow_manager/models/aggregation_function.py +49 -0
- darkhunt_api/workflow_manager/models/analytics_request.py +130 -0
- darkhunt_api/workflow_manager/models/analytics_request_group_by_inner.py +150 -0
- darkhunt_api/workflow_manager/models/analytics_response.py +97 -0
- darkhunt_api/workflow_manager/models/analytics_row.py +106 -0
- darkhunt_api/workflow_manager/models/application.py +124 -0
- darkhunt_api/workflow_manager/models/application_create_request.py +97 -0
- darkhunt_api/workflow_manager/models/application_status.py +48 -0
- darkhunt_api/workflow_manager/models/application_type.py +46 -0
- darkhunt_api/workflow_manager/models/application_update_request.py +94 -0
- darkhunt_api/workflow_manager/models/dataset_definition.py +113 -0
- darkhunt_api/workflow_manager/models/dataset_registry.py +96 -0
- darkhunt_api/workflow_manager/models/drill_down.py +97 -0
- darkhunt_api/workflow_manager/models/error_response.py +101 -0
- darkhunt_api/workflow_manager/models/field_definition.py +105 -0
- darkhunt_api/workflow_manager/models/field_type.py +53 -0
- darkhunt_api/workflow_manager/models/join_cardinality.py +47 -0
- darkhunt_api/workflow_manager/models/join_config.py +117 -0
- darkhunt_api/workflow_manager/models/join_on.py +91 -0
- darkhunt_api/workflow_manager/models/join_order_by.py +101 -0
- darkhunt_api/workflow_manager/models/join_relationship.py +100 -0
- darkhunt_api/workflow_manager/models/operator_type.py +64 -0
- darkhunt_api/workflow_manager/models/order_by.py +101 -0
- darkhunt_api/workflow_manager/models/time_bucket_group_by.py +92 -0
- darkhunt_api/workflow_manager/models/workspace.py +102 -0
- darkhunt_api/workflow_manager/models/workspace_create_request.py +94 -0
- darkhunt_api/workflow_manager/models/workspace_update_request.py +94 -0
- darkhunt_api/workflow_manager/rest.py +267 -0
- darkhunt_api-0.1.1.dist-info/METADATA +99 -0
- darkhunt_api-0.1.1.dist-info/RECORD +83 -0
- darkhunt_api-0.1.1.dist-info/WHEEL +4 -0
- darkhunt_api-0.1.1.dist-info/licenses/LICENSE +201 -0
darkhunt_api/__init__.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Darkhunt public API SDK.
|
|
2
|
+
|
|
3
|
+
Generated from the public OpenAPI contracts published at
|
|
4
|
+
https://docs.darkhunt.ai/openapi/. Do not edit by hand.
|
|
5
|
+
|
|
6
|
+
Each service module carries the contract version it was generated from:
|
|
7
|
+
|
|
8
|
+
darkhunt_api.guardrail_manager.__version__ == "0.5.0"
|
|
9
|
+
darkhunt_api.workflow_manager.__version__ == "0.29.0"
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.1"
|
|
13
|
+
|
|
14
|
+
#: Contract version each service module was generated from. The package
|
|
15
|
+
#: version above is independent of these — one package, several contracts.
|
|
16
|
+
CONTRACT_VERSIONS = {
|
|
17
|
+
"guardrail_manager": "0.5.0",
|
|
18
|
+
"workflow_manager": "0.29.0",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
__all__ = ["CONTRACT_VERSIONS", "__version__"]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Guardrail Manager API
|
|
7
|
+
|
|
8
|
+
API for managing guardrail rules, enforcement logs, and integrations
|
|
9
|
+
|
|
10
|
+
The version of the OpenAPI document: 0.5.0
|
|
11
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
12
|
+
|
|
13
|
+
Do not edit the class manually.
|
|
14
|
+
""" # noqa: E501
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__version__ = "0.5.0"
|
|
18
|
+
|
|
19
|
+
# import apis into sdk package
|
|
20
|
+
from darkhunt_api.guardrail_manager.api.analytics_api import AnalyticsApi
|
|
21
|
+
from darkhunt_api.guardrail_manager.api.guardrail_rules_api import GuardrailRulesApi
|
|
22
|
+
from darkhunt_api.guardrail_manager.api.integrations_api import IntegrationsApi
|
|
23
|
+
|
|
24
|
+
# import ApiClient
|
|
25
|
+
from darkhunt_api.guardrail_manager.api_response import ApiResponse
|
|
26
|
+
from darkhunt_api.guardrail_manager.api_client import ApiClient
|
|
27
|
+
from darkhunt_api.guardrail_manager.configuration import Configuration
|
|
28
|
+
from darkhunt_api.guardrail_manager.exceptions import OpenApiException
|
|
29
|
+
from darkhunt_api.guardrail_manager.exceptions import ApiTypeError
|
|
30
|
+
from darkhunt_api.guardrail_manager.exceptions import ApiValueError
|
|
31
|
+
from darkhunt_api.guardrail_manager.exceptions import ApiKeyError
|
|
32
|
+
from darkhunt_api.guardrail_manager.exceptions import ApiAttributeError
|
|
33
|
+
from darkhunt_api.guardrail_manager.exceptions import ApiException
|
|
34
|
+
|
|
35
|
+
# import models into sdk package
|
|
36
|
+
from darkhunt_api.guardrail_manager.models.aggregation import Aggregation
|
|
37
|
+
from darkhunt_api.guardrail_manager.models.aggregation_function import AggregationFunction
|
|
38
|
+
from darkhunt_api.guardrail_manager.models.analytics_request import AnalyticsRequest
|
|
39
|
+
from darkhunt_api.guardrail_manager.models.analytics_request_group_by_inner import AnalyticsRequestGroupByInner
|
|
40
|
+
from darkhunt_api.guardrail_manager.models.analytics_response import AnalyticsResponse
|
|
41
|
+
from darkhunt_api.guardrail_manager.models.dataset_definition import DatasetDefinition
|
|
42
|
+
from darkhunt_api.guardrail_manager.models.dataset_registry import DatasetRegistry
|
|
43
|
+
from darkhunt_api.guardrail_manager.models.email_integration_config import EmailIntegrationConfig
|
|
44
|
+
from darkhunt_api.guardrail_manager.models.error_response import ErrorResponse
|
|
45
|
+
from darkhunt_api.guardrail_manager.models.field_definition import FieldDefinition
|
|
46
|
+
from darkhunt_api.guardrail_manager.models.field_type import FieldType
|
|
47
|
+
from darkhunt_api.guardrail_manager.models.guardrail_rule import GuardrailRule
|
|
48
|
+
from darkhunt_api.guardrail_manager.models.guardrail_rule_action import GuardrailRuleAction
|
|
49
|
+
from darkhunt_api.guardrail_manager.models.guardrail_rule_create_request import GuardrailRuleCreateRequest
|
|
50
|
+
from darkhunt_api.guardrail_manager.models.guardrail_rule_field_definition import GuardrailRuleFieldDefinition
|
|
51
|
+
from darkhunt_api.guardrail_manager.models.guardrail_rule_update_request import GuardrailRuleUpdateRequest
|
|
52
|
+
from darkhunt_api.guardrail_manager.models.http_integration_config import HttpIntegrationConfig
|
|
53
|
+
from darkhunt_api.guardrail_manager.models.integration import Integration
|
|
54
|
+
from darkhunt_api.guardrail_manager.models.integration_type import IntegrationType
|
|
55
|
+
from darkhunt_api.guardrail_manager.models.join_cardinality import JoinCardinality
|
|
56
|
+
from darkhunt_api.guardrail_manager.models.join_config import JoinConfig
|
|
57
|
+
from darkhunt_api.guardrail_manager.models.join_on import JoinOn
|
|
58
|
+
from darkhunt_api.guardrail_manager.models.join_order_by import JoinOrderBy
|
|
59
|
+
from darkhunt_api.guardrail_manager.models.join_relationship import JoinRelationship
|
|
60
|
+
from darkhunt_api.guardrail_manager.models.operator_type import OperatorType
|
|
61
|
+
from darkhunt_api.guardrail_manager.models.order_by import OrderBy
|
|
62
|
+
from darkhunt_api.guardrail_manager.models.slack_integration_config import SlackIntegrationConfig
|
|
63
|
+
from darkhunt_api.guardrail_manager.models.time_bucket_group_by import TimeBucketGroupBy
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# flake8: noqa
|
|
2
|
+
|
|
3
|
+
# import apis into api package
|
|
4
|
+
from darkhunt_api.guardrail_manager.api.analytics_api import AnalyticsApi
|
|
5
|
+
from darkhunt_api.guardrail_manager.api.guardrail_rules_api import GuardrailRulesApi
|
|
6
|
+
from darkhunt_api.guardrail_manager.api.integrations_api import IntegrationsApi
|
|
7
|
+
|
|
@@ -0,0 +1,605 @@
|
|
|
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 darkhunt_api.guardrail_manager.models.analytics_request import AnalyticsRequest
|
|
31
|
+
from darkhunt_api.guardrail_manager.models.analytics_response import AnalyticsResponse
|
|
32
|
+
from darkhunt_api.guardrail_manager.models.dataset_registry import DatasetRegistry
|
|
33
|
+
|
|
34
|
+
from darkhunt_api.guardrail_manager.api_client import ApiClient
|
|
35
|
+
from darkhunt_api.guardrail_manager.api_response import ApiResponse
|
|
36
|
+
from darkhunt_api.guardrail_manager.rest import RESTResponseType
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class AnalyticsApi:
|
|
40
|
+
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
41
|
+
Ref: https://openapi-generator.tech
|
|
42
|
+
|
|
43
|
+
Do not edit the class manually.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
def __init__(self, api_client=None) -> None:
|
|
47
|
+
if api_client is None:
|
|
48
|
+
api_client = ApiClient.get_default()
|
|
49
|
+
self.api_client = api_client
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@validate_call
|
|
53
|
+
def execute_analytics_query(
|
|
54
|
+
self,
|
|
55
|
+
tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
|
|
56
|
+
dataset_key: Annotated[StrictStr, Field(description="Dataset identifier. Available datasets: guardrail_results, guardrail_rules")],
|
|
57
|
+
analytics_request: AnalyticsRequest,
|
|
58
|
+
_request_timeout: Union[
|
|
59
|
+
None,
|
|
60
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
61
|
+
Tuple[
|
|
62
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
63
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
64
|
+
]
|
|
65
|
+
] = None,
|
|
66
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
67
|
+
_content_type: Optional[StrictStr] = None,
|
|
68
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
69
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
70
|
+
) -> AnalyticsResponse:
|
|
71
|
+
"""Execute analytics query
|
|
72
|
+
|
|
73
|
+
Execute aggregation and grouping query on a dataset using HuntQL filter syntax
|
|
74
|
+
|
|
75
|
+
:param tenant_id: Unique tenant identifier (required)
|
|
76
|
+
:type tenant_id: str
|
|
77
|
+
:param dataset_key: Dataset identifier. Available datasets: guardrail_results, guardrail_rules (required)
|
|
78
|
+
:type dataset_key: str
|
|
79
|
+
:param analytics_request: (required)
|
|
80
|
+
:type analytics_request: AnalyticsRequest
|
|
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._execute_analytics_query_serialize(
|
|
104
|
+
tenant_id=tenant_id,
|
|
105
|
+
dataset_key=dataset_key,
|
|
106
|
+
analytics_request=analytics_request,
|
|
107
|
+
_request_auth=_request_auth,
|
|
108
|
+
_content_type=_content_type,
|
|
109
|
+
_headers=_headers,
|
|
110
|
+
_host_index=_host_index
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
114
|
+
'200': "AnalyticsResponse",
|
|
115
|
+
'400': "ErrorResponse",
|
|
116
|
+
'404': "ErrorResponse",
|
|
117
|
+
'500': "ErrorResponse",
|
|
118
|
+
}
|
|
119
|
+
response_data = self.api_client.call_api(
|
|
120
|
+
*_param,
|
|
121
|
+
_request_timeout=_request_timeout
|
|
122
|
+
)
|
|
123
|
+
response_data.read()
|
|
124
|
+
return self.api_client.response_deserialize(
|
|
125
|
+
response_data=response_data,
|
|
126
|
+
response_types_map=_response_types_map,
|
|
127
|
+
).data
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@validate_call
|
|
131
|
+
def execute_analytics_query_with_http_info(
|
|
132
|
+
self,
|
|
133
|
+
tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
|
|
134
|
+
dataset_key: Annotated[StrictStr, Field(description="Dataset identifier. Available datasets: guardrail_results, guardrail_rules")],
|
|
135
|
+
analytics_request: AnalyticsRequest,
|
|
136
|
+
_request_timeout: Union[
|
|
137
|
+
None,
|
|
138
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
139
|
+
Tuple[
|
|
140
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
141
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
142
|
+
]
|
|
143
|
+
] = None,
|
|
144
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
145
|
+
_content_type: Optional[StrictStr] = None,
|
|
146
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
147
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
148
|
+
) -> ApiResponse[AnalyticsResponse]:
|
|
149
|
+
"""Execute analytics query
|
|
150
|
+
|
|
151
|
+
Execute aggregation and grouping query on a dataset using HuntQL filter syntax
|
|
152
|
+
|
|
153
|
+
:param tenant_id: Unique tenant identifier (required)
|
|
154
|
+
:type tenant_id: str
|
|
155
|
+
:param dataset_key: Dataset identifier. Available datasets: guardrail_results, guardrail_rules (required)
|
|
156
|
+
:type dataset_key: str
|
|
157
|
+
:param analytics_request: (required)
|
|
158
|
+
:type analytics_request: AnalyticsRequest
|
|
159
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
160
|
+
number provided, it will be total request
|
|
161
|
+
timeout. It can also be a pair (tuple) of
|
|
162
|
+
(connection, read) timeouts.
|
|
163
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
164
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
165
|
+
request; this effectively ignores the
|
|
166
|
+
authentication in the spec for a single request.
|
|
167
|
+
:type _request_auth: dict, optional
|
|
168
|
+
:param _content_type: force content-type for the request.
|
|
169
|
+
:type _content_type: str, Optional
|
|
170
|
+
:param _headers: set to override the headers for a single
|
|
171
|
+
request; this effectively ignores the headers
|
|
172
|
+
in the spec for a single request.
|
|
173
|
+
:type _headers: dict, optional
|
|
174
|
+
:param _host_index: set to override the host_index for a single
|
|
175
|
+
request; this effectively ignores the host_index
|
|
176
|
+
in the spec for a single request.
|
|
177
|
+
:type _host_index: int, optional
|
|
178
|
+
:return: Returns the result object.
|
|
179
|
+
""" # noqa: E501
|
|
180
|
+
|
|
181
|
+
_param = self._execute_analytics_query_serialize(
|
|
182
|
+
tenant_id=tenant_id,
|
|
183
|
+
dataset_key=dataset_key,
|
|
184
|
+
analytics_request=analytics_request,
|
|
185
|
+
_request_auth=_request_auth,
|
|
186
|
+
_content_type=_content_type,
|
|
187
|
+
_headers=_headers,
|
|
188
|
+
_host_index=_host_index
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
192
|
+
'200': "AnalyticsResponse",
|
|
193
|
+
'400': "ErrorResponse",
|
|
194
|
+
'404': "ErrorResponse",
|
|
195
|
+
'500': "ErrorResponse",
|
|
196
|
+
}
|
|
197
|
+
response_data = self.api_client.call_api(
|
|
198
|
+
*_param,
|
|
199
|
+
_request_timeout=_request_timeout
|
|
200
|
+
)
|
|
201
|
+
response_data.read()
|
|
202
|
+
return self.api_client.response_deserialize(
|
|
203
|
+
response_data=response_data,
|
|
204
|
+
response_types_map=_response_types_map,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
@validate_call
|
|
209
|
+
def execute_analytics_query_without_preload_content(
|
|
210
|
+
self,
|
|
211
|
+
tenant_id: Annotated[StrictStr, Field(description="Unique tenant identifier")],
|
|
212
|
+
dataset_key: Annotated[StrictStr, Field(description="Dataset identifier. Available datasets: guardrail_results, guardrail_rules")],
|
|
213
|
+
analytics_request: AnalyticsRequest,
|
|
214
|
+
_request_timeout: Union[
|
|
215
|
+
None,
|
|
216
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
217
|
+
Tuple[
|
|
218
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
219
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
220
|
+
]
|
|
221
|
+
] = None,
|
|
222
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
223
|
+
_content_type: Optional[StrictStr] = None,
|
|
224
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
225
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
226
|
+
) -> RESTResponseType:
|
|
227
|
+
"""Execute analytics query
|
|
228
|
+
|
|
229
|
+
Execute aggregation and grouping query on a dataset using HuntQL filter syntax
|
|
230
|
+
|
|
231
|
+
:param tenant_id: Unique tenant identifier (required)
|
|
232
|
+
:type tenant_id: str
|
|
233
|
+
:param dataset_key: Dataset identifier. Available datasets: guardrail_results, guardrail_rules (required)
|
|
234
|
+
:type dataset_key: str
|
|
235
|
+
:param analytics_request: (required)
|
|
236
|
+
:type analytics_request: AnalyticsRequest
|
|
237
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
238
|
+
number provided, it will be total request
|
|
239
|
+
timeout. It can also be a pair (tuple) of
|
|
240
|
+
(connection, read) timeouts.
|
|
241
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
242
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
243
|
+
request; this effectively ignores the
|
|
244
|
+
authentication in the spec for a single request.
|
|
245
|
+
:type _request_auth: dict, optional
|
|
246
|
+
:param _content_type: force content-type for the request.
|
|
247
|
+
:type _content_type: str, Optional
|
|
248
|
+
:param _headers: set to override the headers for a single
|
|
249
|
+
request; this effectively ignores the headers
|
|
250
|
+
in the spec for a single request.
|
|
251
|
+
:type _headers: dict, optional
|
|
252
|
+
:param _host_index: set to override the host_index for a single
|
|
253
|
+
request; this effectively ignores the host_index
|
|
254
|
+
in the spec for a single request.
|
|
255
|
+
:type _host_index: int, optional
|
|
256
|
+
:return: Returns the result object.
|
|
257
|
+
""" # noqa: E501
|
|
258
|
+
|
|
259
|
+
_param = self._execute_analytics_query_serialize(
|
|
260
|
+
tenant_id=tenant_id,
|
|
261
|
+
dataset_key=dataset_key,
|
|
262
|
+
analytics_request=analytics_request,
|
|
263
|
+
_request_auth=_request_auth,
|
|
264
|
+
_content_type=_content_type,
|
|
265
|
+
_headers=_headers,
|
|
266
|
+
_host_index=_host_index
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
270
|
+
'200': "AnalyticsResponse",
|
|
271
|
+
'400': "ErrorResponse",
|
|
272
|
+
'404': "ErrorResponse",
|
|
273
|
+
'500': "ErrorResponse",
|
|
274
|
+
}
|
|
275
|
+
response_data = self.api_client.call_api(
|
|
276
|
+
*_param,
|
|
277
|
+
_request_timeout=_request_timeout
|
|
278
|
+
)
|
|
279
|
+
return response_data.response
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def _execute_analytics_query_serialize(
|
|
283
|
+
self,
|
|
284
|
+
tenant_id,
|
|
285
|
+
dataset_key,
|
|
286
|
+
analytics_request,
|
|
287
|
+
_request_auth,
|
|
288
|
+
_content_type,
|
|
289
|
+
_headers,
|
|
290
|
+
_host_index,
|
|
291
|
+
) -> Tuple:
|
|
292
|
+
|
|
293
|
+
_host = None
|
|
294
|
+
|
|
295
|
+
_collection_formats: Dict[str, str] = {
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
_path_params: Dict[str, str] = {}
|
|
299
|
+
_query_params: List[Tuple[str, str]] = []
|
|
300
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
301
|
+
_form_params: List[Tuple[str, str]] = []
|
|
302
|
+
_files: Dict[str, str] = {}
|
|
303
|
+
_body_params: Optional[bytes] = None
|
|
304
|
+
|
|
305
|
+
# process the path parameters
|
|
306
|
+
if tenant_id is not None:
|
|
307
|
+
_path_params['tenantId'] = tenant_id
|
|
308
|
+
if dataset_key is not None:
|
|
309
|
+
_path_params['datasetKey'] = dataset_key
|
|
310
|
+
# process the query parameters
|
|
311
|
+
# process the header parameters
|
|
312
|
+
# process the form parameters
|
|
313
|
+
# process the body parameter
|
|
314
|
+
if analytics_request is not None:
|
|
315
|
+
_body_params = analytics_request
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
# set the HTTP header `Accept`
|
|
319
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
320
|
+
[
|
|
321
|
+
'application/json'
|
|
322
|
+
]
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
# set the HTTP header `Content-Type`
|
|
326
|
+
if _content_type:
|
|
327
|
+
_header_params['Content-Type'] = _content_type
|
|
328
|
+
else:
|
|
329
|
+
_default_content_type = (
|
|
330
|
+
self.api_client.select_header_content_type(
|
|
331
|
+
[
|
|
332
|
+
'application/json'
|
|
333
|
+
]
|
|
334
|
+
)
|
|
335
|
+
)
|
|
336
|
+
if _default_content_type is not None:
|
|
337
|
+
_header_params['Content-Type'] = _default_content_type
|
|
338
|
+
|
|
339
|
+
# authentication setting
|
|
340
|
+
_auth_settings: List[str] = [
|
|
341
|
+
'bearerHttpAuthentication'
|
|
342
|
+
]
|
|
343
|
+
|
|
344
|
+
return self.api_client.param_serialize(
|
|
345
|
+
method='POST',
|
|
346
|
+
resource_path='/api/t/{tenantId}/analytics/{datasetKey}',
|
|
347
|
+
path_params=_path_params,
|
|
348
|
+
query_params=_query_params,
|
|
349
|
+
header_params=_header_params,
|
|
350
|
+
body=_body_params,
|
|
351
|
+
post_params=_form_params,
|
|
352
|
+
files=_files,
|
|
353
|
+
auth_settings=_auth_settings,
|
|
354
|
+
collection_formats=_collection_formats,
|
|
355
|
+
_host=_host,
|
|
356
|
+
_request_auth=_request_auth
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
@validate_call
|
|
363
|
+
def get_analytics_datasets(
|
|
364
|
+
self,
|
|
365
|
+
_request_timeout: Union[
|
|
366
|
+
None,
|
|
367
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
368
|
+
Tuple[
|
|
369
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
370
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
371
|
+
]
|
|
372
|
+
] = None,
|
|
373
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
374
|
+
_content_type: Optional[StrictStr] = None,
|
|
375
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
376
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
377
|
+
) -> DatasetRegistry:
|
|
378
|
+
"""Get available analytics datasets
|
|
379
|
+
|
|
380
|
+
Returns list of datasets available for analytics queries with their field definitions
|
|
381
|
+
|
|
382
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
383
|
+
number provided, it will be total request
|
|
384
|
+
timeout. It can also be a pair (tuple) of
|
|
385
|
+
(connection, read) timeouts.
|
|
386
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
387
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
388
|
+
request; this effectively ignores the
|
|
389
|
+
authentication in the spec for a single request.
|
|
390
|
+
:type _request_auth: dict, optional
|
|
391
|
+
:param _content_type: force content-type for the request.
|
|
392
|
+
:type _content_type: str, Optional
|
|
393
|
+
:param _headers: set to override the headers for a single
|
|
394
|
+
request; this effectively ignores the headers
|
|
395
|
+
in the spec for a single request.
|
|
396
|
+
:type _headers: dict, optional
|
|
397
|
+
:param _host_index: set to override the host_index for a single
|
|
398
|
+
request; this effectively ignores the host_index
|
|
399
|
+
in the spec for a single request.
|
|
400
|
+
:type _host_index: int, optional
|
|
401
|
+
:return: Returns the result object.
|
|
402
|
+
""" # noqa: E501
|
|
403
|
+
|
|
404
|
+
_param = self._get_analytics_datasets_serialize(
|
|
405
|
+
_request_auth=_request_auth,
|
|
406
|
+
_content_type=_content_type,
|
|
407
|
+
_headers=_headers,
|
|
408
|
+
_host_index=_host_index
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
412
|
+
'200': "DatasetRegistry",
|
|
413
|
+
'500': "ErrorResponse",
|
|
414
|
+
}
|
|
415
|
+
response_data = self.api_client.call_api(
|
|
416
|
+
*_param,
|
|
417
|
+
_request_timeout=_request_timeout
|
|
418
|
+
)
|
|
419
|
+
response_data.read()
|
|
420
|
+
return self.api_client.response_deserialize(
|
|
421
|
+
response_data=response_data,
|
|
422
|
+
response_types_map=_response_types_map,
|
|
423
|
+
).data
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
@validate_call
|
|
427
|
+
def get_analytics_datasets_with_http_info(
|
|
428
|
+
self,
|
|
429
|
+
_request_timeout: Union[
|
|
430
|
+
None,
|
|
431
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
432
|
+
Tuple[
|
|
433
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
434
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
435
|
+
]
|
|
436
|
+
] = None,
|
|
437
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
438
|
+
_content_type: Optional[StrictStr] = None,
|
|
439
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
440
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
441
|
+
) -> ApiResponse[DatasetRegistry]:
|
|
442
|
+
"""Get available analytics datasets
|
|
443
|
+
|
|
444
|
+
Returns list of datasets available for analytics queries with their field definitions
|
|
445
|
+
|
|
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._get_analytics_datasets_serialize(
|
|
469
|
+
_request_auth=_request_auth,
|
|
470
|
+
_content_type=_content_type,
|
|
471
|
+
_headers=_headers,
|
|
472
|
+
_host_index=_host_index
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
476
|
+
'200': "DatasetRegistry",
|
|
477
|
+
'500': "ErrorResponse",
|
|
478
|
+
}
|
|
479
|
+
response_data = self.api_client.call_api(
|
|
480
|
+
*_param,
|
|
481
|
+
_request_timeout=_request_timeout
|
|
482
|
+
)
|
|
483
|
+
response_data.read()
|
|
484
|
+
return self.api_client.response_deserialize(
|
|
485
|
+
response_data=response_data,
|
|
486
|
+
response_types_map=_response_types_map,
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
@validate_call
|
|
491
|
+
def get_analytics_datasets_without_preload_content(
|
|
492
|
+
self,
|
|
493
|
+
_request_timeout: Union[
|
|
494
|
+
None,
|
|
495
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
496
|
+
Tuple[
|
|
497
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
498
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
499
|
+
]
|
|
500
|
+
] = None,
|
|
501
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
502
|
+
_content_type: Optional[StrictStr] = None,
|
|
503
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
504
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
505
|
+
) -> RESTResponseType:
|
|
506
|
+
"""Get available analytics datasets
|
|
507
|
+
|
|
508
|
+
Returns list of datasets available for analytics queries with their field definitions
|
|
509
|
+
|
|
510
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
511
|
+
number provided, it will be total request
|
|
512
|
+
timeout. It can also be a pair (tuple) of
|
|
513
|
+
(connection, read) timeouts.
|
|
514
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
515
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
516
|
+
request; this effectively ignores the
|
|
517
|
+
authentication in the spec for a single request.
|
|
518
|
+
:type _request_auth: dict, optional
|
|
519
|
+
:param _content_type: force content-type for the request.
|
|
520
|
+
:type _content_type: str, Optional
|
|
521
|
+
:param _headers: set to override the headers for a single
|
|
522
|
+
request; this effectively ignores the headers
|
|
523
|
+
in the spec for a single request.
|
|
524
|
+
:type _headers: dict, optional
|
|
525
|
+
:param _host_index: set to override the host_index for a single
|
|
526
|
+
request; this effectively ignores the host_index
|
|
527
|
+
in the spec for a single request.
|
|
528
|
+
:type _host_index: int, optional
|
|
529
|
+
:return: Returns the result object.
|
|
530
|
+
""" # noqa: E501
|
|
531
|
+
|
|
532
|
+
_param = self._get_analytics_datasets_serialize(
|
|
533
|
+
_request_auth=_request_auth,
|
|
534
|
+
_content_type=_content_type,
|
|
535
|
+
_headers=_headers,
|
|
536
|
+
_host_index=_host_index
|
|
537
|
+
)
|
|
538
|
+
|
|
539
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
540
|
+
'200': "DatasetRegistry",
|
|
541
|
+
'500': "ErrorResponse",
|
|
542
|
+
}
|
|
543
|
+
response_data = self.api_client.call_api(
|
|
544
|
+
*_param,
|
|
545
|
+
_request_timeout=_request_timeout
|
|
546
|
+
)
|
|
547
|
+
return response_data.response
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
def _get_analytics_datasets_serialize(
|
|
551
|
+
self,
|
|
552
|
+
_request_auth,
|
|
553
|
+
_content_type,
|
|
554
|
+
_headers,
|
|
555
|
+
_host_index,
|
|
556
|
+
) -> Tuple:
|
|
557
|
+
|
|
558
|
+
_host = None
|
|
559
|
+
|
|
560
|
+
_collection_formats: Dict[str, str] = {
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
_path_params: Dict[str, str] = {}
|
|
564
|
+
_query_params: List[Tuple[str, str]] = []
|
|
565
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
566
|
+
_form_params: List[Tuple[str, str]] = []
|
|
567
|
+
_files: Dict[str, str] = {}
|
|
568
|
+
_body_params: Optional[bytes] = None
|
|
569
|
+
|
|
570
|
+
# process the path parameters
|
|
571
|
+
# process the query parameters
|
|
572
|
+
# process the header parameters
|
|
573
|
+
# process the form parameters
|
|
574
|
+
# process the body parameter
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
# set the HTTP header `Accept`
|
|
578
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
579
|
+
[
|
|
580
|
+
'application/json'
|
|
581
|
+
]
|
|
582
|
+
)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
# authentication setting
|
|
586
|
+
_auth_settings: List[str] = [
|
|
587
|
+
'bearerHttpAuthentication'
|
|
588
|
+
]
|
|
589
|
+
|
|
590
|
+
return self.api_client.param_serialize(
|
|
591
|
+
method='GET',
|
|
592
|
+
resource_path='/api/analytics/datasets',
|
|
593
|
+
path_params=_path_params,
|
|
594
|
+
query_params=_query_params,
|
|
595
|
+
header_params=_header_params,
|
|
596
|
+
body=_body_params,
|
|
597
|
+
post_params=_form_params,
|
|
598
|
+
files=_files,
|
|
599
|
+
auth_settings=_auth_settings,
|
|
600
|
+
collection_formats=_collection_formats,
|
|
601
|
+
_host=_host,
|
|
602
|
+
_request_auth=_request_auth
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
|