arthur-client 1.4.1055__py3-none-any.whl → 1.4.1186__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.
- arthur_client/api_bindings/__init__.py +5 -1
- arthur_client/api_bindings/api/alert_rules_v1_api.py +303 -0
- arthur_client/api_bindings/api/datasets_v1_api.py +3 -0
- arthur_client/api_bindings/docs/AggregationSpecSchemaInitArgsInner.md +1 -1
- arthur_client/api_bindings/docs/Alert.md +1 -0
- arthur_client/api_bindings/docs/AlertRule.md +1 -0
- arthur_client/api_bindings/docs/AlertRuleInterval.md +30 -0
- arthur_client/api_bindings/docs/AlertRuleSQLValidationResp.md +32 -0
- arthur_client/api_bindings/docs/AlertRulesV1Api.md +83 -0
- arthur_client/api_bindings/docs/DType.md +2 -0
- arthur_client/api_bindings/docs/DatasetLocatorFieldDataType.md +2 -0
- arthur_client/api_bindings/docs/DatasetsV1Api.md +1 -0
- arthur_client/api_bindings/docs/IntervalUnit.md +16 -0
- arthur_client/api_bindings/docs/Items1.md +1 -1
- arthur_client/api_bindings/docs/MetricsColumnListParameterSchema.md +4 -0
- arthur_client/api_bindings/docs/MetricsColumnListParameterSchemaAllowedColumnTypesInner.md +31 -0
- arthur_client/api_bindings/docs/MetricsColumnParameterSchema.md +1 -1
- arthur_client/api_bindings/docs/ObjectType.md +1 -1
- arthur_client/api_bindings/docs/PatchAlertRule.md +1 -0
- arthur_client/api_bindings/docs/PostAlert.md +1 -0
- arthur_client/api_bindings/docs/PostAlertRule.md +1 -0
- arthur_client/api_bindings/docs/PostMetricsQuery.md +1 -0
- arthur_client/api_bindings/docs/ValidateAlertRuleQueryReq.md +29 -0
- arthur_client/api_bindings/models/__init__.py +5 -1
- arthur_client/api_bindings/models/alert.py +7 -1
- arthur_client/api_bindings/models/alert_rule.py +7 -1
- arthur_client/api_bindings/models/alert_rule_interval.py +90 -0
- arthur_client/api_bindings/models/alert_rule_sql_validation_resp.py +93 -0
- arthur_client/api_bindings/models/d_type.py +1 -0
- arthur_client/api_bindings/models/dataset_locator_field_data_type.py +1 -0
- arthur_client/api_bindings/models/interval_unit.py +39 -0
- arthur_client/api_bindings/models/metrics_column_list_parameter_schema.py +24 -2
- arthur_client/api_bindings/models/{metrics_column_parameter_schema_allowed_column_types_inner.py → metrics_column_list_parameter_schema_allowed_column_types_inner.py} +7 -7
- arthur_client/api_bindings/models/metrics_column_parameter_schema.py +3 -3
- arthur_client/api_bindings/models/object_type.py +3 -3
- arthur_client/api_bindings/models/patch_alert_rule.py +12 -1
- arthur_client/api_bindings/models/post_alert.py +7 -1
- arthur_client/api_bindings/models/post_alert_rule.py +7 -1
- arthur_client/api_bindings/models/post_metrics_query.py +12 -1
- arthur_client/api_bindings/models/validate_alert_rule_query_req.py +87 -0
- arthur_client/api_bindings/test/test_alert.py +6 -0
- arthur_client/api_bindings/test/test_alert_rule.py +6 -0
- arthur_client/api_bindings/test/test_alert_rule_interval.py +54 -0
- arthur_client/api_bindings/test/test_alert_rule_sql_validation_resp.py +58 -0
- arthur_client/api_bindings/test/test_alert_rules_v1_api.py +7 -0
- arthur_client/api_bindings/test/test_created_alerts.py +6 -0
- arthur_client/api_bindings/test/test_infinite_resource_list_alert.py +6 -0
- arthur_client/api_bindings/test/test_interval_unit.py +33 -0
- arthur_client/api_bindings/test/test_metrics_column_list_parameter_schema.py +10 -1
- arthur_client/api_bindings/test/{test_metrics_column_parameter_schema_allowed_column_types_inner.py → test_metrics_column_list_parameter_schema_allowed_column_types_inner.py} +11 -11
- arthur_client/api_bindings/test/test_patch_alert_rule.py +3 -0
- arthur_client/api_bindings/test/test_post_alert.py +6 -0
- arthur_client/api_bindings/test/test_post_alert_rule.py +6 -0
- arthur_client/api_bindings/test/test_post_alerts.py +6 -0
- arthur_client/api_bindings/test/test_post_metrics_query.py +3 -0
- arthur_client/api_bindings/test/test_resource_list_alert_rule.py +6 -0
- arthur_client/api_bindings/test/test_validate_alert_rule_query_req.py +52 -0
- arthur_client/api_bindings_README.md +6 -1
- {arthur_client-1.4.1055.dist-info → arthur_client-1.4.1186.dist-info}/METADATA +1 -1
- {arthur_client-1.4.1055.dist-info → arthur_client-1.4.1186.dist-info}/RECORD +61 -49
- arthur_client/api_bindings/docs/MetricsColumnParameterSchemaAllowedColumnTypesInner.md +0 -31
- {arthur_client-1.4.1055.dist-info → arthur_client-1.4.1186.dist-info}/WHEEL +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# MetricsColumnListParameterSchemaAllowedColumnTypesInner
|
2
|
+
|
3
|
+
|
4
|
+
## Properties
|
5
|
+
|
6
|
+
Name | Type | Description | Notes
|
7
|
+
------------ | ------------- | ------------- | -------------
|
8
|
+
**dtype** | [**DType**](DType.md) | |
|
9
|
+
**object** | [**Dict[str, MetricsColumnListParameterSchemaAllowedColumnTypesInner]**](MetricsColumnListParameterSchemaAllowedColumnTypesInner.md) | |
|
10
|
+
**items** | [**Items1**](Items1.md) | |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```python
|
15
|
+
from arthur_client.api_bindings.models.metrics_column_list_parameter_schema_allowed_column_types_inner import MetricsColumnListParameterSchemaAllowedColumnTypesInner
|
16
|
+
|
17
|
+
# TODO update the JSON string below
|
18
|
+
json = "{}"
|
19
|
+
# create an instance of MetricsColumnListParameterSchemaAllowedColumnTypesInner from a JSON string
|
20
|
+
metrics_column_list_parameter_schema_allowed_column_types_inner_instance = MetricsColumnListParameterSchemaAllowedColumnTypesInner.from_json(json)
|
21
|
+
# print the JSON string representation of the object
|
22
|
+
print(MetricsColumnListParameterSchemaAllowedColumnTypesInner.to_json())
|
23
|
+
|
24
|
+
# convert the object into a dict
|
25
|
+
metrics_column_list_parameter_schema_allowed_column_types_inner_dict = metrics_column_list_parameter_schema_allowed_column_types_inner_instance.to_dict()
|
26
|
+
# create an instance of MetricsColumnListParameterSchemaAllowedColumnTypesInner from a dict
|
27
|
+
metrics_column_list_parameter_schema_allowed_column_types_inner_from_dict = MetricsColumnListParameterSchemaAllowedColumnTypesInner.from_dict(metrics_column_list_parameter_schema_allowed_column_types_inner_dict)
|
28
|
+
```
|
29
|
+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
30
|
+
|
31
|
+
|
@@ -12,7 +12,7 @@ Name | Type | Description | Notes
|
|
12
12
|
**parameter_type** | **str** | | [optional] [default to 'column']
|
13
13
|
**tag_hints** | [**List[ScopeSchemaTag]**](ScopeSchemaTag.md) | List of tags that are applicable to this parameter. Datasets with columns that have matching tags can be inferred this way. | [optional] [default to []]
|
14
14
|
**source_dataset_parameter_key** | **str** | Name of the parameter that provides the dataset to be used for this column. |
|
15
|
-
**allowed_column_types** | [**List[
|
15
|
+
**allowed_column_types** | [**List[MetricsColumnListParameterSchemaAllowedColumnTypesInner]**](MetricsColumnListParameterSchemaAllowedColumnTypesInner.md) | | [optional]
|
16
16
|
**allow_any_column_type** | **bool** | Indicates if this metric parameter can accept any column type. | [optional] [default to False]
|
17
17
|
|
18
18
|
## Example
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Name | Type | Description | Notes
|
7
7
|
------------ | ------------- | ------------- | -------------
|
8
|
-
**object** | [**Dict[str,
|
8
|
+
**object** | [**Dict[str, MetricsColumnListParameterSchemaAllowedColumnTypesInner]**](MetricsColumnListParameterSchemaAllowedColumnTypesInner.md) | |
|
9
9
|
|
10
10
|
## Example
|
11
11
|
|
@@ -11,6 +11,7 @@ Name | Type | Description | Notes
|
|
11
11
|
**bound** | [**AlertBound**](AlertBound.md) | | [optional]
|
12
12
|
**query** | **str** | | [optional]
|
13
13
|
**metric_name** | **str** | | [optional]
|
14
|
+
**interval** | [**AlertRuleInterval**](AlertRuleInterval.md) | | [optional]
|
14
15
|
**notification_webhook_ids** | **List[str]** | | [optional]
|
15
16
|
|
16
17
|
## Example
|
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
|
|
10
10
|
**value** | **float** | The value of the metric that triggered the alert. |
|
11
11
|
**threshold** | **float** | The threshold that triggered the alert. |
|
12
12
|
**bound** | [**AlertBound**](AlertBound.md) | The bound of the alert. |
|
13
|
+
**interval** | [**AlertRuleInterval**](AlertRuleInterval.md) | The interval of the alert rule, commonly '1 day', '1 hour', etc. |
|
13
14
|
**dimensions** | **object** | |
|
14
15
|
**alert_rule_id** | **str** | The alert rule id of the alert. |
|
15
16
|
**job_id** | **str** | | [optional]
|
@@ -11,6 +11,7 @@ Name | Type | Description | Notes
|
|
11
11
|
**bound** | [**AlertBound**](AlertBound.md) | The bound of the alert rule. |
|
12
12
|
**query** | **str** | The query of the alert rule. |
|
13
13
|
**metric_name** | **str** | The name of the metric returned by the alert rule query. |
|
14
|
+
**interval** | [**AlertRuleInterval**](AlertRuleInterval.md) | The interval of the alert rule, commonly '1 day', '1 hour', etc. |
|
14
15
|
**notification_webhook_ids** | **List[str]** | The notification webhook IDs where the alert rule will send alert notification. | [optional] [default to []]
|
15
16
|
|
16
17
|
## Example
|
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
|
|
7
7
|
------------ | ------------- | ------------- | -------------
|
8
8
|
**query** | **str** | Query for retrieving the metrics. |
|
9
9
|
**time_range** | [**PostMetricsQueryTimeRange**](PostMetricsQueryTimeRange.md) | Time range to filter the metrics by. |
|
10
|
+
**interval** | [**AlertRuleInterval**](AlertRuleInterval.md) | | [optional]
|
10
11
|
**limit** | **int** | Limit the number of metrics returned. Defaults to 50. | [optional] [default to 50]
|
11
12
|
**result_filter** | [**ResultFilter**](ResultFilter.md) | | [optional]
|
12
13
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# ValidateAlertRuleQueryReq
|
2
|
+
|
3
|
+
|
4
|
+
## Properties
|
5
|
+
|
6
|
+
Name | Type | Description | Notes
|
7
|
+
------------ | ------------- | ------------- | -------------
|
8
|
+
**query** | **str** | The query of the alert rule. |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```python
|
13
|
+
from arthur_client.api_bindings.models.validate_alert_rule_query_req import ValidateAlertRuleQueryReq
|
14
|
+
|
15
|
+
# TODO update the JSON string below
|
16
|
+
json = "{}"
|
17
|
+
# create an instance of ValidateAlertRuleQueryReq from a JSON string
|
18
|
+
validate_alert_rule_query_req_instance = ValidateAlertRuleQueryReq.from_json(json)
|
19
|
+
# print the JSON string representation of the object
|
20
|
+
print(ValidateAlertRuleQueryReq.to_json())
|
21
|
+
|
22
|
+
# convert the object into a dict
|
23
|
+
validate_alert_rule_query_req_dict = validate_alert_rule_query_req_instance.to_dict()
|
24
|
+
# create an instance of ValidateAlertRuleQueryReq from a dict
|
25
|
+
validate_alert_rule_query_req_from_dict = ValidateAlertRuleQueryReq.from_dict(validate_alert_rule_query_req_dict)
|
26
|
+
```
|
27
|
+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
28
|
+
|
29
|
+
|
@@ -22,7 +22,9 @@ from arthur_client.api_bindings.models.alert import Alert
|
|
22
22
|
from arthur_client.api_bindings.models.alert_bound import AlertBound
|
23
23
|
from arthur_client.api_bindings.models.alert_check_job_spec import AlertCheckJobSpec
|
24
24
|
from arthur_client.api_bindings.models.alert_rule import AlertRule
|
25
|
+
from arthur_client.api_bindings.models.alert_rule_interval import AlertRuleInterval
|
25
26
|
from arthur_client.api_bindings.models.alert_rule_notification_webhook import AlertRuleNotificationWebhook
|
27
|
+
from arthur_client.api_bindings.models.alert_rule_sql_validation_resp import AlertRuleSQLValidationResp
|
26
28
|
from arthur_client.api_bindings.models.alert_rule_sort import AlertRuleSort
|
27
29
|
from arthur_client.api_bindings.models.alert_sort import AlertSort
|
28
30
|
from arthur_client.api_bindings.models.alert_webhook_called import AlertWebhookCalled
|
@@ -99,6 +101,7 @@ from arthur_client.api_bindings.models.infinite_pagination import InfinitePagina
|
|
99
101
|
from arthur_client.api_bindings.models.infinite_resource_list_alert import InfiniteResourceListAlert
|
100
102
|
from arthur_client.api_bindings.models.infinite_resource_list_job import InfiniteResourceListJob
|
101
103
|
from arthur_client.api_bindings.models.internal_server_error import InternalServerError
|
104
|
+
from arthur_client.api_bindings.models.interval_unit import IntervalUnit
|
102
105
|
from arthur_client.api_bindings.models.invite_new_user import InviteNewUser
|
103
106
|
from arthur_client.api_bindings.models.items import Items
|
104
107
|
from arthur_client.api_bindings.models.items1 import Items1
|
@@ -124,8 +127,8 @@ from arthur_client.api_bindings.models.list_type import ListType
|
|
124
127
|
from arthur_client.api_bindings.models.metrics_arg_spec import MetricsArgSpec
|
125
128
|
from arthur_client.api_bindings.models.metrics_calculation_job_spec import MetricsCalculationJobSpec
|
126
129
|
from arthur_client.api_bindings.models.metrics_column_list_parameter_schema import MetricsColumnListParameterSchema
|
130
|
+
from arthur_client.api_bindings.models.metrics_column_list_parameter_schema_allowed_column_types_inner import MetricsColumnListParameterSchemaAllowedColumnTypesInner
|
127
131
|
from arthur_client.api_bindings.models.metrics_column_parameter_schema import MetricsColumnParameterSchema
|
128
|
-
from arthur_client.api_bindings.models.metrics_column_parameter_schema_allowed_column_types_inner import MetricsColumnParameterSchemaAllowedColumnTypesInner
|
129
132
|
from arthur_client.api_bindings.models.metrics_dataset_parameter_schema import MetricsDatasetParameterSchema
|
130
133
|
from arthur_client.api_bindings.models.metrics_literal_parameter_schema import MetricsLiteralParameterSchema
|
131
134
|
from arthur_client.api_bindings.models.metrics_query_result import MetricsQueryResult
|
@@ -278,6 +281,7 @@ from arthur_client.api_bindings.models.user_credentials import UserCredentials
|
|
278
281
|
from arthur_client.api_bindings.models.user_service_account_credentials import UserServiceAccountCredentials
|
279
282
|
from arthur_client.api_bindings.models.user_sort import UserSort
|
280
283
|
from arthur_client.api_bindings.models.user_type import UserType
|
284
|
+
from arthur_client.api_bindings.models.validate_alert_rule_query_req import ValidateAlertRuleQueryReq
|
281
285
|
from arthur_client.api_bindings.models.validation_error import ValidationError
|
282
286
|
from arthur_client.api_bindings.models.validation_error_loc_inner import ValidationErrorLocInner
|
283
287
|
from arthur_client.api_bindings.models.webhook import Webhook
|
@@ -21,6 +21,7 @@ from datetime import datetime
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
23
23
|
from arthur_client.api_bindings.models.alert_bound import AlertBound
|
24
|
+
from arthur_client.api_bindings.models.alert_rule_interval import AlertRuleInterval
|
24
25
|
from typing import Optional, Set
|
25
26
|
from typing_extensions import Self
|
26
27
|
|
@@ -33,6 +34,7 @@ class Alert(BaseModel):
|
|
33
34
|
value: Union[StrictFloat, StrictInt] = Field(description="The value of the metric that triggered the alert.")
|
34
35
|
threshold: Union[StrictFloat, StrictInt] = Field(description="The threshold that triggered the alert.")
|
35
36
|
bound: AlertBound = Field(description="The bound of the alert.")
|
37
|
+
interval: AlertRuleInterval = Field(description="The interval of the alert rule, commonly '1 day', '1 hour', etc.")
|
36
38
|
dimensions: Optional[Dict[str, Any]]
|
37
39
|
alert_rule_id: StrictStr = Field(description="The alert rule id of the alert.")
|
38
40
|
job_id: Optional[StrictStr] = None
|
@@ -43,7 +45,7 @@ class Alert(BaseModel):
|
|
43
45
|
alert_rule_name: StrictStr = Field(description="The name of the alert rule.")
|
44
46
|
alert_rule_metric_name: StrictStr = Field(description="The name of the metric returned by the alert rule query.")
|
45
47
|
is_duplicate_of: Optional[StrictStr] = None
|
46
|
-
__properties: ClassVar[List[str]] = ["description", "timestamp", "value", "threshold", "bound", "dimensions", "alert_rule_id", "job_id", "created_at", "updated_at", "id", "model_id", "alert_rule_name", "alert_rule_metric_name", "is_duplicate_of"]
|
48
|
+
__properties: ClassVar[List[str]] = ["description", "timestamp", "value", "threshold", "bound", "interval", "dimensions", "alert_rule_id", "job_id", "created_at", "updated_at", "id", "model_id", "alert_rule_name", "alert_rule_metric_name", "is_duplicate_of"]
|
47
49
|
|
48
50
|
model_config = ConfigDict(
|
49
51
|
populate_by_name=True,
|
@@ -84,6 +86,9 @@ class Alert(BaseModel):
|
|
84
86
|
exclude=excluded_fields,
|
85
87
|
exclude_none=True,
|
86
88
|
)
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of interval
|
90
|
+
if self.interval:
|
91
|
+
_dict['interval'] = self.interval.to_dict()
|
87
92
|
# set to None if description (nullable) is None
|
88
93
|
# and model_fields_set contains the field
|
89
94
|
if self.description is None and "description" in self.model_fields_set:
|
@@ -121,6 +126,7 @@ class Alert(BaseModel):
|
|
121
126
|
"value": obj.get("value"),
|
122
127
|
"threshold": obj.get("threshold"),
|
123
128
|
"bound": obj.get("bound"),
|
129
|
+
"interval": AlertRuleInterval.from_dict(obj["interval"]) if obj.get("interval") is not None else None,
|
124
130
|
"dimensions": obj.get("dimensions"),
|
125
131
|
"alert_rule_id": obj.get("alert_rule_id"),
|
126
132
|
"job_id": obj.get("job_id"),
|
@@ -21,6 +21,7 @@ from datetime import datetime
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
23
23
|
from arthur_client.api_bindings.models.alert_bound import AlertBound
|
24
|
+
from arthur_client.api_bindings.models.alert_rule_interval import AlertRuleInterval
|
24
25
|
from arthur_client.api_bindings.models.alert_rule_notification_webhook import AlertRuleNotificationWebhook
|
25
26
|
from arthur_client.api_bindings.models.user import User
|
26
27
|
from typing import Optional, Set
|
@@ -40,9 +41,10 @@ class AlertRule(BaseModel):
|
|
40
41
|
bound: AlertBound = Field(description="The bound of the alert rule.")
|
41
42
|
query: StrictStr = Field(description="The query of the alert rule.")
|
42
43
|
metric_name: StrictStr = Field(description="The name of the metric returned by the alert rule query.")
|
44
|
+
interval: AlertRuleInterval = Field(description="The interval of the alert rule, commonly '1 day', '1 hour', etc.")
|
43
45
|
last_updated_by_user: Optional[User] = None
|
44
46
|
notification_webhooks: List[AlertRuleNotificationWebhook] = Field(description="Notification webhooks configured for the alert rule.")
|
45
|
-
__properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "model_id", "name", "description", "threshold", "bound", "query", "metric_name", "last_updated_by_user", "notification_webhooks"]
|
47
|
+
__properties: ClassVar[List[str]] = ["created_at", "updated_at", "id", "model_id", "name", "description", "threshold", "bound", "query", "metric_name", "interval", "last_updated_by_user", "notification_webhooks"]
|
46
48
|
|
47
49
|
model_config = ConfigDict(
|
48
50
|
populate_by_name=True,
|
@@ -83,6 +85,9 @@ class AlertRule(BaseModel):
|
|
83
85
|
exclude=excluded_fields,
|
84
86
|
exclude_none=True,
|
85
87
|
)
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of interval
|
89
|
+
if self.interval:
|
90
|
+
_dict['interval'] = self.interval.to_dict()
|
86
91
|
# override the default output from pydantic by calling `to_dict()` of last_updated_by_user
|
87
92
|
if self.last_updated_by_user:
|
88
93
|
_dict['last_updated_by_user'] = self.last_updated_by_user.to_dict()
|
@@ -125,6 +130,7 @@ class AlertRule(BaseModel):
|
|
125
130
|
"bound": obj.get("bound"),
|
126
131
|
"query": obj.get("query"),
|
127
132
|
"metric_name": obj.get("metric_name"),
|
133
|
+
"interval": AlertRuleInterval.from_dict(obj["interval"]) if obj.get("interval") is not None else None,
|
128
134
|
"last_updated_by_user": User.from_dict(obj["last_updated_by_user"]) if obj.get("last_updated_by_user") is not None else None,
|
129
135
|
"notification_webhooks": [AlertRuleNotificationWebhook.from_dict(_item) for _item in obj["notification_webhooks"]] if obj.get("notification_webhooks") is not None else None
|
130
136
|
})
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Arthur Scope
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from arthur_client.api_bindings.models.interval_unit import IntervalUnit
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class AlertRuleInterval(BaseModel):
|
27
|
+
"""
|
28
|
+
AlertRuleInterval
|
29
|
+
""" # noqa: E501
|
30
|
+
unit: IntervalUnit = Field(description="Unit of time interval. Example: 'minutes'.")
|
31
|
+
count: StrictInt = Field(description="Number of units in the interval. Example: '5'.")
|
32
|
+
__properties: ClassVar[List[str]] = ["unit", "count"]
|
33
|
+
|
34
|
+
model_config = ConfigDict(
|
35
|
+
populate_by_name=True,
|
36
|
+
validate_assignment=True,
|
37
|
+
protected_namespaces=(),
|
38
|
+
)
|
39
|
+
|
40
|
+
|
41
|
+
def to_str(self) -> str:
|
42
|
+
"""Returns the string representation of the model using alias"""
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
44
|
+
|
45
|
+
def to_json(self) -> str:
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
48
|
+
return json.dumps(self.to_dict())
|
49
|
+
|
50
|
+
@classmethod
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
52
|
+
"""Create an instance of AlertRuleInterval from a JSON string"""
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
54
|
+
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
57
|
+
|
58
|
+
This has the following differences from calling pydantic's
|
59
|
+
`self.model_dump(by_alias=True)`:
|
60
|
+
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
62
|
+
were set at model initialization. Other fields with value `None`
|
63
|
+
are ignored.
|
64
|
+
"""
|
65
|
+
excluded_fields: Set[str] = set([
|
66
|
+
])
|
67
|
+
|
68
|
+
_dict = self.model_dump(
|
69
|
+
by_alias=True,
|
70
|
+
exclude=excluded_fields,
|
71
|
+
exclude_none=True,
|
72
|
+
)
|
73
|
+
return _dict
|
74
|
+
|
75
|
+
@classmethod
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
77
|
+
"""Create an instance of AlertRuleInterval from a dict"""
|
78
|
+
if obj is None:
|
79
|
+
return None
|
80
|
+
|
81
|
+
if not isinstance(obj, dict):
|
82
|
+
return cls.model_validate(obj)
|
83
|
+
|
84
|
+
_obj = cls.model_validate({
|
85
|
+
"unit": obj.get("unit"),
|
86
|
+
"count": obj.get("count")
|
87
|
+
})
|
88
|
+
return _obj
|
89
|
+
|
90
|
+
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Arthur Scope
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class AlertRuleSQLValidationResp(BaseModel):
|
26
|
+
"""
|
27
|
+
AlertRuleSQLValidationResp
|
28
|
+
""" # noqa: E501
|
29
|
+
has_metric_timestamp_col: StrictBool = Field(description="The name of the metric returned by the alert rule query.")
|
30
|
+
has_metric_value_col: StrictBool = Field(description="The name of the metric returned by the alert rule query.")
|
31
|
+
has_time_templates: StrictBool = Field(description="The name of the metric returned by the alert rule query.")
|
32
|
+
has_interval_templates: StrictBool = Field(description="The name of the metric returned by the alert rule query.")
|
33
|
+
__properties: ClassVar[List[str]] = ["has_metric_timestamp_col", "has_metric_value_col", "has_time_templates", "has_interval_templates"]
|
34
|
+
|
35
|
+
model_config = ConfigDict(
|
36
|
+
populate_by_name=True,
|
37
|
+
validate_assignment=True,
|
38
|
+
protected_namespaces=(),
|
39
|
+
)
|
40
|
+
|
41
|
+
|
42
|
+
def to_str(self) -> str:
|
43
|
+
"""Returns the string representation of the model using alias"""
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
45
|
+
|
46
|
+
def to_json(self) -> str:
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
49
|
+
return json.dumps(self.to_dict())
|
50
|
+
|
51
|
+
@classmethod
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
53
|
+
"""Create an instance of AlertRuleSQLValidationResp from a JSON string"""
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
55
|
+
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
58
|
+
|
59
|
+
This has the following differences from calling pydantic's
|
60
|
+
`self.model_dump(by_alias=True)`:
|
61
|
+
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
63
|
+
were set at model initialization. Other fields with value `None`
|
64
|
+
are ignored.
|
65
|
+
"""
|
66
|
+
excluded_fields: Set[str] = set([
|
67
|
+
])
|
68
|
+
|
69
|
+
_dict = self.model_dump(
|
70
|
+
by_alias=True,
|
71
|
+
exclude=excluded_fields,
|
72
|
+
exclude_none=True,
|
73
|
+
)
|
74
|
+
return _dict
|
75
|
+
|
76
|
+
@classmethod
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
78
|
+
"""Create an instance of AlertRuleSQLValidationResp from a dict"""
|
79
|
+
if obj is None:
|
80
|
+
return None
|
81
|
+
|
82
|
+
if not isinstance(obj, dict):
|
83
|
+
return cls.model_validate(obj)
|
84
|
+
|
85
|
+
_obj = cls.model_validate({
|
86
|
+
"has_metric_timestamp_col": obj.get("has_metric_timestamp_col"),
|
87
|
+
"has_metric_value_col": obj.get("has_metric_value_col"),
|
88
|
+
"has_time_templates": obj.get("has_time_templates"),
|
89
|
+
"has_interval_templates": obj.get("has_interval_templates")
|
90
|
+
})
|
91
|
+
return _obj
|
92
|
+
|
93
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Arthur Scope
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class IntervalUnit(str, Enum):
|
22
|
+
"""
|
23
|
+
IntervalUnit
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
SECONDS = 'seconds'
|
30
|
+
MINUTES = 'minutes'
|
31
|
+
HOURS = 'hours'
|
32
|
+
DAYS = 'days'
|
33
|
+
|
34
|
+
@classmethod
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
36
|
+
"""Create an instance of IntervalUnit from a JSON string"""
|
37
|
+
return cls(json.loads(json_str))
|
38
|
+
|
39
|
+
|
@@ -19,6 +19,8 @@ import json
|
|
19
19
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from arthur_client.api_bindings.models.metrics_column_list_parameter_schema_allowed_column_types_inner import MetricsColumnListParameterSchemaAllowedColumnTypesInner
|
23
|
+
from arthur_client.api_bindings.models.scope_schema_tag import ScopeSchemaTag
|
22
24
|
from typing import Optional, Set
|
23
25
|
from typing_extensions import Self
|
24
26
|
|
@@ -31,7 +33,11 @@ class MetricsColumnListParameterSchema(BaseModel):
|
|
31
33
|
friendly_name: StrictStr = Field(description="User facing name of the parameter.")
|
32
34
|
description: StrictStr = Field(description="Description of the parameter.")
|
33
35
|
parameter_type: Optional[StrictStr] = 'column_list'
|
34
|
-
|
36
|
+
tag_hints: Optional[List[ScopeSchemaTag]] = Field(default=None, description="List of tags that are applicable to this parameter. Datasets with columns that have matching tags can be inferred this way.")
|
37
|
+
source_dataset_parameter_key: StrictStr = Field(description="Name of the parameter that provides the dataset to be used for this column.")
|
38
|
+
allowed_column_types: Optional[List[MetricsColumnListParameterSchemaAllowedColumnTypesInner]] = None
|
39
|
+
allow_any_column_type: Optional[StrictBool] = Field(default=False, description="Indicates if this metric parameter can accept any column type.")
|
40
|
+
__properties: ClassVar[List[str]] = ["parameter_key", "optional", "friendly_name", "description", "parameter_type", "tag_hints", "source_dataset_parameter_key", "allowed_column_types", "allow_any_column_type"]
|
35
41
|
|
36
42
|
@field_validator('parameter_type')
|
37
43
|
def parameter_type_validate_enum(cls, value):
|
@@ -82,6 +88,18 @@ class MetricsColumnListParameterSchema(BaseModel):
|
|
82
88
|
exclude=excluded_fields,
|
83
89
|
exclude_none=True,
|
84
90
|
)
|
91
|
+
# override the default output from pydantic by calling `to_dict()` of each item in allowed_column_types (list)
|
92
|
+
_items = []
|
93
|
+
if self.allowed_column_types:
|
94
|
+
for _item_allowed_column_types in self.allowed_column_types:
|
95
|
+
if _item_allowed_column_types:
|
96
|
+
_items.append(_item_allowed_column_types.to_dict())
|
97
|
+
_dict['allowed_column_types'] = _items
|
98
|
+
# set to None if allowed_column_types (nullable) is None
|
99
|
+
# and model_fields_set contains the field
|
100
|
+
if self.allowed_column_types is None and "allowed_column_types" in self.model_fields_set:
|
101
|
+
_dict['allowed_column_types'] = None
|
102
|
+
|
85
103
|
return _dict
|
86
104
|
|
87
105
|
@classmethod
|
@@ -98,7 +116,11 @@ class MetricsColumnListParameterSchema(BaseModel):
|
|
98
116
|
"optional": obj.get("optional") if obj.get("optional") is not None else False,
|
99
117
|
"friendly_name": obj.get("friendly_name"),
|
100
118
|
"description": obj.get("description"),
|
101
|
-
"parameter_type": obj.get("parameter_type") if obj.get("parameter_type") is not None else 'column_list'
|
119
|
+
"parameter_type": obj.get("parameter_type") if obj.get("parameter_type") is not None else 'column_list',
|
120
|
+
"tag_hints": obj.get("tag_hints"),
|
121
|
+
"source_dataset_parameter_key": obj.get("source_dataset_parameter_key"),
|
122
|
+
"allowed_column_types": [MetricsColumnListParameterSchemaAllowedColumnTypesInner.from_dict(_item) for _item in obj["allowed_column_types"]] if obj.get("allowed_column_types") is not None else None,
|
123
|
+
"allow_any_column_type": obj.get("allow_any_column_type") if obj.get("allow_any_column_type") is not None else False
|
102
124
|
})
|
103
125
|
return _obj
|
104
126
|
|
@@ -24,11 +24,11 @@ from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
24
24
|
from typing_extensions import Literal, Self
|
25
25
|
from pydantic import Field
|
26
26
|
|
27
|
-
|
27
|
+
METRICSCOLUMNLISTPARAMETERSCHEMAALLOWEDCOLUMNTYPESINNER_ANY_OF_SCHEMAS = ["ListType", "ObjectType", "ScalarType"]
|
28
28
|
|
29
|
-
class
|
29
|
+
class MetricsColumnListParameterSchemaAllowedColumnTypesInner(BaseModel):
|
30
30
|
"""
|
31
|
-
|
31
|
+
MetricsColumnListParameterSchemaAllowedColumnTypesInner
|
32
32
|
"""
|
33
33
|
|
34
34
|
# data type: ScalarType
|
@@ -60,7 +60,7 @@ class MetricsColumnParameterSchemaAllowedColumnTypesInner(BaseModel):
|
|
60
60
|
|
61
61
|
@field_validator('actual_instance')
|
62
62
|
def actual_instance_must_validate_anyof(cls, v):
|
63
|
-
instance =
|
63
|
+
instance = MetricsColumnListParameterSchemaAllowedColumnTypesInner.model_construct()
|
64
64
|
error_messages = []
|
65
65
|
# validate data type: ScalarType
|
66
66
|
if not isinstance(v, ScalarType):
|
@@ -82,7 +82,7 @@ class MetricsColumnParameterSchemaAllowedColumnTypesInner(BaseModel):
|
|
82
82
|
|
83
83
|
if error_messages:
|
84
84
|
# no match
|
85
|
-
raise ValueError("No match found when setting the actual_instance in
|
85
|
+
raise ValueError("No match found when setting the actual_instance in MetricsColumnListParameterSchemaAllowedColumnTypesInner with anyOf schemas: ListType, ObjectType, ScalarType. Details: " + ", ".join(error_messages))
|
86
86
|
else:
|
87
87
|
return v
|
88
88
|
|
@@ -116,7 +116,7 @@ class MetricsColumnParameterSchemaAllowedColumnTypesInner(BaseModel):
|
|
116
116
|
|
117
117
|
if error_messages:
|
118
118
|
# no match
|
119
|
-
raise ValueError("No match found when deserializing the JSON string into
|
119
|
+
raise ValueError("No match found when deserializing the JSON string into MetricsColumnListParameterSchemaAllowedColumnTypesInner with anyOf schemas: ListType, ObjectType, ScalarType. Details: " + ", ".join(error_messages))
|
120
120
|
else:
|
121
121
|
return instance
|
122
122
|
|
@@ -147,5 +147,5 @@ class MetricsColumnParameterSchemaAllowedColumnTypesInner(BaseModel):
|
|
147
147
|
from arthur_client.api_bindings.models.list_type import ListType
|
148
148
|
from arthur_client.api_bindings.models.object_type import ObjectType
|
149
149
|
# TODO: Rewrite to not use raise_errors
|
150
|
-
|
150
|
+
MetricsColumnListParameterSchemaAllowedColumnTypesInner.model_rebuild(raise_errors=False)
|
151
151
|
|
@@ -19,7 +19,7 @@ import json
|
|
19
19
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
-
from arthur_client.api_bindings.models.
|
22
|
+
from arthur_client.api_bindings.models.metrics_column_list_parameter_schema_allowed_column_types_inner import MetricsColumnListParameterSchemaAllowedColumnTypesInner
|
23
23
|
from arthur_client.api_bindings.models.scope_schema_tag import ScopeSchemaTag
|
24
24
|
from typing import Optional, Set
|
25
25
|
from typing_extensions import Self
|
@@ -35,7 +35,7 @@ class MetricsColumnParameterSchema(BaseModel):
|
|
35
35
|
parameter_type: Optional[StrictStr] = 'column'
|
36
36
|
tag_hints: Optional[List[ScopeSchemaTag]] = Field(default=None, description="List of tags that are applicable to this parameter. Datasets with columns that have matching tags can be inferred this way.")
|
37
37
|
source_dataset_parameter_key: StrictStr = Field(description="Name of the parameter that provides the dataset to be used for this column.")
|
38
|
-
allowed_column_types: Optional[List[
|
38
|
+
allowed_column_types: Optional[List[MetricsColumnListParameterSchemaAllowedColumnTypesInner]] = None
|
39
39
|
allow_any_column_type: Optional[StrictBool] = Field(default=False, description="Indicates if this metric parameter can accept any column type.")
|
40
40
|
__properties: ClassVar[List[str]] = ["parameter_key", "optional", "friendly_name", "description", "parameter_type", "tag_hints", "source_dataset_parameter_key", "allowed_column_types", "allow_any_column_type"]
|
41
41
|
|
@@ -119,7 +119,7 @@ class MetricsColumnParameterSchema(BaseModel):
|
|
119
119
|
"parameter_type": obj.get("parameter_type") if obj.get("parameter_type") is not None else 'column',
|
120
120
|
"tag_hints": obj.get("tag_hints"),
|
121
121
|
"source_dataset_parameter_key": obj.get("source_dataset_parameter_key"),
|
122
|
-
"allowed_column_types": [
|
122
|
+
"allowed_column_types": [MetricsColumnListParameterSchemaAllowedColumnTypesInner.from_dict(_item) for _item in obj["allowed_column_types"]] if obj.get("allowed_column_types") is not None else None,
|
123
123
|
"allow_any_column_type": obj.get("allow_any_column_type") if obj.get("allow_any_column_type") is not None else False
|
124
124
|
})
|
125
125
|
return _obj
|
@@ -26,7 +26,7 @@ class ObjectType(BaseModel):
|
|
26
26
|
"""
|
27
27
|
ObjectType
|
28
28
|
""" # noqa: E501
|
29
|
-
object: Dict[str,
|
29
|
+
object: Dict[str, MetricsColumnListParameterSchemaAllowedColumnTypesInner]
|
30
30
|
__properties: ClassVar[List[str]] = ["object"]
|
31
31
|
|
32
32
|
model_config = ConfigDict(
|
@@ -88,7 +88,7 @@ class ObjectType(BaseModel):
|
|
88
88
|
|
89
89
|
_obj = cls.model_validate({
|
90
90
|
"object": dict(
|
91
|
-
(_k,
|
91
|
+
(_k, MetricsColumnListParameterSchemaAllowedColumnTypesInner.from_dict(_v))
|
92
92
|
for _k, _v in obj["object"].items()
|
93
93
|
)
|
94
94
|
if obj.get("object") is not None
|
@@ -96,7 +96,7 @@ class ObjectType(BaseModel):
|
|
96
96
|
})
|
97
97
|
return _obj
|
98
98
|
|
99
|
-
from arthur_client.api_bindings.models.
|
99
|
+
from arthur_client.api_bindings.models.metrics_column_list_parameter_schema_allowed_column_types_inner import MetricsColumnListParameterSchemaAllowedColumnTypesInner
|
100
100
|
# TODO: Rewrite to not use raise_errors
|
101
101
|
ObjectType.model_rebuild(raise_errors=False)
|
102
102
|
|