1
0
mirror of https://github.com/prometheus/alertmanager.git synced 2026-02-05 15:45:34 +01:00

Regenerate v2 models

Signed-off-by: Andrey Kuzmin <andrey.kuzmin@soundcloud.com>
This commit is contained in:
Andrey Kuzmin
2019-04-27 12:44:12 +02:00
parent eb8345e72f
commit 287c149f92
2 changed files with 20 additions and 10 deletions

View File

@@ -26,6 +26,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// AlertGroup alert group
@@ -33,13 +34,16 @@ import (
type AlertGroup struct {
// alerts
// Required: true
Alerts []*GettableAlert `json:"alerts"`
// labels
Labels LabelSet `json:"labels,omitempty"`
// Required: true
Labels LabelSet `json:"labels"`
// receiver
Receiver *Receiver `json:"receiver,omitempty"`
// Required: true
Receiver *Receiver `json:"receiver"`
}
// Validate validates this alert group
@@ -66,8 +70,8 @@ func (m *AlertGroup) Validate(formats strfmt.Registry) error {
func (m *AlertGroup) validateAlerts(formats strfmt.Registry) error {
if swag.IsZero(m.Alerts) { // not required
return nil
if err := validate.Required("alerts", "body", m.Alerts); err != nil {
return err
}
for i := 0; i < len(m.Alerts); i++ {
@@ -91,10 +95,6 @@ func (m *AlertGroup) validateAlerts(formats strfmt.Registry) error {
func (m *AlertGroup) validateLabels(formats strfmt.Registry) error {
if swag.IsZero(m.Labels) { // not required
return nil
}
if err := m.Labels.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("labels")
@@ -107,8 +107,8 @@ func (m *AlertGroup) validateLabels(formats strfmt.Registry) error {
func (m *AlertGroup) validateReceiver(formats strfmt.Registry) error {
if swag.IsZero(m.Receiver) { // not required
return nil
if err := validate.Required("receiver", "body", m.Receiver); err != nil {
return err
}
if m.Receiver != nil {

View File

@@ -395,6 +395,11 @@ func init() {
},
"alertGroup": {
"type": "object",
"required": [
"labels",
"receiver",
"alerts"
],
"properties": {
"alerts": {
"type": "array",
@@ -1199,6 +1204,11 @@ func init() {
},
"alertGroup": {
"type": "object",
"required": [
"labels",
"receiver",
"alerts"
],
"properties": {
"alerts": {
"type": "array",