Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
v1_mutating_webhook.py429 linesDownload Raw Back to models
1# coding: utf-82 3"""4    Kubernetes5 6    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E5017 8    The version of the OpenAPI document: release-1.359    Generated by: https://openapi-generator.tech10"""11 12 13import pprint14import re  # noqa: F40115 16import six17 18from kubernetes.client.configuration import Configuration19 20 21class V1MutatingWebhook(object):22    """NOTE: This class is auto generated by OpenAPI Generator.23    Ref: https://openapi-generator.tech24 25    Do not edit the class manually.26    """27 28    """29    Attributes:30      openapi_types (dict): The key is attribute name31                            and the value is attribute type.32      attribute_map (dict): The key is attribute name33                            and the value is json key in definition.34    """35    openapi_types = {36        'admission_review_versions': 'list[str]',37        'client_config': 'AdmissionregistrationV1WebhookClientConfig',38        'failure_policy': 'str',39        'match_conditions': 'list[V1MatchCondition]',40        'match_policy': 'str',41        'name': 'str',42        'namespace_selector': 'V1LabelSelector',43        'object_selector': 'V1LabelSelector',44        'reinvocation_policy': 'str',45        'rules': 'list[V1RuleWithOperations]',46        'side_effects': 'str',47        'timeout_seconds': 'int'48    }49 50    attribute_map = {51        'admission_review_versions': 'admissionReviewVersions',52        'client_config': 'clientConfig',53        'failure_policy': 'failurePolicy',54        'match_conditions': 'matchConditions',55        'match_policy': 'matchPolicy',56        'name': 'name',57        'namespace_selector': 'namespaceSelector',58        'object_selector': 'objectSelector',59        'reinvocation_policy': 'reinvocationPolicy',60        'rules': 'rules',61        'side_effects': 'sideEffects',62        'timeout_seconds': 'timeoutSeconds'63    }64 65    def __init__(self, admission_review_versions=None, client_config=None, failure_policy=None, match_conditions=None, match_policy=None, name=None, namespace_selector=None, object_selector=None, reinvocation_policy=None, rules=None, side_effects=None, timeout_seconds=None, local_vars_configuration=None):  # noqa: E50166        """V1MutatingWebhook - a model defined in OpenAPI"""  # noqa: E50167        if local_vars_configuration is None:68            local_vars_configuration = Configuration()69        self.local_vars_configuration = local_vars_configuration70 71        self._admission_review_versions = None72        self._client_config = None73        self._failure_policy = None74        self._match_conditions = None75        self._match_policy = None76        self._name = None77        self._namespace_selector = None78        self._object_selector = None79        self._reinvocation_policy = None80        self._rules = None81        self._side_effects = None82        self._timeout_seconds = None83        self.discriminator = None84 85        self.admission_review_versions = admission_review_versions86        self.client_config = client_config87        if failure_policy is not None:88            self.failure_policy = failure_policy89        if match_conditions is not None:90            self.match_conditions = match_conditions91        if match_policy is not None:92            self.match_policy = match_policy93        self.name = name94        if namespace_selector is not None:95            self.namespace_selector = namespace_selector96        if object_selector is not None:97            self.object_selector = object_selector98        if reinvocation_policy is not None:99            self.reinvocation_policy = reinvocation_policy100        if rules is not None:101            self.rules = rules102        self.side_effects = side_effects103        if timeout_seconds is not None:104            self.timeout_seconds = timeout_seconds105 106    @property107    def admission_review_versions(self):108        """Gets the admission_review_versions of this V1MutatingWebhook.  # noqa: E501109 110        AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.  # noqa: E501111 112        :return: The admission_review_versions of this V1MutatingWebhook.  # noqa: E501113        :rtype: list[str]114        """115        return self._admission_review_versions116 117    @admission_review_versions.setter118    def admission_review_versions(self, admission_review_versions):119        """Sets the admission_review_versions of this V1MutatingWebhook.120 121        AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.  # noqa: E501122 123        :param admission_review_versions: The admission_review_versions of this V1MutatingWebhook.  # noqa: E501124        :type: list[str]125        """126        if self.local_vars_configuration.client_side_validation and admission_review_versions is None:  # noqa: E501127            raise ValueError("Invalid value for `admission_review_versions`, must not be `None`")  # noqa: E501128 129        self._admission_review_versions = admission_review_versions130 131    @property132    def client_config(self):133        """Gets the client_config of this V1MutatingWebhook.  # noqa: E501134 135 136        :return: The client_config of this V1MutatingWebhook.  # noqa: E501137        :rtype: AdmissionregistrationV1WebhookClientConfig138        """139        return self._client_config140 141    @client_config.setter142    def client_config(self, client_config):143        """Sets the client_config of this V1MutatingWebhook.144 145 146        :param client_config: The client_config of this V1MutatingWebhook.  # noqa: E501147        :type: AdmissionregistrationV1WebhookClientConfig148        """149        if self.local_vars_configuration.client_side_validation and client_config is None:  # noqa: E501150            raise ValueError("Invalid value for `client_config`, must not be `None`")  # noqa: E501151 152        self._client_config = client_config153 154    @property155    def failure_policy(self):156        """Gets the failure_policy of this V1MutatingWebhook.  # noqa: E501157 158        FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail.  # noqa: E501159 160        :return: The failure_policy of this V1MutatingWebhook.  # noqa: E501161        :rtype: str162        """163        return self._failure_policy164 165    @failure_policy.setter166    def failure_policy(self, failure_policy):167        """Sets the failure_policy of this V1MutatingWebhook.168 169        FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail.  # noqa: E501170 171        :param failure_policy: The failure_policy of this V1MutatingWebhook.  # noqa: E501172        :type: str173        """174 175        self._failure_policy = failure_policy176 177    @property178    def match_conditions(self):179        """Gets the match_conditions of this V1MutatingWebhook.  # noqa: E501180 181        MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.  The exact matching logic is (in order):   1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.   2. If ALL matchConditions evaluate to TRUE, the webhook is called.   3. If any matchCondition evaluates to an error (but none are FALSE):      - If failurePolicy=Fail, reject the request      - If failurePolicy=Ignore, the error is ignored and the webhook is skipped  # noqa: E501182 183        :return: The match_conditions of this V1MutatingWebhook.  # noqa: E501184        :rtype: list[V1MatchCondition]185        """186        return self._match_conditions187 188    @match_conditions.setter189    def match_conditions(self, match_conditions):190        """Sets the match_conditions of this V1MutatingWebhook.191 192        MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.  The exact matching logic is (in order):   1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.   2. If ALL matchConditions evaluate to TRUE, the webhook is called.   3. If any matchCondition evaluates to an error (but none are FALSE):      - If failurePolicy=Fail, reject the request      - If failurePolicy=Ignore, the error is ignored and the webhook is skipped  # noqa: E501193 194        :param match_conditions: The match_conditions of this V1MutatingWebhook.  # noqa: E501195        :type: list[V1MatchCondition]196        """197 198        self._match_conditions = match_conditions199 200    @property201    def match_policy(self):202        """Gets the match_policy of this V1MutatingWebhook.  # noqa: E501203 204        matchPolicy defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".  - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.  - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.  Defaults to \"Equivalent\"  # noqa: E501205 206        :return: The match_policy of this V1MutatingWebhook.  # noqa: E501207        :rtype: str208        """209        return self._match_policy210 211    @match_policy.setter212    def match_policy(self, match_policy):213        """Sets the match_policy of this V1MutatingWebhook.214 215        matchPolicy defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".  - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.  - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.  Defaults to \"Equivalent\"  # noqa: E501216 217        :param match_policy: The match_policy of this V1MutatingWebhook.  # noqa: E501218        :type: str219        """220 221        self._match_policy = match_policy222 223    @property224    def name(self):225        """Gets the name of this V1MutatingWebhook.  # noqa: E501226 227        The name of the 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.  # noqa: E501228 229        :return: The name of this V1MutatingWebhook.  # noqa: E501230        :rtype: str231        """232        return self._name233 234    @name.setter235    def name(self, name):236        """Sets the name of this V1MutatingWebhook.237 238        The name of the 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.  # noqa: E501239 240        :param name: The name of this V1MutatingWebhook.  # noqa: E501241        :type: str242        """243        if self.local_vars_configuration.client_side_validation and name is None:  # noqa: E501244            raise ValueError("Invalid value for `name`, must not be `None`")  # noqa: E501245 246        self._name = name247 248    @property249    def namespace_selector(self):250        """Gets the namespace_selector of this V1MutatingWebhook.  # noqa: E501251 252 253        :return: The namespace_selector of this V1MutatingWebhook.  # noqa: E501254        :rtype: V1LabelSelector255        """256        return self._namespace_selector257 258    @namespace_selector.setter259    def namespace_selector(self, namespace_selector):260        """Sets the namespace_selector of this V1MutatingWebhook.261 262 263        :param namespace_selector: The namespace_selector of this V1MutatingWebhook.  # noqa: E501264        :type: V1LabelSelector265        """266 267        self._namespace_selector = namespace_selector268 269    @property270    def object_selector(self):271        """Gets the object_selector of this V1MutatingWebhook.  # noqa: E501272 273 274        :return: The object_selector of this V1MutatingWebhook.  # noqa: E501275        :rtype: V1LabelSelector276        """277        return self._object_selector278 279    @object_selector.setter280    def object_selector(self, object_selector):281        """Sets the object_selector of this V1MutatingWebhook.282 283 284        :param object_selector: The object_selector of this V1MutatingWebhook.  # noqa: E501285        :type: V1LabelSelector286        """287 288        self._object_selector = object_selector289 290    @property291    def reinvocation_policy(self):292        """Gets the reinvocation_policy of this V1MutatingWebhook.  # noqa: E501293 294        reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. Allowed values are \"Never\" and \"IfNeeded\".  Never: the webhook will not be called more than once in a single admission evaluation.  IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation if the object being admitted is modified by other admission plugins after the initial webhook call. Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. Note: * the number of additional invocations is not guaranteed to be exactly one. * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. * webhooks that use this option may be reordered to minimize the number of additional invocations. * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead.  Defaults to \"Never\".  # noqa: E501295 296        :return: The reinvocation_policy of this V1MutatingWebhook.  # noqa: E501297        :rtype: str298        """299        return self._reinvocation_policy300 301    @reinvocation_policy.setter302    def reinvocation_policy(self, reinvocation_policy):303        """Sets the reinvocation_policy of this V1MutatingWebhook.304 305        reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. Allowed values are \"Never\" and \"IfNeeded\".  Never: the webhook will not be called more than once in a single admission evaluation.  IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation if the object being admitted is modified by other admission plugins after the initial webhook call. Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. Note: * the number of additional invocations is not guaranteed to be exactly one. * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. * webhooks that use this option may be reordered to minimize the number of additional invocations. * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead.  Defaults to \"Never\".  # noqa: E501306 307        :param reinvocation_policy: The reinvocation_policy of this V1MutatingWebhook.  # noqa: E501308        :type: str309        """310 311        self._reinvocation_policy = reinvocation_policy312 313    @property314    def rules(self):315        """Gets the rules of this V1MutatingWebhook.  # noqa: E501316 317        Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.  # noqa: E501318 319        :return: The rules of this V1MutatingWebhook.  # noqa: E501320        :rtype: list[V1RuleWithOperations]321        """322        return self._rules323 324    @rules.setter325    def rules(self, rules):326        """Sets the rules of this V1MutatingWebhook.327 328        Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.  # noqa: E501329 330        :param rules: The rules of this V1MutatingWebhook.  # noqa: E501331        :type: list[V1RuleWithOperations]332        """333 334        self._rules = rules335 336    @property337    def side_effects(self):338        """Gets the side_effects of this V1MutatingWebhook.  # noqa: E501339 340        SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.  # noqa: E501341 342        :return: The side_effects of this V1MutatingWebhook.  # noqa: E501343        :rtype: str344        """345        return self._side_effects346 347    @side_effects.setter348    def side_effects(self, side_effects):349        """Sets the side_effects of this V1MutatingWebhook.350 351        SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.  # noqa: E501352 353        :param side_effects: The side_effects of this V1MutatingWebhook.  # noqa: E501354        :type: str355        """356        if self.local_vars_configuration.client_side_validation and side_effects is None:  # noqa: E501357            raise ValueError("Invalid value for `side_effects`, must not be `None`")  # noqa: E501358 359        self._side_effects = side_effects360 361    @property362    def timeout_seconds(self):363        """Gets the timeout_seconds of this V1MutatingWebhook.  # noqa: E501364 365        TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds.  # noqa: E501366 367        :return: The timeout_seconds of this V1MutatingWebhook.  # noqa: E501368        :rtype: int369        """370        return self._timeout_seconds371 372    @timeout_seconds.setter373    def timeout_seconds(self, timeout_seconds):374        """Sets the timeout_seconds of this V1MutatingWebhook.375 376        TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds.  # noqa: E501377 378        :param timeout_seconds: The timeout_seconds of this V1MutatingWebhook.  # noqa: E501379        :type: int380        """381 382        self._timeout_seconds = timeout_seconds383 384    def to_dict(self):385        """Returns the model properties as a dict"""386        result = {}387 388        for attr, _ in six.iteritems(self.openapi_types):389            value = getattr(self, attr)390            if isinstance(value, list):391                result[attr] = list(map(392                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,393                    value394                ))395            elif hasattr(value, "to_dict"):396                result[attr] = value.to_dict()397            elif isinstance(value, dict):398                result[attr] = dict(map(399                    lambda item: (item[0], item[1].to_dict())400                    if hasattr(item[1], "to_dict") else item,401                    value.items()402                ))403            else:404                result[attr] = value405 406        return result407 408    def to_str(self):409        """Returns the string representation of the model"""410        return pprint.pformat(self.to_dict())411 412    def __repr__(self):413        """For `print` and `pprint`"""414        return self.to_str()415 416    def __eq__(self, other):417        """Returns true if both objects are equal"""418        if not isinstance(other, V1MutatingWebhook):419            return False420 421        return self.to_dict() == other.to_dict()422 423    def __ne__(self, other):424        """Returns true if both objects are not equal"""425        if not isinstance(other, V1MutatingWebhook):426            return True427 428        return self.to_dict() != other.to_dict()429 
codekingpro/portable-devtools · Team Ai