def create_vserver(self, req=None, **kwargs): """ CreateVServer - 创建VServer实例,定义监听的协议和端口以及负载均衡算法 **Request** - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ - **ULBId** (str) - (Required) 负载均衡实例ID - **ClientTimeout** (int) - ListenType为RequestProxy时表示空闲连接的回收时间,单位:秒,取值范围:时(0,86400],默认值为60;ListenType为PacketsTransmit时表示连接保持的时间,单位:秒,取值范围:[60,900],0 表示禁用连接保持 - **Domain** (str) - 根据MonitorType确认; 当MonitorType为Port时,此字段无意义。当MonitorType为Path时,代表HTTP检查域名 - **FrontendPort** (int) - VServer后端端口,取值范围[1-65535];默认值为80 - **ListenType** (str) - 监听器类型,枚举值为:RequestProxy -> 请求代理;PacketsTransmit -> 报文转发;默认为"RequestProxy" - **Method** (str) - VServer负载均衡模式,枚举值:Roundrobin -> 轮询;Source -> 源地址;ConsistentHash -> 一致性哈希;SourcePort -> 源地址(计算端口);ConsistentHashPort -> 一致性哈希(计算端口); WeightRoundrobin -> 加权轮询; Leastconn -> 最小连接数。ConsistentHash,SourcePort,ConsistentHashPort 只在报文转发中使用;Leastconn只在请求代理中使用;Roundrobin、Source和WeightRoundrobin在请求代理和报文转发中使用。默认为:"Roundrobin" - **MonitorType** (str) - 健康检查类型,枚举值:Port -> 端口检查;Path -> 路径检查; - **Path** (str) - 根据MonitorType确认; 当MonitorType为Port时,此字段无意义。当MonitorType为Path时,代表HTTP检查路径 - **PersistenceInfo** (str) - 根据PersistenceType确认; None和ServerInsert: 此字段无意义; UserDefined:此字段传入自定义会话保持String - **PersistenceType** (str) - VServer会话保持方式,默认关闭会话保持。枚举值:None -> 关闭;ServerInsert -> 自动生成KEY;UserDefined -> 用户自定义KEY。 - **Protocol** (str) - VServer实例的协议,请求代理模式下有 HTTP、HTTPS、TCP,报文转发下有 TCP,UDP。默认为“HTTP" - **VServerName** (str) - VServer实例名称,默认为"VServer" **Response** - **VServerId** (str) - VServer实例的Id """ d = {"ProjectId": self.config.project_id, "Region": self.config.region} req and d.update(req) d = apis.CreateVServerRequestSchema().dumps(d) kwargs["max_retries"] = 0 resp = self.invoke("CreateVServer", d, **kwargs) return apis.CreateVServerResponseSchema().loads(resp)
def create_vserver(self, req: typing.Optional[dict] = None, **kwargs) -> dict: """ CreateVServer - 创建VServer实例,定义监听的协议和端口以及负载均衡算法 :param ProjectId: (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) :param Region: (Config) 地域。 参见 [地域和可用区列表](../summary/regionlist.html) :param ULBId: (Required) 负载均衡实例ID :param ClientTimeout: (Optional) ListenType为RequestProxy时表示空闲连接的回收时间,单位:秒,取值范围:时(0,86400],默认值为60;ListenType为PacketsTransmit时表示连接保持的时间,单位:秒,取值范围:[60,900],0 表示禁用连接保持 :param Domain: (Optional) 根据MonitorType确认; 当MonitorType为Port时,此字段无意义。当MonitorType为Path时,代表HTTP检查路径 :param FrontendPort: (Optional) VServer后端端口,取值范围[1-65535];默认值为80 :param ListenType: (Optional) 监听器类型,枚举值为:RequestProxy -> 请求代理;PacketsTransmit -> 报文转发;默认为"RequestProxy" :param Method: (Optional) VServer负载均衡模式,枚举值:Roundrobin -> 轮询;Source -> 源地址;ConsistentHash -> 一致性哈希;SourcePort -> 源地址(计算端口);ConsistentHashPort -> 一致性哈希(计算端口); WeightRoundrobin -> 加权轮询; Leastconn -> 最小连接数。ConsistentHash,SourcePort,ConsistentHashPort 只在报文转发中使用;Leastconn只在请求代理中使用;Roundrobin、Source和WeightRoundrobin在请求代理和报文转发中使用。默认为:"Roundrobin" :param MonitorType: (Optional) 健康检查类型,枚举值:Port -> 端口检查;Path -> 路径检查; :param Path: (Optional) 根据MonitorType确认; 当MonitorType为Port时,此字段无意义。当MonitorType为Path时,代表HTTP检查域名 :param PersistenceInfo: (Optional) 根据PersistenceType确认; None和ServerInsert: 此字段无意义; UserDefined:此字段传入自定义会话保持String :param PersistenceType: (Optional) VServer会话保持方式,默认关闭会话保持。枚举值:None -> 关闭;ServerInsert -> 自动生成KEY;UserDefined -> 用户自定义KEY。 :param Protocol: (Optional) VServer实例的协议,请求代理模式下有 HTTP、HTTPS、TCP,报文转发下有 TCP,UDP。默认为“HTTP" :param VServerName: (Optional) VServer实例名称,默认为"VServer" """ # build request d = {"ProjectId": self.config.project_id, "Region": self.config.region} req and d.update(req) d = apis.CreateVServerRequestSchema().dumps(d) # build options kwargs["max_retries"] = 0 # ignore retry when api is not idempotent resp = self.invoke("CreateVServer", d, **kwargs) return apis.CreateVServerResponseSchema().loads(resp)
def create_vserver(self, req: typing.Optional[dict] = None, **kwargs) -> dict: """CreateVServer - 创建VServer实例,定义监听的协议和端口以及负载均衡算法 **Request** - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_ - **ULBId** (str) - (Required) 负载均衡实例ID - **ClientTimeout** (int) - ListenType为RequestProxy时表示空闲连接的回收时间,单位:秒,取值范围:时(0,86400],默认值为60;ListenType为PacketsTransmit时表示连接保持的时间,单位:秒,取值范围:[60,900],0 表示禁用连接保持 - **Domain** (str) - 根据MonitorType确认; 当MonitorType为Path时,此字段有意义,代表HTTP检查域名 - **FrontendPort** (int) - VServer后端端口,取值范围[1-65535];默认值为80 - **ListenType** (str) - 监听器类型,枚举值,RequestProxy ,请求代理;PacketsTransmit ,报文转发。默认为RequestProxy - **Method** (str) - VServer负载均衡模式,枚举值:Roundrobin -> 轮询;Source -> 源地址;ConsistentHash -> 一致性哈希;SourcePort -> 源地址(计算端口);ConsistentHashPort -> 一致性哈希(计算端口); WeightRoundrobin -> 加权轮询; Leastconn -> 最小连接数;Backup ->主备模式。ConsistentHash,SourcePort,ConsistentHashPort 只在报文转发中使用;Leastconn只在请求代理中使用;Roundrobin、Source和WeightRoundrobin,Backup在请求代理和报文转发中使用。默认为:"Roundrobin" - **MonitorType** (str) - 健康检查类型,枚举值:Port -> 端口检查;Path -> 路径检查;Ping -> Ping探测;Customize -> UDP检查请求代理型默认值为Port,其中TCP协议仅支持Port,其他协议支持Port和Path;报文转发型TCP协议仅支持Port,UDP协议支持Ping、Port和Customize,默认值为Ping - **Path** (str) - 根据MonitorType确认; 当MonitorType为Path时,此字段有意义,代表HTTP检查路径 - **PersistenceInfo** (str) - 根据PersistenceType确认; None和ServerInsert: 此字段无意义; UserDefined:此字段传入自定义会话保持String - **PersistenceType** (str) - VServer会话保持方式,默认关闭会话保持。枚举值:None -> 关闭;ServerInsert -> 自动生成KEY;UserDefined -> 用户自定义KEY。 - **Protocol** (str) - VServer实例的协议,请求代理模式下有 HTTP、HTTPS、TCP,报文转发下有 TCP,UDP。默认为“HTTP" - **RequestMsg** (str) - 根据MonitorType确认; 当MonitorType为Customize时,此字段有意义,代表UDP检查发出的请求报文 - **ResponseMsg** (str) - 根据MonitorType确认; 当MonitorType为Customize时,此字段有意义,代表UDP检查请求应收到的响应报文 - **VServerName** (str) - VServer实例名称,默认为"VServer" **Response** - **VServerId** (str) - VServer实例的Id """ # build request d = { "ProjectId": self.config.project_id, "Region": self.config.region, } req and d.update(req) d = apis.CreateVServerRequestSchema().dumps(d) # build options kwargs["max_retries"] = 0 # ignore retry when api is not idempotent resp = self.invoke("CreateVServer", d, **kwargs) return apis.CreateVServerResponseSchema().loads(resp)