grafana/pkg/services/ngalert/api/tooling/definitions/provisioning_templates.go
George Robinson d4256b352d
Docs: Rename Message templates to Notification templates (#59477)
This commit renames "Message templates" to "Notification templates"
in the user interface as it suggests that these templates cannot
be used to template anything other than the message. However, message
templates are much more general and can be used to template other fields
too such as the subject of an email, or the title of a Slack message.
2023-01-18 17:26:34 +00:00

75 lines
1.8 KiB
Go

package definitions
import (
"github.com/grafana/grafana/pkg/services/ngalert/models"
)
// swagger:route GET /api/v1/provisioning/templates provisioning stable RouteGetTemplates
//
// Get all notification templates.
//
// Responses:
// 200: NotificationTemplates
// 404: description: Not found.
// swagger:route GET /api/v1/provisioning/templates/{name} provisioning stable RouteGetTemplate
//
// Get a notification template.
//
// Responses:
// 200: NotificationTemplate
// 404: description: Not found.
// swagger:route PUT /api/v1/provisioning/templates/{name} provisioning stable RoutePutTemplate
//
// Updates an existing notification template.
//
// Consumes:
// - application/json
//
// Responses:
// 202: NotificationTemplate
// 400: ValidationError
// swagger:route DELETE /api/v1/provisioning/templates/{name} provisioning stable RouteDeleteTemplate
//
// Delete a template.
//
// Responses:
// 204: description: The template was deleted successfully.
// swagger:parameters RouteGetTemplate RoutePutTemplate RouteDeleteTemplate
type RouteGetTemplateParam struct {
// Template Name
// in:path
Name string `json:"name"`
}
// swagger:model
type NotificationTemplate struct {
Name string `json:"name"`
Template string `json:"template"`
Provenance models.Provenance `json:"provenance,omitempty"`
}
// swagger:model
type NotificationTemplates []NotificationTemplate
type NotificationTemplateContent struct {
Template string `json:"template"`
}
// swagger:parameters RoutePutTemplate
type NotificationTemplatePayload struct {
// in:body
Body NotificationTemplateContent
}
func (t *NotificationTemplate) ResourceType() string {
return "template"
}
func (t *NotificationTemplate) ResourceID() string {
return t.Name
}