From b632eb77cdf800e72b0d753acc782a68699401f5 Mon Sep 17 00:00:00 2001 From: Abduh Date: Thu, 4 Apr 2024 23:27:12 +0700 Subject: [PATCH] fix: table in doc (#61) --- docs/docs/guides/notification.md | 6 +- docs/docs/reference/api.md | 171 ++++++++++++++++++++++++++++++- docs/docs/reference/cli.md | 9 -- 3 files changed, 171 insertions(+), 15 deletions(-) diff --git a/docs/docs/guides/notification.md b/docs/docs/guides/notification.md index 9a79d8ab..b47181ba 100644 --- a/docs/docs/guides/notification.md +++ b/docs/docs/guides/notification.md @@ -16,11 +16,11 @@ We could send a notification with `POST /notifications` API to a specific receiv | Field Name | Type | Required? | Description | |--- |--- |--- |--- | -| receivers | list of json | yes | Selector of receivers using receiver labels
[
{
"id": 3,
},
{
"type": "slack_channel",
"team": "de-infra"
},
{
"type": "email",
"team": "de-experience"
}
] -
This will fetch all receivers that have the labels. | +| receivers | list of json | yes | Selector of receivers using receiver labels
[
{
"id": 3,
},
{
"type": "slack_channel",
"team": "de-infra"
},
{
"type": "email",
"team": "de-experience"
}
]
+ This will fetch all receivers that have the labels. | | data | json | yes | any data that we want to pass to the message. The data will populate the corresponding template or content variables. | | template | string | no | template name that will be used to populate the message. default template will be used if this value is empty. errors might be thrown if there are errors when parsing template. | -| labels | json | no | If populated, labels would be used by subscription matchers to find the subscribers that listen to specific labels. e.g.
{
"team": "de-infra",
"severity": "CRITICAL"
}
| +| labels | json | no | If populated, labels would be used by subscription matchers to find the subscribers that listen to specific labels. e.g.
{
"team": "de-infra",
"severity": "CRITICAL"
} | ### Example: Sending Notification to Slack diff --git a/docs/docs/reference/api.md b/docs/docs/reference/api.md index 8c6bee2e..7e619deb 100644 --- a/docs/docs/reference/api.md +++ b/docs/docs/reference/api.md @@ -2,7 +2,7 @@ Documentation of our Siren API with gRPC and gRPC-Gateway. -## Version: 0.5 +## Version: 0.6 ### /v1beta1/alerts/{provider_type}/{provider_id} @@ -162,6 +162,65 @@ update a namespace | 200 | A successful response. | [UpdateNamespaceResponse](#updatenamespaceresponse) | | default | An unexpected error response. | [Status](#status) | +### /v1beta1/notifications + +#### GET +##### Summary + +List notifications + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| type | query | | No | string | +| template | query | | No | string | + +##### Responses + +| Code | Description | Schema | +| ---- | ----------- | ------ | +| 200 | A successful response. | [ListNotificationsResponse](#listnotificationsresponse) | +| default | An unexpected error response. | [Status](#status) | + +#### POST +##### Summary + +Post an event notification + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| body | body | | Yes | [PostNotificationRequest](#postnotificationrequest) | + +##### Responses + +| Code | Description | Schema | +| ---- | ----------- | ------ | +| 200 | A successful response. | [PostNotificationResponse](#postnotificationresponse) | +| default | An unexpected error response. | [Status](#status) | + +### /v1beta1/notifications/{notification_id}/messages + +#### GET +##### Summary + +List messages generated by notification + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| notification_id | path | | Yes | string | + +##### Responses + +| Code | Description | Schema | +| ---- | ----------- | ------ | +| 200 | A successful response. | [ListNotificationMessagesResponse](#listnotificationmessagesresponse) | +| default | An unexpected error response. | [Status](#status) | + ### /v1beta1/providers #### GET @@ -696,6 +755,14 @@ render a template | triggered_at | dateTime | | No | | namespace_id | string (uint64) | | No | | silence_status | string | | No | +| created_at | dateTime | | No | +| updated_at | dateTime | | No | +| group_key | string | | No | +| status | string | | No | +| annotations | object | | No | +| labels | object | | No | +| generator_url | string | | No | +| fingerprint | string | | No | #### Any @@ -758,6 +825,7 @@ render a template | type | string | | No | | labels | object | | No | | configurations | object | | No | +| parent_id | string (uint64) | | No | #### CreateReceiverResponse @@ -788,6 +856,8 @@ render a template | namespace | string (uint64) | | No | | receivers | [ [ReceiverMetadata](#receivermetadata) ] | | No | | match | object | | No | +| metadata | object | | No | +| created_by | string | | No | #### CreateSubscriptionResponse @@ -879,6 +949,18 @@ render a template | ---- | ---- | ----------- | -------- | | namespaces | [ [Namespace](#namespace) ] | | No | +#### ListNotificationMessagesResponse + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| messages | [ [NotificationMessage](#notificationmessage) ] | | No | + +#### ListNotificationsResponse + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| notifications | [ [Notification](#notification) ] | | No | + #### ListProvidersResponse | Name | Type | Description | Required | @@ -928,6 +1010,39 @@ render a template | created_at | dateTime | | No | | updated_at | dateTime | | No | +#### Notification + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | string | | No | +| namespace_id | string (uint64) | | No | +| type | string | | No | +| data | object | | No | +| labels | object | | No | +| valid_duration | string | | No | +| template | string | | No | +| create_at | dateTime | | No | +| unique_key | string | | No | +| receiver_selectors | [ [ReceiverSelector](#receiverselector) ] | | No | + +#### NotificationMessage + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | string | | No | +| notification_id | string | | No | +| status | string | | No | +| receiver_type | string | | No | +| details | object | | No | +| last_error | string | | No | +| max_tries | string (uint64) | | No | +| try_count | string (uint64) | | No | +| retryable | boolean | | No | +| expired_at | dateTime | | No | +| created_at | dateTime | | No | +| updated_at | dateTime | | No | +| configs | object | | No | + #### NotifyReceiverResponse | Name | Type | Description | Required | @@ -939,13 +1054,28 @@ render a template `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. - The JSON representation for `NullValue` is JSON `null`. +The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value. | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| NullValue | string | `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value. | | +| NullValue | string | `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value. | | + +#### PostNotificationRequest + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| receivers | [ object ] | | No | +| data | object | | No | +| labels | object | | No | +| template | string | | No | + +#### PostNotificationResponse + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| notification_id | string | | No | #### Provider @@ -973,6 +1103,7 @@ render a template | data | object | | No | | created_at | dateTime | | No | | updated_at | dateTime | | No | +| parent_id | string (uint64) | | No | #### ReceiverMetadata @@ -981,6 +1112,12 @@ render a template | id | string (uint64) | | No | | configuration | object | | No | +#### ReceiverSelector + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| receiver_selector | object | | No | + #### RenderTemplateResponse | Name | Type | Description | Required | @@ -1002,6 +1139,12 @@ render a template | updated_at | dateTime | | No | | provider_namespace | string (uint64) | | No | +#### SetConfigResponse + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| SetConfigResponse | object | | | + #### Silence | Name | Type | Description | Required | @@ -1034,6 +1177,15 @@ render a template | match | object | | No | | created_at | dateTime | | No | | updated_at | dateTime | | No | +| metadata | object | | No | +| created_by | string | | No | +| updated_by | string | | No | + +#### SyncRuntimeConfigResponse + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| labels | object | | No | #### Template @@ -1056,6 +1208,13 @@ render a template | default | string | | No | | description | string | | No | +#### TransformToAlertsResponse + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| alerts | [ [Alert](#alert) ] | | No | +| firing_num | string (uint64) | | No | + #### UpdateNamespaceResponse | Name | Type | Description | Required | @@ -1097,6 +1256,12 @@ render a template | ---- | ---- | ----------- | -------- | | id | string (uint64) | | No | +#### UpsertRuleResponse + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| UpsertRuleResponse | object | | | + #### UpsertTemplateRequest | Name | Type | Description | Required | diff --git a/docs/docs/reference/cli.md b/docs/docs/reference/cli.md index 2be63ac1..ac8116e7 100644 --- a/docs/docs/reference/cli.md +++ b/docs/docs/reference/cli.md @@ -166,15 +166,6 @@ Edit a receiver List receivers -### `siren receiver send [flags]` - -Send a receiver notification - -``` --f, --file string Path to the receiver notification message - --id uint receiver id -```` - ### `siren receiver view [flags]` View a receiver details