# coding: utf-8
# Copyright (c) 2016, 2026, Oracle and/or its affiliates.  All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.

# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20220509


from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel  # noqa: F401
from oci.decorators import init_model_state_from_kwargs


@init_model_state_from_kwargs
class OlvmVmPlacementPolicy(object):
    """
    The configuration of the virtual machine\u2019s placement policy.
    """

    #: A constant which can be used with the vm_affinity property of a OlvmVmPlacementPolicy.
    #: This constant has a value of "MIGRATABLE"
    VM_AFFINITY_MIGRATABLE = "MIGRATABLE"

    #: A constant which can be used with the vm_affinity property of a OlvmVmPlacementPolicy.
    #: This constant has a value of "PINNED"
    VM_AFFINITY_PINNED = "PINNED"

    #: A constant which can be used with the vm_affinity property of a OlvmVmPlacementPolicy.
    #: This constant has a value of "USER_MIGRATABLE"
    VM_AFFINITY_USER_MIGRATABLE = "USER_MIGRATABLE"

    def __init__(self, **kwargs):
        """
        Initializes a new OlvmVmPlacementPolicy object with values from keyword arguments.
        The following keyword arguments are supported (corresponding to the getters/setters of this class):

        :param vm_affinity:
            The value to assign to the vm_affinity property of this OlvmVmPlacementPolicy.
            Allowed values for this property are: "MIGRATABLE", "PINNED", "USER_MIGRATABLE"
        :type vm_affinity: str

        :param hosts:
            The value to assign to the hosts property of this OlvmVmPlacementPolicy.
        :type hosts: list[oci.cloud_bridge.models.OlvmHost]

        """
        self.swagger_types = {
            'vm_affinity': 'str',
            'hosts': 'list[OlvmHost]'
        }
        self.attribute_map = {
            'vm_affinity': 'vmAffinity',
            'hosts': 'hosts'
        }
        self._vm_affinity = None
        self._hosts = None

    @property
    def vm_affinity(self):
        """
        Gets the vm_affinity of this OlvmVmPlacementPolicy.
        Affinity of the virtual machine.

        Allowed values for this property are: "MIGRATABLE", "PINNED", "USER_MIGRATABLE"


        :return: The vm_affinity of this OlvmVmPlacementPolicy.
        :rtype: str
        """
        return self._vm_affinity

    @vm_affinity.setter
    def vm_affinity(self, vm_affinity):
        """
        Sets the vm_affinity of this OlvmVmPlacementPolicy.
        Affinity of the virtual machine.


        :param vm_affinity: The vm_affinity of this OlvmVmPlacementPolicy.
        :type: str
        """
        allowed_values = ["MIGRATABLE", "PINNED", "USER_MIGRATABLE"]
        if not value_allowed_none_or_none_sentinel(vm_affinity, allowed_values):
            raise ValueError(
                f"Invalid value for `vm_affinity`, must be None or one of {allowed_values}"
            )
        self._vm_affinity = vm_affinity

    @property
    def hosts(self):
        """
        Gets the hosts of this OlvmVmPlacementPolicy.
        List of hosts.


        :return: The hosts of this OlvmVmPlacementPolicy.
        :rtype: list[oci.cloud_bridge.models.OlvmHost]
        """
        return self._hosts

    @hosts.setter
    def hosts(self, hosts):
        """
        Sets the hosts of this OlvmVmPlacementPolicy.
        List of hosts.


        :param hosts: The hosts of this OlvmVmPlacementPolicy.
        :type: list[oci.cloud_bridge.models.OlvmHost]
        """
        self._hosts = hosts

    def __repr__(self):
        return formatted_flat_dict(self)

    def __eq__(self, other):
        if other is None:
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not self == other
