# coding: utf-8

"""
    Kubernetes

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: release-1.29
    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 typing import List, Optional
from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist
from .v1_secret_reference import V1SecretReference

class V1CephFSPersistentVolumeSource(BaseModel):
    """
    Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.  # noqa: E501
    """
    monitors: conlist(StrictStr) = Field(..., description="monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it")
    path: Optional[StrictStr] = Field(None, description="path is Optional: Used as the mounted root, rather than the full Ceph tree, default is /")
    read_only: Optional[StrictBool] = Field(None, alias="readOnly", description="readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it")
    secret_file: Optional[StrictStr] = Field(None, alias="secretFile", description="secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it")
    secret_ref: Optional[V1SecretReference] = Field(None, alias="secretRef")
    user: Optional[StrictStr] = Field(None, description="user is Optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it")
    __properties = ["monitors", "path", "readOnly", "secretFile", "secretRef", "user"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> V1CephFSPersistentVolumeSource:
        """Create an instance of V1CephFSPersistentVolumeSource from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    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 secret_ref
        if self.secret_ref:
            _dict['secretRef'] = self.secret_ref.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> V1CephFSPersistentVolumeSource:
        """Create an instance of V1CephFSPersistentVolumeSource from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return V1CephFSPersistentVolumeSource.parse_obj(obj)

        _obj = V1CephFSPersistentVolumeSource.parse_obj({
            "monitors": obj.get("monitors"),
            "path": obj.get("path"),
            "read_only": obj.get("readOnly"),
            "secret_file": obj.get("secretFile"),
            "secret_ref": V1SecretReference.from_dict(obj.get("secretRef")) if obj.get("secretRef") is not None else None,
            "user": obj.get("user")
        })
        return _obj


