Source code for openapi_client.models.guard_rail_summary

# 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, StrictBool, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

[docs] class GuardRailSummary(BaseModel): """ Summary information about a guard rail for listing. """ # noqa: E501 guard_rail_id: Optional[StrictStr] = Field(default=None, description="The unique identifier of the guard rail.", alias="GuardRailId") guard_rail_name: Optional[StrictStr] = Field(default=None, description="The name of the guard rail.", alias="GuardRailName") description: Optional[StrictStr] = Field(default=None, description="The description of the guard rail.", alias="Description") tier: Optional[StrictStr] = Field(default=None, description="The tier of the guard rail (CLASSIC or STANDARD).", alias="Tier") is_cross_region_enabled: Optional[StrictBool] = Field(default=None, description="Whether cross-region configuration is enabled for the guard rail.", alias="IsCrossRegionEnabled") scope: Optional[StrictStr] = Field(default=None, description="The scope of the guard rail (global or private).", alias="Scope") owner: Optional[StrictStr] = Field(default=None, description="The owner of the guard rail (user ID for private, system user for global scope).", alias="Owner") last_modified_time: Optional[StrictStr] = Field(default=None, description="The timestamp when the guard rail was last modified.", alias="LastModifiedTime") last_modified_by: Optional[StrictStr] = Field(default=None, description="The user who last modified the guard rail.", alias="LastModifiedBy") is_default: Optional[StrictBool] = Field(default=None, description="Whether the guard rail is the default guard rail.", alias="IsDefault") created_by: Optional[StrictStr] = Field(default=None, description="The user who created the guard rail.", alias="CreatedBy") creation_time: Optional[StrictStr] = Field(default=None, description="The timestamp when the guard rail was created.", alias="CreationTime") access_type: Optional[StrictStr] = Field(default=None, description="The access type of the guard rail.", alias="AccessType") __properties: ClassVar[List[str]] = ["GuardRailId", "GuardRailName", "Description", "Tier", "IsCrossRegionEnabled", "Scope", "Owner", "LastModifiedTime", "LastModifiedBy", "IsDefault", "CreatedBy", "CreationTime", "AccessType"]
[docs] @field_validator('tier') def tier_validate_enum(cls, value): """Validates the enum""" if value is None: return value if value not in set(['CLASSIC', 'STANDARD']): raise ValueError("must be one of enum values ('CLASSIC', 'STANDARD')") return value
[docs] @field_validator('scope') def scope_validate_enum(cls, value): """Validates the enum""" if value is None: return value if value not in set(['global', 'private']): raise ValueError("must be one of enum values ('global', 'private')") return value
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 GuardRailSummary 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, ) return _dict
[docs] @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of GuardRailSummary from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate({ "GuardRailId": obj.get("GuardRailId"), "GuardRailName": obj.get("GuardRailName"), "Description": obj.get("Description"), "Tier": obj.get("Tier"), "IsCrossRegionEnabled": obj.get("IsCrossRegionEnabled"), "Scope": obj.get("Scope"), "Owner": obj.get("Owner"), "LastModifiedTime": obj.get("LastModifiedTime"), "LastModifiedBy": obj.get("LastModifiedBy"), "IsDefault": obj.get("IsDefault"), "CreatedBy": obj.get("CreatedBy"), "CreationTime": obj.get("CreationTime"), "AccessType": obj.get("AccessType") }) return _obj