1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
|
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.30
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from kubernetes.client.configuration import Configuration
class V1MutatingWebhook(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 = {
'admission_review_versions': 'list[str]',
'client_config': 'AdmissionregistrationV1WebhookClientConfig',
'failure_policy': 'str',
'match_conditions': 'list[V1MatchCondition]',
'match_policy': 'str',
'name': 'str',
'namespace_selector': 'V1LabelSelector',
'object_selector': 'V1LabelSelector',
'reinvocation_policy': 'str',
'rules': 'list[V1RuleWithOperations]',
'side_effects': 'str',
'timeout_seconds': 'int'
}
attribute_map = {
'admission_review_versions': 'admissionReviewVersions',
'client_config': 'clientConfig',
'failure_policy': 'failurePolicy',
'match_conditions': 'matchConditions',
'match_policy': 'matchPolicy',
'name': 'name',
'namespace_selector': 'namespaceSelector',
'object_selector': 'objectSelector',
'reinvocation_policy': 'reinvocationPolicy',
'rules': 'rules',
'side_effects': 'sideEffects',
'timeout_seconds': 'timeoutSeconds'
}
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: E501
"""V1MutatingWebhook - 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._admission_review_versions = None
self._client_config = None
self._failure_policy = None
self._match_conditions = None
self._match_policy = None
self._name = None
self._namespace_selector = None
self._object_selector = None
self._reinvocation_policy = None
self._rules = None
self._side_effects = None
self._timeout_seconds = None
self.discriminator = None
self.admission_review_versions = admission_review_versions
self.client_config = client_config
if failure_policy is not None:
self.failure_policy = failure_policy
if match_conditions is not None:
self.match_conditions = match_conditions
if match_policy is not None:
self.match_policy = match_policy
self.name = name
if namespace_selector is not None:
self.namespace_selector = namespace_selector
if object_selector is not None:
self.object_selector = object_selector
if reinvocation_policy is not None:
self.reinvocation_policy = reinvocation_policy
if rules is not None:
self.rules = rules
self.side_effects = side_effects
if timeout_seconds is not None:
self.timeout_seconds = timeout_seconds
@property
def admission_review_versions(self):
"""Gets the admission_review_versions of this V1MutatingWebhook. # noqa: E501
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: E501
:return: The admission_review_versions of this V1MutatingWebhook. # noqa: E501
:rtype: list[str]
"""
return self._admission_review_versions
@admission_review_versions.setter
def admission_review_versions(self, admission_review_versions):
"""Sets the admission_review_versions of this V1MutatingWebhook.
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: E501
:param admission_review_versions: The admission_review_versions of this V1MutatingWebhook. # noqa: E501
:type: list[str]
"""
if self.local_vars_configuration.client_side_validation and admission_review_versions is None: # noqa: E501
raise ValueError("Invalid value for `admission_review_versions`, must not be `None`") # noqa: E501
self._admission_review_versions = admission_review_versions
@property
def client_config(self):
"""Gets the client_config of this V1MutatingWebhook. # noqa: E501
:return: The client_config of this V1MutatingWebhook. # noqa: E501
:rtype: AdmissionregistrationV1WebhookClientConfig
"""
return self._client_config
@client_config.setter
def client_config(self, client_config):
"""Sets the client_config of this V1MutatingWebhook.
:param client_config: The client_config of this V1MutatingWebhook. # noqa: E501
:type: AdmissionregistrationV1WebhookClientConfig
"""
if self.local_vars_configuration.client_side_validation and client_config is None: # noqa: E501
raise ValueError("Invalid value for `client_config`, must not be `None`") # noqa: E501
self._client_config = client_config
@property
def failure_policy(self):
"""Gets the failure_policy of this V1MutatingWebhook. # noqa: E501
FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail. # noqa: E501
:return: The failure_policy of this V1MutatingWebhook. # noqa: E501
:rtype: str
"""
return self._failure_policy
@failure_policy.setter
def failure_policy(self, failure_policy):
"""Sets the failure_policy of this V1MutatingWebhook.
FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail. # noqa: E501
:param failure_policy: The failure_policy of this V1MutatingWebhook. # noqa: E501
:type: str
"""
self._failure_policy = failure_policy
@property
def match_conditions(self):
"""Gets the match_conditions of this V1MutatingWebhook. # noqa: E501
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: E501
:return: The match_conditions of this V1MutatingWebhook. # noqa: E501
:rtype: list[V1MatchCondition]
"""
return self._match_conditions
@match_conditions.setter
def match_conditions(self, match_conditions):
"""Sets the match_conditions of this V1MutatingWebhook.
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: E501
:param match_conditions: The match_conditions of this V1MutatingWebhook. # noqa: E501
:type: list[V1MatchCondition]
"""
self._match_conditions = match_conditions
@property
def match_policy(self):
"""Gets the match_policy of this V1MutatingWebhook. # noqa: E501
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: E501
:return: The match_policy of this V1MutatingWebhook. # noqa: E501
:rtype: str
"""
return self._match_policy
@match_policy.setter
def match_policy(self, match_policy):
"""Sets the match_policy of this V1MutatingWebhook.
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: E501
:param match_policy: The match_policy of this V1MutatingWebhook. # noqa: E501
:type: str
"""
self._match_policy = match_policy
@property
def name(self):
"""Gets the name of this V1MutatingWebhook. # noqa: E501
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: E501
:return: The name of this V1MutatingWebhook. # noqa: E501
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this V1MutatingWebhook.
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: E501
:param name: The name of this V1MutatingWebhook. # 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 namespace_selector(self):
"""Gets the namespace_selector of this V1MutatingWebhook. # noqa: E501
:return: The namespace_selector of this V1MutatingWebhook. # noqa: E501
:rtype: V1LabelSelector
"""
return self._namespace_selector
@namespace_selector.setter
def namespace_selector(self, namespace_selector):
"""Sets the namespace_selector of this V1MutatingWebhook.
:param namespace_selector: The namespace_selector of this V1MutatingWebhook. # noqa: E501
:type: V1LabelSelector
"""
self._namespace_selector = namespace_selector
@property
def object_selector(self):
"""Gets the object_selector of this V1MutatingWebhook. # noqa: E501
:return: The object_selector of this V1MutatingWebhook. # noqa: E501
:rtype: V1LabelSelector
"""
return self._object_selector
@object_selector.setter
def object_selector(self, object_selector):
"""Sets the object_selector of this V1MutatingWebhook.
:param object_selector: The object_selector of this V1MutatingWebhook. # noqa: E501
:type: V1LabelSelector
"""
self._object_selector = object_selector
@property
def reinvocation_policy(self):
"""Gets the reinvocation_policy of this V1MutatingWebhook. # noqa: E501
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: E501
:return: The reinvocation_policy of this V1MutatingWebhook. # noqa: E501
:rtype: str
"""
return self._reinvocation_policy
@reinvocation_policy.setter
def reinvocation_policy(self, reinvocation_policy):
"""Sets the reinvocation_policy of this V1MutatingWebhook.
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: E501
:param reinvocation_policy: The reinvocation_policy of this V1MutatingWebhook. # noqa: E501
:type: str
"""
self._reinvocation_policy = reinvocation_policy
@property
def rules(self):
"""Gets the rules of this V1MutatingWebhook. # noqa: E501
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: E501
:return: The rules of this V1MutatingWebhook. # noqa: E501
:rtype: list[V1RuleWithOperations]
"""
return self._rules
@rules.setter
def rules(self, rules):
"""Sets the rules of this V1MutatingWebhook.
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: E501
:param rules: The rules of this V1MutatingWebhook. # noqa: E501
:type: list[V1RuleWithOperations]
"""
self._rules = rules
@property
def side_effects(self):
"""Gets the side_effects of this V1MutatingWebhook. # noqa: E501
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: E501
:return: The side_effects of this V1MutatingWebhook. # noqa: E501
:rtype: str
"""
return self._side_effects
@side_effects.setter
def side_effects(self, side_effects):
"""Sets the side_effects of this V1MutatingWebhook.
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: E501
:param side_effects: The side_effects of this V1MutatingWebhook. # noqa: E501
:type: str
"""
if self.local_vars_configuration.client_side_validation and side_effects is None: # noqa: E501
raise ValueError("Invalid value for `side_effects`, must not be `None`") # noqa: E501
self._side_effects = side_effects
@property
def timeout_seconds(self):
"""Gets the timeout_seconds of this V1MutatingWebhook. # noqa: E501
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: E501
:return: The timeout_seconds of this V1MutatingWebhook. # noqa: E501
:rtype: int
"""
return self._timeout_seconds
@timeout_seconds.setter
def timeout_seconds(self, timeout_seconds):
"""Sets the timeout_seconds of this V1MutatingWebhook.
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: E501
:param timeout_seconds: The timeout_seconds of this V1MutatingWebhook. # noqa: E501
:type: int
"""
self._timeout_seconds = timeout_seconds
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, V1MutatingWebhook):
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, V1MutatingWebhook):
return True
return self.to_dict() != other.to_dict()
|