# coding: utf-8

"""
    Anyscale API

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

    The version of the OpenAPI document: 0.1.0
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from anyscale_client.configuration import Configuration


class CreateCluster(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_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.
    """
    openapi_types = {
        'name': 'str',
        'project_id': 'str',
        'cluster_environment_build_id': 'str',
        'cluster_compute_id': 'str',
        'cluster_compute_config': 'CreateClusterComputeConfig',
        'idle_timeout_minutes': 'int',
        'allow_public_internet_traffic': 'bool',
        'user_service_access': 'UserServiceAccessTypes',
        'user_service_token': 'str',
        'ha_job_id': 'str'
    }

    attribute_map = {
        'name': 'name',
        'project_id': 'project_id',
        'cluster_environment_build_id': 'cluster_environment_build_id',
        'cluster_compute_id': 'cluster_compute_id',
        'cluster_compute_config': 'cluster_compute_config',
        'idle_timeout_minutes': 'idle_timeout_minutes',
        'allow_public_internet_traffic': 'allow_public_internet_traffic',
        'user_service_access': 'user_service_access',
        'user_service_token': 'user_service_token',
        'ha_job_id': 'ha_job_id'
    }

    def __init__(self, name=None, project_id=None, cluster_environment_build_id=None, cluster_compute_id=None, cluster_compute_config=None, idle_timeout_minutes=None, allow_public_internet_traffic=False, user_service_access=None, user_service_token=None, ha_job_id=None, local_vars_configuration=None):  # noqa: E501
        """CreateCluster - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._name = None
        self._project_id = None
        self._cluster_environment_build_id = None
        self._cluster_compute_id = None
        self._cluster_compute_config = None
        self._idle_timeout_minutes = None
        self._allow_public_internet_traffic = None
        self._user_service_access = None
        self._user_service_token = None
        self._ha_job_id = None
        self.discriminator = None

        self.name = name
        if project_id is not None:
            self.project_id = project_id
        self.cluster_environment_build_id = cluster_environment_build_id
        if cluster_compute_id is not None:
            self.cluster_compute_id = cluster_compute_id
        if cluster_compute_config is not None:
            self.cluster_compute_config = cluster_compute_config
        if idle_timeout_minutes is not None:
            self.idle_timeout_minutes = idle_timeout_minutes
        if allow_public_internet_traffic is not None:
            self.allow_public_internet_traffic = allow_public_internet_traffic
        if user_service_access is not None:
            self.user_service_access = user_service_access
        if user_service_token is not None:
            self.user_service_token = user_service_token
        if ha_job_id is not None:
            self.ha_job_id = ha_job_id

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

        Name of this Cluster.  # noqa: E501

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

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

        Name of this Cluster.  # noqa: E501

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

        self._name = name

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

        Project that this Cluster belongs to. If none, this Cluster will use the default Project.  # noqa: E501

        :return: The project_id of this CreateCluster.  # noqa: E501
        :rtype: str
        """
        return self._project_id

    @project_id.setter
    def project_id(self, project_id):
        """Sets the project_id of this CreateCluster.

        Project that this Cluster belongs to. If none, this Cluster will use the default Project.  # noqa: E501

        :param project_id: The project_id of this CreateCluster.  # noqa: E501
        :type: str
        """

        self._project_id = project_id

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

        Cluster Environment Build that this Cluster is using.  # noqa: E501

        :return: The cluster_environment_build_id of this CreateCluster.  # noqa: E501
        :rtype: str
        """
        return self._cluster_environment_build_id

    @cluster_environment_build_id.setter
    def cluster_environment_build_id(self, cluster_environment_build_id):
        """Sets the cluster_environment_build_id of this CreateCluster.

        Cluster Environment Build that this Cluster is using.  # noqa: E501

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

        self._cluster_environment_build_id = cluster_environment_build_id

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

        Cluster Compute that this Cluster is using.  # noqa: E501

        :return: The cluster_compute_id of this CreateCluster.  # noqa: E501
        :rtype: str
        """
        return self._cluster_compute_id

    @cluster_compute_id.setter
    def cluster_compute_id(self, cluster_compute_id):
        """Sets the cluster_compute_id of this CreateCluster.

        Cluster Compute that this Cluster is using.  # noqa: E501

        :param cluster_compute_id: The cluster_compute_id of this CreateCluster.  # noqa: E501
        :type: str
        """

        self._cluster_compute_id = cluster_compute_id

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

        One-off cluster compute that this cluster is using.  # noqa: E501

        :return: The cluster_compute_config of this CreateCluster.  # noqa: E501
        :rtype: CreateClusterComputeConfig
        """
        return self._cluster_compute_config

    @cluster_compute_config.setter
    def cluster_compute_config(self, cluster_compute_config):
        """Sets the cluster_compute_config of this CreateCluster.

        One-off cluster compute that this cluster is using.  # noqa: E501

        :param cluster_compute_config: The cluster_compute_config of this CreateCluster.  # noqa: E501
        :type: CreateClusterComputeConfig
        """

        self._cluster_compute_config = cluster_compute_config

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

        DEPRECATED: Please use the idle_termination_minutes field in the cluster compute. Idle timeout (in minutes), after which the Cluster is terminated. Idle time is defined as the time during which a Cluster is not running a user command (through 'anyscale exec' or the Web UI), and does not have an attached driver. Time spent running Jupyter commands, or commands run through ssh, is still considered 'idle'.  # noqa: E501

        :return: The idle_timeout_minutes of this CreateCluster.  # noqa: E501
        :rtype: int
        """
        return self._idle_timeout_minutes

    @idle_timeout_minutes.setter
    def idle_timeout_minutes(self, idle_timeout_minutes):
        """Sets the idle_timeout_minutes of this CreateCluster.

        DEPRECATED: Please use the idle_termination_minutes field in the cluster compute. Idle timeout (in minutes), after which the Cluster is terminated. Idle time is defined as the time during which a Cluster is not running a user command (through 'anyscale exec' or the Web UI), and does not have an attached driver. Time spent running Jupyter commands, or commands run through ssh, is still considered 'idle'.  # noqa: E501

        :param idle_timeout_minutes: The idle_timeout_minutes of this CreateCluster.  # noqa: E501
        :type: int
        """

        self._idle_timeout_minutes = idle_timeout_minutes

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

        Whether public internet traffic can access Serve endpoints or if an authentication token is required.  # noqa: E501

        :return: The allow_public_internet_traffic of this CreateCluster.  # noqa: E501
        :rtype: bool
        """
        return self._allow_public_internet_traffic

    @allow_public_internet_traffic.setter
    def allow_public_internet_traffic(self, allow_public_internet_traffic):
        """Sets the allow_public_internet_traffic of this CreateCluster.

        Whether public internet traffic can access Serve endpoints or if an authentication token is required.  # noqa: E501

        :param allow_public_internet_traffic: The allow_public_internet_traffic of this CreateCluster.  # noqa: E501
        :type: bool
        """

        self._allow_public_internet_traffic = allow_public_internet_traffic

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

        Whether user service can be accessed by public internet traffic.  # noqa: E501

        :return: The user_service_access of this CreateCluster.  # noqa: E501
        :rtype: UserServiceAccessTypes
        """
        return self._user_service_access

    @user_service_access.setter
    def user_service_access(self, user_service_access):
        """Sets the user_service_access of this CreateCluster.

        Whether user service can be accessed by public internet traffic.  # noqa: E501

        :param user_service_access: The user_service_access of this CreateCluster.  # noqa: E501
        :type: UserServiceAccessTypes
        """

        self._user_service_access = user_service_access

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

        User service token that is used to authenticate access to public user services. This must be a valid 32 byte URL safe string and can be generated by calling `secrets.token_urlsafe(32))`. This is ignored if the user service has private access. If not specified for a public user service, a token is autogenerated.  # noqa: E501

        :return: The user_service_token of this CreateCluster.  # noqa: E501
        :rtype: str
        """
        return self._user_service_token

    @user_service_token.setter
    def user_service_token(self, user_service_token):
        """Sets the user_service_token of this CreateCluster.

        User service token that is used to authenticate access to public user services. This must be a valid 32 byte URL safe string and can be generated by calling `secrets.token_urlsafe(32))`. This is ignored if the user service has private access. If not specified for a public user service, a token is autogenerated.  # noqa: E501

        :param user_service_token: The user_service_token of this CreateCluster.  # noqa: E501
        :type: str
        """

        self._user_service_token = user_service_token

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

        This is used internally by Anyscale to associate clusters to a job. It is set automatically and should *not* be used directly.  # noqa: E501

        :return: The ha_job_id of this CreateCluster.  # noqa: E501
        :rtype: str
        """
        return self._ha_job_id

    @ha_job_id.setter
    def ha_job_id(self, ha_job_id):
        """Sets the ha_job_id of this CreateCluster.

        This is used internally by Anyscale to associate clusters to a job. It is set automatically and should *not* be used directly.  # noqa: E501

        :param ha_job_id: The ha_job_id of this CreateCluster.  # noqa: E501
        :type: str
        """

        self._ha_job_id = ha_job_id

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

        for attr, _ in six.iteritems(self.openapi_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

        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, CreateCluster):
            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, CreateCluster):
            return True

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