Skip to content

Commit

Permalink
feat: Add schema types
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeiminds committed Oct 25, 2023
1 parent d00d0c3 commit 8a38a2a
Show file tree
Hide file tree
Showing 37 changed files with 2,004 additions and 24 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ This is the Guance specification written by [Iacker](https://github.com/GuanceCl

| Registry | State | Import |
| --- | --- | --- |
| [![Static Badge](https://img.shields.io/badge/Godoc-gray?style=flat-square&logo=go)](https://pkg.go.dev/github.com/GuanceCloud/guance) | Active | `go get github.com/GuanceCloud/iacker-guance` |
| [![Static Badge](https://img.shields.io/badge/Godoc-gray?style=flat-square&logo=go)](https://pkg.go.dev/github.com/GuanceCloud/iacker-guance) | Active | `go get github.com/GuanceCloud/iacker-guance` |
| [![Static Badge](https://img.shields.io/badge/Protobuf-gray?style=flat-square&logo=go)](https://buf.build/guancecloud/iacker-guance) | Active | Edit buf.yaml & Run `buf mod update` |

## Managed Providers

| Target | State | Documentation |
| --- | --- | --- |
| [Terraform](./targets/go) | Active | [![Static Badge](https://img.shields.io/badge/Terraform-gray?style=flat-square&logo=terraform)](https://registry.terraform.io/providers/GuanceCloud/guance/latest) |
| [KubeVela](./targets/kubevela) | Prototype | |
| [Crossplane](./targets/kubevela) | Prototype | |
| [Terraform](https://github.com/GuanceCloud/terraform-provider-guance) | Active | [![Static Badge](https://img.shields.io/badge/Terraform-gray?style=flat-square&logo=terraform)](https://registry.terraform.io/providers/GuanceCloud/guance/latest) |
| [KubeVela](https://github.com/GuanceCloud/kubevela-addon-guance) | Prototype | |
| [Crossplane](https://github.com/GuanceCloud/crossplane-provider-guance) | Prototype | |

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/alertpolicy/v1/alertpolicy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package pkg.resources.alertpolicy.v1;

option go_package = "github.com/GuanceCloud/openapi/pkg/resources/alertpolicy/v1;v1";
option go_package = "github.com/GuanceCloud/iakcer-server/pkg/resources/alertpolicy/v1;v1";

/*
*/
Expand Down
56 changes: 56 additions & 0 deletions pkg/resources/alertpolicy/v1/alertpolicy.schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

235 changes: 235 additions & 0 deletions pkg/resources/alertpolicy/v1/alertpolicy.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
{
"plural": "alert_policies",
"title": {
"zh": "告警策略",
"en": "Alert Policy"
},
"description": {
"zh": "告警策略是一组规则,定义了何时触发告警。您可以为您的数据源创建告警策略,并设置告警目标接收告警。\n\n观测云支持对监控器的检测结果进行告警策略管理,通过发送告警通知邮件或者群消息通知,让您及时了解监测的异常数据情况,发现问题,解决问题。\n\n关联:\n\n```mermaid\ngraph LR\n\nA[监控器] --> B[告警策略] --> C[通知对象]\n```\n\n注意:\n\n1. 每个监控器创建时必须选择一个告警策略,默认选中「默认」;\n2. 当某个告警策略被删除时,删除告警策略下的监控器将自动归类到「默认」下。",
"en": "Alert policy is a set of rules that define when to trigger an alert. You can create alert policies for your data sources, and set up alert targets to receive alerts.\n\nGuance Cloud supports alert policy management for the results of monitor checks, by sending alert notification emails or group message notifications, so that you can know about the abnormal data situation of the monitoring in time, find problems, and solve problems.\n\nRelationships:\n\n```mermaid\ngraph LR\n\nA[Monitor] --> B[Alert Policy] --> C[Notification]\n```\n\nNotes:\n\n1. When a monitor is created, an alert policy must be selected, and the default is selected by default;\n2. When a certain alert policy is deleted, the monitor under the deleted alert policy will automatically be classified into the default."
},
"models": {
"AlertPolicy": {
"properties": [
{
"name": "name",
"title": {
"zh": "告警策略名",
"en": "Alert Policy Name"
},
"schema": {
"type": "string",
"required": true
}
},
{
"name": "silent_timeout",
"title": {
"zh": "沉默超时时间-时间戳",
"en": "Silent timeout timestamp"
},
"schema": {
"type": "string",
"format": "duration"
}
},
{
"name": "statuses",
"title": {
"zh": "待发送告警事件的 status 值",
"en": "The status value of the event to be sent"
},
"schema": {
"type": "array",
"required": true,
"elem": {
"type": "string",
"enum": [
{
"name": "all",
"value": "ALL",
"title": {
"zh": "全部",
"en": "ALL"
}
},
{
"name": "critical",
"value": "critical",
"title": {
"zh": "严重",
"en": "critical"
}
},
{
"name": "error",
"value": "error",
"title": {
"zh": "错误",
"en": "error"
}
},
{
"name": "warning",
"value": "warning",
"title": {
"zh": "警告",
"en": "warning"
}
},
{
"name": "info",
"value": "info",
"title": {
"zh": "信息",
"en": "info"
}
},
{
"name": "ok",
"value": "ok",
"title": {
"zh": "正常",
"en": "ok"
}
},
{
"name": "nodata",
"value": "nodata",
"title": {
"zh": "无数据",
"en": "nodata"
}
},
{
"name": "nodata_ok",
"value": "nodata_ok",
"title": {
"zh": "无数据正常",
"en": "nodata_ok"
}
},
{
"name": "nodata_as_ok",
"value": "nodata_as_ok",
"title": {
"zh": "无数据当正常",
"en": "nodata_as_ok"
}
}
]
}
}
},
{
"name": "alert_targets",
"title": {
"zh": "告警动作",
"en": "Alert Action"
},
"schema": {
"type": "array",
"elem": {
"type": "object",
"model": "AlertTarget"
}
}
}
]
},
"AlertTarget": {
"properties": [
{
"name": "type",
"title": {
"zh": "告警类型",
"en": "Alert type"
},
"schema": {
"type": "string",
"required": true,
"enum": [
{
"name": "MemberGroup",
"value": "member_group",
"title": {
"zh": "成员组",
"en": "Member group"
}
},
{
"name": "Notification",
"value": "notification",
"title": {
"zh": "通知对象",
"en": "Notification object"
}
}
]
}
},
{
"name": "notification",
"title": {
"zh": "通知",
"en": "Notification"
},
"schema": {
"type": "object",
"required": false,
"model": "TargetNotification"
}
},
{
"name": "member_group",
"title": {
"zh": "成员组",
"en": "Member Group"
},
"schema": {
"type": "object",
"required": false,
"model": "TargetMemberGroup"
}
}
]
},
"TargetMemberGroup": {
"properties": [
{
"name": "id",
"title": {
"zh": "成员组",
"en": "Member Group"
},
"schema": {
"type": "ref",
"required": true,
"ref": "MemberGroup"
}
}
]
},
"TargetNotification": {
"properties": [
{
"name": "id",
"title": {
"zh": "通知对象",
"en": "Notification"
},
"schema": {
"type": "ref",
"required": true,
"ref": "Notification"
}
}
]
}
},
"identifier": {
"primary": [
"/properties/name"
]
}
}
2 changes: 1 addition & 1 deletion pkg/resources/alertpolicy/v1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Notes:
1. When a monitor is created, an alert policy must be selected, and the default is selected by default;
2. When a certain alert policy is deleted, the monitor under the deleted alert policy will automatically be classified into the default.
*/
package v1
package v1
2 changes: 1 addition & 1 deletion pkg/resources/blacklist/v1/blacklist.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package pkg.resources.blacklist.v1;

option go_package = "github.com/GuanceCloud/openapi/pkg/resources/blacklist/v1;v1";
option go_package = "github.com/GuanceCloud/iakcer-server/pkg/resources/blacklist/v1;v1";

/*
*/
Expand Down
57 changes: 57 additions & 0 deletions pkg/resources/blacklist/v1/blacklist.schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8a38a2a

Please sign in to comment.