Source code for openapi_client.models.operations_response

# coding: utf-8

"""
    Amorphic Data Platform

    Amorphic Data Platform - API Definition documentation

    The version of the OpenAPI document: 0.3.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.cluster_groups import ClusterGroups
from openapi_client.models.cluster_metrics import ClusterMetrics
from openapi_client.models.cluster_schema_tables import ClusterSchemaTables
from openapi_client.models.cluster_schemas import ClusterSchemas
from openapi_client.models.dwh_list_tables import DWHListTables
from openapi_client.models.dwh_query_response import DWHQueryResponse
from openapi_client.models.dwh_query_results import DWHQueryResults
from openapi_client.models.index_history_inner import IndexHistoryInner
from openapi_client.models.message_status import MessageStatus
from openapi_client.models.queries_and_loads_response import QueriesAndLoadsResponse
from openapi_client.models.tenant_response_body import TenantResponseBody
from openapi_client.models.tenants import Tenants
from openapi_client.models.wlm_config_response import WLMConfigResponse
from openapi_client.models.wlm_queue_config import WLMQueueConfig
from typing import Optional, Set
from typing_extensions import Self

[docs] class OperationsResponse(BaseModel): """ OperationsResponse """ # noqa: E501 cluster_metrics: Optional[ClusterMetrics] = Field(default=None, alias="ClusterMetrics") cluster_schemas: Optional[ClusterSchemas] = Field(default=None, alias="ClusterSchemas") cluster_schema_tables: Optional[ClusterSchemaTables] = Field(default=None, alias="ClusterSchemaTables") dwh_list_tables: Optional[DWHListTables] = Field(default=None, alias="DWHListTables") dwh_query_response: Optional[DWHQueryResponse] = Field(default=None, alias="DWHQueryResponse") dwh_query_results: Optional[DWHQueryResults] = Field(default=None, alias="DWHQueryResults") message_status: Optional[MessageStatus] = Field(default=None, alias="MessageStatus") tenants: Optional[Tenants] = Field(default=None, alias="Tenants") tenant_response_body: Optional[TenantResponseBody] = Field(default=None, alias="TenantResponseBody") wlm_config_response: Optional[WLMConfigResponse] = Field(default=None, alias="WLMConfigResponse") wlm_queue_config: Optional[WLMQueueConfig] = Field(default=None, alias="WLMQueueConfig") cluster_groups: Optional[ClusterGroups] = Field(default=None, alias="ClusterGroups") queries_and_loads_response: Optional[QueriesAndLoadsResponse] = Field(default=None, alias="QueriesAndLoadsResponse") index_history: Optional[List[IndexHistoryInner]] = Field(default=None, alias="IndexHistory") __properties: ClassVar[List[str]] = ["ClusterMetrics", "ClusterSchemas", "ClusterSchemaTables", "DWHListTables", "DWHQueryResponse", "DWHQueryResults", "MessageStatus", "Tenants", "TenantResponseBody", "WLMConfigResponse", "WLMQueueConfig", "ClusterGroups", "QueriesAndLoadsResponse", "IndexHistory"] model_config = ConfigDict( populate_by_name=True, validate_assignment=True, protected_namespaces=(), )
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True))
[docs] def to_json(self) -> str: """Returns the JSON representation of the model using alias""" # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict())
[docs] @classmethod def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OperationsResponse from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's `self.model_dump(by_alias=True)`: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. """ excluded_fields: Set[str] = set([ ]) _dict = self.model_dump( by_alias=True, exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of cluster_metrics if self.cluster_metrics: _dict['ClusterMetrics'] = self.cluster_metrics.to_dict() # override the default output from pydantic by calling `to_dict()` of cluster_schemas if self.cluster_schemas: _dict['ClusterSchemas'] = self.cluster_schemas.to_dict() # override the default output from pydantic by calling `to_dict()` of cluster_schema_tables if self.cluster_schema_tables: _dict['ClusterSchemaTables'] = self.cluster_schema_tables.to_dict() # override the default output from pydantic by calling `to_dict()` of dwh_list_tables if self.dwh_list_tables: _dict['DWHListTables'] = self.dwh_list_tables.to_dict() # override the default output from pydantic by calling `to_dict()` of dwh_query_response if self.dwh_query_response: _dict['DWHQueryResponse'] = self.dwh_query_response.to_dict() # override the default output from pydantic by calling `to_dict()` of dwh_query_results if self.dwh_query_results: _dict['DWHQueryResults'] = self.dwh_query_results.to_dict() # override the default output from pydantic by calling `to_dict()` of message_status if self.message_status: _dict['MessageStatus'] = self.message_status.to_dict() # override the default output from pydantic by calling `to_dict()` of tenants if self.tenants: _dict['Tenants'] = self.tenants.to_dict() # override the default output from pydantic by calling `to_dict()` of tenant_response_body if self.tenant_response_body: _dict['TenantResponseBody'] = self.tenant_response_body.to_dict() # override the default output from pydantic by calling `to_dict()` of wlm_config_response if self.wlm_config_response: _dict['WLMConfigResponse'] = self.wlm_config_response.to_dict() # override the default output from pydantic by calling `to_dict()` of wlm_queue_config if self.wlm_queue_config: _dict['WLMQueueConfig'] = self.wlm_queue_config.to_dict() # override the default output from pydantic by calling `to_dict()` of cluster_groups if self.cluster_groups: _dict['ClusterGroups'] = self.cluster_groups.to_dict() # override the default output from pydantic by calling `to_dict()` of queries_and_loads_response if self.queries_and_loads_response: _dict['QueriesAndLoadsResponse'] = self.queries_and_loads_response.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in index_history (list) _items = [] if self.index_history: for _item_index_history in self.index_history: if _item_index_history: _items.append(_item_index_history.to_dict()) _dict['IndexHistory'] = _items return _dict
[docs] @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OperationsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate({ "ClusterMetrics": ClusterMetrics.from_dict(obj["ClusterMetrics"]) if obj.get("ClusterMetrics") is not None else None, "ClusterSchemas": ClusterSchemas.from_dict(obj["ClusterSchemas"]) if obj.get("ClusterSchemas") is not None else None, "ClusterSchemaTables": ClusterSchemaTables.from_dict(obj["ClusterSchemaTables"]) if obj.get("ClusterSchemaTables") is not None else None, "DWHListTables": DWHListTables.from_dict(obj["DWHListTables"]) if obj.get("DWHListTables") is not None else None, "DWHQueryResponse": DWHQueryResponse.from_dict(obj["DWHQueryResponse"]) if obj.get("DWHQueryResponse") is not None else None, "DWHQueryResults": DWHQueryResults.from_dict(obj["DWHQueryResults"]) if obj.get("DWHQueryResults") is not None else None, "MessageStatus": MessageStatus.from_dict(obj["MessageStatus"]) if obj.get("MessageStatus") is not None else None, "Tenants": Tenants.from_dict(obj["Tenants"]) if obj.get("Tenants") is not None else None, "TenantResponseBody": TenantResponseBody.from_dict(obj["TenantResponseBody"]) if obj.get("TenantResponseBody") is not None else None, "WLMConfigResponse": WLMConfigResponse.from_dict(obj["WLMConfigResponse"]) if obj.get("WLMConfigResponse") is not None else None, "WLMQueueConfig": WLMQueueConfig.from_dict(obj["WLMQueueConfig"]) if obj.get("WLMQueueConfig") is not None else None, "ClusterGroups": ClusterGroups.from_dict(obj["ClusterGroups"]) if obj.get("ClusterGroups") is not None else None, "QueriesAndLoadsResponse": QueriesAndLoadsResponse.from_dict(obj["QueriesAndLoadsResponse"]) if obj.get("QueriesAndLoadsResponse") is not None else None, "IndexHistory": [IndexHistoryInner.from_dict(_item) for _item in obj["IndexHistory"]] if obj.get("IndexHistory") is not None else None }) return _obj