# 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, StrictStr
from .v1_aws_elastic_block_store_volume_source import V1AWSElasticBlockStoreVolumeSource
from .v1_azure_disk_volume_source import V1AzureDiskVolumeSource
from .v1_azure_file_volume_source import V1AzureFileVolumeSource
from .v1_ceph_fs_volume_source import V1CephFSVolumeSource
from .v1_cinder_volume_source import V1CinderVolumeSource
from .v1_config_map_volume_source import V1ConfigMapVolumeSource
from .v1_csi_volume_source import V1CSIVolumeSource
from .v1_downward_api_volume_source import V1DownwardAPIVolumeSource
from .v1_empty_dir_volume_source import V1EmptyDirVolumeSource
from .v1_ephemeral_volume_source import V1EphemeralVolumeSource
from .v1_fc_volume_source import V1FCVolumeSource
from .v1_flex_volume_source import V1FlexVolumeSource
from .v1_flocker_volume_source import V1FlockerVolumeSource
from .v1_gce_persistent_disk_volume_source import V1GCEPersistentDiskVolumeSource
from .v1_git_repo_volume_source import V1GitRepoVolumeSource
from .v1_glusterfs_volume_source import V1GlusterfsVolumeSource
from .v1_host_path_volume_source import V1HostPathVolumeSource
from .v1_iscsi_volume_source import V1ISCSIVolumeSource
from .v1_nfs_volume_source import V1NFSVolumeSource
from .v1_persistent_volume_claim_volume_source import V1PersistentVolumeClaimVolumeSource
from .v1_photon_persistent_disk_volume_source import V1PhotonPersistentDiskVolumeSource
from .v1_portworx_volume_source import V1PortworxVolumeSource
from .v1_projected_volume_source import V1ProjectedVolumeSource
from .v1_quobyte_volume_source import V1QuobyteVolumeSource
from .v1_rbd_volume_source import V1RBDVolumeSource
from .v1_scale_io_volume_source import V1ScaleIOVolumeSource
from .v1_secret_volume_source import V1SecretVolumeSource
from .v1_storage_os_volume_source import V1StorageOSVolumeSource
from .v1_vsphere_virtual_disk_volume_source import V1VsphereVirtualDiskVolumeSource

class V1Volume(BaseModel):
    """
    Volume represents a named volume in a pod that may be accessed by any container in the pod.  # noqa: E501
    """
    aws_elastic_block_store: Optional[V1AWSElasticBlockStoreVolumeSource] = Field(None, alias="awsElasticBlockStore")
    azure_disk: Optional[V1AzureDiskVolumeSource] = Field(None, alias="azureDisk")
    azure_file: Optional[V1AzureFileVolumeSource] = Field(None, alias="azureFile")
    cephfs: Optional[V1CephFSVolumeSource] = None
    cinder: Optional[V1CinderVolumeSource] = None
    config_map: Optional[V1ConfigMapVolumeSource] = Field(None, alias="configMap")
    csi: Optional[V1CSIVolumeSource] = None
    downward_api: Optional[V1DownwardAPIVolumeSource] = Field(None, alias="downwardAPI")
    empty_dir: Optional[V1EmptyDirVolumeSource] = Field(None, alias="emptyDir")
    ephemeral: Optional[V1EphemeralVolumeSource] = None
    fc: Optional[V1FCVolumeSource] = None
    flex_volume: Optional[V1FlexVolumeSource] = Field(None, alias="flexVolume")
    flocker: Optional[V1FlockerVolumeSource] = None
    gce_persistent_disk: Optional[V1GCEPersistentDiskVolumeSource] = Field(None, alias="gcePersistentDisk")
    git_repo: Optional[V1GitRepoVolumeSource] = Field(None, alias="gitRepo")
    glusterfs: Optional[V1GlusterfsVolumeSource] = None
    host_path: Optional[V1HostPathVolumeSource] = Field(None, alias="hostPath")
    iscsi: Optional[V1ISCSIVolumeSource] = None
    name: StrictStr = Field(..., description="name of the volume. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names")
    nfs: Optional[V1NFSVolumeSource] = None
    persistent_volume_claim: Optional[V1PersistentVolumeClaimVolumeSource] = Field(None, alias="persistentVolumeClaim")
    photon_persistent_disk: Optional[V1PhotonPersistentDiskVolumeSource] = Field(None, alias="photonPersistentDisk")
    portworx_volume: Optional[V1PortworxVolumeSource] = Field(None, alias="portworxVolume")
    projected: Optional[V1ProjectedVolumeSource] = None
    quobyte: Optional[V1QuobyteVolumeSource] = None
    rbd: Optional[V1RBDVolumeSource] = None
    scale_io: Optional[V1ScaleIOVolumeSource] = Field(None, alias="scaleIO")
    secret: Optional[V1SecretVolumeSource] = None
    storageos: Optional[V1StorageOSVolumeSource] = None
    vsphere_volume: Optional[V1VsphereVirtualDiskVolumeSource] = Field(None, alias="vsphereVolume")
    __properties = ["awsElasticBlockStore", "azureDisk", "azureFile", "cephfs", "cinder", "configMap", "csi", "downwardAPI", "emptyDir", "ephemeral", "fc", "flexVolume", "flocker", "gcePersistentDisk", "gitRepo", "glusterfs", "hostPath", "iscsi", "name", "nfs", "persistentVolumeClaim", "photonPersistentDisk", "portworxVolume", "projected", "quobyte", "rbd", "scaleIO", "secret", "storageos", "vsphereVolume"]

    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) -> V1Volume:
        """Create an instance of V1Volume 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 aws_elastic_block_store
        if self.aws_elastic_block_store:
            _dict['awsElasticBlockStore'] = self.aws_elastic_block_store.to_dict()
        # override the default output from pydantic by calling `to_dict()` of azure_disk
        if self.azure_disk:
            _dict['azureDisk'] = self.azure_disk.to_dict()
        # override the default output from pydantic by calling `to_dict()` of azure_file
        if self.azure_file:
            _dict['azureFile'] = self.azure_file.to_dict()
        # override the default output from pydantic by calling `to_dict()` of cephfs
        if self.cephfs:
            _dict['cephfs'] = self.cephfs.to_dict()
        # override the default output from pydantic by calling `to_dict()` of cinder
        if self.cinder:
            _dict['cinder'] = self.cinder.to_dict()
        # override the default output from pydantic by calling `to_dict()` of config_map
        if self.config_map:
            _dict['configMap'] = self.config_map.to_dict()
        # override the default output from pydantic by calling `to_dict()` of csi
        if self.csi:
            _dict['csi'] = self.csi.to_dict()
        # override the default output from pydantic by calling `to_dict()` of downward_api
        if self.downward_api:
            _dict['downwardAPI'] = self.downward_api.to_dict()
        # override the default output from pydantic by calling `to_dict()` of empty_dir
        if self.empty_dir:
            _dict['emptyDir'] = self.empty_dir.to_dict()
        # override the default output from pydantic by calling `to_dict()` of ephemeral
        if self.ephemeral:
            _dict['ephemeral'] = self.ephemeral.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fc
        if self.fc:
            _dict['fc'] = self.fc.to_dict()
        # override the default output from pydantic by calling `to_dict()` of flex_volume
        if self.flex_volume:
            _dict['flexVolume'] = self.flex_volume.to_dict()
        # override the default output from pydantic by calling `to_dict()` of flocker
        if self.flocker:
            _dict['flocker'] = self.flocker.to_dict()
        # override the default output from pydantic by calling `to_dict()` of gce_persistent_disk
        if self.gce_persistent_disk:
            _dict['gcePersistentDisk'] = self.gce_persistent_disk.to_dict()
        # override the default output from pydantic by calling `to_dict()` of git_repo
        if self.git_repo:
            _dict['gitRepo'] = self.git_repo.to_dict()
        # override the default output from pydantic by calling `to_dict()` of glusterfs
        if self.glusterfs:
            _dict['glusterfs'] = self.glusterfs.to_dict()
        # override the default output from pydantic by calling `to_dict()` of host_path
        if self.host_path:
            _dict['hostPath'] = self.host_path.to_dict()
        # override the default output from pydantic by calling `to_dict()` of iscsi
        if self.iscsi:
            _dict['iscsi'] = self.iscsi.to_dict()
        # override the default output from pydantic by calling `to_dict()` of nfs
        if self.nfs:
            _dict['nfs'] = self.nfs.to_dict()
        # override the default output from pydantic by calling `to_dict()` of persistent_volume_claim
        if self.persistent_volume_claim:
            _dict['persistentVolumeClaim'] = self.persistent_volume_claim.to_dict()
        # override the default output from pydantic by calling `to_dict()` of photon_persistent_disk
        if self.photon_persistent_disk:
            _dict['photonPersistentDisk'] = self.photon_persistent_disk.to_dict()
        # override the default output from pydantic by calling `to_dict()` of portworx_volume
        if self.portworx_volume:
            _dict['portworxVolume'] = self.portworx_volume.to_dict()
        # override the default output from pydantic by calling `to_dict()` of projected
        if self.projected:
            _dict['projected'] = self.projected.to_dict()
        # override the default output from pydantic by calling `to_dict()` of quobyte
        if self.quobyte:
            _dict['quobyte'] = self.quobyte.to_dict()
        # override the default output from pydantic by calling `to_dict()` of rbd
        if self.rbd:
            _dict['rbd'] = self.rbd.to_dict()
        # override the default output from pydantic by calling `to_dict()` of scale_io
        if self.scale_io:
            _dict['scaleIO'] = self.scale_io.to_dict()
        # override the default output from pydantic by calling `to_dict()` of secret
        if self.secret:
            _dict['secret'] = self.secret.to_dict()
        # override the default output from pydantic by calling `to_dict()` of storageos
        if self.storageos:
            _dict['storageos'] = self.storageos.to_dict()
        # override the default output from pydantic by calling `to_dict()` of vsphere_volume
        if self.vsphere_volume:
            _dict['vsphereVolume'] = self.vsphere_volume.to_dict()
        return _dict

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

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

        _obj = V1Volume.parse_obj({
            "aws_elastic_block_store": V1AWSElasticBlockStoreVolumeSource.from_dict(obj.get("awsElasticBlockStore")) if obj.get("awsElasticBlockStore") is not None else None,
            "azure_disk": V1AzureDiskVolumeSource.from_dict(obj.get("azureDisk")) if obj.get("azureDisk") is not None else None,
            "azure_file": V1AzureFileVolumeSource.from_dict(obj.get("azureFile")) if obj.get("azureFile") is not None else None,
            "cephfs": V1CephFSVolumeSource.from_dict(obj.get("cephfs")) if obj.get("cephfs") is not None else None,
            "cinder": V1CinderVolumeSource.from_dict(obj.get("cinder")) if obj.get("cinder") is not None else None,
            "config_map": V1ConfigMapVolumeSource.from_dict(obj.get("configMap")) if obj.get("configMap") is not None else None,
            "csi": V1CSIVolumeSource.from_dict(obj.get("csi")) if obj.get("csi") is not None else None,
            "downward_api": V1DownwardAPIVolumeSource.from_dict(obj.get("downwardAPI")) if obj.get("downwardAPI") is not None else None,
            "empty_dir": V1EmptyDirVolumeSource.from_dict(obj.get("emptyDir")) if obj.get("emptyDir") is not None else None,
            "ephemeral": V1EphemeralVolumeSource.from_dict(obj.get("ephemeral")) if obj.get("ephemeral") is not None else None,
            "fc": V1FCVolumeSource.from_dict(obj.get("fc")) if obj.get("fc") is not None else None,
            "flex_volume": V1FlexVolumeSource.from_dict(obj.get("flexVolume")) if obj.get("flexVolume") is not None else None,
            "flocker": V1FlockerVolumeSource.from_dict(obj.get("flocker")) if obj.get("flocker") is not None else None,
            "gce_persistent_disk": V1GCEPersistentDiskVolumeSource.from_dict(obj.get("gcePersistentDisk")) if obj.get("gcePersistentDisk") is not None else None,
            "git_repo": V1GitRepoVolumeSource.from_dict(obj.get("gitRepo")) if obj.get("gitRepo") is not None else None,
            "glusterfs": V1GlusterfsVolumeSource.from_dict(obj.get("glusterfs")) if obj.get("glusterfs") is not None else None,
            "host_path": V1HostPathVolumeSource.from_dict(obj.get("hostPath")) if obj.get("hostPath") is not None else None,
            "iscsi": V1ISCSIVolumeSource.from_dict(obj.get("iscsi")) if obj.get("iscsi") is not None else None,
            "name": obj.get("name"),
            "nfs": V1NFSVolumeSource.from_dict(obj.get("nfs")) if obj.get("nfs") is not None else None,
            "persistent_volume_claim": V1PersistentVolumeClaimVolumeSource.from_dict(obj.get("persistentVolumeClaim")) if obj.get("persistentVolumeClaim") is not None else None,
            "photon_persistent_disk": V1PhotonPersistentDiskVolumeSource.from_dict(obj.get("photonPersistentDisk")) if obj.get("photonPersistentDisk") is not None else None,
            "portworx_volume": V1PortworxVolumeSource.from_dict(obj.get("portworxVolume")) if obj.get("portworxVolume") is not None else None,
            "projected": V1ProjectedVolumeSource.from_dict(obj.get("projected")) if obj.get("projected") is not None else None,
            "quobyte": V1QuobyteVolumeSource.from_dict(obj.get("quobyte")) if obj.get("quobyte") is not None else None,
            "rbd": V1RBDVolumeSource.from_dict(obj.get("rbd")) if obj.get("rbd") is not None else None,
            "scale_io": V1ScaleIOVolumeSource.from_dict(obj.get("scaleIO")) if obj.get("scaleIO") is not None else None,
            "secret": V1SecretVolumeSource.from_dict(obj.get("secret")) if obj.get("secret") is not None else None,
            "storageos": V1StorageOSVolumeSource.from_dict(obj.get("storageos")) if obj.get("storageos") is not None else None,
            "vsphere_volume": V1VsphereVirtualDiskVolumeSource.from_dict(obj.get("vsphereVolume")) if obj.get("vsphereVolume") is not None else None
        })
        return _obj


