From 8a05d1d9af6dd5152f3aab8e858500783e664c08 Mon Sep 17 00:00:00 2001 From: ucloud-bot Date: Wed, 26 Aug 2026 10:44:57 +0000 Subject: [PATCH] sdk: rolling update for 0.11.124 --- ucloud/services/cloudwatch/client.py | 36 +- ucloud/services/cloudwatch/schemas/models.py | 74 +-- ucloud/services/ulogservice/client.py | 424 +++++++++++++++++- ucloud/services/ulogservice/schemas/apis.py | 327 +++++++++++++- ucloud/services/ulogservice/schemas/models.py | 83 ++++ ucloud/services/uwsc/client.py | 44 +- ucloud/services/uwsc/schemas/apis.py | 46 +- ucloud/services/uwsc/schemas/models.py | 84 ++-- ucloud/version.py | 2 +- 9 files changed, 968 insertions(+), 152 deletions(-) diff --git a/ucloud/services/cloudwatch/client.py b/ucloud/services/cloudwatch/client.py index 413c9f8..732d751 100644 --- a/ucloud/services/cloudwatch/client.py +++ b/ucloud/services/cloudwatch/client.py @@ -270,19 +270,6 @@ def get_product_metrics( **Response Model** - **ConversionRule** - - **ConversionFactor** (int) - 转换因子 - - **From** (str) - 来源 - - **To** (str) - 目标 - - - **MetricUnitConfig** - - **ConversionFactor** (int) - 转换因子 - - **ConversionRules** (list) - 见 **ConversionRule** 模型定义 - - **UnitCnNames** (list) - 指标中文名列表 - - **UnitEnNames** (list) - 指标英文名列表 - - **MetricUnit** - **ConversionFactor** (int) - 转换因子 - **CreatedAt** (str) - 创建时间 @@ -315,6 +302,19 @@ def get_product_metrics( - **UpdatedBy** (str) - 修改者 + **ConversionRule** + - **ConversionFactor** (int) - 转换因子 + - **From** (str) - 来源 + - **To** (str) - 目标 + + + **MetricUnitConfig** + - **ConversionFactor** (int) - 转换因子 + - **ConversionRules** (list) - 见 **ConversionRule** 模型定义 + - **UnitCnNames** (list) - 指标中文名列表 + - **UnitEnNames** (list) - 指标英文名列表 + + **GetProductMetricsRespData** - **List** (list) - 见 **Metirc** 模型定义 - **Total** (int) - 查询结果总数 @@ -661,16 +661,16 @@ def query_metric_data_set( - **TagName** (str) - 标签名称 - **MetricSample** - - **Timestamp** (int) - 时间戳 - - **Value** (float) - 样本值 - - **TagListItem** - **Tag** (str) - 标签名 - **TagValue** (str) - 标签值 + **MetricSample** + - **Timestamp** (int) - 时间戳 + - **Value** (float) - 样本值 + + **MetricResult** - **ResourceId** (str) - 资源的短id - **ResourceName** (str) - 资源名称 diff --git a/ucloud/services/cloudwatch/schemas/models.py b/ucloud/services/cloudwatch/schemas/models.py index 3440c9d..8c04701 100644 --- a/ucloud/services/cloudwatch/schemas/models.py +++ b/ucloud/services/cloudwatch/schemas/models.py @@ -68,6 +68,18 @@ class MetricUnitSchema(schema.ResponseSchema): } +class ConversionRuleSchema(schema.ResponseSchema): + """ConversionRule - 指标单位转换规则""" + + fields = { + "ConversionFactor": fields.Int( + required=False, load_from="ConversionFactor" + ), + "From": fields.Str(required=False, load_from="From"), + "To": fields.Str(required=False, load_from="To"), + } + + class MetircSchema(schema.ResponseSchema): """Metirc - 指标""" @@ -90,18 +102,6 @@ class MetircSchema(schema.ResponseSchema): } -class ConversionRuleSchema(schema.ResponseSchema): - """ConversionRule - 指标单位转换规则""" - - fields = { - "ConversionFactor": fields.Int( - required=False, load_from="ConversionFactor" - ), - "From": fields.Str(required=False, load_from="From"), - "To": fields.Str(required=False, load_from="To"), - } - - class MetricUnitConfigSchema(schema.ResponseSchema): """MetricUnitConfig - 指标单位配置""" @@ -261,21 +261,21 @@ class ListMonitorProductSchema(schema.ResponseSchema): } -class TagListItemSchema(schema.ResponseSchema): - """TagListItem - 标签键值项""" +class MetricSampleSchema(schema.ResponseSchema): + """MetricSample - 指标数据点(代码结构体:MetricPoint)""" fields = { - "Tag": fields.Str(required=False, load_from="Tag"), - "TagValue": fields.Str(required=False, load_from="TagValue"), + "Timestamp": fields.Int(required=False, load_from="Timestamp"), + "Value": fields.Float(required=False, load_from="Value"), } -class MetricSampleSchema(schema.ResponseSchema): - """MetricSample - 指标数据点(代码结构体:MetricPoint)""" +class TagListItemSchema(schema.ResponseSchema): + """TagListItem - 标签键值项""" fields = { - "Timestamp": fields.Int(required=False, load_from="Timestamp"), - "Value": fields.Float(required=False, load_from="Value"), + "Tag": fields.Str(required=False, load_from="Tag"), + "TagValue": fields.Str(required=False, load_from="TagValue"), } @@ -320,40 +320,40 @@ class QueryMetricDataRespSchema(schema.ResponseSchema): } -class ResourceExtendAttrItemSchema(schema.ResponseSchema): - """ResourceExtendAttrItem - 资源扩展属性项""" +class MetricSingleSampleSchema(schema.ResponseSchema): + """MetricSingleSample - 指标单个样本点结果""" fields = { - "Key": fields.Str(required=False, load_from="Key"), - "Value": fields.Str(required=False, load_from="Value"), + "Metric": fields.Str(required=False, load_from="Metric"), + "TagsList": fields.List(TagListItemSchema()), + "Value": MetricSampleSchema(), } -class LabelAttrItemSchema(schema.ResponseSchema): - """LabelAttrItem - 标签扩展属性项""" +class ResourceMonitorItemSchema(schema.ResponseSchema): + """ResourceMonitorItem - 资源监控的单个指标数据""" fields = { - "Key": fields.Str(required=False, load_from="Key"), - "Value": fields.Str(required=False, load_from="Value"), + "Metric": fields.Str(required=False, load_from="Metric"), + "MetricValues": fields.List(MetricSingleSampleSchema()), } -class MetricSingleSampleSchema(schema.ResponseSchema): - """MetricSingleSample - 指标单个样本点结果""" +class ResourceExtendAttrItemSchema(schema.ResponseSchema): + """ResourceExtendAttrItem - 资源扩展属性项""" fields = { - "Metric": fields.Str(required=False, load_from="Metric"), - "TagsList": fields.List(TagListItemSchema()), - "Value": MetricSampleSchema(), + "Key": fields.Str(required=False, load_from="Key"), + "Value": fields.Str(required=False, load_from="Value"), } -class ResourceMonitorItemSchema(schema.ResponseSchema): - """ResourceMonitorItem - 资源监控的单个指标数据""" +class LabelAttrItemSchema(schema.ResponseSchema): + """LabelAttrItem - 标签扩展属性项""" fields = { - "Metric": fields.Str(required=False, load_from="Metric"), - "MetricValues": fields.List(MetricSingleSampleSchema()), + "Key": fields.Str(required=False, load_from="Key"), + "Value": fields.Str(required=False, load_from="Value"), } diff --git a/ucloud/services/ulogservice/client.py b/ucloud/services/ulogservice/client.py index e9de6ba..c01e3fa 100644 --- a/ucloud/services/ulogservice/client.py +++ b/ucloud/services/ulogservice/client.py @@ -15,6 +15,86 @@ def __init__( config, transport, middleware, logger ) + def bind_u_log_service_group_to_collect_conf( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """BindULogServiceGroupToCollectConf - 日志主题采集配置绑定机器组 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **CollectConfId** (int) - (Required) 采集配置id + - **TopicId** (str) - (Required) 日志主题ID + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **MachineGroupIds** (int) - 机器组ID,是一个数组 + + **Response** + + - **Message** (str) - 错误信息 + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.BindULogServiceGroupToCollectConfRequestSchema().dumps(d) + + resp = self.invoke("BindULogServiceGroupToCollectConf", d, **kwargs) + return apis.BindULogServiceGroupToCollectConfResponseSchema().loads( + resp + ) + + def create_u_log_service_collect_conf( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """CreateULogServiceCollectConf - 创建日志主题采集配置 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **CollectPolicy** (str) - (Required) 采集策略。可选值: full (全量采集存量日志), increment (从当前时间点增量采集)。默认为 full。 + - **LogType** (str) - (Required) 日志解析类型,决定了如何结构化日志。可选值: json:json 格式,delimiter:分隔符,full_regex:完全正则,multi_line_full_regex:多行完全正则,multi_line_delimiter: 多行分隔符正则,minimal_list:单行全文日志,multi_line:多行全文日志 + - **Name** (str) - (Required) 配置名称 + - **TopicId** (str) - (Required) 日志主题ID + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **Delimiter** (str) - 当 LogType 为delimiter 或multi_line_delimiter时可选,支持多字符分隔,需要转换成Base64 + - **Encode** (str) - 日志原文的编码格式。可选值: utf-8, gbk。默认为 utf-8。 + - **ExtractRule** (str) - 日志提取正则表达式。当 logType 为正则模式 (如 full_regex,multi_line_full_regex) 时,用于从日志中提取字段。需要转换成Base64 + - **FilePaths** (list) - 见 **CreateULogServiceCollectConfParamFilePaths** 模型定义 + - **Keys** (list) - 索引字段key,是一个数组 + - **MatchRule** (str) - 行首正则表达式。当 logType 为多行模式 (如 multi_line 或 multi_line_full_regex或multi_line_delimiter) 时,用于标识一条新日志的开始。需要转换成Base64 + - **UnMatchKey** (str) - 如果 UnMatchUpload 为 true,无法解析的日志原文将被存放在此字段指定的 Key 下。默认为 LogParseFailure。 + + **Response** + + - **Message** (str) - 错误信息 + + **Request Model** + + **CreateULogServiceCollectConfParamFilePaths** + - **File** (str) - 定义采集路径的文件名,数组类型 + - **Path** (str) - 定义采集路径,数组类型 + + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.CreateULogServiceCollectConfRequestSchema().dumps(d) + + # build options + kwargs["max_retries"] = 0 # ignore retry when api is not idempotent + + resp = self.invoke("CreateULogServiceCollectConf", d, **kwargs) + return apis.CreateULogServiceCollectConfResponseSchema().loads(resp) + def create_u_log_service_log_set( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: @@ -47,6 +127,41 @@ def create_u_log_service_log_set( resp = self.invoke("CreateULogServiceLogSet", d, **kwargs) return apis.CreateULogServiceLogSetResponseSchema().loads(resp) + def create_u_log_service_machine_group( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """CreateULogServiceMachineGroup - 创建机器组 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **InstanceId** (str) - (Required) 日志服务实例资源ID + - **Name** (str) - (Required) 机器组名称;格式校验:^[\w]{1,23}$ + - **Type** (str) - (Required) 采集客户端识别模式;可选值 LABEL | IP; + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **Ips** (str) - 机器IP,如果Type是IP,那么Ips可以填写IP,是一个数组 + - **Labels** (str) - 采集客户端识别标识,是一个数组 + + **Response** + + - **Message** (str) - 错误信息 + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.CreateULogServiceMachineGroupRequestSchema().dumps(d) + + # build options + kwargs["max_retries"] = 0 # ignore retry when api is not idempotent + + resp = self.invoke("CreateULogServiceMachineGroup", d, **kwargs) + return apis.CreateULogServiceMachineGroupResponseSchema().loads(resp) + def create_u_log_service_topic( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: @@ -56,10 +171,10 @@ def create_u_log_service_topic( - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ - - **ReserveAge** (int) - (Required) 保存时间 1~360 天,-1表示永久保存 - - **TopicName** (str) - (Required) 主题名称,校验规则"^[\w]{1,23}$" - - **LogSetId** (str) - 日志集ID - - **TopicShardNum** (int) - 分区数量 数字1~20 + - **LogSetId** (str) - (Required) 日志集ID + - **ReserveAge** (int) - (Required) 保存时间 1~730 天 + - **TopicName** (str) - (Required) 主题名称,校验规则"^[\w]{1,64}$" + - **TopicShardNum** (int) - (Required) 分区数量,固定是2 **Response** @@ -80,6 +195,35 @@ def create_u_log_service_topic( resp = self.invoke("CreateULogServiceTopic", d, **kwargs) return apis.CreateULogServiceTopicResponseSchema().loads(resp) + def delete_u_log_service_collect_conf( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """DeleteULogServiceCollectConf - 删除日志主题采集配置 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **CollectConfId** (int) - (Required) 日志主题采集配置ID + - **TopicId** (str) - (Required) 日志主题ID + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + + **Response** + + - **Message** (str) - 错误信息 + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.DeleteULogServiceCollectConfRequestSchema().dumps(d) + + resp = self.invoke("DeleteULogServiceCollectConf", d, **kwargs) + return apis.DeleteULogServiceCollectConfResponseSchema().loads(resp) + def delete_u_log_service_log_set( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: @@ -107,6 +251,34 @@ def delete_u_log_service_log_set( resp = self.invoke("DeleteULogServiceLogSet", d, **kwargs) return apis.DeleteULogServiceLogSetResponseSchema().loads(resp) + def delete_u_log_service_machine_group( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """DeleteULogServiceMachineGroup - 删除机器组 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **Id** (int) - (Required) 删除的机器组ID + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + + **Response** + + - **Message** (str) - 错误信息 + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.DeleteULogServiceMachineGroupRequestSchema().dumps(d) + + resp = self.invoke("DeleteULogServiceMachineGroup", d, **kwargs) + return apis.DeleteULogServiceMachineGroupResponseSchema().loads(resp) + def delete_u_log_service_topic( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: @@ -134,6 +306,119 @@ def delete_u_log_service_topic( resp = self.invoke("DeleteULogServiceTopic", d, **kwargs) return apis.DeleteULogServiceTopicResponseSchema().loads(resp) + def describe_u_log_service_machine_group( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """DescribeULogServiceMachineGroup - 查询日志采集机器组 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **Id** (str) - (Required) 机器组ID + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + + **Response** + + - **MachineGroup** (dict) - 见 **MachineInfo** 模型定义 + - **Message** (str) - 错误信息 + + **Response Model** + + **LogAgent** + - **AgentVersion** (str) - LogAgent版本 + - **HostIp** (str) - 主机IP + - **InstanceId** (str) - logagent id + - **Label** (str) - 主机标签 + - **OffLineTime** (str) - 离线时间,单位是ms + - **Status** (str) - logagent状态,NORMAL:正常,OFFLINE: 离线 + + + **MachineInfo** + - **Id** (int) - 机器组ID + - **Ips** (str) - 机器组Ip,数组类型 + - **Labels** (list) - 机器组标签,数组类型 + - **LogAgents** (dict) - 见 **LogAgent** 模型定义 + - **Name** (str) - 机器组名称 + - **Type** (str) - 机器组类型,取值有:LABEL和IP + + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.DescribeULogServiceMachineGroupRequestSchema().dumps(d) + + resp = self.invoke("DescribeULogServiceMachineGroup", d, **kwargs) + return apis.DescribeULogServiceMachineGroupResponseSchema().loads(resp) + + def list_u_log_service_collect_conf( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """ListULogServiceCollectConf - 查询日志主题采集配置列表 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **TopicId** (int) - (Required) 日志主题ID + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **CollectConfId** (int) - 采集配置ID + + **Response** + + - **CollectConfs** (dict) - 见 **CollectConf** 模型定义 + - **Message** (str) - 错误信息 + + **Response Model** + + **FilePath** + - **File** (str) - 文件名 + - **Path** (str) - 路径 + + + **MachineGroup** + - **CreateTime** (int) - 创建时间 + - **Id** (str) - 机器组ID + - **Name** (str) - 机器组名称 + - **Type** (str) - 采集器识别类型:LABEL:机器标识,IP:IP类型 + - **UpdateTime** (int) - 修改时间 + + + **CollectConf** + - **CollectPolicy** (str) - 采集策略。可选值: full (全量采集存量日志), increment (从当前时间点增量采集)。默认为 full。 + - **CreateTime** (int) - CreateTime + - **Delimiter** (str) - 当 LogType 为delimiter 或multi_line_delimiter时可选,支持多字符分隔,需要转换成Base64 + - **Encode** (str) - 日志原文的编码格式。可选值: utf-8, gbk。默认为 utf-8。 + - **ExtractRule** (str) - 日志提取正则表达式。当 logType 为正则模式 (如 full_regex,multi_line_full_regex) 时,用于从日志中提取字段。需要转换成Base64 + - **FilePaths** (list) - 见 **FilePath** 模型定义 + - **Id** (int) - Id + - **Keys** (str) - 索引字段key,是一个数组 + - **LogType** (str) - 日志解析类型,决定了如何结构化日志。可选值: json:json 格式,delimiter:分隔符,full_regex:完全正则,multi_line_full_regex:多行完全正则,multi_line_delimiter: 多行分隔符正则,minimal_list:单行全文日志,multi_line:多行全文日志 + - **MachineGroups** (list) - 见 **MachineGroup** 模型定义 + - **MatchRule** (str) - 行首正则表达式。当 logType 为多行模式 (如 multi_line 或 multi_line_full_regex或multi_line_delimiter) 时,用于标识一条新日志的开始。需要转换成Base64 + - **Name** (str) - 日志采集配置名称 + - **State** (int) - State + - **TopicId** (int) - 日志主题ID + - **UnMatchKey** (str) - 如果 UnMatchUpload 为 true,无法解析的日志原文将被存放在此字段指定的 Key 下。默认为 LogParseFailure。 + - **UpdateTime** (int) - updateTime + + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.ListULogServiceCollectConfRequestSchema().dumps(d) + + resp = self.invoke("ListULogServiceCollectConf", d, **kwargs) + return apis.ListULogServiceCollectConfResponseSchema().loads(resp) + def list_u_log_service_log_set( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: @@ -171,6 +456,44 @@ def list_u_log_service_log_set( resp = self.invoke("ListULogServiceLogSet", d, **kwargs) return apis.ListULogServiceLogSetResponseSchema().loads(resp) + def list_u_log_service_machine_group( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """ListULogServiceMachineGroup - 查看机器组列表 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + + **Response** + + - **MachineGroups** (list) - 见 **MachineGroup** 模型定义 + - **Message** (str) - 错误信息 + + **Response Model** + + **MachineGroup** + - **CreateTime** (int) - 创建时间 + - **Id** (str) - 机器组ID + - **Name** (str) - 机器组名称 + - **Type** (str) - 采集器识别类型:LABEL:机器标识,IP:IP类型 + - **UpdateTime** (int) - 修改时间 + + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.ListULogServiceMachineGroupRequestSchema().dumps(d) + + resp = self.invoke("ListULogServiceMachineGroup", d, **kwargs) + return apis.ListULogServiceMachineGroupResponseSchema().loads(resp) + def list_u_log_service_topic( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: @@ -180,6 +503,7 @@ def list_u_log_service_topic( - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **LogSetId** (str) - (Required) 日志集ID - **Limit** (int) - 分页限制数,默认为30 - **Offset** (int) - 分页起始条目数, 默认为0 @@ -192,11 +516,11 @@ def list_u_log_service_topic( **TopicInfo** - **IsReserved** (int) - 是否保留:0 - NORMAL, 1 - RESERVED - - **ReserveAge** (int) - 保存时间 1~360 天,-1表示永久保存 + - **ReserveAge** (int) - 保存时间 1~730 天 - **TopicDesc** (str) - 主题描述 - **TopicId** (str) - 主题ID - **TopicName** (str) - 主题名称 - - **TopicShardNum** (int) - 分区数量 数字1~20 + - **TopicShardNum** (int) - 分区数量,固定是2 """ @@ -228,7 +552,7 @@ def query_u_log_service_log( - **LastId** (str) - 滚动加载参数,上一页最后一条数据的ID - **LastTimestamp** (str) - 滚动加载参数,上一页最后一条数据的timestamp - **ScrollId** (str) - Deprecated. 滚动加载参数ScrollId - - **Size** (int) - 一次返回条数,默认20 + - **Size** (int) - 一次返回条数,默认20。仅当检索分析语句不包含SQL时有效。SQL结果条数方式可以在SQL里使用limit语法。 - **StartTime** (int) - 起始日志时间,秒级时间戳 **Response** @@ -238,12 +562,21 @@ def query_u_log_service_log( **Response Model** **LogContent** + - **FileName** (str) - 日志文件路径 + - **HostName** (str) - 日志来源主机 - **LogId** (str) - 日志标识ID - **LogJson** (str) - JSON格式的日志内容 - **Timestamp** (int) - 日志时间 + **AnalysisField** + - **Name** (str) - 字段名 + - **Type** (str) - 字段类型 + + **LogQueryResult** + - **AnalysisRecords** (list) - 当使用SQL语句查询时,数据通过该字段返回 + - **Columns** (list) - 见 **AnalysisField** 模型定义 - **Contents** (dict) - 见 **LogContent** 模型定义 - **IsOver** (bool) - 检索结果是否到底 - **LastId** (str) - 滚动检索,当前页最后一条数据ID @@ -264,3 +597,80 @@ def query_u_log_service_log( resp = self.invoke("QueryULogServiceLog", d, **kwargs) return apis.QueryULogServiceLogResponseSchema().loads(resp) + + def update_u_log_service_collect_conf( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """UpdateULogServiceCollectConf - 修改日志主题采集配置 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **CollectConfId** (int) - (Required) 日志主题采集配置ID + - **CollectPolicy** (str) - (Required) 采集策略。可选值: full (全量采集存量日志), increment (从当前时间点增量采集)。默认为 full。 + - **LogType** (str) - (Required) 日志解析类型,决定了如何结构化日志。可选值: json:json 格式,delimiter:分隔符,full_regex:完全正则,multi_line_full_regex:多行完全正则,multi_line_delimiter: 多行分隔符正则,minimal_list:单行全文日志,multi_line:多行全文日志 + - **TopicId** (str) - (Required) 日志主题ID + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **Delimiter** (str) - 当 LogType 为delimiter 或multi_line_delimiter时可选,支持多字符分隔,需要转换成Base64 + - **Encode** (str) - 日志原文的编码格式。可选值: utf-8, gbk。默认为 utf-8。 + - **ExtractRule** (str) - 日志提取正则表达式。当 logType 为正则模式 (如 full_regex,multi_line_full_regex) 时,用于从日志中提取字段。需要转换成Base64 + - **FilePaths** (list) - 见 **UpdateULogServiceCollectConfParamFilePaths** 模型定义 + - **Keys** (list) - 索引字段key,是一个数组 + - **MatchRule** (str) - 行首正则表达式。当 logType 为多行模式 (如 multi_line 或 multi_line_full_regex或multi_line_delimiter) 时,用于标识一条新日志的开始。需要转换成Base64 + - **UnMatchKey** (str) - 如果 UnMatchUpload 为 true,无法解析的日志原文将被存放在此字段指定的 Key 下。默认为 LogParseFailure。 + + **Response** + + - **Message** (str) - 错误信息 + + **Request Model** + + **UpdateULogServiceCollectConfParamFilePaths** + - **File** (str) - 定义采集路径的文件名,数组类型 + - **Path** (str) - 定义采集路径,数组类型 + + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.UpdateULogServiceCollectConfRequestSchema().dumps(d) + + resp = self.invoke("UpdateULogServiceCollectConf", d, **kwargs) + return apis.UpdateULogServiceCollectConfResponseSchema().loads(resp) + + def update_u_log_service_machine_group( + self, req: typing.Optional[dict] = None, **kwargs + ) -> dict: + """UpdateULogServiceMachineGroup - 更新日志机器组 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **Id** (int) - (Required) 机器组ID + - **Name** (str) - (Required) 机器组名称; 格式校验:^[\w]{1,255}$ + - **Type** (str) - (Required) 采集客户端识别模式;可选值 LABEL | IP; + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **Ips** (str) - 机器IP,如果Type是IP,那么Ips可以填写IP,是一个数组 + - **Labels** (str) - 采集客户端识别标识,数组类型 + + **Response** + + - **Message** (str) - 错误信息 + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.UpdateULogServiceMachineGroupRequestSchema().dumps(d) + + resp = self.invoke("UpdateULogServiceMachineGroup", d, **kwargs) + return apis.UpdateULogServiceMachineGroupResponseSchema().loads(resp) diff --git a/ucloud/services/ulogservice/schemas/apis.py b/ucloud/services/ulogservice/schemas/apis.py index db9f308..6cd0095 100644 --- a/ucloud/services/ulogservice/schemas/apis.py +++ b/ucloud/services/ulogservice/schemas/apis.py @@ -7,6 +7,83 @@ """ +""" +API: BindULogServiceGroupToCollectConf + +日志主题采集配置绑定机器组 +""" + + +class BindULogServiceGroupToCollectConfRequestSchema(schema.RequestSchema): + """BindULogServiceGroupToCollectConf - 日志主题采集配置绑定机器组""" + + fields = { + "CollectConfId": fields.Int(required=True, dump_to="CollectConfId"), + "MachineGroupIds": fields.Int( + required=False, dump_to="MachineGroupIds" + ), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "TopicId": fields.Str(required=True, dump_to="TopicId"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class BindULogServiceGroupToCollectConfResponseSchema(schema.ResponseSchema): + """BindULogServiceGroupToCollectConf - 日志主题采集配置绑定机器组""" + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: CreateULogServiceCollectConf + +创建日志主题采集配置 +""" + + +class CreateULogServiceCollectConfParamFilePathsSchema(schema.RequestSchema): + """CreateULogServiceCollectConfParamFilePaths -""" + + fields = { + "File": fields.Str(required=False, dump_to="File"), + "Path": fields.Str(required=False, dump_to="Path"), + } + + +class CreateULogServiceCollectConfRequestSchema(schema.RequestSchema): + """CreateULogServiceCollectConf - 创建日志主题采集配置""" + + fields = { + "CollectPolicy": fields.Str(required=True, dump_to="CollectPolicy"), + "Delimiter": fields.Str(required=False, dump_to="Delimiter"), + "Encode": fields.Str(required=False, dump_to="Encode"), + "ExtractRule": fields.Str(required=False, dump_to="ExtractRule"), + "FilePaths": fields.List( + CreateULogServiceCollectConfParamFilePathsSchema() + ), + "Keys": fields.List(fields.Str()), + "LogType": fields.Str(required=True, dump_to="LogType"), + "MatchRule": fields.Str(required=False, dump_to="MatchRule"), + "Name": fields.Str(required=True, dump_to="Name"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "TopicId": fields.Str(required=True, dump_to="TopicId"), + "UnMatchKey": fields.Str(required=False, dump_to="UnMatchKey"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateULogServiceCollectConfResponseSchema(schema.ResponseSchema): + """CreateULogServiceCollectConf - 创建日志主题采集配置""" + + fields = { + "Message": fields.Str(required=False, load_from="Message"), + } + + """ API: CreateULogServiceLogSet @@ -34,6 +111,36 @@ class CreateULogServiceLogSetResponseSchema(schema.ResponseSchema): } +""" +API: CreateULogServiceMachineGroup + +创建机器组 +""" + + +class CreateULogServiceMachineGroupRequestSchema(schema.RequestSchema): + """CreateULogServiceMachineGroup - 创建机器组""" + + fields = { + "InstanceId": fields.Str(required=True, dump_to="InstanceId"), + "Ips": fields.Str(required=False, dump_to="Ips"), + "Labels": fields.Str(required=False, dump_to="Labels"), + "Name": fields.Str(required=True, dump_to="Name"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "Type": fields.Str(required=True, dump_to="Type"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateULogServiceMachineGroupResponseSchema(schema.ResponseSchema): + """CreateULogServiceMachineGroup - 创建机器组""" + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + } + + """ API: CreateULogServiceTopic @@ -45,12 +152,12 @@ class CreateULogServiceTopicRequestSchema(schema.RequestSchema): """CreateULogServiceTopic - 创建ULogService主题""" fields = { - "LogSetId": fields.Str(required=False, dump_to="LogSetId"), + "LogSetId": fields.Str(required=True, dump_to="LogSetId"), "ProjectId": fields.Str(required=False, dump_to="ProjectId"), "Region": fields.Str(required=True, dump_to="Region"), "ReserveAge": fields.Int(required=True, dump_to="ReserveAge"), "TopicName": fields.Str(required=True, dump_to="TopicName"), - "TopicShardNum": fields.Int(required=False, dump_to="TopicShardNum"), + "TopicShardNum": fields.Int(required=True, dump_to="TopicShardNum"), } @@ -62,6 +169,33 @@ class CreateULogServiceTopicResponseSchema(schema.ResponseSchema): } +""" +API: DeleteULogServiceCollectConf + +删除日志主题采集配置 +""" + + +class DeleteULogServiceCollectConfRequestSchema(schema.RequestSchema): + """DeleteULogServiceCollectConf - 删除日志主题采集配置""" + + fields = { + "CollectConfId": fields.Int(required=True, dump_to="CollectConfId"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "TopicId": fields.Str(required=True, dump_to="TopicId"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteULogServiceCollectConfResponseSchema(schema.ResponseSchema): + """DeleteULogServiceCollectConf - 删除日志主题采集配置""" + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + } + + """ API: DeleteULogServiceLogSet @@ -86,6 +220,32 @@ class DeleteULogServiceLogSetResponseSchema(schema.ResponseSchema): fields = {} +""" +API: DeleteULogServiceMachineGroup + +删除机器组 +""" + + +class DeleteULogServiceMachineGroupRequestSchema(schema.RequestSchema): + """DeleteULogServiceMachineGroup - 删除机器组""" + + fields = { + "Id": fields.Int(required=True, dump_to="Id"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteULogServiceMachineGroupResponseSchema(schema.ResponseSchema): + """DeleteULogServiceMachineGroup - 删除机器组""" + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + } + + """ API: DeleteULogServiceTopic @@ -111,6 +271,61 @@ class DeleteULogServiceTopicResponseSchema(schema.ResponseSchema): } +""" +API: DescribeULogServiceMachineGroup + +查询日志采集机器组 +""" + + +class DescribeULogServiceMachineGroupRequestSchema(schema.RequestSchema): + """DescribeULogServiceMachineGroup - 查询日志采集机器组""" + + fields = { + "Id": fields.Str(required=True, dump_to="Id"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeULogServiceMachineGroupResponseSchema(schema.ResponseSchema): + """DescribeULogServiceMachineGroup - 查询日志采集机器组""" + + fields = { + "MachineGroup": models.MachineInfoSchema(), + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: ListULogServiceCollectConf + +查询日志主题采集配置列表 +""" + + +class ListULogServiceCollectConfRequestSchema(schema.RequestSchema): + """ListULogServiceCollectConf - 查询日志主题采集配置列表""" + + fields = { + "CollectConfId": fields.Int(required=False, dump_to="CollectConfId"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "TopicId": fields.Int(required=True, dump_to="TopicId"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class ListULogServiceCollectConfResponseSchema(schema.ResponseSchema): + """ListULogServiceCollectConf - 查询日志主题采集配置列表""" + + fields = { + "CollectConfs": models.CollectConfSchema(), + "Message": fields.Str(required=True, load_from="Message"), + } + + """ API: ListULogServiceLogSet @@ -138,6 +353,36 @@ class ListULogServiceLogSetResponseSchema(schema.ResponseSchema): } +""" +API: ListULogServiceMachineGroup + +查看机器组列表 +""" + + +class ListULogServiceMachineGroupRequestSchema(schema.RequestSchema): + """ListULogServiceMachineGroup - 查看机器组列表""" + + fields = { + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class ListULogServiceMachineGroupResponseSchema(schema.ResponseSchema): + """ListULogServiceMachineGroup - 查看机器组列表""" + + fields = { + "MachineGroups": fields.List( + models.MachineGroupSchema(), + required=True, + load_from="MachineGroups", + ), + "Message": fields.Str(required=True, load_from="Message"), + } + + """ API: ListULogServiceTopic @@ -150,6 +395,7 @@ class ListULogServiceTopicRequestSchema(schema.RequestSchema): fields = { "Limit": fields.Int(required=False, dump_to="Limit"), + "LogSetId": fields.Str(required=True, dump_to="LogSetId"), "Offset": fields.Int(required=False, dump_to="Offset"), "ProjectId": fields.Str(required=False, dump_to="ProjectId"), "Region": fields.Str(required=True, dump_to="Region"), @@ -199,3 +445,80 @@ class QueryULogServiceLogResponseSchema(schema.ResponseSchema): fields = { "Data": models.LogQueryResultSchema(), } + + +""" +API: UpdateULogServiceCollectConf + +修改日志主题采集配置 +""" + + +class UpdateULogServiceCollectConfParamFilePathsSchema(schema.RequestSchema): + """UpdateULogServiceCollectConfParamFilePaths -""" + + fields = { + "File": fields.Str(required=False, dump_to="File"), + "Path": fields.Str(required=False, dump_to="Path"), + } + + +class UpdateULogServiceCollectConfRequestSchema(schema.RequestSchema): + """UpdateULogServiceCollectConf - 修改日志主题采集配置""" + + fields = { + "CollectConfId": fields.Int(required=True, dump_to="CollectConfId"), + "CollectPolicy": fields.Str(required=True, dump_to="CollectPolicy"), + "Delimiter": fields.Str(required=False, dump_to="Delimiter"), + "Encode": fields.Str(required=False, dump_to="Encode"), + "ExtractRule": fields.Str(required=False, dump_to="ExtractRule"), + "FilePaths": fields.List( + UpdateULogServiceCollectConfParamFilePathsSchema() + ), + "Keys": fields.List(fields.Str()), + "LogType": fields.Str(required=True, dump_to="LogType"), + "MatchRule": fields.Str(required=False, dump_to="MatchRule"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "TopicId": fields.Str(required=True, dump_to="TopicId"), + "UnMatchKey": fields.Str(required=False, dump_to="UnMatchKey"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UpdateULogServiceCollectConfResponseSchema(schema.ResponseSchema): + """UpdateULogServiceCollectConf - 修改日志主题采集配置""" + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: UpdateULogServiceMachineGroup + +更新日志机器组 +""" + + +class UpdateULogServiceMachineGroupRequestSchema(schema.RequestSchema): + """UpdateULogServiceMachineGroup - 更新日志机器组""" + + fields = { + "Id": fields.Int(required=True, dump_to="Id"), + "Ips": fields.Str(required=False, dump_to="Ips"), + "Labels": fields.Str(required=False, dump_to="Labels"), + "Name": fields.Str(required=True, dump_to="Name"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "Type": fields.Str(required=True, dump_to="Type"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UpdateULogServiceMachineGroupResponseSchema(schema.ResponseSchema): + """UpdateULogServiceMachineGroup - 更新日志机器组""" + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + } diff --git a/ucloud/services/ulogservice/schemas/models.py b/ucloud/services/ulogservice/schemas/models.py index dcf1d0f..fd6a24a 100644 --- a/ucloud/services/ulogservice/schemas/models.py +++ b/ucloud/services/ulogservice/schemas/models.py @@ -3,6 +3,76 @@ from ucloud.core.typesystem import schema, fields +class LogAgentSchema(schema.ResponseSchema): + """LogAgent - logagent 信息""" + + fields = { + "AgentVersion": fields.Str(required=False, load_from="AgentVersion"), + "HostIp": fields.Str(required=False, load_from="HostIp"), + "InstanceId": fields.Str(required=False, load_from="InstanceId"), + "Label": fields.Str(required=False, load_from="Label"), + "OffLineTime": fields.Str(required=False, load_from="OffLineTime"), + "Status": fields.Str(required=False, load_from="Status"), + } + + +class MachineInfoSchema(schema.ResponseSchema): + """MachineInfo - 机器信息""" + + fields = { + "Id": fields.Int(required=False, load_from="Id"), + "Ips": fields.Str(required=False, load_from="Ips"), + "Labels": fields.List(fields.Str()), + "LogAgents": LogAgentSchema(), + "Name": fields.Str(required=False, load_from="Name"), + "Type": fields.Str(required=False, load_from="Type"), + } + + +class MachineGroupSchema(schema.ResponseSchema): + """MachineGroup - 机器组""" + + fields = { + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Id": fields.Str(required=False, load_from="Id"), + "Name": fields.Str(required=False, load_from="Name"), + "Type": fields.Str(required=False, load_from="Type"), + "UpdateTime": fields.Int(required=False, load_from="UpdateTime"), + } + + +class FilePathSchema(schema.ResponseSchema): + """FilePath - 文件路径""" + + fields = { + "File": fields.Str(required=False, load_from="File"), + "Path": fields.Str(required=False, load_from="Path"), + } + + +class CollectConfSchema(schema.ResponseSchema): + """CollectConf - 日志采集配置""" + + fields = { + "CollectPolicy": fields.Str(required=False, load_from="CollectPolicy"), + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Delimiter": fields.Str(required=False, load_from="Delimiter"), + "Encode": fields.Str(required=False, load_from="Encode"), + "ExtractRule": fields.Str(required=False, load_from="ExtractRule"), + "FilePaths": fields.List(FilePathSchema()), + "Id": fields.Int(required=False, load_from="Id"), + "Keys": fields.Str(required=False, load_from="Keys"), + "LogType": fields.Str(required=False, load_from="LogType"), + "MachineGroups": fields.List(MachineGroupSchema()), + "MatchRule": fields.Str(required=False, load_from="MatchRule"), + "Name": fields.Str(required=False, load_from="Name"), + "State": fields.Int(required=True, load_from="State"), + "TopicId": fields.Int(required=True, load_from="TopicId"), + "UnMatchKey": fields.Str(required=False, load_from="UnMatchKey"), + "UpdateTime": fields.Int(required=False, load_from="UpdateTime"), + } + + class LogSetInfoSchema(schema.ResponseSchema): """LogSetInfo -""" @@ -28,10 +98,21 @@ class TopicInfoSchema(schema.ResponseSchema): } +class AnalysisFieldSchema(schema.ResponseSchema): + """AnalysisField - 统计分析结果字段头""" + + fields = { + "Name": fields.Str(required=True, load_from="Name"), + "Type": fields.Str(required=True, load_from="Type"), + } + + class LogContentSchema(schema.ResponseSchema): """LogContent - 日志内容""" fields = { + "FileName": fields.Str(required=True, load_from="FileName"), + "HostName": fields.Str(required=True, load_from="HostName"), "LogId": fields.Str(required=True, load_from="LogId"), "LogJson": fields.Str(required=True, load_from="LogJson"), "Timestamp": fields.Int(required=True, load_from="Timestamp"), @@ -42,6 +123,8 @@ class LogQueryResultSchema(schema.ResponseSchema): """LogQueryResult - 日志检索结果""" fields = { + "AnalysisRecords": fields.List(fields.Str()), + "Columns": fields.List(AnalysisFieldSchema()), "Contents": LogContentSchema(), "IsOver": fields.Bool(required=True, load_from="IsOver"), "LastId": fields.Str(required=False, load_from="LastId"), diff --git a/ucloud/services/uwsc/client.py b/ucloud/services/uwsc/client.py index b7ecc6e..44a874c 100644 --- a/ucloud/services/uwsc/client.py +++ b/ucloud/services/uwsc/client.py @@ -130,6 +130,13 @@ def create_ce_tunnel( **Request Model** + **CreateCETunnelParamDPDConf** + - **Action** (str) - DPD超时后的动作,Enable为1(开启)时有效。可取值为clear(断开)、restart(重试)和 trap(流量触发) + - **Delay** (int) - DPD探测间隔时间。dpdEnable为1(开启)时有效。单位为秒,默认为 10 + - **Enabled** (int) - 是否开启 DPD(对等体存活检测)功能。取值:0(关闭)、1(开启) + - **Timeout** (int) - DPD超时时间。即探测确认对端不存在需要的时间。dpdEnable为1(开启)时有效。单位为秒。取值范围为 30-60(IKEv2 默认为 0) + + **CreateCETunnelParamIKEConf** - **AuthenticationAlgorithm** (str) - IKE 认证算法,取值:"md5", "sha1", "sha2-256" - **DhGroup** (str) - DH group,指定IKE交换密钥时使用的DH组。取值:"1", "2", "5", "14", "15", "16" @@ -160,13 +167,6 @@ def create_ce_tunnel( - **TunnelCidr** (str) - BGP隧道网段。该网段需是一个在 169.254.0.0/16 内的掩码长度为 30 的网段。 - **CreateCETunnelParamDPDConf** - - **Action** (str) - DPD超时后的动作,Enable为1(开启)时有效。可取值为clear(断开)、restart(重试)和 trap(流量触发) - - **Delay** (int) - DPD探测间隔时间。dpdEnable为1(开启)时有效。单位为秒,默认为 10 - - **Enabled** (int) - 是否开启 DPD(对等体存活检测)功能。取值:0(关闭)、1(开启) - - **Timeout** (int) - DPD超时时间。即探测确认对端不存在需要的时间。dpdEnable为1(开启)时有效。单位为秒。取值范围为 30-60(IKEv2 默认为 0) - - """ # build request d = { @@ -528,13 +528,6 @@ def describe_ce_tunnel( - **Version** (str) - 版本 - **DPDConf** - - **Action** (str) - DPD 行为 - - **Delay** (int) - DPD 探测间隔时间 - - **Enabled** (int) - 是否开启 DPD - - **Timeout** (int) - DPD 探测超时时间 - - **IPSecConf** - **AuthenticationAlgorithm** (str) - 认证算法 - **CENetwork** (list) - 客户网段 @@ -553,6 +546,13 @@ def describe_ce_tunnel( - **TunnelCidr** (str) - BGP隧道网段 + **DPDConf** + - **Action** (str) - DPD 行为 + - **Delay** (int) - DPD 探测间隔时间 + - **Enabled** (int) - 是否开启 DPD + - **Timeout** (int) - DPD 探测超时时间 + + **VPNTunnelInfo** - **BGPConf** (dict) - 见 **BGPConf** 模型定义 - **CloseAction** (str) - 隧道关闭后动作 @@ -904,6 +904,14 @@ def update_ce_tunnel( **Request Model** + **UpdateCETunnelParamBGPConf** + - **LocalAsn** (str) - Ucloud侧的自治系统号。 + - **LocalIp** (str) - 云端BGP地址。必须从BGP隧道网段内分配。 + - **PeerAsn** (str) - 对端BGP ASN号。 + - **PeerIp** (str) - 用户端BGP地址。必须从BGP隧道网段内分配。 + - **TunnelCidr** (str) - BGP隧道网段。该网段需是一个在 169.254.0.0/16 内的掩码长度为 30 的网段。 + + **UpdateCETunnelParamIKEConf** - **AuthenticationAlgorithm** (str) - IKE 认证算法,取值:"md5", "sha1", "sha2-256" - **DhGroup** (str) - DH group,指定IKE交换密钥时使用的DH组。取值:"1", "2", "5", "14", "15", "16" @@ -933,14 +941,6 @@ def update_ce_tunnel( - **Timeout** (str) - DPD超时时间。即探测确认对端不存在需要的时间。dpdEnable为1(开启)时有效。单位为秒。取值范围为 30-60(IKEv2 默认为 0) - **UpdateCETunnelParamBGPConf** - - **LocalAsn** (str) - Ucloud侧的自治系统号。 - - **LocalIp** (str) - 云端BGP地址。必须从BGP隧道网段内分配。 - - **PeerAsn** (str) - 对端BGP ASN号。 - - **PeerIp** (str) - 用户端BGP地址。必须从BGP隧道网段内分配。 - - **TunnelCidr** (str) - BGP隧道网段。该网段需是一个在 169.254.0.0/16 内的掩码长度为 30 的网段。 - - """ # build request d = { diff --git a/ucloud/services/uwsc/schemas/apis.py b/ucloud/services/uwsc/schemas/apis.py index a03ef3c..d4d93bb 100644 --- a/ucloud/services/uwsc/schemas/apis.py +++ b/ucloud/services/uwsc/schemas/apis.py @@ -96,6 +96,17 @@ class CreateCEGatewayResponseSchema(schema.ResponseSchema): """ +class CreateCETunnelParamDPDConfSchema(schema.RequestSchema): + """CreateCETunnelParamDPDConf -""" + + fields = { + "Action": fields.Str(required=False, dump_to="Action"), + "Delay": fields.Int(required=False, dump_to="Delay"), + "Enabled": fields.Int(required=True, dump_to="Enabled"), + "Timeout": fields.Int(required=False, dump_to="Timeout"), + } + + class CreateCETunnelParamIKEConfSchema(schema.RequestSchema): """CreateCETunnelParamIKEConf -""" @@ -148,17 +159,6 @@ class CreateCETunnelParamBGPConfSchema(schema.RequestSchema): } -class CreateCETunnelParamDPDConfSchema(schema.RequestSchema): - """CreateCETunnelParamDPDConf -""" - - fields = { - "Action": fields.Str(required=False, dump_to="Action"), - "Delay": fields.Int(required=False, dump_to="Delay"), - "Enabled": fields.Int(required=True, dump_to="Enabled"), - "Timeout": fields.Int(required=False, dump_to="Timeout"), - } - - class CreateCETunnelRequestSchema(schema.RequestSchema): """CreateCETunnel - 创建隧道""" @@ -722,6 +722,18 @@ class UpdateCEGatewayResponseSchema(schema.ResponseSchema): """ +class UpdateCETunnelParamBGPConfSchema(schema.RequestSchema): + """UpdateCETunnelParamBGPConf -""" + + fields = { + "LocalAsn": fields.Str(required=False, dump_to="LocalAsn"), + "LocalIp": fields.Str(required=False, dump_to="LocalIp"), + "PeerAsn": fields.Str(required=False, dump_to="PeerAsn"), + "PeerIp": fields.Str(required=False, dump_to="PeerIp"), + "TunnelCidr": fields.Str(required=False, dump_to="TunnelCidr"), + } + + class UpdateCETunnelParamIKEConfSchema(schema.RequestSchema): """UpdateCETunnelParamIKEConf -""" @@ -773,18 +785,6 @@ class UpdateCETunnelParamDPDConfSchema(schema.RequestSchema): } -class UpdateCETunnelParamBGPConfSchema(schema.RequestSchema): - """UpdateCETunnelParamBGPConf -""" - - fields = { - "LocalAsn": fields.Str(required=False, dump_to="LocalAsn"), - "LocalIp": fields.Str(required=False, dump_to="LocalIp"), - "PeerAsn": fields.Str(required=False, dump_to="PeerAsn"), - "PeerIp": fields.Str(required=False, dump_to="PeerIp"), - "TunnelCidr": fields.Str(required=False, dump_to="TunnelCidr"), - } - - class UpdateCETunnelRequestSchema(schema.RequestSchema): """UpdateCETunnel - 更新隧道配置""" diff --git a/ucloud/services/uwsc/schemas/models.py b/ucloud/services/uwsc/schemas/models.py index d30d94e..5df568e 100644 --- a/ucloud/services/uwsc/schemas/models.py +++ b/ucloud/services/uwsc/schemas/models.py @@ -21,23 +21,15 @@ class VPNInfoSchema(schema.ResponseSchema): } -class IPSecConfSchema(schema.ResponseSchema): - """IPSecConf - IPSec配置信息""" +class BGPConfSchema(schema.ResponseSchema): + """BGPConf - CE隧道 BGP配置""" fields = { - "AuthenticationAlgorithm": fields.Str( - required=False, load_from="AuthenticationAlgorithm" - ), - "CENetwork": fields.List(fields.Str()), - "EncryptionAlgorithm": fields.Str( - required=False, load_from="EncryptionAlgorithm" - ), - "PFSDhGroup": fields.Str(required=False, load_from="PFSDhGroup"), - "Protocol": fields.Str(required=False, load_from="Protocol"), - "SALifeTime": fields.Str(required=False, load_from="SALifeTime"), - "SALifetimeBytes": fields.Str( - required=False, load_from="SALifetimeBytes" - ), + "LocalAsn": fields.Int(required=False, load_from="LocalAsn"), + "LocalIp": fields.Str(required=False, load_from="LocalIp"), + "PeerAsn": fields.Int(required=False, load_from="PeerAsn"), + "PeerIp": fields.Str(required=False, load_from="PeerIp"), + "TunnelCidr": fields.Str(required=False, load_from="TunnelCidr"), } @@ -52,18 +44,6 @@ class DPDConfSchema(schema.ResponseSchema): } -class BGPConfSchema(schema.ResponseSchema): - """BGPConf - CE隧道 BGP配置""" - - fields = { - "LocalAsn": fields.Int(required=False, load_from="LocalAsn"), - "LocalIp": fields.Str(required=False, load_from="LocalIp"), - "PeerAsn": fields.Int(required=False, load_from="PeerAsn"), - "PeerIp": fields.Str(required=False, load_from="PeerIp"), - "TunnelCidr": fields.Str(required=False, load_from="TunnelCidr"), - } - - class IKEConfSchema(schema.ResponseSchema): """IKEConf - IKE配置信息""" @@ -84,6 +64,26 @@ class IKEConfSchema(schema.ResponseSchema): } +class IPSecConfSchema(schema.ResponseSchema): + """IPSecConf - IPSec配置信息""" + + fields = { + "AuthenticationAlgorithm": fields.Str( + required=False, load_from="AuthenticationAlgorithm" + ), + "CENetwork": fields.List(fields.Str()), + "EncryptionAlgorithm": fields.Str( + required=False, load_from="EncryptionAlgorithm" + ), + "PFSDhGroup": fields.Str(required=False, load_from="PFSDhGroup"), + "Protocol": fields.Str(required=False, load_from="Protocol"), + "SALifeTime": fields.Str(required=False, load_from="SALifeTime"), + "SALifetimeBytes": fields.Str( + required=False, load_from="SALifetimeBytes" + ), + } + + class VPNTunnelInfoSchema(schema.ResponseSchema): """VPNTunnelInfo - 隧道信息""" @@ -182,21 +182,6 @@ class WhiteListInfoSchema(schema.ResponseSchema): } -class BWPackageInfoSchema(schema.ResponseSchema): - """BWPackageInfo - UWAN虚拟路由器带宽包信息""" - - fields = { - "BandWidth": fields.Float(required=False, load_from="BandWidth"), - "BwId": fields.Str(required=False, load_from="BwId"), - "ChargeType": fields.Str(required=False, load_from="ChargeType"), - "DueTime": fields.Int(required=False, load_from="DueTime"), - "Name": fields.Str(required=False, load_from="Name"), - "PayMode": fields.Str(required=False, load_from="PayMode"), - "PublicIp": fields.Str(required=False, load_from="PublicIp"), - "Remark": fields.Str(required=False, load_from="Remark"), - } - - class UGNBWInfoSchema(schema.ResponseSchema): """UGNBWInfo - UGN带宽包信息""" @@ -216,6 +201,21 @@ class UGNInfoSchema(schema.ResponseSchema): } +class BWPackageInfoSchema(schema.ResponseSchema): + """BWPackageInfo - UWAN虚拟路由器带宽包信息""" + + fields = { + "BandWidth": fields.Float(required=False, load_from="BandWidth"), + "BwId": fields.Str(required=False, load_from="BwId"), + "ChargeType": fields.Str(required=False, load_from="ChargeType"), + "DueTime": fields.Int(required=False, load_from="DueTime"), + "Name": fields.Str(required=False, load_from="Name"), + "PayMode": fields.Str(required=False, load_from="PayMode"), + "PublicIp": fields.Str(required=False, load_from="PublicIp"), + "Remark": fields.Str(required=False, load_from="Remark"), + } + + class POPGWInfoSchema(schema.ResponseSchema): """POPGWInfo - UWAN虚拟路由器信息""" diff --git a/ucloud/version.py b/ucloud/version.py index 0d2df48..0a33a30 100644 --- a/ucloud/version.py +++ b/ucloud/version.py @@ -1 +1 @@ -version = "0.11.123" +version = "0.11.124"