acceldata-sdk-python 26.7.0__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.
- acceldata/__init__.py +7 -0
- acceldata/client/__init__.py +0 -0
- acceldata/client/adoc_client.py +666 -0
- acceldata/client/http_client.py +346 -0
- acceldata/client/transient_retry.py +142 -0
- acceldata/constants/__init__.py +1 -0
- acceldata/constants/constants.py +13 -0
- acceldata/exceptions/__init__.py +52 -0
- acceldata/exceptions/api_errors.py +85 -0
- acceldata/exceptions/exceptions.py +174 -0
- acceldata/exceptions/sdk_exceptions.py +98 -0
- acceldata/mappers/__init__.py +21 -0
- acceldata/mappers/catalog_executions.py +107 -0
- acceldata/models/__init__.py +0 -0
- acceldata/models/api/catalog/above_configs.py +99 -0
- acceldata/models/api/catalog/above_configs_success.py +138 -0
- acceldata/models/api/catalog/absolute_configs.py +197 -0
- acceldata/models/api/catalog/absolute_configs_fallback.py +101 -0
- acceldata/models/api/catalog/absolute_threshold_config.py +105 -0
- acceldata/models/api/catalog/analysis_job_context.py +102 -0
- acceldata/models/api/catalog/analytics_pipeline.py +385 -0
- acceldata/models/api/catalog/analytics_pipeline_endpoint.py +136 -0
- acceldata/models/api/catalog/anomaly_config.py +95 -0
- acceldata/models/api/catalog/anomaly_details.py +119 -0
- acceldata/models/api/catalog/anomaly_threshold_config.py +105 -0
- acceldata/models/api/catalog/artifact.py +92 -0
- acceldata/models/api/catalog/assembly.py +171 -0
- acceldata/models/api/catalog/asset.py +162 -0
- acceldata/models/api/catalog/asset_catalog_listing.py +159 -0
- acceldata/models/api/catalog/asset_catalog_listing_response.py +102 -0
- acceldata/models/api/catalog/asset_label_request.py +96 -0
- acceldata/models/api/catalog/asset_progress.py +96 -0
- acceldata/models/api/catalog/asset_progress_details.py +117 -0
- acceldata/models/api/catalog/asset_tag.py +124 -0
- acceldata/models/api/catalog/asset_tag_info.py +140 -0
- acceldata/models/api/catalog/asset_tag_request.py +95 -0
- acceldata/models/api/catalog/asset_tag_response.py +96 -0
- acceldata/models/api/catalog/asset_tags_response.py +102 -0
- acceldata/models/api/catalog/asset_type.py +96 -0
- acceldata/models/api/catalog/auto_anomaly_feature_analysis.py +160 -0
- acceldata/models/api/catalog/auto_anomaly_item_execution.py +133 -0
- acceldata/models/api/catalog/auto_anomaly_meta_data.py +162 -0
- acceldata/models/api/catalog/auto_anomaly_rule_execution.py +102 -0
- acceldata/models/api/catalog/auto_anomaly_summary.py +124 -0
- acceldata/models/api/catalog/backing_asset.py +126 -0
- acceldata/models/api/catalog/below_configs.py +99 -0
- acceldata/models/api/catalog/big_decimal.py +100 -0
- acceldata/models/api/catalog/big_integer.py +98 -0
- acceldata/models/api/catalog/bounds_date_time_marker_config.py +110 -0
- acceldata/models/api/catalog/bounds_file_event_marker_config.py +108 -0
- acceldata/models/api/catalog/bounds_id_marker_config.py +96 -0
- acceldata/models/api/catalog/catalog_asset_meta_data.py +128 -0
- acceldata/models/api/catalog/changes_by_config.py +105 -0
- acceldata/models/api/catalog/column_mapping.py +139 -0
- acceldata/models/api/catalog/column_metadata.py +90 -0
- acceldata/models/api/catalog/column_metric_with_anomaly_details.py +119 -0
- acceldata/models/api/catalog/column_variable.py +111 -0
- acceldata/models/api/catalog/composite_policy_execution.py +102 -0
- acceldata/models/api/catalog/composite_policy_item_execution.py +104 -0
- acceldata/models/api/catalog/connection.py +118 -0
- acceldata/models/api/catalog/connection_test_result.py +106 -0
- acceldata/models/api/catalog/connection_type.py +90 -0
- acceldata/models/api/catalog/connection_types_response.py +96 -0
- acceldata/models/api/catalog/crawler.py +88 -0
- acceldata/models/api/catalog/crawler_action_response.py +90 -0
- acceldata/models/api/catalog/crawler_execution.py +147 -0
- acceldata/models/api/catalog/crawler_execution_response.py +102 -0
- acceldata/models/api/catalog/crawler_status_response.py +90 -0
- acceldata/models/api/catalog/create_profile.py +194 -0
- acceldata/models/api/catalog/custom_sql_config.py +121 -0
- acceldata/models/api/catalog/data_bricks_spark_resource_config.py +104 -0
- acceldata/models/api/catalog/data_cadence_rule.py +236 -0
- acceldata/models/api/catalog/data_cadence_rule_details.py +125 -0
- acceldata/models/api/catalog/data_cadence_rule_execution.py +102 -0
- acceldata/models/api/catalog/data_cadence_rule_item.py +104 -0
- acceldata/models/api/catalog/data_cadence_rule_item_execution.py +158 -0
- acceldata/models/api/catalog/data_cadence_rule_response.py +98 -0
- acceldata/models/api/catalog/data_drift_execution.py +102 -0
- acceldata/models/api/catalog/data_drift_item_execution.py +121 -0
- acceldata/models/api/catalog/data_quality_engine.py +90 -0
- acceldata/models/api/catalog/data_quality_execution.py +106 -0
- acceldata/models/api/catalog/data_quality_rule.py +323 -0
- acceldata/models/api/catalog/data_quality_rule_details.py +186 -0
- acceldata/models/api/catalog/data_quality_rule_response.py +120 -0
- acceldata/models/api/catalog/data_quality_rules_response.py +102 -0
- acceldata/models/api/catalog/databricks_compute_config.py +113 -0
- acceldata/models/api/catalog/dataplane_engine.py +105 -0
- acceldata/models/api/catalog/dataplane_health_metrics.py +101 -0
- acceldata/models/api/catalog/dataplane_job.py +216 -0
- acceldata/models/api/catalog/dataplane_job_status.py +113 -0
- acceldata/models/api/catalog/dataplane_request.py +96 -0
- acceldata/models/api/catalog/dataproc_compute_config.py +106 -0
- acceldata/models/api/catalog/dataproc_spark_resource_config.py +104 -0
- acceldata/models/api/catalog/date_based_partition_marker_config.py +116 -0
- acceldata/models/api/catalog/date_partitioning_marker_config.py +113 -0
- acceldata/models/api/catalog/date_time_marker_config.py +109 -0
- acceldata/models/api/catalog/day_month_year_based_partition_marker_config.py +124 -0
- acceldata/models/api/catalog/decreased_by_config.py +105 -0
- acceldata/models/api/catalog/delete_artifact_response.py +88 -0
- acceldata/models/api/catalog/dq_rule_execution.py +248 -0
- acceldata/models/api/catalog/drift.py +121 -0
- acceldata/models/api/catalog/enable_rule_request.py +88 -0
- acceldata/models/api/catalog/engine.py +90 -0
- acceldata/models/api/catalog/execution_cancellation_response.py +92 -0
- acceldata/models/api/catalog/execution_response.py +144 -0
- acceldata/models/api/catalog/execution_result.py +126 -0
- acceldata/models/api/catalog/executions_response.py +102 -0
- acceldata/models/api/catalog/failed_asset_detail.py +90 -0
- acceldata/models/api/catalog/failed_summary.py +98 -0
- acceldata/models/api/catalog/file.py +94 -0
- acceldata/models/api/catalog/file_marker_config.py +99 -0
- acceldata/models/api/catalog/generic_config_fallback.py +101 -0
- acceldata/models/api/catalog/generic_execution.py +221 -0
- acceldata/models/api/catalog/generic_rule_execution.py +137 -0
- acceldata/models/api/catalog/global_storage_config_dto.py +172 -0
- acceldata/models/api/catalog/hosted_dp_deployment_response.py +98 -0
- acceldata/models/api/catalog/id_marker_config.py +94 -0
- acceldata/models/api/catalog/increased_by_config.py +105 -0
- acceldata/models/api/catalog/item.py +160 -0
- acceldata/models/api/catalog/item_execution.py +192 -0
- acceldata/models/api/catalog/item_segment.py +131 -0
- acceldata/models/api/catalog/job_schedule.py +118 -0
- acceldata/models/api/catalog/job_spec.py +96 -0
- acceldata/models/api/catalog/kubernetes_metrics.py +91 -0
- acceldata/models/api/catalog/label.py +97 -0
- acceldata/models/api/catalog/livy_compute_config.py +103 -0
- acceldata/models/api/catalog/livy_spark_resource_config.py +106 -0
- acceldata/models/api/catalog/look_back_config.py +90 -0
- acceldata/models/api/catalog/manual_tag_request.py +92 -0
- acceldata/models/api/catalog/mapping.py +97 -0
- acceldata/models/api/catalog/marker.py +88 -0
- acceldata/models/api/catalog/marker_config.py +349 -0
- acceldata/models/api/catalog/marker_config_fallback.py +101 -0
- acceldata/models/api/catalog/meta.py +92 -0
- acceldata/models/api/catalog/meta_data.py +92 -0
- acceldata/models/api/catalog/meta_data_item.py +94 -0
- acceldata/models/api/catalog/mini_profile_request.py +112 -0
- acceldata/models/api/catalog/notification_payload.py +114 -0
- acceldata/models/api/catalog/offset_based_marker_config.py +97 -0
- acceldata/models/api/catalog/operational_config.py +92 -0
- acceldata/models/api/catalog/pattern_configuration.py +90 -0
- acceldata/models/api/catalog/pipe_line_request.py +92 -0
- acceldata/models/api/catalog/pipeline_compute_config.py +110 -0
- acceldata/models/api/catalog/policy_execution_marker_config.py +94 -0
- acceldata/models/api/catalog/policy_execution_request.py +229 -0
- acceldata/models/api/catalog/policy_group.py +114 -0
- acceldata/models/api/catalog/policy_transform_udf.py +113 -0
- acceldata/models/api/catalog/process_metrics.py +91 -0
- acceldata/models/api/catalog/profile_anomaly_details_response.py +109 -0
- acceldata/models/api/catalog/profile_anomaly_item_execution.py +127 -0
- acceldata/models/api/catalog/profile_anomaly_rule_execution.py +102 -0
- acceldata/models/api/catalog/profile_anomaly_rule_item.py +109 -0
- acceldata/models/api/catalog/profile_cancellation_response.py +92 -0
- acceldata/models/api/catalog/profile_request.py +211 -0
- acceldata/models/api/catalog/profile_request_response.py +92 -0
- acceldata/models/api/catalog/property_template.py +178 -0
- acceldata/models/api/catalog/property_templates.py +123 -0
- acceldata/models/api/catalog/pub_sub_lookback_marker_config.py +96 -0
- acceldata/models/api/catalog/pub_sub_timestamp_marker_config.py +108 -0
- acceldata/models/api/catalog/quality_rule.py +381 -0
- acceldata/models/api/catalog/quality_rule_execution_metrics.py +114 -0
- acceldata/models/api/catalog/quality_rule_with_latest_execution.py +115 -0
- acceldata/models/api/catalog/range_configs.py +109 -0
- acceldata/models/api/catalog/reconciliation_item.py +102 -0
- acceldata/models/api/catalog/reconciliation_item_execution.py +157 -0
- acceldata/models/api/catalog/reconciliation_rule.py +339 -0
- acceldata/models/api/catalog/reconciliation_rule_details.py +225 -0
- acceldata/models/api/catalog/reconciliation_rule_execution.py +102 -0
- acceldata/models/api/catalog/reconciliation_rule_response.py +98 -0
- acceldata/models/api/catalog/reconciliation_rules_response.py +102 -0
- acceldata/models/api/catalog/relative_config.py +197 -0
- acceldata/models/api/catalog/relative_config_fallback.py +101 -0
- acceldata/models/api/catalog/relative_threshold_config.py +111 -0
- acceldata/models/api/catalog/root_cause_analysis.py +108 -0
- acceldata/models/api/catalog/rule_execution.py +327 -0
- acceldata/models/api/catalog/rule_execution_result.py +90 -0
- acceldata/models/api/catalog/rule_item_result.py +125 -0
- acceldata/models/api/catalog/rule_meta_data.py +94 -0
- acceldata/models/api/catalog/rule_spark_sql_dynamic_filter_variable_mapping.py +100 -0
- acceldata/models/api/catalog/rule_tag.py +101 -0
- acceldata/models/api/catalog/rule_threshold_configuration.py +236 -0
- acceldata/models/api/catalog/rule_threshold_configuration_fallback.py +101 -0
- acceldata/models/api/catalog/rules_with_latest_execution_response.py +102 -0
- acceldata/models/api/catalog/sample_data_api_response.py +122 -0
- acceldata/models/api/catalog/schema_drift_item_execution.py +131 -0
- acceldata/models/api/catalog/schema_drift_rule_execution.py +102 -0
- acceldata/models/api/catalog/secret_manager_configuration.py +90 -0
- acceldata/models/api/catalog/secret_manager_configuration_with_option.py +98 -0
- acceldata/models/api/catalog/security_config.py +90 -0
- acceldata/models/api/catalog/segment_metric_json.py +142 -0
- acceldata/models/api/catalog/segments_analysis.py +145 -0
- acceldata/models/api/catalog/short_segment.py +97 -0
- acceldata/models/api/catalog/simple_quality_rule_response.py +92 -0
- acceldata/models/api/catalog/snapshot_data.py +117 -0
- acceldata/models/api/catalog/source_model.py +90 -0
- acceldata/models/api/catalog/source_type.py +100 -0
- acceldata/models/api/catalog/source_types_response.py +102 -0
- acceldata/models/api/catalog/spark_job_status.py +113 -0
- acceldata/models/api/catalog/spark_resource_config.py +114 -0
- acceldata/models/api/catalog/standard_response_assembly.py +92 -0
- acceldata/models/api/catalog/standard_response_crawler_action_response.py +92 -0
- acceldata/models/api/catalog/standard_response_crawler_status_response.py +92 -0
- acceldata/models/api/catalog/standard_response_delete_artifact_response.py +92 -0
- acceldata/models/api/catalog/standard_response_list.py +96 -0
- acceldata/models/api/catalog/standard_response_map.py +88 -0
- acceldata/models/api/catalog/standard_response_meta_data.py +92 -0
- acceldata/models/api/catalog/standard_response_mini_profile_request.py +92 -0
- acceldata/models/api/catalog/standard_response_profile_request.py +92 -0
- acceldata/models/api/catalog/start_profiling_request.py +92 -0
- acceldata/models/api/catalog/tag_domain.py +116 -0
- acceldata/models/api/catalog/threshold_breach_details.py +101 -0
- acceldata/models/api/catalog/time_based_config.py +92 -0
- acceldata/models/api/catalog/time_based_threshold_config.py +105 -0
- acceldata/models/api/catalog/timestamp_based_marker_config.py +115 -0
- acceldata/models/api/catalog/udf_variable.py +97 -0
- acceldata/models/api/catalog/yunikorn_compute_config.py +133 -0
- acceldata/models/api/catalog/yunikorn_spark_resource_config.py +154 -0
- acceldata/models/api/pipeline/big_decimal.py +100 -0
- acceldata/models/api/pipeline/big_integer.py +98 -0
- acceldata/models/api/pipeline/child_span_response.py +96 -0
- acceldata/models/api/pipeline/create_span_event.py +109 -0
- acceldata/models/api/pipeline/edge.py +108 -0
- acceldata/models/api/pipeline/event_alert_object.py +95 -0
- acceldata/models/api/pipeline/generic_config_fallback.py +101 -0
- acceldata/models/api/pipeline/identifier.py +146 -0
- acceldata/models/api/pipeline/job_request.py +130 -0
- acceldata/models/api/pipeline/meta.py +107 -0
- acceldata/models/api/pipeline/meta_data.py +92 -0
- acceldata/models/api/pipeline/metric.py +103 -0
- acceldata/models/api/pipeline/node.py +201 -0
- acceldata/models/api/pipeline/node_response.py +92 -0
- acceldata/models/api/pipeline/notification_payload.py +114 -0
- acceldata/models/api/pipeline/pipeline.py +152 -0
- acceldata/models/api/pipeline/pipeline_baseline_metric.py +92 -0
- acceldata/models/api/pipeline/pipeline_details.py +118 -0
- acceldata/models/api/pipeline/pipeline_details_response.py +102 -0
- acceldata/models/api/pipeline/pipeline_input_request.py +92 -0
- acceldata/models/api/pipeline/pipeline_listing_info.py +118 -0
- acceldata/models/api/pipeline/pipeline_response.py +92 -0
- acceldata/models/api/pipeline/pipeline_run.py +136 -0
- acceldata/models/api/pipeline/pipeline_run_request.py +92 -0
- acceldata/models/api/pipeline/pipeline_runs_response.py +102 -0
- acceldata/models/api/pipeline/pipeline_summary.py +98 -0
- acceldata/models/api/pipeline/pipelines_listing_response.py +102 -0
- acceldata/models/api/pipeline/policy_summary.py +102 -0
- acceldata/models/api/pipeline/span.py +115 -0
- acceldata/models/api/pipeline/span_event.py +114 -0
- acceldata/models/api/pipeline/span_event_request.py +92 -0
- acceldata/models/api/pipeline/span_event_response.py +92 -0
- acceldata/models/api/pipeline/span_request.py +94 -0
- acceldata/models/api/pipeline/spans_response.py +96 -0
- acceldata/models/api/pipeline/tag.py +97 -0
- acceldata/models/sdk/__init__.py +0 -0
- acceldata/models/sdk/catalog/__init__.py +105 -0
- acceldata/models/sdk/catalog/asset_resource.py +112 -0
- acceldata/models/sdk/catalog/asset_source_type.py +59 -0
- acceldata/models/sdk/catalog/custom_asset_metadata.py +11 -0
- acceldata/models/sdk/catalog/datasource_resource.py +88 -0
- acceldata/models/sdk/catalog/executor.py +524 -0
- acceldata/models/sdk/catalog/policy_execution_request.py +114 -0
- acceldata/models/sdk/catalog/policy_execution_type.py +16 -0
- acceldata/models/sdk/catalog/policy_filter.py +94 -0
- acceldata/models/sdk/catalog/policy_rule_resources.py +388 -0
- acceldata/models/sdk/catalog/profile_request_resource.py +77 -0
- acceldata/models/sdk/catalog/profiling.py +82 -0
- acceldata/models/sdk/catalog/profiling_configuration_error.py +5 -0
- acceldata/models/sdk/pipeline/__init__.py +62 -0
- acceldata/models/sdk/pipeline/create_job_input.py +108 -0
- acceldata/models/sdk/pipeline/create_pipeline_input_request.py +72 -0
- acceldata/models/sdk/pipeline/events/__init__.py +5 -0
- acceldata/models/sdk/pipeline/events/generic_event.py +31 -0
- acceldata/models/sdk/pipeline/events/log_event.py +34 -0
- acceldata/models/sdk/pipeline/events/span_event.py +8 -0
- acceldata/models/sdk/pipeline/pipeline_resource.py +171 -0
- acceldata/models/sdk/pipeline/pipeline_run_input.py +84 -0
- acceldata/models/sdk/pipeline/pipeline_run_resource.py +208 -0
- acceldata/models/sdk/pipeline/pipeline_source_type.py +20 -0
- acceldata/models/sdk/pipeline/span_resource.py +327 -0
- acceldata/openapi_deserialization_patches.py +161 -0
- acceldata/openapi_repr_patches.py +62 -0
- acceldata/services/__init__.py +0 -0
- acceldata/services/api_timestamp.py +31 -0
- acceldata/services/asset_service.py +651 -0
- acceldata/services/datasource_service.py +120 -0
- acceldata/services/generic_service.py +132 -0
- acceldata/services/marker_config.py +232 -0
- acceldata/services/pipeline_big_decimal_api.py +102 -0
- acceldata/services/pipeline_response_parse.py +209 -0
- acceldata/services/pipeline_service.py +494 -0
- acceldata/services/rule_service.py +620 -0
- acceldata/urls/__init__.py +1 -0
- acceldata/urls/catalog_urls.py +137 -0
- acceldata/urls/pipeline_urls.py +55 -0
- acceldata/utils/__init__.py +6 -0
- acceldata/utils/datetime_utils.py +16 -0
- acceldata/utils/operation_ack.py +22 -0
- acceldata/utils/span_helpers.py +95 -0
- acceldata/utils/time_range_utils.py +90 -0
- acceldata_sdk_python-26.7.0.dist-info/METADATA +26 -0
- acceldata_sdk_python-26.7.0.dist-info/RECORD +303 -0
- acceldata_sdk_python-26.7.0.dist-info/WHEEL +5 -0
- acceldata_sdk_python-26.7.0.dist-info/licenses/LICENSE +22 -0
- acceldata_sdk_python-26.7.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Pipeline Control Plane API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 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
|
+
class OpenApiException(Exception):
|
|
16
|
+
"""The base exception class for all OpenAPIExceptions"""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ApiTypeError(OpenApiException, TypeError):
|
|
20
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
|
21
|
+
key_type=None) -> None:
|
|
22
|
+
""" Raises an exception for TypeErrors
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
msg (str): the exception message
|
|
26
|
+
|
|
27
|
+
Keyword Args:
|
|
28
|
+
path_to_item (list): a list of keys an indices to get to the
|
|
29
|
+
current_item
|
|
30
|
+
None if unset
|
|
31
|
+
valid_classes (tuple): the primitive classes that current item
|
|
32
|
+
should be an instance of
|
|
33
|
+
None if unset
|
|
34
|
+
key_type (bool): False if our value is a value in a dict
|
|
35
|
+
True if it is a key in a dict
|
|
36
|
+
False if our item is an item in a list
|
|
37
|
+
None if unset
|
|
38
|
+
"""
|
|
39
|
+
self.path_to_item = path_to_item
|
|
40
|
+
self.valid_classes = valid_classes
|
|
41
|
+
self.key_type = key_type
|
|
42
|
+
full_msg = msg
|
|
43
|
+
if path_to_item:
|
|
44
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
45
|
+
super(ApiTypeError, self).__init__(full_msg)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ApiValueError(OpenApiException, ValueError):
|
|
49
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
50
|
+
"""
|
|
51
|
+
Args:
|
|
52
|
+
msg (str): the exception message
|
|
53
|
+
|
|
54
|
+
Keyword Args:
|
|
55
|
+
path_to_item (list) the path to the exception in the
|
|
56
|
+
received_data dict. None if unset
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
self.path_to_item = path_to_item
|
|
60
|
+
full_msg = msg
|
|
61
|
+
if path_to_item:
|
|
62
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
63
|
+
super(ApiValueError, self).__init__(full_msg)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
|
67
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
68
|
+
"""
|
|
69
|
+
Raised when an attribute reference or assignment fails.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
msg (str): the exception message
|
|
73
|
+
|
|
74
|
+
Keyword Args:
|
|
75
|
+
path_to_item (None/list) the path to the exception in the
|
|
76
|
+
received_data dict
|
|
77
|
+
"""
|
|
78
|
+
self.path_to_item = path_to_item
|
|
79
|
+
full_msg = msg
|
|
80
|
+
if path_to_item:
|
|
81
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
82
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ApiKeyError(OpenApiException, KeyError):
|
|
86
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
87
|
+
"""
|
|
88
|
+
Args:
|
|
89
|
+
msg (str): the exception message
|
|
90
|
+
|
|
91
|
+
Keyword Args:
|
|
92
|
+
path_to_item (None/list) the path to the exception in the
|
|
93
|
+
received_data dict
|
|
94
|
+
"""
|
|
95
|
+
self.path_to_item = path_to_item
|
|
96
|
+
full_msg = msg
|
|
97
|
+
if path_to_item:
|
|
98
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
99
|
+
super(ApiKeyError, self).__init__(full_msg)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class ApiException(OpenApiException):
|
|
103
|
+
|
|
104
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
105
|
+
if http_resp:
|
|
106
|
+
self.status = http_resp.status
|
|
107
|
+
self.reason = http_resp.reason
|
|
108
|
+
self.body = http_resp.data
|
|
109
|
+
self.headers = http_resp.getheaders()
|
|
110
|
+
else:
|
|
111
|
+
self.status = status
|
|
112
|
+
self.reason = reason
|
|
113
|
+
self.body = None
|
|
114
|
+
self.headers = None
|
|
115
|
+
# So ``str(e)``, ``e.args``, and ``raise ... from e`` tracebacks stay useful without relying on ``__str__`` alone.
|
|
116
|
+
summary = self._summary_line()
|
|
117
|
+
super().__init__(summary)
|
|
118
|
+
|
|
119
|
+
def _summary_line(self) -> str:
|
|
120
|
+
if self.reason:
|
|
121
|
+
return f"HTTP transport failure (status={self.status!r}): {self.reason}"
|
|
122
|
+
return f"HTTP transport failure (status={self.status!r})"
|
|
123
|
+
|
|
124
|
+
def __str__(self):
|
|
125
|
+
"""Custom error messages for exception"""
|
|
126
|
+
error_message = "({0})\n"\
|
|
127
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
|
128
|
+
if self.headers:
|
|
129
|
+
error_message += "HTTP response headers: {0}\n".format(
|
|
130
|
+
self.headers)
|
|
131
|
+
|
|
132
|
+
if self.body:
|
|
133
|
+
error_message += "HTTP response body: {0}\n".format(self.body)
|
|
134
|
+
|
|
135
|
+
return error_message
|
|
136
|
+
|
|
137
|
+
class BadRequestException(ApiException):
|
|
138
|
+
|
|
139
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
140
|
+
super(BadRequestException, self).__init__(status, reason, http_resp)
|
|
141
|
+
|
|
142
|
+
class NotFoundException(ApiException):
|
|
143
|
+
|
|
144
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
145
|
+
super(NotFoundException, self).__init__(status, reason, http_resp)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class UnauthorizedException(ApiException):
|
|
149
|
+
|
|
150
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
151
|
+
super(UnauthorizedException, self).__init__(status, reason, http_resp)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class ForbiddenException(ApiException):
|
|
155
|
+
|
|
156
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
157
|
+
super(ForbiddenException, self).__init__(status, reason, http_resp)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class ServiceException(ApiException):
|
|
161
|
+
|
|
162
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
163
|
+
super(ServiceException, self).__init__(status, reason, http_resp)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def render_path(path_to_item):
|
|
167
|
+
"""Returns a string representation of a path"""
|
|
168
|
+
result = ""
|
|
169
|
+
for pth in path_to_item:
|
|
170
|
+
if isinstance(pth, int):
|
|
171
|
+
result += "[{0}]".format(pth)
|
|
172
|
+
else:
|
|
173
|
+
result += "['{0}']".format(pth)
|
|
174
|
+
return result
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Client-side and workflow exceptions for the Acceldata Python SDK (non-HTTP errors)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AcceldataSdkException(Exception):
|
|
9
|
+
"""Raised for validation mistakes, unsupported SDK usage, or workflow outcomes (not API HTTP errors).
|
|
10
|
+
|
|
11
|
+
Subclasses set :attr:`code` for stable programmatic handling alongside :attr:`message`.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
code: str = "SDK_ERROR"
|
|
15
|
+
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
message: str,
|
|
19
|
+
*,
|
|
20
|
+
code: str | None = None,
|
|
21
|
+
) -> None:
|
|
22
|
+
super().__init__(message)
|
|
23
|
+
self.message = message
|
|
24
|
+
if code is not None:
|
|
25
|
+
self.code = code
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class InvalidPolicyTypeError(AcceldataSdkException):
|
|
29
|
+
"""Raised when :meth:`~acceldata.client.adoc_client.AdocClient.get_policy` receives an unsupported policy kind."""
|
|
30
|
+
|
|
31
|
+
code = "INVALID_POLICY_TYPE"
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
message: str,
|
|
36
|
+
*,
|
|
37
|
+
allowed_policy_types: tuple[str, ...] | None = None,
|
|
38
|
+
) -> None:
|
|
39
|
+
super().__init__(message)
|
|
40
|
+
self.allowed_policy_types = allowed_policy_types
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class InvalidPipelineRunLookupError(AcceldataSdkException):
|
|
44
|
+
"""Raised when resolving a pipeline run without the required identifiers."""
|
|
45
|
+
|
|
46
|
+
code = "INVALID_PIPELINE_RUN_LOOKUP"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class PipelineRunNotFoundError(AcceldataSdkException):
|
|
50
|
+
"""Raised when no run exists for the given ``continuation_id`` on a pipeline."""
|
|
51
|
+
|
|
52
|
+
code = "PIPELINE_RUN_NOT_FOUND"
|
|
53
|
+
|
|
54
|
+
def __init__(
|
|
55
|
+
self,
|
|
56
|
+
message: str,
|
|
57
|
+
*,
|
|
58
|
+
continuation_id: str,
|
|
59
|
+
pipeline_id: int,
|
|
60
|
+
) -> None:
|
|
61
|
+
super().__init__(message)
|
|
62
|
+
self.continuation_id = continuation_id
|
|
63
|
+
self.pipeline_id = pipeline_id
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class PolicyExecutionCompletedWithWarningError(AcceldataSdkException):
|
|
67
|
+
"""Raised when a policy run finishes with warnings and failure strategy requires failing on warnings."""
|
|
68
|
+
|
|
69
|
+
code = "POLICY_EXECUTION_COMPLETED_WITH_WARNING"
|
|
70
|
+
|
|
71
|
+
def __init__(self, message: str, *, details: Any = None) -> None:
|
|
72
|
+
super().__init__(message)
|
|
73
|
+
self.details = details
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class PolicyExecutionCompletedWithErrorResultError(AcceldataSdkException):
|
|
77
|
+
"""Raised when a policy run finishes with errors and failure strategy requires raising."""
|
|
78
|
+
|
|
79
|
+
code = "POLICY_EXECUTION_COMPLETED_WITH_ERROR"
|
|
80
|
+
|
|
81
|
+
def __init__(self, message: str, *, details: Any = None) -> None:
|
|
82
|
+
super().__init__(message)
|
|
83
|
+
self.details = details
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class InvalidRuleTypeError(AcceldataSdkException):
|
|
87
|
+
"""Raised when a rule type is not supported for the requested operation."""
|
|
88
|
+
|
|
89
|
+
code = "INVALID_RULE_TYPE"
|
|
90
|
+
|
|
91
|
+
def __init__(
|
|
92
|
+
self,
|
|
93
|
+
message: str,
|
|
94
|
+
*,
|
|
95
|
+
allowed_rule_types: tuple[str, ...] | None = None,
|
|
96
|
+
) -> None:
|
|
97
|
+
super().__init__(message)
|
|
98
|
+
self.allowed_rule_types = allowed_rule_types
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Map generated catalog API models to values the SDK uses in services and helpers."""
|
|
2
|
+
|
|
3
|
+
from acceldata.mappers.catalog_executions import (
|
|
4
|
+
catalog_generic_execution_branch_typename,
|
|
5
|
+
catalog_generic_execution_payload,
|
|
6
|
+
catalog_generic_rule_execution_payload,
|
|
7
|
+
catalog_rule_execution_nested_payload,
|
|
8
|
+
execution_status_pair_from_result,
|
|
9
|
+
rule_execution_error_message_from_result,
|
|
10
|
+
rule_execution_id_from_generic_post_response,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"catalog_generic_execution_branch_typename",
|
|
15
|
+
"catalog_generic_execution_payload",
|
|
16
|
+
"catalog_generic_rule_execution_payload",
|
|
17
|
+
"catalog_rule_execution_nested_payload",
|
|
18
|
+
"execution_status_pair_from_result",
|
|
19
|
+
"rule_execution_error_message_from_result",
|
|
20
|
+
"rule_execution_id_from_generic_post_response",
|
|
21
|
+
]
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Extract concrete payloads from catalog execution response wrappers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from acceldata.models.api.catalog.execution_result import ExecutionResult
|
|
9
|
+
from acceldata.models.api.catalog.generic_execution import GenericExecution
|
|
10
|
+
from acceldata.models.api.catalog.generic_rule_execution import GenericRuleExecution
|
|
11
|
+
|
|
12
|
+
LOGGER = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def catalog_generic_execution_payload(ge: GenericExecution | None) -> Any | None:
|
|
16
|
+
"""Return the resolved concrete branch inside ``GenericExecution``, or ``None``."""
|
|
17
|
+
if ge is None:
|
|
18
|
+
return None
|
|
19
|
+
return getattr(ge, "actual_instance", None)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def catalog_generic_rule_execution_payload(gre: GenericRuleExecution | None) -> Any | None:
|
|
23
|
+
"""Return the resolved ``RuleExecution`` / ``DQRuleExecution`` inside ``GenericRuleExecution``."""
|
|
24
|
+
if gre is None:
|
|
25
|
+
return None
|
|
26
|
+
return getattr(gre, "actual_instance", None)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def catalog_rule_execution_nested_payload(inner: Any | None) -> Any | None:
|
|
30
|
+
"""Normalize ``execution`` on result/list DTOs: unwrap ``GenericRuleExecution`` when present."""
|
|
31
|
+
if inner is None:
|
|
32
|
+
return None
|
|
33
|
+
if isinstance(inner, GenericRuleExecution):
|
|
34
|
+
return catalog_generic_rule_execution_payload(inner)
|
|
35
|
+
return inner
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def rule_execution_id_from_generic_post_response(ge: GenericExecution) -> int | None:
|
|
39
|
+
"""Numeric ``RuleExecution.id`` from POST ``.../executions`` (DQ / reconciliation / cadence)."""
|
|
40
|
+
inst = catalog_generic_execution_payload(ge)
|
|
41
|
+
if inst is None:
|
|
42
|
+
return None
|
|
43
|
+
inner = getattr(inst, "execution", None)
|
|
44
|
+
if inner is None:
|
|
45
|
+
return None
|
|
46
|
+
concrete = catalog_rule_execution_nested_payload(inner)
|
|
47
|
+
if concrete is None:
|
|
48
|
+
return None
|
|
49
|
+
rid = getattr(concrete, "id", None)
|
|
50
|
+
return int(rid) if rid is not None else None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _status_pair_from_rule_execution_like(inner: Any | None) -> tuple[str, str] | None:
|
|
54
|
+
if inner is None:
|
|
55
|
+
return None
|
|
56
|
+
es = getattr(inner, "execution_status", None)
|
|
57
|
+
rs = getattr(inner, "result_status", None)
|
|
58
|
+
if not isinstance(es, str) or not isinstance(rs, str):
|
|
59
|
+
return None
|
|
60
|
+
return es, rs
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def execution_status_pair_from_result(er: ExecutionResult) -> tuple[str, str]:
|
|
64
|
+
"""``(executionStatus, resultStatus)`` as on the catalog wire; default ERRORED for both if unknown."""
|
|
65
|
+
from acceldata.models.sdk.catalog.policy_filter import RuleExecutionStatus
|
|
66
|
+
|
|
67
|
+
err = RuleExecutionStatus.ERRORED.value, RuleExecutionStatus.ERRORED.value
|
|
68
|
+
inner = catalog_rule_execution_nested_payload(er.execution) if er.execution is not None else None
|
|
69
|
+
pair = _status_pair_from_rule_execution_like(inner)
|
|
70
|
+
if pair is not None:
|
|
71
|
+
return pair
|
|
72
|
+
|
|
73
|
+
# Fall back to serialized payload if execution object is missing/unexpected.
|
|
74
|
+
# This keeps support for looser/untyped call sites while avoiding unnecessary
|
|
75
|
+
# pydantic union-serializer warnings for partial model_construct test objects.
|
|
76
|
+
try:
|
|
77
|
+
payload = er.to_dict()
|
|
78
|
+
ex = payload.get("execution")
|
|
79
|
+
if isinstance(ex, dict):
|
|
80
|
+
es = ex.get("executionStatus")
|
|
81
|
+
rs = ex.get("resultStatus")
|
|
82
|
+
if isinstance(es, str) and isinstance(rs, str):
|
|
83
|
+
return es, rs
|
|
84
|
+
except Exception:
|
|
85
|
+
LOGGER.debug(
|
|
86
|
+
"ExecutionResult.to_dict() failed; using parsed execution fields",
|
|
87
|
+
exc_info=True,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
return err
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def rule_execution_error_message_from_result(er: ExecutionResult) -> str | None:
|
|
94
|
+
"""``execution_error`` from the nested rule execution payload, if present."""
|
|
95
|
+
inner = catalog_rule_execution_nested_payload(er.execution) if er.execution is not None else None
|
|
96
|
+
if inner is None:
|
|
97
|
+
return None
|
|
98
|
+
msg = getattr(inner, "execution_error", None)
|
|
99
|
+
return msg if isinstance(msg, str) else None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def catalog_generic_execution_branch_typename(ge: GenericExecution | None) -> str | None:
|
|
103
|
+
"""Short class name of the resolved ``GenericExecution`` branch (for logs)."""
|
|
104
|
+
inst = catalog_generic_execution_payload(ge)
|
|
105
|
+
if inst is None:
|
|
106
|
+
return None
|
|
107
|
+
return type(inst).__name__
|
|
File without changes
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Catalog Control Plane API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 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, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from acceldata.models.api.catalog.above_configs_success import AboveConfigsSuccess
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class AboveConfigs(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
AboveConfigs
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
direction: StrictStr = Field(description="Allowed values at generation time: ABOVE, BELOW, RANGE, CHANGES_BY, DECREASED_BY, INCREASED_BY.")
|
|
32
|
+
success: AboveConfigsSuccess
|
|
33
|
+
warning: Optional[AboveConfigsSuccess] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["direction", "success", "warning"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
validate_by_name=True,
|
|
38
|
+
validate_by_alias=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of AboveConfigs from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of success
|
|
76
|
+
if self.success:
|
|
77
|
+
_dict['success'] = self.success.to_dict()
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of warning
|
|
79
|
+
if self.warning:
|
|
80
|
+
_dict['warning'] = self.warning.to_dict()
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of AboveConfigs from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate({
|
|
93
|
+
"direction": obj.get("direction"),
|
|
94
|
+
"success": AboveConfigsSuccess.from_dict(obj["success"]) if obj.get("success") is not None else None,
|
|
95
|
+
"warning": AboveConfigsSuccess.from_dict(obj["warning"]) if obj.get("warning") is not None else None
|
|
96
|
+
})
|
|
97
|
+
return _obj
|
|
98
|
+
|
|
99
|
+
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Catalog Control Plane API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 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
|
+
from inspect import getfullargspec
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
|
|
21
|
+
from typing import Optional, Union
|
|
22
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
23
|
+
from typing_extensions import Literal, Self
|
|
24
|
+
from pydantic import Field
|
|
25
|
+
|
|
26
|
+
ABOVECONFIGSSUCCESS_ANY_OF_SCHEMAS = ["float", "str"]
|
|
27
|
+
|
|
28
|
+
class AboveConfigsSuccess(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Numeric value as JSON number or string (API may quote decimals).
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
# data type: float
|
|
34
|
+
anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None
|
|
35
|
+
# data type: str
|
|
36
|
+
anyof_schema_2_validator: Optional[StrictStr] = None
|
|
37
|
+
if TYPE_CHECKING:
|
|
38
|
+
actual_instance: Optional[Union[float, str]] = None
|
|
39
|
+
else:
|
|
40
|
+
actual_instance: Any = None
|
|
41
|
+
any_of_schemas: Set[str] = { "float", "str" }
|
|
42
|
+
|
|
43
|
+
model_config = {
|
|
44
|
+
"validate_assignment": True,
|
|
45
|
+
"protected_namespaces": (),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
49
|
+
if args:
|
|
50
|
+
if len(args) > 1:
|
|
51
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
52
|
+
if kwargs:
|
|
53
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
54
|
+
super().__init__(actual_instance=args[0])
|
|
55
|
+
else:
|
|
56
|
+
super().__init__(**kwargs)
|
|
57
|
+
|
|
58
|
+
@field_validator('actual_instance')
|
|
59
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
60
|
+
instance = AboveConfigsSuccess.model_construct()
|
|
61
|
+
error_messages = []
|
|
62
|
+
# validate data type: float
|
|
63
|
+
try:
|
|
64
|
+
instance.anyof_schema_1_validator = v
|
|
65
|
+
return v
|
|
66
|
+
except (ValidationError, ValueError) as e:
|
|
67
|
+
error_messages.append(str(e))
|
|
68
|
+
# validate data type: str
|
|
69
|
+
try:
|
|
70
|
+
instance.anyof_schema_2_validator = v
|
|
71
|
+
return v
|
|
72
|
+
except (ValidationError, ValueError) as e:
|
|
73
|
+
error_messages.append(str(e))
|
|
74
|
+
if error_messages:
|
|
75
|
+
# no match
|
|
76
|
+
raise ValueError("No match found when setting the actual_instance in AboveConfigsSuccess with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
77
|
+
else:
|
|
78
|
+
return v
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
82
|
+
return cls.from_json(json.dumps(obj))
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_json(cls, json_str: str) -> Self:
|
|
86
|
+
"""Returns the object represented by the json string"""
|
|
87
|
+
instance = cls.model_construct()
|
|
88
|
+
error_messages = []
|
|
89
|
+
# deserialize data into float
|
|
90
|
+
try:
|
|
91
|
+
# validation
|
|
92
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
93
|
+
# assign value to actual_instance
|
|
94
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
|
95
|
+
return instance
|
|
96
|
+
except (ValidationError, ValueError) as e:
|
|
97
|
+
error_messages.append(str(e))
|
|
98
|
+
# deserialize data into str
|
|
99
|
+
try:
|
|
100
|
+
# validation
|
|
101
|
+
instance.anyof_schema_2_validator = json.loads(json_str)
|
|
102
|
+
# assign value to actual_instance
|
|
103
|
+
instance.actual_instance = instance.anyof_schema_2_validator
|
|
104
|
+
return instance
|
|
105
|
+
except (ValidationError, ValueError) as e:
|
|
106
|
+
error_messages.append(str(e))
|
|
107
|
+
|
|
108
|
+
if error_messages:
|
|
109
|
+
# no match
|
|
110
|
+
raise ValueError("No match found when deserializing the JSON string into AboveConfigsSuccess with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
111
|
+
else:
|
|
112
|
+
return instance
|
|
113
|
+
|
|
114
|
+
def to_json(self) -> str:
|
|
115
|
+
"""Returns the JSON representation of the actual instance"""
|
|
116
|
+
if self.actual_instance is None:
|
|
117
|
+
return "null"
|
|
118
|
+
|
|
119
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
120
|
+
return self.actual_instance.to_json()
|
|
121
|
+
else:
|
|
122
|
+
return json.dumps(self.actual_instance)
|
|
123
|
+
|
|
124
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]:
|
|
125
|
+
"""Returns the dict representation of the actual instance"""
|
|
126
|
+
if self.actual_instance is None:
|
|
127
|
+
return None
|
|
128
|
+
|
|
129
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
130
|
+
return self.actual_instance.to_dict()
|
|
131
|
+
else:
|
|
132
|
+
return self.actual_instance
|
|
133
|
+
|
|
134
|
+
def to_str(self) -> str:
|
|
135
|
+
"""Returns the string representation of the actual instance"""
|
|
136
|
+
return pprint.pformat(self.model_dump())
|
|
137
|
+
|
|
138
|
+
|