# coding: utf-8

"""
    Kubernetes

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

    OpenAPI spec version: v1.7.1
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from pprint import pformat
from six import iteritems
import re


class V1alpha1ExternalAdmissionHook(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, client_config=None, failure_policy=None, name=None, rules=None):
        """
        V1alpha1ExternalAdmissionHook - a model defined in Swagger

        :param dict swaggerTypes: The key is attribute name
                                  and the value is attribute type.
        :param dict attributeMap: The key is attribute name
                                  and the value is json key in definition.
        """
        self.swagger_types = {
            'client_config': 'V1alpha1AdmissionHookClientConfig',
            'failure_policy': 'str',
            'name': 'str',
            'rules': 'list[V1alpha1RuleWithOperations]'
        }

        self.attribute_map = {
            'client_config': 'clientConfig',
            'failure_policy': 'failurePolicy',
            'name': 'name',
            'rules': 'rules'
        }

        self._client_config = client_config
        self._failure_policy = failure_policy
        self._name = name
        self._rules = rules

    @property
    def client_config(self):
        """
        Gets the client_config of this V1alpha1ExternalAdmissionHook.
        ClientConfig defines how to communicate with the hook. Required

        :return: The client_config of this V1alpha1ExternalAdmissionHook.
        :rtype: V1alpha1AdmissionHookClientConfig
        """
        return self._client_config

    @client_config.setter
    def client_config(self, client_config):
        """
        Sets the client_config of this V1alpha1ExternalAdmissionHook.
        ClientConfig defines how to communicate with the hook. Required

        :param client_config: The client_config of this V1alpha1ExternalAdmissionHook.
        :type: V1alpha1AdmissionHookClientConfig
        """
        if client_config is None:
            raise ValueError("Invalid value for `client_config`, must not be `None`")

        self._client_config = client_config

    @property
    def failure_policy(self):
        """
        Gets the failure_policy of this V1alpha1ExternalAdmissionHook.
        FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Ignore.

        :return: The failure_policy of this V1alpha1ExternalAdmissionHook.
        :rtype: str
        """
        return self._failure_policy

    @failure_policy.setter
    def failure_policy(self, failure_policy):
        """
        Sets the failure_policy of this V1alpha1ExternalAdmissionHook.
        FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Ignore.

        :param failure_policy: The failure_policy of this V1alpha1ExternalAdmissionHook.
        :type: str
        """

        self._failure_policy = failure_policy

    @property
    def name(self):
        """
        Gets the name of this V1alpha1ExternalAdmissionHook.
        The name of the external admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.

        :return: The name of this V1alpha1ExternalAdmissionHook.
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """
        Sets the name of this V1alpha1ExternalAdmissionHook.
        The name of the external admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.

        :param name: The name of this V1alpha1ExternalAdmissionHook.
        :type: str
        """
        if name is None:
            raise ValueError("Invalid value for `name`, must not be `None`")

        self._name = name

    @property
    def rules(self):
        """
        Gets the rules of this V1alpha1ExternalAdmissionHook.
        Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule.

        :return: The rules of this V1alpha1ExternalAdmissionHook.
        :rtype: list[V1alpha1RuleWithOperations]
        """
        return self._rules

    @rules.setter
    def rules(self, rules):
        """
        Sets the rules of this V1alpha1ExternalAdmissionHook.
        Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule.

        :param rules: The rules of this V1alpha1ExternalAdmissionHook.
        :type: list[V1alpha1RuleWithOperations]
        """

        self._rules = rules

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

        for attr, _ in 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

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return 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, V1alpha1ExternalAdmissionHook):
            return False

        return self.__dict__ == other.__dict__

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