# 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 Optional
from pydantic import BaseModel, Field, StrictBool, StrictStr

class V1VolumeMount(BaseModel):
    """
    VolumeMount describes a mounting of a Volume within a container.  # noqa: E501
    """
    mount_path: StrictStr = Field(..., alias="mountPath", description="Path within the container at which the volume should be mounted.  Must not contain ':'.")
    mount_propagation: Optional[StrictStr] = Field(None, alias="mountPropagation", description="mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10.")
    name: StrictStr = Field(..., description="This must match the Name of a Volume.")
    read_only: Optional[StrictBool] = Field(None, alias="readOnly", description="Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.")
    sub_path: Optional[StrictStr] = Field(None, alias="subPath", description="Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).")
    sub_path_expr: Optional[StrictStr] = Field(None, alias="subPathExpr", description="Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to \"\" (volume's root). SubPathExpr and SubPath are mutually exclusive.")
    __properties = ["mountPath", "mountPropagation", "name", "readOnly", "subPath", "subPathExpr"]

    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) -> V1VolumeMount:
        """Create an instance of V1VolumeMount 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)
        return _dict

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

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

        _obj = V1VolumeMount.parse_obj({
            "mount_path": obj.get("mountPath"),
            "mount_propagation": obj.get("mountPropagation"),
            "name": obj.get("name"),
            "read_only": obj.get("readOnly"),
            "sub_path": obj.get("subPath"),
            "sub_path_expr": obj.get("subPathExpr")
        })
        return _obj


