Source code for openapi_client.models.hcls_stores

# coding: utf-8

"""
    Amorphic Data Platform

    Amorphic Data Platform - API Definition documentation

    The version of the OpenAPI document: 1.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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.hcls_stores_dataset_access import HclsStoresDatasetAccess
from openapi_client.models.hcls_stores_dependent_resources_inner import HclsStoresDependentResourcesInner
from openapi_client.models.hcls_stores_store_config import HclsStoresStoreConfig
from typing import Optional, Set
from typing_extensions import Self

[docs] class HclsStores(BaseModel): """ HclsStores """ # noqa: E501 store_name: Optional[StrictStr] = Field(default=None, alias="StoreName") store_id: Optional[StrictStr] = Field(default=None, alias="StoreId") omics_workflow_id: Optional[StrictStr] = Field(default=None, alias="OmicsWorkflowId") hcls_workflow_id: Optional[StrictStr] = Field(default=None, alias="HclsWorkflowId") workflow_name: Optional[StrictStr] = Field(default=None, alias="WorkflowName") display_name: Optional[StrictStr] = Field(default=None, alias="DisplayName") description: Optional[StrictStr] = Field(default=None, alias="Description") keywords: Optional[List[StrictStr]] = Field(default=None, alias="Keywords") store_type: Optional[StrictStr] = Field(default=None, alias="StoreType") store_arn: Optional[StrictStr] = Field(default=None, alias="StoreArn") access_type: Optional[StrictStr] = Field(default=None, alias="AccessType") store_config: Optional[HclsStoresStoreConfig] = Field(default=None, alias="StoreConfig") is_auto_terminate_enabled: Optional[StrictBool] = Field(default=None, alias="IsAutoTerminateEnabled") auto_termination_time: Optional[StrictStr] = Field(default=None, alias="AutoTerminationTime") image_sets: Optional[List[Dict[str, Any]]] = Field(default=None, alias="imageSets") main: Optional[StrictStr] = Field(default=None, alias="Main") workflow_engine: Optional[StrictStr] = Field(default=None, alias="WorkflowEngine") storage_capacity: Optional[StrictInt] = Field(default=None, alias="StorageCapacity") workflow_role_arn: Optional[StrictStr] = Field(default=None, alias="WorkflowRoleArn") workflow_s3_path: Optional[StrictStr] = Field(default=None, alias="WorkflowS3Path") workflow_params: Optional[Dict[str, Any]] = Field(default=None, alias="WorkflowParams") dataset_access: Optional[HclsStoresDatasetAccess] = Field(default=None, alias="DatasetAccess") flex_view_connection_status: Optional[StrictStr] = Field(default=None, alias="FlexViewConnectionStatus") created_by: Optional[StrictStr] = Field(default=None, alias="CreatedBy") creation_time: Optional[StrictStr] = Field(default=None, alias="CreationTime") last_modified_by: Optional[StrictStr] = Field(default=None, alias="LastModifiedBy") last_modified_time: Optional[StrictStr] = Field(default=None, alias="LastModifiedTime") dependent_resources: Optional[List[HclsStoresDependentResourcesInner]] = Field(default=None, alias="DependentResources") __properties: ClassVar[List[str]] = ["StoreName", "StoreId", "OmicsWorkflowId", "HclsWorkflowId", "WorkflowName", "DisplayName", "Description", "Keywords", "StoreType", "StoreArn", "AccessType", "StoreConfig", "IsAutoTerminateEnabled", "AutoTerminationTime", "imageSets", "Main", "WorkflowEngine", "StorageCapacity", "WorkflowRoleArn", "WorkflowS3Path", "WorkflowParams", "DatasetAccess", "FlexViewConnectionStatus", "CreatedBy", "CreationTime", "LastModifiedBy", "LastModifiedTime", "DependentResources"] 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 HclsStores 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 store_config if self.store_config: _dict['StoreConfig'] = self.store_config.to_dict() # override the default output from pydantic by calling `to_dict()` of dataset_access if self.dataset_access: _dict['DatasetAccess'] = self.dataset_access.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in dependent_resources (list) _items = [] if self.dependent_resources: for _item_dependent_resources in self.dependent_resources: if _item_dependent_resources: _items.append(_item_dependent_resources.to_dict()) _dict['DependentResources'] = _items return _dict
[docs] @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of HclsStores from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate({ "StoreName": obj.get("StoreName"), "StoreId": obj.get("StoreId"), "OmicsWorkflowId": obj.get("OmicsWorkflowId"), "HclsWorkflowId": obj.get("HclsWorkflowId"), "WorkflowName": obj.get("WorkflowName"), "DisplayName": obj.get("DisplayName"), "Description": obj.get("Description"), "Keywords": obj.get("Keywords"), "StoreType": obj.get("StoreType"), "StoreArn": obj.get("StoreArn"), "AccessType": obj.get("AccessType"), "StoreConfig": HclsStoresStoreConfig.from_dict(obj["StoreConfig"]) if obj.get("StoreConfig") is not None else None, "IsAutoTerminateEnabled": obj.get("IsAutoTerminateEnabled"), "AutoTerminationTime": obj.get("AutoTerminationTime"), "imageSets": obj.get("imageSets"), "Main": obj.get("Main"), "WorkflowEngine": obj.get("WorkflowEngine"), "StorageCapacity": obj.get("StorageCapacity"), "WorkflowRoleArn": obj.get("WorkflowRoleArn"), "WorkflowS3Path": obj.get("WorkflowS3Path"), "WorkflowParams": obj.get("WorkflowParams"), "DatasetAccess": HclsStoresDatasetAccess.from_dict(obj["DatasetAccess"]) if obj.get("DatasetAccess") is not None else None, "FlexViewConnectionStatus": obj.get("FlexViewConnectionStatus"), "CreatedBy": obj.get("CreatedBy"), "CreationTime": obj.get("CreationTime"), "LastModifiedBy": obj.get("LastModifiedBy"), "LastModifiedTime": obj.get("LastModifiedTime"), "DependentResources": [HclsStoresDependentResourcesInner.from_dict(_item) for _item in obj["DependentResources"]] if obj.get("DependentResources") is not None else None }) return _obj