fix silences

This commit is contained in:
Domas
2021-02-22 16:51:31 +02:00
parent 9cc5b1adaf
commit e9ec87dc67
2 changed files with 68 additions and 41 deletions
+12 -11
View File
@@ -59,7 +59,7 @@ import (
// get silences
//
// Responses:
// 200: Silences
// 200: GettableSilences
// 400: ValidationError
// swagger:route POST /api/v1/silences alertmanager RouteCreateSilence
@@ -67,7 +67,7 @@ import (
// create silence
//
// Responses:
// 201: Silence
// 201: GettableSilence
// 400: ValidationError
// swagger:route GET /api/v1/silence/{SilenceId} alertmanager RouteGetSilence
@@ -75,7 +75,7 @@ import (
// get silence
//
// Responses:
// 200: Silence
// 200: GettableSilence
// 400: ValidationError
// swagger:route DELETE /api/v1/silence/{SilenceId} alertmanager RouteDeleteSilence
@@ -88,13 +88,8 @@ import (
// swagger:parameters RouteCreateSilence
type CreateSilenceParams struct {
// ID of any existing silence to overwrite
// in:body
// required: false
Id string `json:"id"`
// in:body
Body Silence
Body SilenceBody
}
//swagger:parameters RouteGetSilence RouteDeleteSilence
@@ -104,10 +99,16 @@ type GetDeleteSilenceParams struct {
}
// swagger:model
type Silence amv2.Silence
type SilenceBody struct {
Idd string `json:"id"`
amv2.Silence
}
// swagger:model
type Silences []amv2.Silence
type GettableSilences []amv2.GettableSilences
// swagger:model
type GetableSilence amv2.Silence
// swagger:model
type GettableAlerts amv2.GettableAlerts
+56 -30
View File
@@ -510,10 +510,7 @@
],
"responses": {
"200": {
"description": "Silence",
"schema": {
"$ref": "#/definitions/Silence"
}
"$ref": "#/responses/GettableSilence"
},
"400": {
"description": "ValidationError",
@@ -562,9 +559,9 @@
"operationId": "RouteGetSilences",
"responses": {
"200": {
"description": "Silences",
"description": "GettableSilences",
"schema": {
"$ref": "#/definitions/Silences"
"$ref": "#/definitions/GettableSilences"
}
},
"400": {
@@ -582,29 +579,17 @@
],
"operationId": "RouteCreateSilence",
"parameters": [
{
"x-go-name": "Id",
"description": "ID of any existing silence to overwrite",
"name": "id",
"in": "body",
"schema": {
"type": "string"
}
},
{
"name": "Body",
"in": "body",
"schema": {
"$ref": "#/definitions/Silence"
"$ref": "#/definitions/SilenceBody"
}
}
],
"responses": {
"201": {
"description": "Silence",
"schema": {
"$ref": "#/definitions/Silence"
}
"$ref": "#/responses/GettableSilence"
},
"400": {
"description": "ValidationError",
@@ -1310,9 +1295,19 @@
},
"x-go-package": "github.com/grafana/alerting-api/pkg/api"
},
"GetableSilence": {
"$ref": "#/definitions/silence"
},
"GettableAlerts": {
"$ref": "#/definitions/gettableAlerts"
},
"GettableSilences": {
"type": "array",
"items": {
"$ref": "#/definitions/gettableSilences"
},
"x-go-package": "github.com/grafana/alerting-api/pkg/api"
},
"GlobalConfig": {
"description": "GlobalConfig defines configuration parameters that are valid globally\nunless overwritten.",
"type": "object",
@@ -2110,13 +2105,45 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/components/securejsondata"
},
"Silence": {
"$ref": "#/definitions/silence"
},
"Silences": {
"type": "array",
"items": {
"$ref": "#/definitions/silence"
"SilenceBody": {
"type": "object",
"required": [
"comment",
"createdBy",
"endsAt",
"matchers",
"startsAt"
],
"properties": {
"comment": {
"description": "comment",
"type": "string",
"x-go-name": "Comment"
},
"createdBy": {
"description": "created by",
"type": "string",
"x-go-name": "CreatedBy"
},
"endsAt": {
"description": "ends at",
"type": "string",
"format": "date-time",
"x-go-name": "EndsAt"
},
"id": {
"type": "string",
"x-go-name": "Idd"
},
"matchers": {
"$ref": "#/definitions/matchers"
},
"startsAt": {
"description": "starts at",
"type": "string",
"format": "date-time",
"x-go-name": "StartsAt"
}
},
"x-go-package": "github.com/grafana/alerting-api/pkg/api"
},
@@ -2329,9 +2356,8 @@
"x-go-package": "github.com/prometheus/common/config"
},
"URL": {
"description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.",
"type": "object",
"title": "A URL represents a parsed URL (technically, a URI reference).",
"title": "URL is a custom URL type that allows validation at configuration load time.",
"properties": {
"ForceQuery": {
"type": "boolean"
@@ -2364,7 +2390,7 @@
"$ref": "#/definitions/Userinfo"
}
},
"x-go-package": "net/url"
"x-go-package": "github.com/prometheus/common/config"
},
"UpdateDashboardAclCommand": {
"type": "object",