huaweicloud-sdk-python-v3/huaweicloud-sdk-aad/huaweicloudsdkaad/v2/model/waf_custom_condition.py

200 lines
11 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class WafCustomCondition:
"""
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.
"""
sensitive_list = []
openapi_types = {
'category': 'str',
'index': 'str',
'logic_operation': 'str',
'contents': 'list[str]'
}
attribute_map = {
'category': 'category',
'index': 'index',
'logic_operation': 'logic_operation',
'contents': 'contents'
}
def __init__(self, category=None, index=None, logic_operation=None, contents=None):
"""WafCustomCondition
The model defined in huaweicloud sdk
:param category: 字段类型 枚举值: url路径 ipIPv4 user-agent: User Agent method: Method referer: Referer paramsParams cookieCookie headerHeader request_line: Request Line request: Request
:type category: str
:param index: 子字段 - 当字段类型为urluser-agent、refer、request_line、method、request时不需要传index参数 - 当字段类型为ip或ipv6时index必填且必须为以下值 client-ip客户端IP x-forwarded-forX-Forwarded-For TCP连接IP: $remote_addr - 当字段类型category选择“params”、“cookie”、“header”时请根据实际需求配置子字段且该参数必填。 - 当匹配逻辑为num_greater、num_less、num_equal、num_not_equal时子字段必须为空 - 当子字段不为空时最大长度不超过2048
:type index: str
:param logic_operation: 条件列表匹配逻辑。 如果字段类型category是url、user-agent或者referer 匹配逻辑可以为contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal或者len_not_equal 如果字段类型category是ip、ipv6或method匹配逻辑可以为 equal、not_equal 如果字段类型category是request_line或者request, 匹配逻辑可以为: len_greater、len_less、len_equal或者len_not_equal 如果字段类型category是params、cookie或者header, 匹配逻辑可以为contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal、len_not_equal、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist
:type logic_operation: str
:param contents: 条件列表逻辑匹配内容。 - 当匹配逻辑为exist或not_exist时contents必须为空其他情况下contents必填且长度不超过2048 - 当匹配逻辑包含\"len\"时contents必须为0~65535的整数当匹配逻辑包含\"num\"时contents必须为0~512的整数 - 当category为method时, contents必须是1-64位大写字母
:type contents: list[str]
"""
self._category = None
self._index = None
self._logic_operation = None
self._contents = None
self.discriminator = None
self.category = category
if index is not None:
self.index = index
self.logic_operation = logic_operation
self.contents = contents
@property
def category(self):
"""Gets the category of this WafCustomCondition.
字段类型 枚举值: url路径 ipIPv4 user-agent: User Agent method: Method referer: Referer paramsParams cookieCookie headerHeader request_line: Request Line request: Request
:return: The category of this WafCustomCondition.
:rtype: str
"""
return self._category
@category.setter
def category(self, category):
"""Sets the category of this WafCustomCondition.
字段类型 枚举值: url路径 ipIPv4 user-agent: User Agent method: Method referer: Referer paramsParams cookieCookie headerHeader request_line: Request Line request: Request
:param category: The category of this WafCustomCondition.
:type category: str
"""
self._category = category
@property
def index(self):
"""Gets the index of this WafCustomCondition.
子字段 - 当字段类型为urluser-agent、refer、request_line、method、request时不需要传index参数 - 当字段类型为ip或ipv6时index必填且必须为以下值 client-ip客户端IP x-forwarded-forX-Forwarded-For TCP连接IP: $remote_addr - 当字段类型category选择“params”、“cookie”、“header”时请根据实际需求配置子字段且该参数必填。 - 当匹配逻辑为num_greater、num_less、num_equal、num_not_equal时子字段必须为空 - 当子字段不为空时最大长度不超过2048
:return: The index of this WafCustomCondition.
:rtype: str
"""
return self._index
@index.setter
def index(self, index):
"""Sets the index of this WafCustomCondition.
子字段 - 当字段类型为urluser-agent、refer、request_line、method、request时不需要传index参数 - 当字段类型为ip或ipv6时index必填且必须为以下值 client-ip客户端IP x-forwarded-forX-Forwarded-For TCP连接IP: $remote_addr - 当字段类型category选择“params”、“cookie”、“header”时请根据实际需求配置子字段且该参数必填。 - 当匹配逻辑为num_greater、num_less、num_equal、num_not_equal时子字段必须为空 - 当子字段不为空时最大长度不超过2048
:param index: The index of this WafCustomCondition.
:type index: str
"""
self._index = index
@property
def logic_operation(self):
"""Gets the logic_operation of this WafCustomCondition.
条件列表匹配逻辑。 如果字段类型category是url、user-agent或者referer 匹配逻辑可以为contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal或者len_not_equal 如果字段类型category是ip、ipv6或method匹配逻辑可以为 equal、not_equal 如果字段类型category是request_line或者request, 匹配逻辑可以为: len_greater、len_less、len_equal或者len_not_equal 如果字段类型category是params、cookie或者header, 匹配逻辑可以为contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal、len_not_equal、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist
:return: The logic_operation of this WafCustomCondition.
:rtype: str
"""
return self._logic_operation
@logic_operation.setter
def logic_operation(self, logic_operation):
"""Sets the logic_operation of this WafCustomCondition.
条件列表匹配逻辑。 如果字段类型category是url、user-agent或者referer 匹配逻辑可以为contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal或者len_not_equal 如果字段类型category是ip、ipv6或method匹配逻辑可以为 equal、not_equal 如果字段类型category是request_line或者request, 匹配逻辑可以为: len_greater、len_less、len_equal或者len_not_equal 如果字段类型category是params、cookie或者header, 匹配逻辑可以为contain、 not_contain、 equal、 not_equal、 prefix、 not_prefix、 suffix、 not_suffix、 len_greater、 len_less、len_equal、len_not_equal、num_greater、num_less、num_equal、num_not_equal、exist或者not_exist
:param logic_operation: The logic_operation of this WafCustomCondition.
:type logic_operation: str
"""
self._logic_operation = logic_operation
@property
def contents(self):
"""Gets the contents of this WafCustomCondition.
条件列表逻辑匹配内容。 - 当匹配逻辑为exist或not_exist时contents必须为空其他情况下contents必填且长度不超过2048 - 当匹配逻辑包含\"len\"contents必须为0~65535的整数当匹配逻辑包含\"num\"contents必须为0~512的整数 - 当category为method时, contents必须是1-64位大写字母
:return: The contents of this WafCustomCondition.
:rtype: list[str]
"""
return self._contents
@contents.setter
def contents(self, contents):
"""Sets the contents of this WafCustomCondition.
条件列表逻辑匹配内容。 - 当匹配逻辑为exist或not_exist时contents必须为空其他情况下contents必填且长度不超过2048 - 当匹配逻辑包含\"len\"contents必须为0~65535的整数当匹配逻辑包含\"num\"contents必须为0~512的整数 - 当category为method时, contents必须是1-64位大写字母
:param contents: The contents of this WafCustomCondition.
:type contents: list[str]
"""
self._contents = contents
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:
if attr in self.sensitive_list:
result[attr] = "****"
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
def __repr__(self):
"""For `print`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, WafCustomCondition):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other