# coding: utf-8

"""
    KubeVirt API

    This is KubeVirt API an add-on for Kubernetes.  # noqa: E501

    OpenAPI spec version: 1.0.0
    Contact: kubevirt-dev@googlegroups.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import pprint
import re  # noqa: F401

import six

from kubevirt.configuration import Configuration


class V1Disk(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'block_size': 'V1BlockSize',
        'boot_order': 'int',
        'cache': 'str',
        'cdrom': 'V1CDRomTarget',
        'changed_block_tracking': 'bool',
        'dedicated_io_thread': 'bool',
        'disk': 'V1DiskTarget',
        'error_policy': 'str',
        'io': 'str',
        'lun': 'V1LunTarget',
        'name': 'str',
        'serial': 'str',
        'shareable': 'bool',
        'tag': 'str'
    }

    attribute_map = {
        'block_size': 'blockSize',
        'boot_order': 'bootOrder',
        'cache': 'cache',
        'cdrom': 'cdrom',
        'changed_block_tracking': 'changedBlockTracking',
        'dedicated_io_thread': 'dedicatedIOThread',
        'disk': 'disk',
        'error_policy': 'errorPolicy',
        'io': 'io',
        'lun': 'lun',
        'name': 'name',
        'serial': 'serial',
        'shareable': 'shareable',
        'tag': 'tag'
    }

    def __init__(self, block_size=None, boot_order=None, cache=None, cdrom=None, changed_block_tracking=None, dedicated_io_thread=None, disk=None, error_policy=None, io=None, lun=None, name='', serial=None, shareable=None, tag=None, _configuration=None):  # noqa: E501
        """V1Disk - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._block_size = None
        self._boot_order = None
        self._cache = None
        self._cdrom = None
        self._changed_block_tracking = None
        self._dedicated_io_thread = None
        self._disk = None
        self._error_policy = None
        self._io = None
        self._lun = None
        self._name = None
        self._serial = None
        self._shareable = None
        self._tag = None
        self.discriminator = None

        if block_size is not None:
            self.block_size = block_size
        if boot_order is not None:
            self.boot_order = boot_order
        if cache is not None:
            self.cache = cache
        if cdrom is not None:
            self.cdrom = cdrom
        if changed_block_tracking is not None:
            self.changed_block_tracking = changed_block_tracking
        if dedicated_io_thread is not None:
            self.dedicated_io_thread = dedicated_io_thread
        if disk is not None:
            self.disk = disk
        if error_policy is not None:
            self.error_policy = error_policy
        if io is not None:
            self.io = io
        if lun is not None:
            self.lun = lun
        self.name = name
        if serial is not None:
            self.serial = serial
        if shareable is not None:
            self.shareable = shareable
        if tag is not None:
            self.tag = tag

    @property
    def block_size(self):
        """Gets the block_size of this V1Disk.  # noqa: E501

        If specified, the virtual disk will be presented with the given block sizes.  # noqa: E501

        :return: The block_size of this V1Disk.  # noqa: E501
        :rtype: V1BlockSize
        """
        return self._block_size

    @block_size.setter
    def block_size(self, block_size):
        """Sets the block_size of this V1Disk.

        If specified, the virtual disk will be presented with the given block sizes.  # noqa: E501

        :param block_size: The block_size of this V1Disk.  # noqa: E501
        :type: V1BlockSize
        """

        self._block_size = block_size

    @property
    def boot_order(self):
        """Gets the boot_order of this V1Disk.  # noqa: E501

        BootOrder is an integer value > 0, used to determine ordering of boot devices. Lower values take precedence. Each disk or interface that has a boot order must have a unique value. Disks without a boot order are not tried if a disk with a boot order exists.  # noqa: E501

        :return: The boot_order of this V1Disk.  # noqa: E501
        :rtype: int
        """
        return self._boot_order

    @boot_order.setter
    def boot_order(self, boot_order):
        """Sets the boot_order of this V1Disk.

        BootOrder is an integer value > 0, used to determine ordering of boot devices. Lower values take precedence. Each disk or interface that has a boot order must have a unique value. Disks without a boot order are not tried if a disk with a boot order exists.  # noqa: E501

        :param boot_order: The boot_order of this V1Disk.  # noqa: E501
        :type: int
        """

        self._boot_order = boot_order

    @property
    def cache(self):
        """Gets the cache of this V1Disk.  # noqa: E501

        Cache specifies which kvm disk cache mode should be used. Supported values are: none: Guest I/O not cached on the host, but may be kept in a disk cache. writethrough: Guest I/O cached on the host but written through to the physical medium. Slowest but with most guarantees. writeback: Guest I/O cached on the host. Defaults to none if the storage supports O_DIRECT, otherwise writethrough.  # noqa: E501

        :return: The cache of this V1Disk.  # noqa: E501
        :rtype: str
        """
        return self._cache

    @cache.setter
    def cache(self, cache):
        """Sets the cache of this V1Disk.

        Cache specifies which kvm disk cache mode should be used. Supported values are: none: Guest I/O not cached on the host, but may be kept in a disk cache. writethrough: Guest I/O cached on the host but written through to the physical medium. Slowest but with most guarantees. writeback: Guest I/O cached on the host. Defaults to none if the storage supports O_DIRECT, otherwise writethrough.  # noqa: E501

        :param cache: The cache of this V1Disk.  # noqa: E501
        :type: str
        """

        self._cache = cache

    @property
    def cdrom(self):
        """Gets the cdrom of this V1Disk.  # noqa: E501

        Attach a volume as a cdrom to the vmi.  # noqa: E501

        :return: The cdrom of this V1Disk.  # noqa: E501
        :rtype: V1CDRomTarget
        """
        return self._cdrom

    @cdrom.setter
    def cdrom(self, cdrom):
        """Sets the cdrom of this V1Disk.

        Attach a volume as a cdrom to the vmi.  # noqa: E501

        :param cdrom: The cdrom of this V1Disk.  # noqa: E501
        :type: V1CDRomTarget
        """

        self._cdrom = cdrom

    @property
    def changed_block_tracking(self):
        """Gets the changed_block_tracking of this V1Disk.  # noqa: E501

        ChangedBlockTracking indicates this disk should have CBT option Defaults to false.  # noqa: E501

        :return: The changed_block_tracking of this V1Disk.  # noqa: E501
        :rtype: bool
        """
        return self._changed_block_tracking

    @changed_block_tracking.setter
    def changed_block_tracking(self, changed_block_tracking):
        """Sets the changed_block_tracking of this V1Disk.

        ChangedBlockTracking indicates this disk should have CBT option Defaults to false.  # noqa: E501

        :param changed_block_tracking: The changed_block_tracking of this V1Disk.  # noqa: E501
        :type: bool
        """

        self._changed_block_tracking = changed_block_tracking

    @property
    def dedicated_io_thread(self):
        """Gets the dedicated_io_thread of this V1Disk.  # noqa: E501

        dedicatedIOThread indicates this disk should have an exclusive IO Thread. Enabling this implies useIOThreads = true. Defaults to false.  # noqa: E501

        :return: The dedicated_io_thread of this V1Disk.  # noqa: E501
        :rtype: bool
        """
        return self._dedicated_io_thread

    @dedicated_io_thread.setter
    def dedicated_io_thread(self, dedicated_io_thread):
        """Sets the dedicated_io_thread of this V1Disk.

        dedicatedIOThread indicates this disk should have an exclusive IO Thread. Enabling this implies useIOThreads = true. Defaults to false.  # noqa: E501

        :param dedicated_io_thread: The dedicated_io_thread of this V1Disk.  # noqa: E501
        :type: bool
        """

        self._dedicated_io_thread = dedicated_io_thread

    @property
    def disk(self):
        """Gets the disk of this V1Disk.  # noqa: E501

        Attach a volume as a disk to the vmi.  # noqa: E501

        :return: The disk of this V1Disk.  # noqa: E501
        :rtype: V1DiskTarget
        """
        return self._disk

    @disk.setter
    def disk(self, disk):
        """Sets the disk of this V1Disk.

        Attach a volume as a disk to the vmi.  # noqa: E501

        :param disk: The disk of this V1Disk.  # noqa: E501
        :type: V1DiskTarget
        """

        self._disk = disk

    @property
    def error_policy(self):
        """Gets the error_policy of this V1Disk.  # noqa: E501

        If specified, it can change the default error policy (stop) for the disk  # noqa: E501

        :return: The error_policy of this V1Disk.  # noqa: E501
        :rtype: str
        """
        return self._error_policy

    @error_policy.setter
    def error_policy(self, error_policy):
        """Sets the error_policy of this V1Disk.

        If specified, it can change the default error policy (stop) for the disk  # noqa: E501

        :param error_policy: The error_policy of this V1Disk.  # noqa: E501
        :type: str
        """

        self._error_policy = error_policy

    @property
    def io(self):
        """Gets the io of this V1Disk.  # noqa: E501

        IO specifies which QEMU disk IO mode should be used. Supported values are: native, default, threads.  # noqa: E501

        :return: The io of this V1Disk.  # noqa: E501
        :rtype: str
        """
        return self._io

    @io.setter
    def io(self, io):
        """Sets the io of this V1Disk.

        IO specifies which QEMU disk IO mode should be used. Supported values are: native, default, threads.  # noqa: E501

        :param io: The io of this V1Disk.  # noqa: E501
        :type: str
        """

        self._io = io

    @property
    def lun(self):
        """Gets the lun of this V1Disk.  # noqa: E501

        Attach a volume as a LUN to the vmi.  # noqa: E501

        :return: The lun of this V1Disk.  # noqa: E501
        :rtype: V1LunTarget
        """
        return self._lun

    @lun.setter
    def lun(self, lun):
        """Sets the lun of this V1Disk.

        Attach a volume as a LUN to the vmi.  # noqa: E501

        :param lun: The lun of this V1Disk.  # noqa: E501
        :type: V1LunTarget
        """

        self._lun = lun

    @property
    def name(self):
        """Gets the name of this V1Disk.  # noqa: E501

        Name is the device name  # noqa: E501

        :return: The name of this V1Disk.  # noqa: E501
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this V1Disk.

        Name is the device name  # noqa: E501

        :param name: The name of this V1Disk.  # noqa: E501
        :type: str
        """
        if self._configuration.client_side_validation and name is None:
            raise ValueError("Invalid value for `name`, must not be `None`")  # noqa: E501

        self._name = name

    @property
    def serial(self):
        """Gets the serial of this V1Disk.  # noqa: E501

        Serial provides the ability to specify a serial number for the disk device.  # noqa: E501

        :return: The serial of this V1Disk.  # noqa: E501
        :rtype: str
        """
        return self._serial

    @serial.setter
    def serial(self, serial):
        """Sets the serial of this V1Disk.

        Serial provides the ability to specify a serial number for the disk device.  # noqa: E501

        :param serial: The serial of this V1Disk.  # noqa: E501
        :type: str
        """

        self._serial = serial

    @property
    def shareable(self):
        """Gets the shareable of this V1Disk.  # noqa: E501

        If specified the disk is made sharable and multiple write from different VMs are permitted  # noqa: E501

        :return: The shareable of this V1Disk.  # noqa: E501
        :rtype: bool
        """
        return self._shareable

    @shareable.setter
    def shareable(self, shareable):
        """Sets the shareable of this V1Disk.

        If specified the disk is made sharable and multiple write from different VMs are permitted  # noqa: E501

        :param shareable: The shareable of this V1Disk.  # noqa: E501
        :type: bool
        """

        self._shareable = shareable

    @property
    def tag(self):
        """Gets the tag of this V1Disk.  # noqa: E501

        If specified, disk address and its tag will be provided to the guest via config drive metadata  # noqa: E501

        :return: The tag of this V1Disk.  # noqa: E501
        :rtype: str
        """
        return self._tag

    @tag.setter
    def tag(self, tag):
        """Sets the tag of this V1Disk.

        If specified, disk address and its tag will be provided to the guest via config drive metadata  # noqa: E501

        :param tag: The tag of this V1Disk.  # noqa: E501
        :type: str
        """

        self._tag = tag

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value
        if issubclass(V1Disk, dict):
            for key, value in self.items():
                result[key] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, V1Disk):
            return False

        return self.to_dict() == other.to_dict()

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        if not isinstance(other, V1Disk):
            return True

        return self.to_dict() != other.to_dict()
