POST alert-notifications spec

This commit is contained in:
Sofia Papagiannaki committed 2021-02-17 13:16:50 +02:00
1 parent 82430b7dc5
commit 8c558e42bd
2 files changed
+176 -11

No files matched your search

+30 -4
View File
@@ -19,9 +19,11 @@
// swagger:meta
package models
import "github.com/grafana/grafana/pkg/models"
import (
"github.com/grafana/grafana/pkg/models"
)
// swagger:route POST /api/dashboards/db RoutePostGrDashboards
// swagger:route POST /api/dashboards/db grafana RoutePostGrDashboards
//
// creates a dashboard with alerts
//
@@ -31,7 +33,7 @@ import "github.com/grafana/grafana/pkg/models"
// 200: Ok
// 400: BadRequest
// 401: Unauthorized
// 403: QuotaExceeded
// 403: PermissionDenied
// 412: PreconditionFailed
// 500: Err
@@ -54,7 +56,7 @@ type BadRequest struct{}
type Unauthorized struct{}
// swagger:model
type QuotaExceeded struct{}
type PermissionDenied struct{}
// swagger:model
type PreconditionFailed struct{}
@@ -64,3 +66,27 @@ type Err struct {
Message string
Error error
}
// swagger:model
type Conflict struct{}
// swagger:route POST /api/alert-notifications grafana RoutePostNotifiers
//
// creates a dashboard with alerts
//
// Schemes: http, https
//
// Responses:
// 200: Ok
// 401: Unauthorized
// 409: Conflict
// 500: Err
// swagger:parameters RoutePostNotifiers
type RoutePostNotifiersConfig struct {
// in:body
Body CreateAlertNotificationCommand
}
// swagger:model
type CreateAlertNotificationCommand models.CreateAlertNotificationCommand
+146 -7
View File
@@ -16,6 +16,54 @@
},
"basePath": "/api/v1",
"paths": {
"/api/alert-notifications": {
"post": {
"description": "creates a dashboard with alerts",
"schemes": [
"http",
"https"
],
"tags": [
"grafana"
],
"operationId": "RoutePostNotifiers",
"parameters": [
{
"name": "Body",
"in": "body",
"schema": {
"$ref": "#/definitions/CreateAlertNotificationCommand"
}
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/Ok"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/Unauthorized"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/Conflict"
}
},
"500": {
"description": "Err",
"schema": {
"$ref": "#/definitions/Err"
}
}
}
}
},
"/api/dashboards/db": {
"post": {
"description": "creates a dashboard with alerts",
@@ -23,6 +71,9 @@
"http",
"https"
],
"tags": [
"grafana"
],
"operationId": "RoutePostGrDashboards",
"parameters": [
{
@@ -53,9 +104,9 @@
}
},
"403": {
"description": "QuotaExceeded",
"description": "PermissionDenied",
"schema": {
"$ref": "#/definitions/QuotaExceeded"
"$ref": "#/definitions/PermissionDenied"
}
},
"412": {
@@ -115,6 +166,53 @@
"type": "object",
"x-go-package": "github.com/grafana/alerting-api/pkg/models"
},
"AlertNotification": {
"type": "object",
"properties": {
"created": {
"type": "string",
"format": "date-time",
"x-go-name": "Created"
},
"disableResolveMessage": {
"type": "boolean",
"x-go-name": "DisableResolveMessage"
},
"frequency": {
"$ref": "#/definitions/Duration"
},
"id": {
"type": "integer",
"format": "int64",
"x-go-name": "Id"
},
"isDefault": {
"type": "boolean",
"x-go-name": "IsDefault"
},
"name": {
"type": "string",
"x-go-name": "Name"
},
"sendReminder": {
"type": "boolean",
"x-go-name": "SendReminder"
},
"settings": {
"$ref": "#/definitions/Json"
},
"type": {
"type": "string",
"x-go-name": "Type"
},
"updated": {
"type": "string",
"format": "date-time",
"x-go-name": "Updated"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"BadRequest": {
"type": "object",
"x-go-package": "github.com/grafana/alerting-api/pkg/models"
@@ -169,6 +267,46 @@
},
"$ref": "#/definitions/Config"
},
"Conflict": {
"type": "object",
"x-go-package": "github.com/grafana/alerting-api/pkg/models"
},
"CreateAlertNotificationCommand": {
"type": "object",
"properties": {
"Result": {
"$ref": "#/definitions/AlertNotification"
},
"disableResolveMessage": {
"type": "boolean",
"x-go-name": "DisableResolveMessage"
},
"frequency": {
"type": "string",
"x-go-name": "Frequency"
},
"isDefault": {
"type": "boolean",
"x-go-name": "IsDefault"
},
"name": {
"type": "string",
"x-go-name": "Name"
},
"sendReminder": {
"type": "boolean",
"x-go-name": "SendReminder"
},
"settings": {
"$ref": "#/definitions/Json"
},
"type": {
"type": "string",
"x-go-name": "Type"
}
},
"$ref": "#/definitions/CreateAlertNotificationCommand"
},
"Dashboard": {
"description": "Dashboard model",
"type": "object",
@@ -234,9 +372,10 @@
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"Duration": {
"description": "A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.",
"description": "Duration wraps time.Duration. It is used to parse the custom duration format\nfrom YAML.\nThis type should not propagate beyond the scope of input/output processing.",
"type": "integer",
"format": "int64",
"x-go-package": "time",
"$ref": "#/definitions/Duration"
},
"EmailConfig": {
@@ -716,6 +855,10 @@
},
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"PermissionDenied": {
"type": "object",
"x-go-package": "github.com/grafana/alerting-api/pkg/models"
},
"PreconditionFailed": {
"type": "object",
"x-go-package": "github.com/grafana/alerting-api/pkg/models"
@@ -773,10 +916,6 @@
},
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"QuotaExceeded": {
"type": "object",
"x-go-package": "github.com/grafana/alerting-api/pkg/models"
},
"Receiver": {
"type": "object",
"title": "Receiver configuration provides configuration on how to contact a receiver.",