huaweicloud-sdk-python-v3/huaweicloud-sdk-elb/huaweicloudsdkelb/v2/model/session_persistence.py

164 lines
6.0 KiB
Python
Raw Normal View History

# coding: utf-8
import pprint
import re
import six
class SessionPersistence:
"""
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 = {
'type': 'str',
'cookie_name': 'str',
'persistence_timeout': 'int'
}
attribute_map = {
'type': 'type',
'cookie_name': 'cookie_name',
'persistence_timeout': 'persistence_timeout'
}
def __init__(self, type=None, cookie_name=None, persistence_timeout=None):
"""SessionPersistence - a model defined in huaweicloud sdk"""
self._type = None
self._cookie_name = None
self._persistence_timeout = None
self.discriminator = None
self.type = type
if cookie_name is not None:
self.cookie_name = cookie_name
if persistence_timeout is not None:
self.persistence_timeout = persistence_timeout
@property
def type(self):
"""Gets the type of this SessionPersistence.
会话保持的类型SOURCE_IP根据请求的源IP将同一IP的请求发送到同一个后端云服务器上HTTP_COOKIE客户端第一次发送请求时负载均衡器自动生成cookie并将该cookie插入响应消息中后续请求会发送到处理第一个请求的后端云服务器上APP_COOKIE客户端第一次发送请求时后端服务器生成cookie并将该cookie插入响应消息中后续请求会发送到处理第一个请求的后端云服务器上当后端云服务器的protocol为TCP时只按SOURCE_IP生效当后端云服务器的protocol为HTTP时只按HTTP_COOKIE或APP_COOKIE生效
:return: The type of this SessionPersistence.
:rtype: str
"""
return self._type
@type.setter
def type(self, type):
"""Sets the type of this SessionPersistence.
会话保持的类型SOURCE_IP根据请求的源IP将同一IP的请求发送到同一个后端云服务器上HTTP_COOKIE客户端第一次发送请求时负载均衡器自动生成cookie并将该cookie插入响应消息中后续请求会发送到处理第一个请求的后端云服务器上APP_COOKIE客户端第一次发送请求时后端服务器生成cookie并将该cookie插入响应消息中后续请求会发送到处理第一个请求的后端云服务器上当后端云服务器的protocol为TCP时只按SOURCE_IP生效当后端云服务器的protocol为HTTP时只按HTTP_COOKIE或APP_COOKIE生效
:param type: The type of this SessionPersistence.
:type: str
"""
self._type = type
@property
def cookie_name(self):
"""Gets the cookie_name of this SessionPersistence.
cookie的名称只有当会话保持的类型是APP_COOKIE时可以指定
:return: The cookie_name of this SessionPersistence.
:rtype: str
"""
return self._cookie_name
@cookie_name.setter
def cookie_name(self, cookie_name):
"""Sets the cookie_name of this SessionPersistence.
cookie的名称只有当会话保持的类型是APP_COOKIE时可以指定
:param cookie_name: The cookie_name of this SessionPersistence.
:type: str
"""
self._cookie_name = cookie_name
@property
def persistence_timeout(self):
"""Gets the persistence_timeout of this SessionPersistence.
会话保持的超时时间取值范围[1,60]分钟当后端云服务器的protocol为TCPUDP时[1,1440]分钟当后端云服务器的protocol为HTTP时当type为APP_COOKIE时该字段不生效
:return: The persistence_timeout of this SessionPersistence.
:rtype: int
"""
return self._persistence_timeout
@persistence_timeout.setter
def persistence_timeout(self, persistence_timeout):
"""Sets the persistence_timeout of this SessionPersistence.
会话保持的超时时间取值范围[1,60]分钟当后端云服务器的protocol为TCPUDP时[1,1440]分钟当后端云服务器的protocol为HTTP时当type为APP_COOKIE时该字段不生效
:param persistence_timeout: The persistence_timeout of this SessionPersistence.
:type: int
"""
self._persistence_timeout = persistence_timeout
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"""
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, SessionPersistence):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other