Source code for sdk.lusid.models.compliance_rule_result

# coding: utf-8

"""
    LUSID API

    FINBOURNE Technology  # noqa: E501

    Contact: info@finbourne.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


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


from typing import List, Dict, Optional, Any, Union, TYPE_CHECKING
from typing_extensions import Annotated
from pydantic.v1 import BaseModel, StrictStr, StrictInt, StrictBool, StrictFloat, StrictBytes, Field, validator, ValidationError, conlist, constr
from datetime import datetime
from lusid.models.resource_id import ResourceId

[docs] class ComplianceRuleResult(BaseModel): """ ComplianceRuleResult """ rule_id: StrictStr = Field(...,alias="ruleId", description="The unique identifierof a compliance rule") rule_name: StrictStr = Field(...,alias="ruleName", description="The User-given name of the rule") rule_description: StrictStr = Field(...,alias="ruleDescription", description="The User-given description of the rule") portfolio: ResourceId passed: StrictBool = Field(description="The result of an individual compliance run, true if passed") result_value: Union[StrictFloat, StrictInt] = Field(description="The calculation result that was used to confirm a pass/fail", alias="resultValue") rule_information_match: StrictStr = Field(...,alias="ruleInformationMatch", description="The value matched by the rule") rule_information_key: StrictStr = Field(...,alias="ruleInformationKey", description="The property key matched by the rule") rule_lower_limit: Union[StrictFloat, StrictInt] = Field(description="The lower limit of the rule", alias="ruleLowerLimit") rule_upper_limit: Union[StrictFloat, StrictInt] = Field(description="The upper limit of the rule", alias="ruleUpperLimit") __properties = ["ruleId", "ruleName", "ruleDescription", "portfolio", "passed", "resultValue", "ruleInformationMatch", "ruleInformationKey", "ruleLowerLimit", "ruleUpperLimit"]
[docs] class Config: """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True
def __str__(self): """For `print` and `pprint`""" return pprint.pformat(self.dict(by_alias=False)) def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.dict(by_alias=True))
[docs] def to_json(self) -> str: """Returns the JSON representation of the model using alias""" return json.dumps(self.to_dict())
[docs] @classmethod def from_json(cls, json_str: str) -> ComplianceRuleResult: """Create an instance of ComplianceRuleResult from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] def to_dict(self): """Returns the dictionary representation of the model using alias""" _dict = self.dict(by_alias=True, exclude={ }, exclude_none=True) # override the default output from pydantic by calling `to_dict()` of portfolio if self.portfolio: _dict['portfolio'] = self.portfolio.to_dict() return _dict
[docs] @classmethod def from_dict(cls, obj: dict) -> ComplianceRuleResult: """Create an instance of ComplianceRuleResult from a dict""" if obj is None: return None if not isinstance(obj, dict): return ComplianceRuleResult.parse_obj(obj) _obj = ComplianceRuleResult.parse_obj({ "rule_id": obj.get("ruleId"), "rule_name": obj.get("ruleName"), "rule_description": obj.get("ruleDescription"), "portfolio": ResourceId.from_dict(obj.get("portfolio")) if obj.get("portfolio") is not None else None, "passed": obj.get("passed"), "result_value": obj.get("resultValue"), "rule_information_match": obj.get("ruleInformationMatch"), "rule_information_key": obj.get("ruleInformationKey"), "rule_lower_limit": obj.get("ruleLowerLimit"), "rule_upper_limit": obj.get("ruleUpperLimit") }) return _obj
ComplianceRuleResult.update_forward_refs()