{"base_path":null,"components":null,"consumes":"[\"application/json\",\"application/json;charset=utf-8\"]","definitions":{"AddMetricNotifyRuleReq":{"description":"设置通知规则。","properties":{"comparison_operator":{"description":"统计指标对应的统计值和threshold进行比较的条件\n* `>=` - 统计指标大于等于threshold时触发\n* `>` - 统计指标大于threshold时触发\n* `=` - 统计指标等于threshold时触发\n* `<=` - 统计指标小于等于threshold时触发\n* `<` - 统计指标小于threshold时触发","example":">=","pattern":"^(\\u003e\\u003d|\\u003e|\\u003d|\\u003c\\u003d|\\u003c)$","type":"string"},"enable":{"default":false,"description":"启禁用规则 true:启用 false:禁用。","example":true,"type":"boolean"},"interval":{"description":"触发通知后;下次通知的间隔时间;默认每天一次","example":1,"maximum":30,"minimum":1,"type":"integer"},"metric_name":{"description":"统计指标名称,目前仅支持固定值:desktop_idle_duration\n同一指标的规则不允许重复\n* `desktop_idle_duration` - 桌面空闲时长, 仅允许设置 '>=' threshold","example":"desktop_idle_duration","maxLength":128,"minLength":1,"type":"string"},"notify_object":{"description":"通知对象;smn的主题urn。","example":"urn:smn:REGION_ID:XXX-XXX-XXX:topicName","maxLength":1024,"minLength":1,"type":"string"},"threshold":{"description":"规则配置-阈值(天)。","example":30,"maximum":30,"minimum":1,"type":"integer"}},"required":["comparison_operator","enable","metric_name","notify_object"]},"ErrorRsp":{"description":"失败时返回的错误对象。","properties":{"error_code":{"description":"错误码。","maxLength":36,"minLength":8,"type":"string"},"error_msg":{"description":"错误描述。","maxLength":512,"minLength":2,"type":"string"}},"required":["error_code","error_msg"]},"MetricNotifyRule":{"description":"指标通知规则。","properties":{"comparison_operator":{"description":"统计指标对应的统计值和threshold进行比较的条件\n* `>=` - 统计指标大于等于threshold时触发\n* `>` - 统计指标大于threshold时触发\n* `=` - 统计指标等于threshold时触发\n* `<=` - 统计指标小于等于threshold时触发\n* `<` - 统计指标小于threshold时触发","example":"","readOnly":true,"type":"string"},"enable":{"default":false,"description":"启禁用规则 true:启用 false:禁用。","example":true,"readOnly":true,"type":"boolean"},"interval":{"description":"触发通知后;下次通知的间隔时间;默认每天一次","example":1,"readOnly":true,"type":"integer"},"metric_name":{"description":"统计指标名称,目前仅支持固定值:desktop_idle_duration\n* `desktop_idle_duration` - 桌面空闲时长","example":"desktop_idle_duration","readOnly":true,"type":"string"},"notify_object":{"description":"通知对象;smn的主题urn。","example":"urn:smn:REGION_ID:XXX-XXX-XXX:topicName","readOnly":true,"type":"string"},"rule_id":{"description":"规则ID。","example":"xxxx-xxxx-xxxx","readOnly":true,"type":"string"},"threshold":{"description":"统计持续周期(天)。","example":30,"readOnly":true,"type":"integer"}}}},"description":null,"group_id":"7383c32d5d5e4d0481c071faeb994404","host":"workspace.cn-north-4.myhuaweicloud.com","id":"29ba770dbbf9475b84f578aee10abb18","info_version":"v2","method":"post","name":"AddMetricNotifyRule","parameters":{},"paths":{"/v2/{project_id}/statistics/notify-rules":{"post":{"consumes":["application/json;charset=UTF-8"],"description":"新增对应指标的通知规则;对应指标满足相应的规则条件时发送通知\n同一指标的规则不允许重复;\n统计指标名称,目前仅支持固定值:desktop_idle_duration\n * `desktop_idle_duration` - 桌面空闲时长, 仅允许设置 '>=' 阈值\n注:需先为云服务添加委托授权,否则无法正常发送通知到SMN","operationId":"AddMetricNotifyRule","parameters":[{"description":"项目ID。","in":"path","maxLength":255,"minLength":1,"name":"project_id","required":true,"type":"string","x-annotations":["@Size(max = 255, min = 1)"],"x-example":"2b31ed520xxxxxxebedb6e57xxxxxxxx"},{"description":"用户Token。\n通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。","in":"header","maxLength":64000,"minLength":1,"name":"X-Auth-Token","required":false,"type":"string","x-annotations":["@Size(max = 64000, min = 1)"],"x-example":"MIIDkgYJKoZIhvcNAQcCoIIDgzCCXXXXXX..."},{"description":"设置通知规则。","in":"body","name":"AddMetricNotifyRuleRequestBody","required":true,"schema":{"$ref":"#/definitions/AddMetricNotifyRuleReq"}}],"produces":["application/json"],"responses":{"200":{"description":"响应成功。","examples":{"application/json":{"comparison_operator":"","enable":true,"interval":1,"metric_name":"desktop_idle_duration","notify_object":"urn:smn:REGION_ID:XXX-XXX-XXX:topicName","rule_id":"xxxx-xxxx-xxxx","threshold":30}},"schema":{"$ref":"#/definitions/MetricNotifyRule"}},"400":{"description":"客户端请求有误。","schema":{"$ref":"#/definitions/ErrorRsp"}},"401":{"description":"鉴权失败。","schema":{"$ref":"#/definitions/ErrorRsp"}},"500":{"description":"内部错误。","schema":{"$ref":"#/definitions/ErrorRsp"}}},"summary":"新增通知规则","tags":["Statistics"],"x-api-type":"open-api","x-apiexplorer-hide":"N","x-apig-group":"internal_token,public","x-apigateway-request-type":"public","x-is-registered":"Y","x-methodAnnotations":["@EnableAuth","@IamAuthMeta(authLevel = IamAuthLevel.PROJECT, abacAction = \"workspace:statistics:createNotifyRules\", authContextInitializerName = \"workspaceCommonAuthContextInitializer\", needApigwJwtAuthCheck = false, rbac = {\"te_admin\", \"wks_adm\"})","@CtsMeta(serviceType = \"Workspace\", resourceType = \"workspace\", traceName = \"AddMetricNotifyRule\")"],"x-request-examples-1":{"comparison_operator":">=","enable":true,"interval":1,"metric_name":"desktop_idle_duration","notify_object":"urn:smn:REGION_ID:XXX-XXX-XXX:topicName","threshold":30},"x-request-examples-text-1":{"comparison_operator":">=","enable":true,"interval":1,"metric_name":"desktop_idle_duration","notify_object":"urn:smn:REGION_ID:XXX-XXX-XXX:topicName","threshold":30},"x-support-sdk":"Y"}}},"product_short":"Workspace","region_id":"cn-north-4","schemes":["HTTPS"],"security_definitions":{"apig-auth-app":{"in":"header","name":"Authorization","type":"apiKey","x-apigateway-auth-type":"AppSigv1"},"apig-auth-iam":{"in":"header","name":"unused","type":"apiKey","x-apigateway-auth-type":"IAM"},"apig-auth-iam-used-authn5":{"in":"header","name":"unused","type":"apiKey","x-apigateway-auth-opt":{"inner-auth-type":"iam_auth_n5"},"x-apigateway-auth-type":"IAM"}},"summary":"新增通知规则","tags":"报表统计","uri":null,"version":"2.0"}