mirror of https://github.com/grafana/grafana
parent
d815bf4a4c
commit
ef7e975584
@ -0,0 +1,11 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// Ack ack
|
||||
//
|
||||
// swagger:model Ack
|
||||
type Ack interface{} |
||||
@ -0,0 +1,120 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// Alert Alert has info for an alert.
|
||||
//
|
||||
// swagger:model Alert
|
||||
type Alert struct { |
||||
|
||||
// active at
|
||||
// Format: date-time
|
||||
ActiveAt strfmt.DateTime `json:"activeAt,omitempty"` |
||||
|
||||
// state
|
||||
State string `json:"state,omitempty"` |
||||
|
||||
// value
|
||||
Value string `json:"value,omitempty"` |
||||
|
||||
// annotations
|
||||
Annotations Labels `json:"annotations,omitempty"` |
||||
|
||||
// labels
|
||||
Labels Labels `json:"labels,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this alert
|
||||
func (m *Alert) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateActiveAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAnnotations(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateLabels(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *Alert) validateActiveAt(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.ActiveAt) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("activeAt", "body", "date-time", m.ActiveAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Alert) validateAnnotations(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Annotations) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Annotations.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("annotations") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Alert) 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") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Alert) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Alert) UnmarshalBinary(b []byte) error { |
||||
var res Alert |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,80 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// AlertDiscovery AlertDiscovery has info for all active alerts.
|
||||
//
|
||||
// swagger:model AlertDiscovery
|
||||
type AlertDiscovery struct { |
||||
|
||||
// alerts
|
||||
Alerts []*Alert `json:"alerts"` |
||||
} |
||||
|
||||
// Validate validates this alert discovery
|
||||
func (m *AlertDiscovery) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAlerts(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertDiscovery) validateAlerts(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Alerts) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Alerts); i++ { |
||||
if swag.IsZero(m.Alerts[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Alerts[i] != nil { |
||||
if err := m.Alerts[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("alerts" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertDiscovery) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertDiscovery) UnmarshalBinary(b []byte) error { |
||||
var res AlertDiscovery |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,128 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// AlertGroup AlertGroup alert group
|
||||
//
|
||||
// swagger:model AlertGroup
|
||||
type AlertGroup struct { |
||||
|
||||
// alerts
|
||||
// Required: true
|
||||
Alerts []*GettableAlert `json:"alerts"` |
||||
|
||||
// labels
|
||||
// Required: true
|
||||
Labels LabelSet `json:"labels"` |
||||
|
||||
// receiver
|
||||
// Required: true
|
||||
Receiver *Receiver `json:"receiver"` |
||||
} |
||||
|
||||
// Validate validates this alert group
|
||||
func (m *AlertGroup) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAlerts(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateLabels(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateReceiver(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertGroup) validateAlerts(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("alerts", "body", m.Alerts); err != nil { |
||||
return err |
||||
} |
||||
|
||||
for i := 0; i < len(m.Alerts); i++ { |
||||
if swag.IsZero(m.Alerts[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Alerts[i] != nil { |
||||
if err := m.Alerts[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("alerts" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertGroup) validateLabels(formats strfmt.Registry) error { |
||||
|
||||
if err := m.Labels.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("labels") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertGroup) validateReceiver(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("receiver", "body", m.Receiver); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if m.Receiver != nil { |
||||
if err := m.Receiver.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("receiver") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertGroup) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertGroup) UnmarshalBinary(b []byte) error { |
||||
var res AlertGroup |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// AlertGroups alert groups
|
||||
//
|
||||
// swagger:model AlertGroups
|
||||
type AlertGroups = AlertGroups |
||||
@ -0,0 +1,44 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// AlertInstancesResponse alert instances response
|
||||
//
|
||||
// swagger:model AlertInstancesResponse
|
||||
type AlertInstancesResponse struct { |
||||
|
||||
// Instances is an array of arrow encoded dataframes
|
||||
// each frame has a single row, and a column for each instance (alert identified by unique labels) with a boolean value (firing/not firing)
|
||||
Instances [][]uint8 `json:"instances"` |
||||
} |
||||
|
||||
// Validate validates this alert instances response
|
||||
func (m *AlertInstancesResponse) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertInstancesResponse) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertInstancesResponse) UnmarshalBinary(b []byte) error { |
||||
var res AlertInstancesResponse |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,136 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// AlertNotification alert notification
|
||||
//
|
||||
// swagger:model AlertNotification
|
||||
type AlertNotification struct { |
||||
|
||||
// created
|
||||
// Format: date-time
|
||||
Created strfmt.DateTime `json:"created,omitempty"` |
||||
|
||||
// disable resolve message
|
||||
DisableResolveMessage bool `json:"disableResolveMessage,omitempty"` |
||||
|
||||
// Id
|
||||
ID int64 `json:"id,omitempty"` |
||||
|
||||
// is default
|
||||
IsDefault bool `json:"isDefault,omitempty"` |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// send reminder
|
||||
SendReminder bool `json:"sendReminder,omitempty"` |
||||
|
||||
// type
|
||||
Type string `json:"type,omitempty"` |
||||
|
||||
// updated
|
||||
// Format: date-time
|
||||
Updated strfmt.DateTime `json:"updated,omitempty"` |
||||
|
||||
// frequency
|
||||
Frequency Duration `json:"frequency,omitempty"` |
||||
|
||||
// secure settings
|
||||
SecureSettings SecureJSONData `json:"secureSettings,omitempty"` |
||||
|
||||
// settings
|
||||
Settings JSON `json:"settings,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this alert notification
|
||||
func (m *AlertNotification) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateCreated(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateUpdated(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSecureSettings(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertNotification) validateCreated(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Created) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("created", "body", "date-time", m.Created.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertNotification) validateUpdated(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Updated) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("updated", "body", "date-time", m.Updated.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertNotification) validateSecureSettings(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SecureSettings) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.SecureSettings.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("secureSettings") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertNotification) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertNotification) UnmarshalBinary(b []byte) error { |
||||
var res AlertNotification |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,81 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// AlertQuery AlertQuery represents a single query associated with an alert definition.
|
||||
//
|
||||
// swagger:model AlertQuery
|
||||
type AlertQuery struct { |
||||
|
||||
// JSON is the raw JSON query and includes the above properties as well as custom properties.
|
||||
Model interface{} `json:"model,omitempty"` |
||||
|
||||
// QueryType is an optional identifier for the type of query.
|
||||
// It can be used to distinguish different types of queries.
|
||||
QueryType string `json:"queryType,omitempty"` |
||||
|
||||
// RefID is the unique identifier of the query, set by the frontend call.
|
||||
RefID string `json:"refId,omitempty"` |
||||
|
||||
// relative time range
|
||||
RelativeTimeRange *RelativeTimeRange `json:"relativeTimeRange,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this alert query
|
||||
func (m *AlertQuery) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateRelativeTimeRange(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertQuery) validateRelativeTimeRange(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.RelativeTimeRange) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.RelativeTimeRange != nil { |
||||
if err := m.RelativeTimeRange.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("relativeTimeRange") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertQuery) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertQuery) UnmarshalBinary(b []byte) error { |
||||
var res AlertQuery |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,71 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// AlertResponse alert response
|
||||
//
|
||||
// swagger:model AlertResponse
|
||||
type AlertResponse struct { |
||||
|
||||
// body
|
||||
Body *AlertResponseBody `json:"Body,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this alert response
|
||||
func (m *AlertResponse) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateBody(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertResponse) validateBody(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Body) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Body != nil { |
||||
if err := m.Body.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("Body") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertResponse) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertResponse) UnmarshalBinary(b []byte) error { |
||||
var res AlertResponse |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,100 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// AlertResponseBody in: body
|
||||
//
|
||||
// swagger:model alertResponseBody
|
||||
type AlertResponseBody struct { |
||||
|
||||
// error
|
||||
Error string `json:"error,omitempty"` |
||||
|
||||
// status
|
||||
Status string `json:"status,omitempty"` |
||||
|
||||
// data
|
||||
Data *AlertDiscovery `json:"data,omitempty"` |
||||
|
||||
// error type
|
||||
ErrorType ErrorType `json:"errorType,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this alert response body
|
||||
func (m *AlertResponseBody) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateData(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateErrorType(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertResponseBody) validateData(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Data) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Data != nil { |
||||
if err := m.Data.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("data") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertResponseBody) validateErrorType(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.ErrorType) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.ErrorType.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("errorType") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertResponseBody) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertResponseBody) UnmarshalBinary(b []byte) error { |
||||
var res AlertResponseBody |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,132 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"encoding/json" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// AlertStatus AlertStatus alert status
|
||||
//
|
||||
// swagger:model AlertStatus
|
||||
type AlertStatus struct { |
||||
|
||||
// inhibited by
|
||||
// Required: true
|
||||
InhibitedBy []string `json:"inhibitedBy"` |
||||
|
||||
// silenced by
|
||||
// Required: true
|
||||
SilencedBy []string `json:"silencedBy"` |
||||
|
||||
// state
|
||||
// Required: true
|
||||
// Enum: [[unprocessed active suppressed]]
|
||||
State *string `json:"state"` |
||||
} |
||||
|
||||
// Validate validates this alert status
|
||||
func (m *AlertStatus) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateInhibitedBy(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSilencedBy(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateState(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertStatus) validateInhibitedBy(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("inhibitedBy", "body", m.InhibitedBy); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertStatus) validateSilencedBy(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("silencedBy", "body", m.SilencedBy); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
var alertStatusTypeStatePropEnum []interface{} |
||||
|
||||
func init() { |
||||
var res []string |
||||
if err := json.Unmarshal([]byte(`["[unprocessed active suppressed]"]`), &res); err != nil { |
||||
panic(err) |
||||
} |
||||
for _, v := range res { |
||||
alertStatusTypeStatePropEnum = append(alertStatusTypeStatePropEnum, v) |
||||
} |
||||
} |
||||
|
||||
const ( |
||||
|
||||
// AlertStatusStateUnprocessedActiveSuppressed captures enum value "[unprocessed active suppressed]"
|
||||
AlertStatusStateUnprocessedActiveSuppressed string = "[unprocessed active suppressed]" |
||||
) |
||||
|
||||
// prop value enum
|
||||
func (m *AlertStatus) validateStateEnum(path, location string, value string) error { |
||||
if err := validate.EnumCase(path, location, value, alertStatusTypeStatePropEnum, true); err != nil { |
||||
return err |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertStatus) validateState(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("state", "body", m.State); err != nil { |
||||
return err |
||||
} |
||||
|
||||
// value enum
|
||||
if err := m.validateStateEnum("state", "body", *m.State); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertStatus) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertStatus) UnmarshalBinary(b []byte) error { |
||||
var res AlertStatus |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,71 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// AlertingConfigResponse alerting config response
|
||||
//
|
||||
// swagger:model AlertingConfigResponse
|
||||
type AlertingConfigResponse struct { |
||||
|
||||
// body
|
||||
Body *UserConfig `json:"Body,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this alerting config response
|
||||
func (m *AlertingConfigResponse) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateBody(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertingConfigResponse) validateBody(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Body) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Body != nil { |
||||
if err := m.Body.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("Body") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertingConfigResponse) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertingConfigResponse) UnmarshalBinary(b []byte) error { |
||||
var res AlertingConfigResponse |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,192 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// AlertingRule adapted from cortex
|
||||
//
|
||||
// swagger:model AlertingRule
|
||||
type AlertingRule struct { |
||||
|
||||
// alerts
|
||||
Alerts []*Alert `json:"alerts"` |
||||
|
||||
// duration
|
||||
Duration float64 `json:"duration,omitempty"` |
||||
|
||||
// evaluation time
|
||||
EvaluationTime float64 `json:"evaluationTime,omitempty"` |
||||
|
||||
// health
|
||||
Health string `json:"health,omitempty"` |
||||
|
||||
// last error
|
||||
LastError string `json:"lastError,omitempty"` |
||||
|
||||
// last evaluation
|
||||
// Format: date-time
|
||||
LastEvaluation strfmt.DateTime `json:"lastEvaluation,omitempty"` |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// query
|
||||
Query string `json:"query,omitempty"` |
||||
|
||||
// State can be "pending", "firing", "inactive".
|
||||
State string `json:"state,omitempty"` |
||||
|
||||
// annotations
|
||||
Annotations Labels `json:"annotations,omitempty"` |
||||
|
||||
// labels
|
||||
Labels Labels `json:"labels,omitempty"` |
||||
|
||||
// type
|
||||
Type RuleType `json:"type,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this alerting rule
|
||||
func (m *AlertingRule) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAlerts(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateLastEvaluation(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAnnotations(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateLabels(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateType(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertingRule) validateAlerts(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Alerts) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Alerts); i++ { |
||||
if swag.IsZero(m.Alerts[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Alerts[i] != nil { |
||||
if err := m.Alerts[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("alerts" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertingRule) validateLastEvaluation(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.LastEvaluation) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("lastEvaluation", "body", "date-time", m.LastEvaluation.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertingRule) validateAnnotations(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Annotations) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Annotations.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("annotations") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertingRule) 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") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertingRule) validateType(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Type) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Type.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("type") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertingRule) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertingRule) UnmarshalBinary(b []byte) error { |
||||
var res AlertingRule |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,64 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// AlertmanagerConfig AlertmanagerConfig alertmanager config
|
||||
//
|
||||
// swagger:model AlertmanagerConfig
|
||||
type AlertmanagerConfig struct { |
||||
|
||||
// original
|
||||
// Required: true
|
||||
Original *string `json:"original"` |
||||
} |
||||
|
||||
// Validate validates this alertmanager config
|
||||
func (m *AlertmanagerConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateOriginal(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *AlertmanagerConfig) validateOriginal(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("original", "body", m.Original); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertmanagerConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AlertmanagerConfig) UnmarshalBinary(b []byte) error { |
||||
var res AlertmanagerConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,165 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// APIAlertingConfig Api alerting config
|
||||
//
|
||||
// swagger:model ApiAlertingConfig
|
||||
type APIAlertingConfig struct { |
||||
|
||||
// inhibit rules
|
||||
InhibitRules []*InhibitRule `json:"inhibit_rules"` |
||||
|
||||
// Override with our superset receiver type
|
||||
Receivers []*APIReceiver `json:"receivers"` |
||||
|
||||
// templates
|
||||
Templates []string `json:"templates"` |
||||
|
||||
// global
|
||||
Global *GlobalConfig `json:"global,omitempty"` |
||||
|
||||
// route
|
||||
Route *Route `json:"route,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this Api alerting config
|
||||
func (m *APIAlertingConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateInhibitRules(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateReceivers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateGlobal(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateRoute(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *APIAlertingConfig) validateInhibitRules(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.InhibitRules) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.InhibitRules); i++ { |
||||
if swag.IsZero(m.InhibitRules[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.InhibitRules[i] != nil { |
||||
if err := m.InhibitRules[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("inhibit_rules" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIAlertingConfig) validateReceivers(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Receivers) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Receivers); i++ { |
||||
if swag.IsZero(m.Receivers[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Receivers[i] != nil { |
||||
if err := m.Receivers[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("receivers" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIAlertingConfig) validateGlobal(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Global) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Global != nil { |
||||
if err := m.Global.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("global") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIAlertingConfig) validateRoute(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Route) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Route != nil { |
||||
if err := m.Route.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("route") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *APIAlertingConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *APIAlertingConfig) UnmarshalBinary(b []byte) error { |
||||
var res APIAlertingConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,334 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// APIReceiver Api receiver
|
||||
//
|
||||
// swagger:model ApiReceiver
|
||||
type APIReceiver struct { |
||||
|
||||
// email configs
|
||||
EmailConfigs []*EmailConfig `json:"email_configs"` |
||||
|
||||
// grafana managed receivers
|
||||
GrafanaManagedReceivers []GrafanaReceiver `json:"grafana_managed_receiver_configs"` |
||||
|
||||
// A unique identifier for this receiver.
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// ops genie configs
|
||||
OpsGenieConfigs []*OpsGenieConfig `json:"opsgenie_configs"` |
||||
|
||||
// pagerduty configs
|
||||
PagerdutyConfigs []*PagerdutyConfig `json:"pagerduty_configs"` |
||||
|
||||
// pushover configs
|
||||
PushoverConfigs []*PushoverConfig `json:"pushover_configs"` |
||||
|
||||
// slack configs
|
||||
SlackConfigs []*SlackConfig `json:"slack_configs"` |
||||
|
||||
// victor ops configs
|
||||
VictorOpsConfigs []*VictorOpsConfig `json:"victorops_configs"` |
||||
|
||||
// webhook configs
|
||||
WebhookConfigs []*WebhookConfig `json:"webhook_configs"` |
||||
|
||||
// wechat configs
|
||||
WechatConfigs []*WechatConfig `json:"wechat_configs"` |
||||
} |
||||
|
||||
// Validate validates this Api receiver
|
||||
func (m *APIReceiver) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateEmailConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateGrafanaManagedReceivers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateOpsGenieConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validatePagerdutyConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validatePushoverConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSlackConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateVictorOpsConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateWebhookConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateWechatConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validateEmailConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.EmailConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.EmailConfigs); i++ { |
||||
if swag.IsZero(m.EmailConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.EmailConfigs[i] != nil { |
||||
if err := m.EmailConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("email_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validateGrafanaManagedReceivers(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.GrafanaManagedReceivers) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.GrafanaManagedReceivers); i++ { |
||||
|
||||
if err := m.GrafanaManagedReceivers[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("grafana_managed_receiver_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validateOpsGenieConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.OpsGenieConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.OpsGenieConfigs); i++ { |
||||
if swag.IsZero(m.OpsGenieConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.OpsGenieConfigs[i] != nil { |
||||
if err := m.OpsGenieConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("opsgenie_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validatePagerdutyConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.PagerdutyConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.PagerdutyConfigs); i++ { |
||||
if swag.IsZero(m.PagerdutyConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.PagerdutyConfigs[i] != nil { |
||||
if err := m.PagerdutyConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("pagerduty_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validatePushoverConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.PushoverConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.PushoverConfigs); i++ { |
||||
if swag.IsZero(m.PushoverConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.PushoverConfigs[i] != nil { |
||||
if err := m.PushoverConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("pushover_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validateSlackConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SlackConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.SlackConfigs); i++ { |
||||
if swag.IsZero(m.SlackConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.SlackConfigs[i] != nil { |
||||
if err := m.SlackConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("slack_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validateVictorOpsConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.VictorOpsConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.VictorOpsConfigs); i++ { |
||||
if swag.IsZero(m.VictorOpsConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.VictorOpsConfigs[i] != nil { |
||||
if err := m.VictorOpsConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("victorops_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validateWebhookConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.WebhookConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.WebhookConfigs); i++ { |
||||
if swag.IsZero(m.WebhookConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.WebhookConfigs[i] != nil { |
||||
if err := m.WebhookConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("webhook_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *APIReceiver) validateWechatConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.WechatConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.WechatConfigs); i++ { |
||||
if swag.IsZero(m.WechatConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.WechatConfigs[i] != nil { |
||||
if err := m.WechatConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("wechat_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *APIReceiver) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *APIReceiver) UnmarshalBinary(b []byte) error { |
||||
var res APIReceiver |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,75 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// BasicAuth BasicAuth contains basic HTTP authentication credentials.
|
||||
//
|
||||
// swagger:model BasicAuth
|
||||
type BasicAuth struct { |
||||
|
||||
// password
|
||||
Password Secret `json:"Password,omitempty"` |
||||
|
||||
// password file
|
||||
PasswordFile string `json:"PasswordFile,omitempty"` |
||||
|
||||
// username
|
||||
Username string `json:"Username,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this basic auth
|
||||
func (m *BasicAuth) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validatePassword(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *BasicAuth) validatePassword(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Password) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Password.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("Password") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *BasicAuth) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *BasicAuth) UnmarshalBinary(b []byte) error { |
||||
var res BasicAuth |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,134 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// ClusterStatus ClusterStatus cluster status
|
||||
//
|
||||
// swagger:model ClusterStatus
|
||||
type ClusterStatus struct { |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// peers
|
||||
Peers []*PeerStatus `json:"peers"` |
||||
|
||||
// status
|
||||
// Required: true
|
||||
// Enum: [[ready settling disabled]]
|
||||
Status *string `json:"status"` |
||||
} |
||||
|
||||
// Validate validates this cluster status
|
||||
func (m *ClusterStatus) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validatePeers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateStatus(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *ClusterStatus) validatePeers(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Peers) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Peers); i++ { |
||||
if swag.IsZero(m.Peers[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Peers[i] != nil { |
||||
if err := m.Peers[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("peers" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
var clusterStatusTypeStatusPropEnum []interface{} |
||||
|
||||
func init() { |
||||
var res []string |
||||
if err := json.Unmarshal([]byte(`["[ready settling disabled]"]`), &res); err != nil { |
||||
panic(err) |
||||
} |
||||
for _, v := range res { |
||||
clusterStatusTypeStatusPropEnum = append(clusterStatusTypeStatusPropEnum, v) |
||||
} |
||||
} |
||||
|
||||
const ( |
||||
|
||||
// ClusterStatusStatusReadySettlingDisabled captures enum value "[ready settling disabled]"
|
||||
ClusterStatusStatusReadySettlingDisabled string = "[ready settling disabled]" |
||||
) |
||||
|
||||
// prop value enum
|
||||
func (m *ClusterStatus) validateStatusEnum(path, location string, value string) error { |
||||
if err := validate.EnumCase(path, location, value, clusterStatusTypeStatusPropEnum, true); err != nil { |
||||
return err |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *ClusterStatus) validateStatus(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("status", "body", m.Status); err != nil { |
||||
return err |
||||
} |
||||
|
||||
// value enum
|
||||
if err := m.validateStatusEnum("status", "body", *m.Status); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ClusterStatus) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ClusterStatus) UnmarshalBinary(b []byte) error { |
||||
var res ClusterStatus |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,98 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// CreateAlertNotificationCommand create alert notification command
|
||||
//
|
||||
// swagger:model CreateAlertNotificationCommand
|
||||
type CreateAlertNotificationCommand struct { |
||||
|
||||
// disable resolve message
|
||||
DisableResolveMessage bool `json:"disableResolveMessage,omitempty"` |
||||
|
||||
// frequency
|
||||
Frequency string `json:"frequency,omitempty"` |
||||
|
||||
// is default
|
||||
IsDefault bool `json:"isDefault,omitempty"` |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// result
|
||||
Result *AlertNotification `json:"Result,omitempty"` |
||||
|
||||
// secure settings
|
||||
SecureSettings map[string]string `json:"secureSettings,omitempty"` |
||||
|
||||
// send reminder
|
||||
SendReminder bool `json:"sendReminder,omitempty"` |
||||
|
||||
// type
|
||||
Type string `json:"type,omitempty"` |
||||
|
||||
// Uid
|
||||
UID string `json:"uid,omitempty"` |
||||
|
||||
// settings
|
||||
Settings JSON `json:"settings,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this create alert notification command
|
||||
func (m *CreateAlertNotificationCommand) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateResult(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *CreateAlertNotificationCommand) validateResult(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Result) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Result != nil { |
||||
if err := m.Result.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("Result") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *CreateAlertNotificationCommand) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *CreateAlertNotificationCommand) UnmarshalBinary(b []byte) error { |
||||
var res CreateAlertNotificationCommand |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,98 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// DashboardACLUpdateItem dashboard Acl update item
|
||||
//
|
||||
// swagger:model DashboardAclUpdateItem
|
||||
type DashboardACLUpdateItem struct { |
||||
|
||||
// team ID
|
||||
TeamID int64 `json:"teamId,omitempty"` |
||||
|
||||
// user ID
|
||||
UserID int64 `json:"userId,omitempty"` |
||||
|
||||
// permission
|
||||
Permission PermissionType `json:"permission,omitempty"` |
||||
|
||||
// role
|
||||
Role RoleType `json:"role,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this dashboard Acl update item
|
||||
func (m *DashboardACLUpdateItem) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validatePermission(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateRole(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *DashboardACLUpdateItem) validatePermission(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Permission) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Permission.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("permission") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *DashboardACLUpdateItem) validateRole(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Role) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Role.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("role") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *DashboardACLUpdateItem) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *DashboardACLUpdateItem) UnmarshalBinary(b []byte) error { |
||||
var res DashboardACLUpdateItem |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// Duration duration
|
||||
//
|
||||
// swagger:model Duration
|
||||
type Duration = Duration |
||||
@ -0,0 +1,172 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// EmailConfig EmailConfig configures notifications via mail.
|
||||
//
|
||||
// swagger:model EmailConfig
|
||||
type EmailConfig struct { |
||||
|
||||
// auth identity
|
||||
AuthIdentity string `json:"auth_identity,omitempty"` |
||||
|
||||
// auth username
|
||||
AuthUsername string `json:"auth_username,omitempty"` |
||||
|
||||
// from
|
||||
From string `json:"from,omitempty"` |
||||
|
||||
// HTML
|
||||
HTML string `json:"html,omitempty"` |
||||
|
||||
// headers
|
||||
Headers map[string]string `json:"headers,omitempty"` |
||||
|
||||
// hello
|
||||
Hello string `json:"hello,omitempty"` |
||||
|
||||
// require TLS
|
||||
RequireTLS bool `json:"require_tls,omitempty"` |
||||
|
||||
// text
|
||||
Text string `json:"text,omitempty"` |
||||
|
||||
// Email address to notify.
|
||||
To string `json:"to,omitempty"` |
||||
|
||||
// v send resolved
|
||||
VSendResolved bool `json:"send_resolved,omitempty"` |
||||
|
||||
// auth password
|
||||
AuthPassword Secret `json:"auth_password,omitempty"` |
||||
|
||||
// auth secret
|
||||
AuthSecret Secret `json:"auth_secret,omitempty"` |
||||
|
||||
// smarthost
|
||||
Smarthost *HostPort `json:"smarthost,omitempty"` |
||||
|
||||
// tls config
|
||||
TLSConfig *TLSConfig `json:"tls_config,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this email config
|
||||
func (m *EmailConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAuthPassword(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAuthSecret(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSmarthost(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateTLSConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *EmailConfig) validateAuthPassword(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.AuthPassword) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.AuthPassword.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("auth_password") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *EmailConfig) validateAuthSecret(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.AuthSecret) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.AuthSecret.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("auth_secret") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *EmailConfig) validateSmarthost(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Smarthost) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Smarthost != nil { |
||||
if err := m.Smarthost.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("smarthost") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *EmailConfig) validateTLSConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.TLSConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.TLSConfig != nil { |
||||
if err := m.TLSConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("tls_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *EmailConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *EmailConfig) UnmarshalBinary(b []byte) error { |
||||
var res EmailConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// ErrorType ErrorType models the different API error types.
|
||||
//
|
||||
// swagger:model ErrorType
|
||||
type ErrorType string |
||||
|
||||
// Validate validates this error type
|
||||
func (m ErrorType) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,105 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// EvalAlertConditionCommand eval alert condition command
|
||||
//
|
||||
// swagger:model EvalAlertConditionCommand
|
||||
type EvalAlertConditionCommand struct { |
||||
|
||||
// condition
|
||||
Condition string `json:"condition,omitempty"` |
||||
|
||||
// data
|
||||
Data []*AlertQuery `json:"data"` |
||||
|
||||
// now
|
||||
// Format: date-time
|
||||
Now strfmt.DateTime `json:"now,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this eval alert condition command
|
||||
func (m *EvalAlertConditionCommand) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateData(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateNow(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *EvalAlertConditionCommand) validateData(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Data) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Data); i++ { |
||||
if swag.IsZero(m.Data[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Data[i] != nil { |
||||
if err := m.Data[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("data" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *EvalAlertConditionCommand) validateNow(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Now) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("now", "body", "date-time", m.Now.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *EvalAlertConditionCommand) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *EvalAlertConditionCommand) UnmarshalBinary(b []byte) error { |
||||
var res EvalAlertConditionCommand |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,269 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// ExtendedReceiver extended receiver
|
||||
//
|
||||
// swagger:model ExtendedReceiver
|
||||
type ExtendedReceiver struct { |
||||
|
||||
// email configs
|
||||
EmailConfigs *EmailConfig `json:"email_configs,omitempty"` |
||||
|
||||
// grafana managed receiver
|
||||
GrafanaManagedReceiver GrafanaReceiver `json:"grafana_managed_receiver,omitempty"` |
||||
|
||||
// opsgenie configs
|
||||
OpsgenieConfigs *OpsGenieConfig `json:"opsgenie_configs,omitempty"` |
||||
|
||||
// pagerduty configs
|
||||
PagerdutyConfigs *PagerdutyConfig `json:"pagerduty_configs,omitempty"` |
||||
|
||||
// pushover configs
|
||||
PushoverConfigs *PushoverConfig `json:"pushover_configs,omitempty"` |
||||
|
||||
// slack configs
|
||||
SlackConfigs *SlackConfig `json:"slack_configs,omitempty"` |
||||
|
||||
// victorops configs
|
||||
VictoropsConfigs *VictorOpsConfig `json:"victorops_configs,omitempty"` |
||||
|
||||
// webhook configs
|
||||
WebhookConfigs *WebhookConfig `json:"webhook_configs,omitempty"` |
||||
|
||||
// wechat configs
|
||||
WechatConfigs *WechatConfig `json:"wechat_configs,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this extended receiver
|
||||
func (m *ExtendedReceiver) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateEmailConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateGrafanaManagedReceiver(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateOpsgenieConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validatePagerdutyConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validatePushoverConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSlackConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateVictoropsConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateWebhookConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateWechatConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validateEmailConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.EmailConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.EmailConfigs != nil { |
||||
if err := m.EmailConfigs.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("email_configs") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validateGrafanaManagedReceiver(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.GrafanaManagedReceiver) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.GrafanaManagedReceiver.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("grafana_managed_receiver") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validateOpsgenieConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.OpsgenieConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.OpsgenieConfigs != nil { |
||||
if err := m.OpsgenieConfigs.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("opsgenie_configs") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validatePagerdutyConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.PagerdutyConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.PagerdutyConfigs != nil { |
||||
if err := m.PagerdutyConfigs.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("pagerduty_configs") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validatePushoverConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.PushoverConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.PushoverConfigs != nil { |
||||
if err := m.PushoverConfigs.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("pushover_configs") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validateSlackConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SlackConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.SlackConfigs != nil { |
||||
if err := m.SlackConfigs.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("slack_configs") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validateVictoropsConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.VictoropsConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.VictoropsConfigs != nil { |
||||
if err := m.VictoropsConfigs.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("victorops_configs") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validateWebhookConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.WebhookConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.WebhookConfigs != nil { |
||||
if err := m.WebhookConfigs.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("webhook_configs") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedReceiver) validateWechatConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.WechatConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.WechatConfigs != nil { |
||||
if err := m.WechatConfigs.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("wechat_configs") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ExtendedReceiver) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ExtendedReceiver) UnmarshalBinary(b []byte) error { |
||||
var res ExtendedReceiver |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,89 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// ExtendedRuleNode extended rule node
|
||||
//
|
||||
// swagger:model ExtendedRuleNode
|
||||
type ExtendedRuleNode struct { |
||||
|
||||
// alert
|
||||
Alert string `json:"alert,omitempty"` |
||||
|
||||
// annotations
|
||||
Annotations map[string]string `json:"annotations,omitempty"` |
||||
|
||||
// expr
|
||||
Expr string `json:"expr,omitempty"` |
||||
|
||||
// labels
|
||||
Labels map[string]string `json:"labels,omitempty"` |
||||
|
||||
// record
|
||||
Record string `json:"record,omitempty"` |
||||
|
||||
// for
|
||||
For Duration `json:"for,omitempty"` |
||||
|
||||
// grafana alert
|
||||
GrafanaAlert *ExtendedUpsertAlertDefinitionCommand `json:"grafana_alert,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this extended rule node
|
||||
func (m *ExtendedRuleNode) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateGrafanaAlert(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedRuleNode) validateGrafanaAlert(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.GrafanaAlert) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.GrafanaAlert != nil { |
||||
if err := m.GrafanaAlert.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("grafana_alert") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ExtendedRuleNode) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ExtendedRuleNode) UnmarshalBinary(b []byte) error { |
||||
var res ExtendedRuleNode |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,206 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// ExtendedUpsertAlertDefinitionCommand ExtendedUpsertAlertDefinitionCommand extends UpsertAlertDefinitionCommand
|
||||
// with properties of grafana dashboard alerts
|
||||
//
|
||||
// swagger:model ExtendedUpsertAlertDefinitionCommand
|
||||
type ExtendedUpsertAlertDefinitionCommand struct { |
||||
|
||||
// Condition is the refID of the query or expression to be evaluated
|
||||
Condition string `json:"condition,omitempty"` |
||||
|
||||
// Data is an array of the queries and expressions
|
||||
Data []*AlertQuery `json:"data"` |
||||
|
||||
// execution error state
|
||||
// Enum: [Alerting KeepLastState]
|
||||
ExecutionErrorState string `json:"exec_err_state,omitempty"` |
||||
|
||||
// no data state
|
||||
// Enum: [Alerting NoData KeepLastState OK]
|
||||
NoDataState string `json:"no_data_state,omitempty"` |
||||
|
||||
// Receivers are optional and used for migrating notification channels of existing alerts
|
||||
Receivers []string `json:"receivers"` |
||||
|
||||
// settings
|
||||
Settings map[string]interface{} `json:"settings,omitempty"` |
||||
|
||||
// title
|
||||
Title string `json:"title,omitempty"` |
||||
|
||||
// UID is set only for existing definitions
|
||||
UID string `json:"uid,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this extended upsert alert definition command
|
||||
func (m *ExtendedUpsertAlertDefinitionCommand) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateData(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateExecutionErrorState(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateNoDataState(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedUpsertAlertDefinitionCommand) validateData(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Data) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Data); i++ { |
||||
if swag.IsZero(m.Data[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Data[i] != nil { |
||||
if err := m.Data[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("data" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
var extendedUpsertAlertDefinitionCommandTypeExecutionErrorStatePropEnum []interface{} |
||||
|
||||
func init() { |
||||
var res []string |
||||
if err := json.Unmarshal([]byte(`["Alerting","KeepLastState"]`), &res); err != nil { |
||||
panic(err) |
||||
} |
||||
for _, v := range res { |
||||
extendedUpsertAlertDefinitionCommandTypeExecutionErrorStatePropEnum = append(extendedUpsertAlertDefinitionCommandTypeExecutionErrorStatePropEnum, v) |
||||
} |
||||
} |
||||
|
||||
const ( |
||||
|
||||
// ExtendedUpsertAlertDefinitionCommandExecutionErrorStateAlerting captures enum value "Alerting"
|
||||
ExtendedUpsertAlertDefinitionCommandExecutionErrorStateAlerting string = "Alerting" |
||||
|
||||
// ExtendedUpsertAlertDefinitionCommandExecutionErrorStateKeepLastState captures enum value "KeepLastState"
|
||||
ExtendedUpsertAlertDefinitionCommandExecutionErrorStateKeepLastState string = "KeepLastState" |
||||
) |
||||
|
||||
// prop value enum
|
||||
func (m *ExtendedUpsertAlertDefinitionCommand) validateExecutionErrorStateEnum(path, location string, value string) error { |
||||
if err := validate.EnumCase(path, location, value, extendedUpsertAlertDefinitionCommandTypeExecutionErrorStatePropEnum, true); err != nil { |
||||
return err |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedUpsertAlertDefinitionCommand) validateExecutionErrorState(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.ExecutionErrorState) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
// value enum
|
||||
if err := m.validateExecutionErrorStateEnum("exec_err_state", "body", m.ExecutionErrorState); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
var extendedUpsertAlertDefinitionCommandTypeNoDataStatePropEnum []interface{} |
||||
|
||||
func init() { |
||||
var res []string |
||||
if err := json.Unmarshal([]byte(`["Alerting","NoData","KeepLastState","OK"]`), &res); err != nil { |
||||
panic(err) |
||||
} |
||||
for _, v := range res { |
||||
extendedUpsertAlertDefinitionCommandTypeNoDataStatePropEnum = append(extendedUpsertAlertDefinitionCommandTypeNoDataStatePropEnum, v) |
||||
} |
||||
} |
||||
|
||||
const ( |
||||
|
||||
// ExtendedUpsertAlertDefinitionCommandNoDataStateAlerting captures enum value "Alerting"
|
||||
ExtendedUpsertAlertDefinitionCommandNoDataStateAlerting string = "Alerting" |
||||
|
||||
// ExtendedUpsertAlertDefinitionCommandNoDataStateNoData captures enum value "NoData"
|
||||
ExtendedUpsertAlertDefinitionCommandNoDataStateNoData string = "NoData" |
||||
|
||||
// ExtendedUpsertAlertDefinitionCommandNoDataStateKeepLastState captures enum value "KeepLastState"
|
||||
ExtendedUpsertAlertDefinitionCommandNoDataStateKeepLastState string = "KeepLastState" |
||||
|
||||
// ExtendedUpsertAlertDefinitionCommandNoDataStateOK captures enum value "OK"
|
||||
ExtendedUpsertAlertDefinitionCommandNoDataStateOK string = "OK" |
||||
) |
||||
|
||||
// prop value enum
|
||||
func (m *ExtendedUpsertAlertDefinitionCommand) validateNoDataStateEnum(path, location string, value string) error { |
||||
if err := validate.EnumCase(path, location, value, extendedUpsertAlertDefinitionCommandTypeNoDataStatePropEnum, true); err != nil { |
||||
return err |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *ExtendedUpsertAlertDefinitionCommand) validateNoDataState(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.NoDataState) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
// value enum
|
||||
if err := m.validateNoDataStateEnum("no_data_state", "body", m.NoDataState); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ExtendedUpsertAlertDefinitionCommand) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ExtendedUpsertAlertDefinitionCommand) UnmarshalBinary(b []byte) error { |
||||
var res ExtendedUpsertAlertDefinitionCommand |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,47 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Failure failure
|
||||
//
|
||||
// swagger:model Failure
|
||||
type Failure struct { |
||||
ResponseDetails |
||||
} |
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
func (m *Failure) UnmarshalJSON(raw []byte) error { |
||||
// AO0
|
||||
var aO0 ResponseDetails |
||||
if err := swag.ReadJSON(raw, &aO0); err != nil { |
||||
return err |
||||
} |
||||
m.ResponseDetails = aO0 |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalJSON marshals this object to a JSON structure
|
||||
func (m Failure) MarshalJSON() ([]byte, error) { |
||||
_parts := make([][]byte, 0, 1) |
||||
|
||||
aO0, err := swag.WriteJSON(m.ResponseDetails) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
_parts = append(_parts, aO0) |
||||
return swag.ConcatJSON(_parts...), nil |
||||
} |
||||
|
||||
// Validate validates this failure
|
||||
func (m *Failure) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,253 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// GettableAlert GettableAlert gettable alert
|
||||
//
|
||||
// swagger:model GettableAlert
|
||||
type GettableAlert struct { |
||||
|
||||
// ends at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
EndsAt *strfmt.DateTime `json:"endsAt"` |
||||
|
||||
// fingerprint
|
||||
// Required: true
|
||||
Fingerprint *string `json:"fingerprint"` |
||||
|
||||
// generator URL
|
||||
// Format: uri
|
||||
// Format: uri
|
||||
GeneratorURL strfmt.URI `json:"generatorURL,omitempty"` |
||||
|
||||
// receivers
|
||||
// Required: true
|
||||
Receivers []*Receiver `json:"receivers"` |
||||
|
||||
// starts at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
StartsAt *strfmt.DateTime `json:"startsAt"` |
||||
|
||||
// updated at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
UpdatedAt *strfmt.DateTime `json:"updatedAt"` |
||||
|
||||
// annotations
|
||||
// Required: true
|
||||
Annotations LabelSet `json:"annotations"` |
||||
|
||||
// labels
|
||||
// Required: true
|
||||
Labels LabelSet `json:"labels"` |
||||
|
||||
// status
|
||||
// Required: true
|
||||
Status *AlertStatus `json:"status"` |
||||
} |
||||
|
||||
// Validate validates this gettable alert
|
||||
func (m *GettableAlert) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateEndsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateFingerprint(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateGeneratorURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateReceivers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateStartsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateUpdatedAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAnnotations(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateLabels(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateStatus(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateEndsAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("endsAt", "body", m.EndsAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("endsAt", "body", "date-time", m.EndsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateFingerprint(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("fingerprint", "body", m.Fingerprint); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateGeneratorURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.GeneratorURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("generatorURL", "body", "uri", m.GeneratorURL.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateReceivers(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("receivers", "body", m.Receivers); err != nil { |
||||
return err |
||||
} |
||||
|
||||
for i := 0; i < len(m.Receivers); i++ { |
||||
if swag.IsZero(m.Receivers[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Receivers[i] != nil { |
||||
if err := m.Receivers[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("receivers" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateStartsAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("startsAt", "body", m.StartsAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("startsAt", "body", "date-time", m.StartsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateUpdatedAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("updatedAt", "body", m.UpdatedAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateAnnotations(formats strfmt.Registry) error { |
||||
|
||||
if err := m.Annotations.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("annotations") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateLabels(formats strfmt.Registry) error { |
||||
|
||||
if err := m.Labels.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("labels") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableAlert) validateStatus(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("status", "body", m.Status); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if m.Status != nil { |
||||
if err := m.Status.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("status") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GettableAlert) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *GettableAlert) UnmarshalBinary(b []byte) error { |
||||
var res GettableAlert |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// GettableAlerts gettable alerts
|
||||
//
|
||||
// swagger:model GettableAlerts
|
||||
type GettableAlerts = GettableAlerts |
||||
@ -0,0 +1,214 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// GettableSilence GettableSilence gettable silence
|
||||
//
|
||||
// swagger:model GettableSilence
|
||||
type GettableSilence struct { |
||||
|
||||
// comment
|
||||
// Required: true
|
||||
Comment *string `json:"comment"` |
||||
|
||||
// created by
|
||||
// Required: true
|
||||
CreatedBy *string `json:"createdBy"` |
||||
|
||||
// ends at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
EndsAt *strfmt.DateTime `json:"endsAt"` |
||||
|
||||
// id
|
||||
// Required: true
|
||||
ID *string `json:"id"` |
||||
|
||||
// starts at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
StartsAt *strfmt.DateTime `json:"startsAt"` |
||||
|
||||
// updated at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
UpdatedAt *strfmt.DateTime `json:"updatedAt"` |
||||
|
||||
// matchers
|
||||
// Required: true
|
||||
Matchers Matchers `json:"matchers"` |
||||
|
||||
// status
|
||||
// Required: true
|
||||
Status *SilenceStatus `json:"status"` |
||||
} |
||||
|
||||
// Validate validates this gettable silence
|
||||
func (m *GettableSilence) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateComment(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateCreatedBy(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateEndsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateID(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateStartsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateUpdatedAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateMatchers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateStatus(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableSilence) validateComment(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("comment", "body", m.Comment); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableSilence) validateCreatedBy(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("createdBy", "body", m.CreatedBy); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableSilence) validateEndsAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("endsAt", "body", m.EndsAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("endsAt", "body", "date-time", m.EndsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableSilence) validateID(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("id", "body", m.ID); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableSilence) validateStartsAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("startsAt", "body", m.StartsAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("startsAt", "body", "date-time", m.StartsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableSilence) validateUpdatedAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("updatedAt", "body", m.UpdatedAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableSilence) validateMatchers(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("matchers", "body", m.Matchers); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := m.Matchers.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("matchers") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GettableSilence) validateStatus(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("status", "body", m.Status); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if m.Status != nil { |
||||
if err := m.Status.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("status") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GettableSilence) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *GettableSilence) UnmarshalBinary(b []byte) error { |
||||
var res GettableSilence |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,45 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// GettableSilences GettableSilences gettable silences
|
||||
//
|
||||
// swagger:model GettableSilences
|
||||
type GettableSilences []*GettableSilence |
||||
|
||||
// Validate validates this gettable silences
|
||||
func (m GettableSilences) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
for i := 0; i < len(m); i++ { |
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m[i] != nil { |
||||
if err := m[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName(strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
@ -0,0 +1,376 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// GlobalConfig GlobalConfig defines configuration parameters that are valid globally
|
||||
// unless overwritten.
|
||||
//
|
||||
// swagger:model GlobalConfig
|
||||
type GlobalConfig struct { |
||||
|
||||
// SMTP auth identity
|
||||
SMTPAuthIdentity string `json:"smtp_auth_identity,omitempty"` |
||||
|
||||
// SMTP auth username
|
||||
SMTPAuthUsername string `json:"smtp_auth_username,omitempty"` |
||||
|
||||
// SMTP from
|
||||
SMTPFrom string `json:"smtp_from,omitempty"` |
||||
|
||||
// SMTP hello
|
||||
SMTPHello string `json:"smtp_hello,omitempty"` |
||||
|
||||
// SMTP require TLS
|
||||
SMTPRequireTLS bool `json:"smtp_require_tls,omitempty"` |
||||
|
||||
// we chat API corp ID
|
||||
WeChatAPICorpID string `json:"wechat_api_corp_id,omitempty"` |
||||
|
||||
// http config
|
||||
HTTPConfig *HTTPClientConfig `json:"http_config,omitempty"` |
||||
|
||||
// opsgenie api key
|
||||
OpsgenieAPIKey Secret `json:"opsgenie_api_key,omitempty"` |
||||
|
||||
// opsgenie api url
|
||||
OpsgenieAPIURL *URL `json:"opsgenie_api_url,omitempty"` |
||||
|
||||
// pagerduty url
|
||||
PagerdutyURL *URL `json:"pagerduty_url,omitempty"` |
||||
|
||||
// resolve timeout
|
||||
ResolveTimeout Duration `json:"resolve_timeout,omitempty"` |
||||
|
||||
// slack api url
|
||||
SlackAPIURL SecretURL `json:"slack_api_url,omitempty"` |
||||
|
||||
// smtp auth password
|
||||
SMTPAuthPassword Secret `json:"smtp_auth_password,omitempty"` |
||||
|
||||
// smtp auth secret
|
||||
SMTPAuthSecret Secret `json:"smtp_auth_secret,omitempty"` |
||||
|
||||
// smtp smarthost
|
||||
SMTPSmarthost *HostPort `json:"smtp_smarthost,omitempty"` |
||||
|
||||
// victorops api key
|
||||
VictoropsAPIKey Secret `json:"victorops_api_key,omitempty"` |
||||
|
||||
// victorops api url
|
||||
VictoropsAPIURL *URL `json:"victorops_api_url,omitempty"` |
||||
|
||||
// wechat api secret
|
||||
WechatAPISecret Secret `json:"wechat_api_secret,omitempty"` |
||||
|
||||
// wechat api url
|
||||
WechatAPIURL *URL `json:"wechat_api_url,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this global config
|
||||
func (m *GlobalConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateHTTPConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateOpsgenieAPIKey(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateOpsgenieAPIURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validatePagerdutyURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateResolveTimeout(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSlackAPIURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSMTPAuthPassword(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSMTPAuthSecret(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSMTPSmarthost(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateVictoropsAPIKey(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateVictoropsAPIURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateWechatAPISecret(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateWechatAPIURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateHTTPConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.HTTPConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.HTTPConfig != nil { |
||||
if err := m.HTTPConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("http_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateOpsgenieAPIKey(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.OpsgenieAPIKey) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.OpsgenieAPIKey.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("opsgenie_api_key") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateOpsgenieAPIURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.OpsgenieAPIURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.OpsgenieAPIURL != nil { |
||||
if err := m.OpsgenieAPIURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("opsgenie_api_url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validatePagerdutyURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.PagerdutyURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.PagerdutyURL != nil { |
||||
if err := m.PagerdutyURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("pagerduty_url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateResolveTimeout(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.ResolveTimeout) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.ResolveTimeout.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("resolve_timeout") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateSlackAPIURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SlackAPIURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.SlackAPIURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("slack_api_url") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateSMTPAuthPassword(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SMTPAuthPassword) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.SMTPAuthPassword.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("smtp_auth_password") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateSMTPAuthSecret(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SMTPAuthSecret) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.SMTPAuthSecret.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("smtp_auth_secret") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateSMTPSmarthost(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SMTPSmarthost) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.SMTPSmarthost != nil { |
||||
if err := m.SMTPSmarthost.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("smtp_smarthost") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateVictoropsAPIKey(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.VictoropsAPIKey) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.VictoropsAPIKey.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("victorops_api_key") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateVictoropsAPIURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.VictoropsAPIURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.VictoropsAPIURL != nil { |
||||
if err := m.VictoropsAPIURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("victorops_api_url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateWechatAPISecret(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.WechatAPISecret) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.WechatAPISecret.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("wechat_api_secret") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *GlobalConfig) validateWechatAPIURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.WechatAPIURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.WechatAPIURL != nil { |
||||
if err := m.WechatAPIURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("wechat_api_url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GlobalConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *GlobalConfig) UnmarshalBinary(b []byte) error { |
||||
var res GlobalConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,47 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// GrafanaReceiver grafana receiver
|
||||
//
|
||||
// swagger:model GrafanaReceiver
|
||||
type GrafanaReceiver struct { |
||||
CreateAlertNotificationCommand |
||||
} |
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
func (m *GrafanaReceiver) UnmarshalJSON(raw []byte) error { |
||||
// AO0
|
||||
var aO0 CreateAlertNotificationCommand |
||||
if err := swag.ReadJSON(raw, &aO0); err != nil { |
||||
return err |
||||
} |
||||
m.CreateAlertNotificationCommand = aO0 |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalJSON marshals this object to a JSON structure
|
||||
func (m GrafanaReceiver) MarshalJSON() ([]byte, error) { |
||||
_parts := make([][]byte, 0, 1) |
||||
|
||||
aO0, err := swag.WriteJSON(m.CreateAlertNotificationCommand) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
_parts = append(_parts, aO0) |
||||
return swag.ConcatJSON(_parts...), nil |
||||
} |
||||
|
||||
// Validate validates this grafana receiver
|
||||
func (m *GrafanaReceiver) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,46 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// HostPort HostPort represents a "host:port" network address.
|
||||
//
|
||||
// swagger:model HostPort
|
||||
type HostPort struct { |
||||
|
||||
// host
|
||||
Host string `json:"Host,omitempty"` |
||||
|
||||
// port
|
||||
Port string `json:"Port,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this host port
|
||||
func (m *HostPort) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *HostPort) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *HostPort) UnmarshalBinary(b []byte) error { |
||||
var res HostPort |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,147 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// HTTPClientConfig HTTPClientConfig configures an HTTP client.
|
||||
//
|
||||
// swagger:model HTTPClientConfig
|
||||
type HTTPClientConfig struct { |
||||
|
||||
// basic auth
|
||||
BasicAuth *BasicAuth `json:"BasicAuth,omitempty"` |
||||
|
||||
// bearer token
|
||||
BearerToken Secret `json:"BearerToken,omitempty"` |
||||
|
||||
// The bearer token file for the targets.
|
||||
BearerTokenFile string `json:"BearerTokenFile,omitempty"` |
||||
|
||||
// proxy URL
|
||||
ProxyURL *URL `json:"ProxyURL,omitempty"` |
||||
|
||||
// TLS config
|
||||
TLSConfig *TLSConfig `json:"TLSConfig,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this HTTP client config
|
||||
func (m *HTTPClientConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateBasicAuth(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateBearerToken(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateProxyURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateTLSConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *HTTPClientConfig) validateBasicAuth(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.BasicAuth) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.BasicAuth != nil { |
||||
if err := m.BasicAuth.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("BasicAuth") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *HTTPClientConfig) validateBearerToken(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.BearerToken) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.BearerToken.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("BearerToken") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *HTTPClientConfig) validateProxyURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.ProxyURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.ProxyURL != nil { |
||||
if err := m.ProxyURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("ProxyURL") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *HTTPClientConfig) validateTLSConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.TLSConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.TLSConfig != nil { |
||||
if err := m.TLSConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("TLSConfig") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *HTTPClientConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *HTTPClientConfig) UnmarshalBinary(b []byte) error { |
||||
var res HTTPClientConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,171 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// InhibitRule InhibitRule defines an inhibition rule that mutes alerts that match the
|
||||
// target labels if an alert matching the source labels exists.
|
||||
// Both alerts have to have a set of labels being equal.
|
||||
//
|
||||
// swagger:model InhibitRule
|
||||
type InhibitRule struct { |
||||
|
||||
// SourceMatch defines a set of labels that have to equal the given
|
||||
// value for source alerts. Deprecated. Remove before v1.0 release.
|
||||
SourceMatch map[string]string `json:"source_match,omitempty"` |
||||
|
||||
// TargetMatch defines a set of labels that have to equal the given
|
||||
// value for target alerts. Deprecated. Remove before v1.0 release.
|
||||
TargetMatch map[string]string `json:"target_match,omitempty"` |
||||
|
||||
// equal
|
||||
Equal LabelNames `json:"equal,omitempty"` |
||||
|
||||
// source match re
|
||||
SourceMatchRe MatchRegexps `json:"source_match_re,omitempty"` |
||||
|
||||
// source matchers
|
||||
SourceMatchers Matchers `json:"source_matchers,omitempty"` |
||||
|
||||
// target match re
|
||||
TargetMatchRe MatchRegexps `json:"target_match_re,omitempty"` |
||||
|
||||
// target matchers
|
||||
TargetMatchers Matchers `json:"target_matchers,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this inhibit rule
|
||||
func (m *InhibitRule) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateEqual(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSourceMatchRe(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSourceMatchers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateTargetMatchRe(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateTargetMatchers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *InhibitRule) validateEqual(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Equal) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Equal.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("equal") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *InhibitRule) validateSourceMatchRe(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SourceMatchRe) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.SourceMatchRe.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("source_match_re") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *InhibitRule) validateSourceMatchers(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SourceMatchers) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.SourceMatchers.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("source_matchers") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *InhibitRule) validateTargetMatchRe(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.TargetMatchRe) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.TargetMatchRe.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("target_match_re") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *InhibitRule) validateTargetMatchers(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.TargetMatchers) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.TargetMatchers.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("target_matchers") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *InhibitRule) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *InhibitRule) UnmarshalBinary(b []byte) error { |
||||
var res InhibitRule |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// JSON Json
|
||||
//
|
||||
// swagger:model Json
|
||||
type JSON interface{} |
||||
@ -0,0 +1,43 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Label Label is a key/value pair of strings.
|
||||
//
|
||||
// swagger:model Label
|
||||
type Label struct { |
||||
|
||||
// value
|
||||
Value string `json:"Name,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this label
|
||||
func (m *Label) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Label) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Label) UnmarshalBinary(b []byte) error { |
||||
var res Label |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// LabelName A LabelName is a key for a LabelSet or Metric. It has a value associated
|
||||
// therewith.
|
||||
//
|
||||
// swagger:model LabelName
|
||||
type LabelName string |
||||
|
||||
// Validate validates this label name
|
||||
func (m LabelName) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,39 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// LabelNames LabelNames is a sortable LabelName slice. In implements sort.Interface.
|
||||
//
|
||||
// swagger:model LabelNames
|
||||
type LabelNames []LabelName |
||||
|
||||
// Validate validates this label names
|
||||
func (m LabelNames) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
for i := 0; i < len(m); i++ { |
||||
|
||||
if err := m[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName(strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
|
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// LabelSet LabelSet label set
|
||||
//
|
||||
// swagger:model LabelSet
|
||||
type LabelSet map[string]string |
||||
|
||||
// Validate validates this label set
|
||||
func (m LabelSet) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,22 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// Labels override the labels type with a map for generation.
|
||||
//
|
||||
// The custom marshaling for labels.Labels ends up doing this anyways.
|
||||
//
|
||||
// swagger:model labels
|
||||
type Labels map[string]string |
||||
|
||||
// Validate validates this labels
|
||||
func (m Labels) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,46 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// LotexQuery lotex query
|
||||
//
|
||||
// swagger:model LotexQuery
|
||||
type LotexQuery struct { |
||||
|
||||
// DatasourceUID is required if the query will be sent to grafana to be executed
|
||||
DatasourceUID string `json:"datasourceUid,omitempty"` |
||||
|
||||
// expr
|
||||
Expr string `json:"Expr,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this lotex query
|
||||
func (m *LotexQuery) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *LotexQuery) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *LotexQuery) UnmarshalBinary(b []byte) error { |
||||
var res LotexQuery |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// MatchRegexps MatchRegexps represents a map of Regexp.
|
||||
//
|
||||
// swagger:model MatchRegexps
|
||||
type MatchRegexps map[string]Regexp |
||||
|
||||
// Validate validates this match regexps
|
||||
func (m MatchRegexps) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// MatchType MatchType is an enum for label matching types.
|
||||
//
|
||||
// swagger:model MatchType
|
||||
type MatchType int64 |
||||
|
||||
// Validate validates this match type
|
||||
func (m MatchType) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,98 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// Matcher Matcher matcher
|
||||
//
|
||||
// swagger:model Matcher
|
||||
type Matcher struct { |
||||
|
||||
// is regex
|
||||
// Required: true
|
||||
IsRegex *bool `json:"isRegex"` |
||||
|
||||
// name
|
||||
// Required: true
|
||||
Name *string `json:"name"` |
||||
|
||||
// value
|
||||
// Required: true
|
||||
Value *string `json:"value"` |
||||
} |
||||
|
||||
// Validate validates this matcher
|
||||
func (m *Matcher) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateIsRegex(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateName(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateValue(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *Matcher) validateIsRegex(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("isRegex", "body", m.IsRegex); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Matcher) validateName(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("name", "body", m.Name); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Matcher) validateValue(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("value", "body", m.Value); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Matcher) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Matcher) UnmarshalBinary(b []byte) error { |
||||
var res Matcher |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,45 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Matchers Matchers matchers
|
||||
//
|
||||
// swagger:model Matchers
|
||||
type Matchers []*Matcher |
||||
|
||||
// Validate validates this matchers
|
||||
func (m Matchers) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
for i := 0; i < len(m); i++ { |
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m[i] != nil { |
||||
if err := m[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName(strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
@ -0,0 +1,40 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// NamespaceConfigResponse namespace config response
|
||||
//
|
||||
// swagger:model NamespaceConfigResponse
|
||||
type NamespaceConfigResponse map[string]RuleGroupConfig |
||||
|
||||
// Validate validates this namespace config response
|
||||
func (m NamespaceConfigResponse) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
for k := range m { |
||||
|
||||
if err := validate.Required(k, "body", m[k]); err != nil { |
||||
return err |
||||
} |
||||
if val, ok := m[k]; ok { |
||||
if err := val.Validate(formats); err != nil { |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
@ -0,0 +1,177 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// OpsGenieConfig OpsGenieConfig configures notifications via OpsGenie.
|
||||
//
|
||||
// swagger:model OpsGenieConfig
|
||||
type OpsGenieConfig struct { |
||||
|
||||
// description
|
||||
Description string `json:"description,omitempty"` |
||||
|
||||
// details
|
||||
Details map[string]string `json:"details,omitempty"` |
||||
|
||||
// message
|
||||
Message string `json:"message,omitempty"` |
||||
|
||||
// note
|
||||
Note string `json:"note,omitempty"` |
||||
|
||||
// priority
|
||||
Priority string `json:"priority,omitempty"` |
||||
|
||||
// responders
|
||||
Responders []*OpsGenieConfigResponder `json:"responders"` |
||||
|
||||
// source
|
||||
Source string `json:"source,omitempty"` |
||||
|
||||
// tags
|
||||
Tags string `json:"tags,omitempty"` |
||||
|
||||
// v send resolved
|
||||
VSendResolved bool `json:"send_resolved,omitempty"` |
||||
|
||||
// api key
|
||||
APIKey Secret `json:"api_key,omitempty"` |
||||
|
||||
// api url
|
||||
APIURL *URL `json:"api_url,omitempty"` |
||||
|
||||
// http config
|
||||
HTTPConfig *HTTPClientConfig `json:"http_config,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this ops genie config
|
||||
func (m *OpsGenieConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateResponders(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAPIKey(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAPIURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateHTTPConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *OpsGenieConfig) validateResponders(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Responders) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Responders); i++ { |
||||
if swag.IsZero(m.Responders[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Responders[i] != nil { |
||||
if err := m.Responders[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("responders" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *OpsGenieConfig) validateAPIKey(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.APIKey) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.APIKey.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("api_key") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *OpsGenieConfig) validateAPIURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.APIURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.APIURL != nil { |
||||
if err := m.APIURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("api_url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *OpsGenieConfig) validateHTTPConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.HTTPConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.HTTPConfig != nil { |
||||
if err := m.HTTPConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("http_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OpsGenieConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OpsGenieConfig) UnmarshalBinary(b []byte) error { |
||||
var res OpsGenieConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,52 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// OpsGenieConfigResponder ops genie config responder
|
||||
//
|
||||
// swagger:model OpsGenieConfigResponder
|
||||
type OpsGenieConfigResponder struct { |
||||
|
||||
// One of those 3 should be filled.
|
||||
ID string `json:"id,omitempty"` |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// team, user, escalation, schedule etc.
|
||||
Type string `json:"type,omitempty"` |
||||
|
||||
// username
|
||||
Username string `json:"username,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this ops genie config responder
|
||||
func (m *OpsGenieConfigResponder) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OpsGenieConfigResponder) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OpsGenieConfigResponder) UnmarshalBinary(b []byte) error { |
||||
var res OpsGenieConfigResponder |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,235 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// PagerdutyConfig PagerdutyConfig configures notifications via PagerDuty.
|
||||
//
|
||||
// swagger:model PagerdutyConfig
|
||||
type PagerdutyConfig struct { |
||||
|
||||
// class
|
||||
Class string `json:"class,omitempty"` |
||||
|
||||
// client
|
||||
Client string `json:"client,omitempty"` |
||||
|
||||
// client URL
|
||||
ClientURL string `json:"client_url,omitempty"` |
||||
|
||||
// component
|
||||
Component string `json:"component,omitempty"` |
||||
|
||||
// description
|
||||
Description string `json:"description,omitempty"` |
||||
|
||||
// details
|
||||
Details map[string]string `json:"details,omitempty"` |
||||
|
||||
// group
|
||||
Group string `json:"group,omitempty"` |
||||
|
||||
// images
|
||||
Images []*PagerdutyImage `json:"images"` |
||||
|
||||
// links
|
||||
Links []*PagerdutyLink `json:"links"` |
||||
|
||||
// severity
|
||||
Severity string `json:"severity,omitempty"` |
||||
|
||||
// v send resolved
|
||||
VSendResolved bool `json:"send_resolved,omitempty"` |
||||
|
||||
// http config
|
||||
HTTPConfig *HTTPClientConfig `json:"http_config,omitempty"` |
||||
|
||||
// routing key
|
||||
RoutingKey Secret `json:"routing_key,omitempty"` |
||||
|
||||
// service key
|
||||
ServiceKey Secret `json:"service_key,omitempty"` |
||||
|
||||
// url
|
||||
URL *URL `json:"url,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this pagerduty config
|
||||
func (m *PagerdutyConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateImages(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateLinks(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateHTTPConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateRoutingKey(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateServiceKey(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *PagerdutyConfig) validateImages(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Images) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Images); i++ { |
||||
if swag.IsZero(m.Images[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Images[i] != nil { |
||||
if err := m.Images[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("images" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PagerdutyConfig) validateLinks(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Links) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Links); i++ { |
||||
if swag.IsZero(m.Links[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Links[i] != nil { |
||||
if err := m.Links[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("links" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PagerdutyConfig) validateHTTPConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.HTTPConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.HTTPConfig != nil { |
||||
if err := m.HTTPConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("http_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PagerdutyConfig) validateRoutingKey(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.RoutingKey) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.RoutingKey.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("routing_key") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PagerdutyConfig) validateServiceKey(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.ServiceKey) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.ServiceKey.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("service_key") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PagerdutyConfig) validateURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.URL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.URL != nil { |
||||
if err := m.URL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PagerdutyConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PagerdutyConfig) UnmarshalBinary(b []byte) error { |
||||
var res PagerdutyConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,49 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// PagerdutyImage PagerdutyImage is an image
|
||||
//
|
||||
// swagger:model PagerdutyImage
|
||||
type PagerdutyImage struct { |
||||
|
||||
// alt
|
||||
Alt string `json:"alt,omitempty"` |
||||
|
||||
// href
|
||||
Href string `json:"href,omitempty"` |
||||
|
||||
// src
|
||||
Src string `json:"src,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this pagerduty image
|
||||
func (m *PagerdutyImage) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PagerdutyImage) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PagerdutyImage) UnmarshalBinary(b []byte) error { |
||||
var res PagerdutyImage |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,46 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// PagerdutyLink PagerdutyLink is a link
|
||||
//
|
||||
// swagger:model PagerdutyLink
|
||||
type PagerdutyLink struct { |
||||
|
||||
// href
|
||||
Href string `json:"href,omitempty"` |
||||
|
||||
// text
|
||||
Text string `json:"text,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this pagerduty link
|
||||
func (m *PagerdutyLink) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PagerdutyLink) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PagerdutyLink) UnmarshalBinary(b []byte) error { |
||||
var res PagerdutyLink |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,81 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// PeerStatus PeerStatus peer status
|
||||
//
|
||||
// swagger:model PeerStatus
|
||||
type PeerStatus struct { |
||||
|
||||
// address
|
||||
// Required: true
|
||||
Address *string `json:"address"` |
||||
|
||||
// name
|
||||
// Required: true
|
||||
Name *string `json:"name"` |
||||
} |
||||
|
||||
// Validate validates this peer status
|
||||
func (m *PeerStatus) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAddress(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateName(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *PeerStatus) validateAddress(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("address", "body", m.Address); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PeerStatus) validateName(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("name", "body", m.Name); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PeerStatus) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PeerStatus) UnmarshalBinary(b []byte) error { |
||||
var res PeerStatus |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// PermissionType permission type
|
||||
//
|
||||
// swagger:model PermissionType
|
||||
type PermissionType int64 |
||||
|
||||
// Validate validates this permission type
|
||||
func (m PermissionType) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,45 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Permissions permissions
|
||||
//
|
||||
// swagger:model Permissions
|
||||
type Permissions []*UpdateDashboardACLCommand |
||||
|
||||
// Validate validates this permissions
|
||||
func (m Permissions) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
for i := 0; i < len(m); i++ { |
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m[i] != nil { |
||||
if err := m[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName(strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
@ -0,0 +1,156 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// PostableAlert PostableAlert postable alert
|
||||
//
|
||||
// swagger:model PostableAlert
|
||||
type PostableAlert struct { |
||||
|
||||
// ends at
|
||||
// Format: date-time
|
||||
// Format: date-time
|
||||
EndsAt strfmt.DateTime `json:"endsAt,omitempty"` |
||||
|
||||
// generator URL
|
||||
// Format: uri
|
||||
// Format: uri
|
||||
GeneratorURL strfmt.URI `json:"generatorURL,omitempty"` |
||||
|
||||
// starts at
|
||||
// Format: date-time
|
||||
// Format: date-time
|
||||
StartsAt strfmt.DateTime `json:"startsAt,omitempty"` |
||||
|
||||
// annotations
|
||||
Annotations LabelSet `json:"annotations,omitempty"` |
||||
|
||||
// labels
|
||||
// Required: true
|
||||
Labels LabelSet `json:"labels"` |
||||
} |
||||
|
||||
// Validate validates this postable alert
|
||||
func (m *PostableAlert) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateEndsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateGeneratorURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateStartsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAnnotations(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateLabels(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *PostableAlert) validateEndsAt(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.EndsAt) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("endsAt", "body", "date-time", m.EndsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PostableAlert) validateGeneratorURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.GeneratorURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("generatorURL", "body", "uri", m.GeneratorURL.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PostableAlert) validateStartsAt(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.StartsAt) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("startsAt", "body", "date-time", m.StartsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PostableAlert) validateAnnotations(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Annotations) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Annotations.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("annotations") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PostableAlert) validateLabels(formats strfmt.Registry) error { |
||||
|
||||
if err := m.Labels.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("labels") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PostableAlert) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PostableAlert) UnmarshalBinary(b []byte) error { |
||||
var res PostableAlert |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,147 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// PushoverConfig pushover config
|
||||
//
|
||||
// swagger:model PushoverConfig
|
||||
type PushoverConfig struct { |
||||
|
||||
// HTML
|
||||
HTML bool `json:"html,omitempty"` |
||||
|
||||
// message
|
||||
Message string `json:"message,omitempty"` |
||||
|
||||
// priority
|
||||
Priority string `json:"priority,omitempty"` |
||||
|
||||
// sound
|
||||
Sound string `json:"sound,omitempty"` |
||||
|
||||
// title
|
||||
Title string `json:"title,omitempty"` |
||||
|
||||
// URL
|
||||
URL string `json:"url,omitempty"` |
||||
|
||||
// URL title
|
||||
URLTitle string `json:"url_title,omitempty"` |
||||
|
||||
// v send resolved
|
||||
VSendResolved bool `json:"send_resolved,omitempty"` |
||||
|
||||
// expire
|
||||
Expire Duration `json:"expire,omitempty"` |
||||
|
||||
// http config
|
||||
HTTPConfig *HTTPClientConfig `json:"http_config,omitempty"` |
||||
|
||||
// retry
|
||||
Retry Duration `json:"retry,omitempty"` |
||||
|
||||
// token
|
||||
Token Secret `json:"token,omitempty"` |
||||
|
||||
// user key
|
||||
UserKey Secret `json:"user_key,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this pushover config
|
||||
func (m *PushoverConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateHTTPConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateToken(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateUserKey(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *PushoverConfig) validateHTTPConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.HTTPConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.HTTPConfig != nil { |
||||
if err := m.HTTPConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("http_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PushoverConfig) validateToken(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Token) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Token.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("token") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *PushoverConfig) validateUserKey(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.UserKey) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.UserKey.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("user_key") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PushoverConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PushoverConfig) UnmarshalBinary(b []byte) error { |
||||
var res PushoverConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,307 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Receiver Receiver configuration provides configuration on how to contact a receiver.
|
||||
//
|
||||
// swagger:model Receiver
|
||||
type Receiver struct { |
||||
|
||||
// email configs
|
||||
EmailConfigs []*EmailConfig `json:"email_configs"` |
||||
|
||||
// A unique identifier for this receiver.
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// ops genie configs
|
||||
OpsGenieConfigs []*OpsGenieConfig `json:"opsgenie_configs"` |
||||
|
||||
// pagerduty configs
|
||||
PagerdutyConfigs []*PagerdutyConfig `json:"pagerduty_configs"` |
||||
|
||||
// pushover configs
|
||||
PushoverConfigs []*PushoverConfig `json:"pushover_configs"` |
||||
|
||||
// slack configs
|
||||
SlackConfigs []*SlackConfig `json:"slack_configs"` |
||||
|
||||
// victor ops configs
|
||||
VictorOpsConfigs []*VictorOpsConfig `json:"victorops_configs"` |
||||
|
||||
// webhook configs
|
||||
WebhookConfigs []*WebhookConfig `json:"webhook_configs"` |
||||
|
||||
// wechat configs
|
||||
WechatConfigs []*WechatConfig `json:"wechat_configs"` |
||||
} |
||||
|
||||
// Validate validates this receiver
|
||||
func (m *Receiver) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateEmailConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateOpsGenieConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validatePagerdutyConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validatePushoverConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateSlackConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateVictorOpsConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateWebhookConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateWechatConfigs(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *Receiver) validateEmailConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.EmailConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.EmailConfigs); i++ { |
||||
if swag.IsZero(m.EmailConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.EmailConfigs[i] != nil { |
||||
if err := m.EmailConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("email_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Receiver) validateOpsGenieConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.OpsGenieConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.OpsGenieConfigs); i++ { |
||||
if swag.IsZero(m.OpsGenieConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.OpsGenieConfigs[i] != nil { |
||||
if err := m.OpsGenieConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("opsgenie_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Receiver) validatePagerdutyConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.PagerdutyConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.PagerdutyConfigs); i++ { |
||||
if swag.IsZero(m.PagerdutyConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.PagerdutyConfigs[i] != nil { |
||||
if err := m.PagerdutyConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("pagerduty_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Receiver) validatePushoverConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.PushoverConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.PushoverConfigs); i++ { |
||||
if swag.IsZero(m.PushoverConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.PushoverConfigs[i] != nil { |
||||
if err := m.PushoverConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("pushover_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Receiver) validateSlackConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.SlackConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.SlackConfigs); i++ { |
||||
if swag.IsZero(m.SlackConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.SlackConfigs[i] != nil { |
||||
if err := m.SlackConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("slack_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Receiver) validateVictorOpsConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.VictorOpsConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.VictorOpsConfigs); i++ { |
||||
if swag.IsZero(m.VictorOpsConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.VictorOpsConfigs[i] != nil { |
||||
if err := m.VictorOpsConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("victorops_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Receiver) validateWebhookConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.WebhookConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.WebhookConfigs); i++ { |
||||
if swag.IsZero(m.WebhookConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.WebhookConfigs[i] != nil { |
||||
if err := m.WebhookConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("webhook_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Receiver) validateWechatConfigs(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.WechatConfigs) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.WechatConfigs); i++ { |
||||
if swag.IsZero(m.WechatConfigs[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.WechatConfigs[i] != nil { |
||||
if err := m.WechatConfigs[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("wechat_configs" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Receiver) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Receiver) UnmarshalBinary(b []byte) error { |
||||
var res Receiver |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,14 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// Regexp Regexp is the representation of a compiled regular expression.
|
||||
//
|
||||
// A Regexp is safe for concurrent use by multiple goroutines,
|
||||
// except for configuration methods, such as Longest.
|
||||
//
|
||||
// swagger:model Regexp
|
||||
type Regexp interface{} |
||||
@ -0,0 +1,47 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// RelativeTimeRange RelativeTimeRange is the per query start and end time
|
||||
// for requests.
|
||||
//
|
||||
// swagger:model RelativeTimeRange
|
||||
type RelativeTimeRange struct { |
||||
|
||||
// from
|
||||
From Duration `json:"from,omitempty"` |
||||
|
||||
// to
|
||||
To Duration `json:"to,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this relative time range
|
||||
func (m *RelativeTimeRange) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *RelativeTimeRange) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *RelativeTimeRange) UnmarshalBinary(b []byte) error { |
||||
var res RelativeTimeRange |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// ResponseDetails response details
|
||||
//
|
||||
// swagger:model ResponseDetails
|
||||
type ResponseDetails struct { |
||||
|
||||
// msg
|
||||
Msg string `json:"msg,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this response details
|
||||
func (m *ResponseDetails) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ResponseDetails) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ResponseDetails) UnmarshalBinary(b []byte) error { |
||||
var res ResponseDetails |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// RoleType role type
|
||||
//
|
||||
// swagger:model RoleType
|
||||
type RoleType string |
||||
|
||||
// Validate validates this role type
|
||||
func (m RoleType) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,147 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Route A Route is a node that contains definitions of how to handle alerts.
|
||||
//
|
||||
// swagger:model Route
|
||||
type Route struct { |
||||
|
||||
// continue
|
||||
Continue bool `json:"continue,omitempty"` |
||||
|
||||
// group by str
|
||||
GroupByStr []string `json:"group_by"` |
||||
|
||||
// Deprecated. Remove before v1.0 release.
|
||||
Match map[string]string `json:"match,omitempty"` |
||||
|
||||
// receiver
|
||||
Receiver string `json:"receiver,omitempty"` |
||||
|
||||
// routes
|
||||
Routes []*Route `json:"routes"` |
||||
|
||||
// group interval
|
||||
GroupInterval Duration `json:"group_interval,omitempty"` |
||||
|
||||
// group wait
|
||||
GroupWait Duration `json:"group_wait,omitempty"` |
||||
|
||||
// match re
|
||||
MatchRe MatchRegexps `json:"match_re,omitempty"` |
||||
|
||||
// matchers
|
||||
Matchers Matchers `json:"matchers,omitempty"` |
||||
|
||||
// repeat interval
|
||||
RepeatInterval Duration `json:"repeat_interval,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this route
|
||||
func (m *Route) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateRoutes(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateMatchRe(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateMatchers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *Route) validateRoutes(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Routes) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Routes); i++ { |
||||
if swag.IsZero(m.Routes[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Routes[i] != nil { |
||||
if err := m.Routes[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("routes" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Route) validateMatchRe(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.MatchRe) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.MatchRe.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("match_re") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Route) validateMatchers(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Matchers) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Matchers.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("matchers") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Route) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Route) UnmarshalBinary(b []byte) error { |
||||
var res Route |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,80 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// RuleDiscovery rule discovery
|
||||
//
|
||||
// swagger:model RuleDiscovery
|
||||
type RuleDiscovery struct { |
||||
|
||||
// rule groups
|
||||
RuleGroups []*RuleGroup `json:"groups"` |
||||
} |
||||
|
||||
// Validate validates this rule discovery
|
||||
func (m *RuleDiscovery) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateRuleGroups(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *RuleDiscovery) validateRuleGroups(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.RuleGroups) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.RuleGroups); i++ { |
||||
if swag.IsZero(m.RuleGroups[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.RuleGroups[i] != nil { |
||||
if err := m.RuleGroups[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("groups" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *RuleDiscovery) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *RuleDiscovery) UnmarshalBinary(b []byte) error { |
||||
var res RuleDiscovery |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,116 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// RuleGroup rule group
|
||||
//
|
||||
// swagger:model RuleGroup
|
||||
type RuleGroup struct { |
||||
|
||||
// evaluation time
|
||||
EvaluationTime float64 `json:"evaluationTime,omitempty"` |
||||
|
||||
// file
|
||||
File string `json:"file,omitempty"` |
||||
|
||||
// interval
|
||||
Interval float64 `json:"interval,omitempty"` |
||||
|
||||
// last evaluation
|
||||
// Format: date-time
|
||||
LastEvaluation strfmt.DateTime `json:"lastEvaluation,omitempty"` |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// In order to preserve rule ordering, while exposing type (alerting or recording)
|
||||
// specific properties, both alerting and recording rules are exposed in the
|
||||
// same array.
|
||||
Rules []*AlertingRule `json:"rules"` |
||||
} |
||||
|
||||
// Validate validates this rule group
|
||||
func (m *RuleGroup) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateLastEvaluation(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateRules(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *RuleGroup) validateLastEvaluation(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.LastEvaluation) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := validate.FormatOf("lastEvaluation", "body", "date-time", m.LastEvaluation.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *RuleGroup) validateRules(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Rules) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Rules); i++ { |
||||
if swag.IsZero(m.Rules[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Rules[i] != nil { |
||||
if err := m.Rules[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("rules" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *RuleGroup) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *RuleGroup) UnmarshalBinary(b []byte) error { |
||||
var res RuleGroup |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,86 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// RuleGroupConfig rule group config
|
||||
//
|
||||
// swagger:model RuleGroupConfig
|
||||
type RuleGroupConfig struct { |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// rules
|
||||
Rules []*ExtendedRuleNode `json:"rules"` |
||||
|
||||
// interval
|
||||
Interval Duration `json:"interval,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this rule group config
|
||||
func (m *RuleGroupConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateRules(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *RuleGroupConfig) validateRules(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Rules) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Rules); i++ { |
||||
if swag.IsZero(m.Rules[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Rules[i] != nil { |
||||
if err := m.Rules[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("rules" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *RuleGroupConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *RuleGroupConfig) UnmarshalBinary(b []byte) error { |
||||
var res RuleGroupConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,86 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// RuleGroupConfigResponse rule group config response
|
||||
//
|
||||
// swagger:model RuleGroupConfigResponse
|
||||
type RuleGroupConfigResponse struct { |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// rules
|
||||
Rules []*ExtendedRuleNode `json:"rules"` |
||||
|
||||
// interval
|
||||
Interval Duration `json:"interval,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this rule group config response
|
||||
func (m *RuleGroupConfigResponse) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateRules(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *RuleGroupConfigResponse) validateRules(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Rules) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Rules); i++ { |
||||
if swag.IsZero(m.Rules[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Rules[i] != nil { |
||||
if err := m.Rules[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("rules" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *RuleGroupConfigResponse) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *RuleGroupConfigResponse) UnmarshalBinary(b []byte) error { |
||||
var res RuleGroupConfigResponse |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,71 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// RuleResponse rule response
|
||||
//
|
||||
// swagger:model RuleResponse
|
||||
type RuleResponse struct { |
||||
|
||||
// body
|
||||
Body *RuleResponseBody `json:"Body,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this rule response
|
||||
func (m *RuleResponse) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateBody(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *RuleResponse) validateBody(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Body) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Body != nil { |
||||
if err := m.Body.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("Body") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *RuleResponse) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *RuleResponse) UnmarshalBinary(b []byte) error { |
||||
var res RuleResponse |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,100 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// RuleResponseBody in: body
|
||||
//
|
||||
// swagger:model ruleResponseBody
|
||||
type RuleResponseBody struct { |
||||
|
||||
// error
|
||||
Error string `json:"error,omitempty"` |
||||
|
||||
// status
|
||||
Status string `json:"status,omitempty"` |
||||
|
||||
// data
|
||||
Data *RuleDiscovery `json:"data,omitempty"` |
||||
|
||||
// error type
|
||||
ErrorType ErrorType `json:"errorType,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this rule response body
|
||||
func (m *RuleResponseBody) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateData(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateErrorType(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *RuleResponseBody) validateData(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Data) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Data != nil { |
||||
if err := m.Data.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("data") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *RuleResponseBody) validateErrorType(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.ErrorType) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.ErrorType.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("errorType") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *RuleResponseBody) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *RuleResponseBody) UnmarshalBinary(b []byte) error { |
||||
var res RuleResponseBody |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// RuleType RuleType models the type of a rule.
|
||||
//
|
||||
// swagger:model RuleType
|
||||
type RuleType string |
||||
|
||||
// Validate validates this rule type
|
||||
func (m RuleType) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,75 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Sample Sample is a single sample belonging to a metric.
|
||||
//
|
||||
// swagger:model Sample
|
||||
type Sample struct { |
||||
|
||||
// metric
|
||||
Metric Labels `json:"Metric,omitempty"` |
||||
|
||||
// t
|
||||
T int64 `json:"T,omitempty"` |
||||
|
||||
// v
|
||||
V float64 `json:"V,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this sample
|
||||
func (m *Sample) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateMetric(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *Sample) validateMetric(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Metric) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Metric.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("Metric") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Sample) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Sample) UnmarshalBinary(b []byte) error { |
||||
var res Sample |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// Secret Secret special type for storing secrets.
|
||||
//
|
||||
// swagger:model Secret
|
||||
type Secret string |
||||
|
||||
// Validate validates this secret
|
||||
func (m Secret) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,47 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// SecretURL SecretURL is a URL that must not be revealed on marshaling.
|
||||
//
|
||||
// swagger:model SecretURL
|
||||
type SecretURL struct { |
||||
URL |
||||
} |
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
func (m *SecretURL) UnmarshalJSON(raw []byte) error { |
||||
// AO0
|
||||
var aO0 URL |
||||
if err := swag.ReadJSON(raw, &aO0); err != nil { |
||||
return err |
||||
} |
||||
m.URL = aO0 |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalJSON marshals this object to a JSON structure
|
||||
func (m SecretURL) MarshalJSON() ([]byte, error) { |
||||
_parts := make([][]byte, 0, 1) |
||||
|
||||
aO0, err := swag.WriteJSON(m.URL) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
_parts = append(_parts, aO0) |
||||
return swag.ConcatJSON(_parts...), nil |
||||
} |
||||
|
||||
// Validate validates this secret URL
|
||||
func (m *SecretURL) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
) |
||||
|
||||
// SecureJSONData SecureJsonData is used to store encrypted data (for example in data_source table). Only values are separately
|
||||
// encrypted.
|
||||
//
|
||||
// swagger:model SecureJsonData
|
||||
type SecureJSONData map[string][]uint8 |
||||
|
||||
// Validate validates this secure Json data
|
||||
func (m SecureJSONData) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,149 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// Silence Silence silence
|
||||
//
|
||||
// swagger:model Silence
|
||||
type Silence struct { |
||||
|
||||
// comment
|
||||
// Required: true
|
||||
Comment *string `json:"comment"` |
||||
|
||||
// created by
|
||||
// Required: true
|
||||
CreatedBy *string `json:"createdBy"` |
||||
|
||||
// ends at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
EndsAt *strfmt.DateTime `json:"endsAt"` |
||||
|
||||
// starts at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
StartsAt *strfmt.DateTime `json:"startsAt"` |
||||
|
||||
// matchers
|
||||
// Required: true
|
||||
Matchers Matchers `json:"matchers"` |
||||
} |
||||
|
||||
// Validate validates this silence
|
||||
func (m *Silence) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateComment(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateCreatedBy(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateEndsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateStartsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateMatchers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *Silence) validateComment(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("comment", "body", m.Comment); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Silence) validateCreatedBy(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("createdBy", "body", m.CreatedBy); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Silence) validateEndsAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("endsAt", "body", m.EndsAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("endsAt", "body", "date-time", m.EndsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Silence) validateStartsAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("startsAt", "body", m.StartsAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("startsAt", "body", "date-time", m.StartsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *Silence) validateMatchers(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("matchers", "body", m.Matchers); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := m.Matchers.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("matchers") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Silence) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Silence) UnmarshalBinary(b []byte) error { |
||||
var res Silence |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,152 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// SilenceBody silence body
|
||||
//
|
||||
// swagger:model SilenceBody
|
||||
type SilenceBody struct { |
||||
|
||||
// comment
|
||||
// Required: true
|
||||
Comment *string `json:"comment"` |
||||
|
||||
// created by
|
||||
// Required: true
|
||||
CreatedBy *string `json:"createdBy"` |
||||
|
||||
// ends at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
EndsAt *strfmt.DateTime `json:"endsAt"` |
||||
|
||||
// Id
|
||||
ID string `json:"id,omitempty"` |
||||
|
||||
// starts at
|
||||
// Required: true
|
||||
// Format: date-time
|
||||
StartsAt *strfmt.DateTime `json:"startsAt"` |
||||
|
||||
// matchers
|
||||
// Required: true
|
||||
Matchers Matchers `json:"matchers"` |
||||
} |
||||
|
||||
// Validate validates this silence body
|
||||
func (m *SilenceBody) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateComment(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateCreatedBy(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateEndsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateStartsAt(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateMatchers(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *SilenceBody) validateComment(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("comment", "body", m.Comment); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *SilenceBody) validateCreatedBy(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("createdBy", "body", m.CreatedBy); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *SilenceBody) validateEndsAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("endsAt", "body", m.EndsAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("endsAt", "body", "date-time", m.EndsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *SilenceBody) validateStartsAt(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("startsAt", "body", m.StartsAt); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := validate.FormatOf("startsAt", "body", "date-time", m.StartsAt.String(), formats); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *SilenceBody) validateMatchers(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("matchers", "body", m.Matchers); err != nil { |
||||
return err |
||||
} |
||||
|
||||
if err := m.Matchers.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("matchers") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SilenceBody) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SilenceBody) UnmarshalBinary(b []byte) error { |
||||
var res SilenceBody |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,98 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"encoding/json" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// SilenceStatus SilenceStatus silence status
|
||||
//
|
||||
// swagger:model SilenceStatus
|
||||
type SilenceStatus struct { |
||||
|
||||
// state
|
||||
// Required: true
|
||||
// Enum: [[expired active pending]]
|
||||
State *string `json:"state"` |
||||
} |
||||
|
||||
// Validate validates this silence status
|
||||
func (m *SilenceStatus) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateState(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
var silenceStatusTypeStatePropEnum []interface{} |
||||
|
||||
func init() { |
||||
var res []string |
||||
if err := json.Unmarshal([]byte(`["[expired active pending]"]`), &res); err != nil { |
||||
panic(err) |
||||
} |
||||
for _, v := range res { |
||||
silenceStatusTypeStatePropEnum = append(silenceStatusTypeStatePropEnum, v) |
||||
} |
||||
} |
||||
|
||||
const ( |
||||
|
||||
// SilenceStatusStateExpiredActivePending captures enum value "[expired active pending]"
|
||||
SilenceStatusStateExpiredActivePending string = "[expired active pending]" |
||||
) |
||||
|
||||
// prop value enum
|
||||
func (m *SilenceStatus) validateStateEnum(path, location string, value string) error { |
||||
if err := validate.EnumCase(path, location, value, silenceStatusTypeStatePropEnum, true); err != nil { |
||||
return err |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *SilenceStatus) validateState(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("state", "body", m.State); err != nil { |
||||
return err |
||||
} |
||||
|
||||
// value enum
|
||||
if err := m.validateStateEnum("state", "body", *m.State); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SilenceStatus) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SilenceStatus) UnmarshalBinary(b []byte) error { |
||||
var res SilenceStatus |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,92 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// SlackAction SlackAction configures a single Slack action that is sent with each notification.
|
||||
//
|
||||
// See https://api.slack.com/docs/message-attachments#action_fields and https://api.slack.com/docs/message-buttons
|
||||
// for more information.
|
||||
//
|
||||
// swagger:model SlackAction
|
||||
type SlackAction struct { |
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"` |
||||
|
||||
// style
|
||||
Style string `json:"style,omitempty"` |
||||
|
||||
// text
|
||||
Text string `json:"text,omitempty"` |
||||
|
||||
// type
|
||||
Type string `json:"type,omitempty"` |
||||
|
||||
// URL
|
||||
URL string `json:"url,omitempty"` |
||||
|
||||
// value
|
||||
Value string `json:"value,omitempty"` |
||||
|
||||
// confirm
|
||||
Confirm *SlackConfirmationField `json:"confirm,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this slack action
|
||||
func (m *SlackAction) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateConfirm(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *SlackAction) validateConfirm(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Confirm) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Confirm != nil { |
||||
if err := m.Confirm.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("confirm") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SlackAction) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SlackAction) UnmarshalBinary(b []byte) error { |
||||
var res SlackAction |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,214 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// SlackConfig SlackConfig configures notifications via Slack.
|
||||
//
|
||||
// swagger:model SlackConfig
|
||||
type SlackConfig struct { |
||||
|
||||
// actions
|
||||
Actions []*SlackAction `json:"actions"` |
||||
|
||||
// callback ID
|
||||
CallbackID string `json:"callback_id,omitempty"` |
||||
|
||||
// Slack channel override, (like #other-channel or @username).
|
||||
Channel string `json:"channel,omitempty"` |
||||
|
||||
// color
|
||||
Color string `json:"color,omitempty"` |
||||
|
||||
// fallback
|
||||
Fallback string `json:"fallback,omitempty"` |
||||
|
||||
// fields
|
||||
Fields []*SlackField `json:"fields"` |
||||
|
||||
// footer
|
||||
Footer string `json:"footer,omitempty"` |
||||
|
||||
// icon emoji
|
||||
IconEmoji string `json:"icon_emoji,omitempty"` |
||||
|
||||
// icon URL
|
||||
IconURL string `json:"icon_url,omitempty"` |
||||
|
||||
// image URL
|
||||
ImageURL string `json:"image_url,omitempty"` |
||||
|
||||
// link names
|
||||
LinkNames bool `json:"link_names,omitempty"` |
||||
|
||||
// mrkdwn in
|
||||
MrkdwnIn []string `json:"mrkdwn_in"` |
||||
|
||||
// pretext
|
||||
Pretext string `json:"pretext,omitempty"` |
||||
|
||||
// short fields
|
||||
ShortFields bool `json:"short_fields,omitempty"` |
||||
|
||||
// text
|
||||
Text string `json:"text,omitempty"` |
||||
|
||||
// thumb URL
|
||||
ThumbURL string `json:"thumb_url,omitempty"` |
||||
|
||||
// title
|
||||
Title string `json:"title,omitempty"` |
||||
|
||||
// title link
|
||||
TitleLink string `json:"title_link,omitempty"` |
||||
|
||||
// username
|
||||
Username string `json:"username,omitempty"` |
||||
|
||||
// v send resolved
|
||||
VSendResolved bool `json:"send_resolved,omitempty"` |
||||
|
||||
// api url
|
||||
APIURL SecretURL `json:"api_url,omitempty"` |
||||
|
||||
// http config
|
||||
HTTPConfig *HTTPClientConfig `json:"http_config,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this slack config
|
||||
func (m *SlackConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateActions(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateFields(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAPIURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateHTTPConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *SlackConfig) validateActions(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Actions) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Actions); i++ { |
||||
if swag.IsZero(m.Actions[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Actions[i] != nil { |
||||
if err := m.Actions[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("actions" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *SlackConfig) validateFields(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Fields) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Fields); i++ { |
||||
if swag.IsZero(m.Fields[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Fields[i] != nil { |
||||
if err := m.Fields[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("fields" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *SlackConfig) validateAPIURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.APIURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.APIURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("api_url") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *SlackConfig) validateHTTPConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.HTTPConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.HTTPConfig != nil { |
||||
if err := m.HTTPConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("http_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SlackConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SlackConfig) UnmarshalBinary(b []byte) error { |
||||
var res SlackConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,54 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// SlackConfirmationField SlackConfirmationField protect users from destructive actions or particularly distinguished decisions
|
||||
// by asking them to confirm their button click one more time.
|
||||
// See https://api.slack.com/docs/interactive-message-field-guide#confirmation_fields for more information.
|
||||
//
|
||||
// swagger:model SlackConfirmationField
|
||||
type SlackConfirmationField struct { |
||||
|
||||
// dismiss text
|
||||
DismissText string `json:"dismiss_text,omitempty"` |
||||
|
||||
// ok text
|
||||
OkText string `json:"ok_text,omitempty"` |
||||
|
||||
// text
|
||||
Text string `json:"text,omitempty"` |
||||
|
||||
// title
|
||||
Title string `json:"title,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this slack confirmation field
|
||||
func (m *SlackConfirmationField) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SlackConfirmationField) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SlackConfirmationField) UnmarshalBinary(b []byte) error { |
||||
var res SlackConfirmationField |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,53 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// SlackField SlackField configures a single Slack field that is sent with each notification.
|
||||
//
|
||||
// Each field must contain a title, value, and optionally, a boolean value to indicate if the field
|
||||
// is short enough to be displayed next to other fields designated as short.
|
||||
// See https://api.slack.com/docs/message-attachments#fields for more information.
|
||||
//
|
||||
// swagger:model SlackField
|
||||
type SlackField struct { |
||||
|
||||
// short
|
||||
Short bool `json:"short,omitempty"` |
||||
|
||||
// title
|
||||
Title string `json:"title,omitempty"` |
||||
|
||||
// value
|
||||
Value string `json:"value,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this slack field
|
||||
func (m *SlackField) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SlackField) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SlackField) UnmarshalBinary(b []byte) error { |
||||
var res SlackField |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,47 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// SMTPNotEnabled Smtp not enabled
|
||||
//
|
||||
// swagger:model SmtpNotEnabled
|
||||
type SMTPNotEnabled struct { |
||||
ResponseDetails |
||||
} |
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
func (m *SMTPNotEnabled) UnmarshalJSON(raw []byte) error { |
||||
// AO0
|
||||
var aO0 ResponseDetails |
||||
if err := swag.ReadJSON(raw, &aO0); err != nil { |
||||
return err |
||||
} |
||||
m.ResponseDetails = aO0 |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalJSON marshals this object to a JSON structure
|
||||
func (m SMTPNotEnabled) MarshalJSON() ([]byte, error) { |
||||
_parts := make([][]byte, 0, 1) |
||||
|
||||
aO0, err := swag.WriteJSON(m.ResponseDetails) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
_parts = append(_parts, aO0) |
||||
return swag.ConcatJSON(_parts...), nil |
||||
} |
||||
|
||||
// Validate validates this Smtp not enabled
|
||||
func (m *SMTPNotEnabled) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,47 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Success success
|
||||
//
|
||||
// swagger:model Success
|
||||
type Success struct { |
||||
ResponseDetails |
||||
} |
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
func (m *Success) UnmarshalJSON(raw []byte) error { |
||||
// AO0
|
||||
var aO0 ResponseDetails |
||||
if err := swag.ReadJSON(raw, &aO0); err != nil { |
||||
return err |
||||
} |
||||
m.ResponseDetails = aO0 |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalJSON marshals this object to a JSON structure
|
||||
func (m Success) MarshalJSON() ([]byte, error) { |
||||
_parts := make([][]byte, 0, 1) |
||||
|
||||
aO0, err := swag.WriteJSON(m.ResponseDetails) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
_parts = append(_parts, aO0) |
||||
return swag.ConcatJSON(_parts...), nil |
||||
} |
||||
|
||||
// Validate validates this success
|
||||
func (m *Success) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
@ -0,0 +1,96 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// TestRulePayload test rule payload
|
||||
//
|
||||
// swagger:model TestRulePayload
|
||||
type TestRulePayload struct { |
||||
|
||||
// expr
|
||||
Expr *LotexQuery `json:"expr,omitempty"` |
||||
|
||||
// grafana condition
|
||||
GrafanaCondition *EvalAlertConditionCommand `json:"grafana_condition,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this test rule payload
|
||||
func (m *TestRulePayload) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateExpr(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateGrafanaCondition(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *TestRulePayload) validateExpr(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Expr) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.Expr != nil { |
||||
if err := m.Expr.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("expr") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *TestRulePayload) validateGrafanaCondition(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.GrafanaCondition) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.GrafanaCondition != nil { |
||||
if err := m.GrafanaCondition.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("grafana_condition") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TestRulePayload) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *TestRulePayload) UnmarshalBinary(b []byte) error { |
||||
var res TestRulePayload |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,94 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// TestRuleResponse test rule response
|
||||
//
|
||||
// swagger:model TestRuleResponse
|
||||
type TestRuleResponse struct { |
||||
|
||||
// alerts
|
||||
Alerts Vector `json:"alerts,omitempty"` |
||||
|
||||
// grafana alert instances
|
||||
GrafanaAlertInstances *AlertInstancesResponse `json:"grafana_alert_instances,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this test rule response
|
||||
func (m *TestRuleResponse) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAlerts(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateGrafanaAlertInstances(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *TestRuleResponse) validateAlerts(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Alerts) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.Alerts.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("alerts") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *TestRuleResponse) validateGrafanaAlertInstances(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.GrafanaAlertInstances) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.GrafanaAlertInstances != nil { |
||||
if err := m.GrafanaAlertInstances.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("grafana_alert_instances") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TestRuleResponse) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *TestRuleResponse) UnmarshalBinary(b []byte) error { |
||||
var res TestRuleResponse |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,55 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// TLSConfig TLSConfig configures the options for TLS connections.
|
||||
//
|
||||
// swagger:model TLSConfig
|
||||
type TLSConfig struct { |
||||
|
||||
// The CA cert to use for the targets.
|
||||
CAFile string `json:"CAFile,omitempty"` |
||||
|
||||
// The client cert file for the targets.
|
||||
CertFile string `json:"CertFile,omitempty"` |
||||
|
||||
// Disable target certificate validation.
|
||||
InsecureSkipVerify bool `json:"InsecureSkipVerify,omitempty"` |
||||
|
||||
// The client key file for the targets.
|
||||
KeyFile string `json:"KeyFile,omitempty"` |
||||
|
||||
// Used to verify the hostname for the targets.
|
||||
ServerName string `json:"ServerName,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this TLS config
|
||||
func (m *TLSConfig) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TLSConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *TLSConfig) UnmarshalBinary(b []byte) error { |
||||
var res TLSConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,80 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// UpdateDashboardACLCommand update dashboard Acl command
|
||||
//
|
||||
// swagger:model UpdateDashboardAclCommand
|
||||
type UpdateDashboardACLCommand struct { |
||||
|
||||
// items
|
||||
Items []*DashboardACLUpdateItem `json:"items"` |
||||
} |
||||
|
||||
// Validate validates this update dashboard Acl command
|
||||
func (m *UpdateDashboardACLCommand) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateItems(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *UpdateDashboardACLCommand) validateItems(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.Items) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
for i := 0; i < len(m.Items); i++ { |
||||
if swag.IsZero(m.Items[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m.Items[i] != nil { |
||||
if err := m.Items[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("items" + "." + strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *UpdateDashboardACLCommand) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *UpdateDashboardACLCommand) UnmarshalBinary(b []byte) error { |
||||
var res UpdateDashboardACLCommand |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,87 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// URL A URL represents a parsed URL (technically, a URI reference).
|
||||
//
|
||||
// The general form represented is:
|
||||
//
|
||||
// [scheme:][//[userinfo@]host][/]path[?query][#fragment]
|
||||
//
|
||||
// URLs that do not start with a slash after the scheme are interpreted as:
|
||||
//
|
||||
// scheme:opaque[?query][#fragment]
|
||||
//
|
||||
// Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.
|
||||
// A consequence is that it is impossible to tell which slashes in the Path were
|
||||
// slashes in the raw URL and which were %2f. This distinction is rarely important,
|
||||
// but when it is, the code should use RawPath, an optional field which only gets
|
||||
// set if the default encoding is different from Path.
|
||||
//
|
||||
// URL's String method uses the EscapedPath method to obtain the path. See the
|
||||
// EscapedPath method for more details.
|
||||
//
|
||||
// swagger:model URL
|
||||
type URL struct { |
||||
|
||||
// force query
|
||||
ForceQuery bool `json:"ForceQuery,omitempty"` |
||||
|
||||
// fragment
|
||||
Fragment string `json:"Fragment,omitempty"` |
||||
|
||||
// host
|
||||
Host string `json:"Host,omitempty"` |
||||
|
||||
// opaque
|
||||
Opaque string `json:"Opaque,omitempty"` |
||||
|
||||
// path
|
||||
Path string `json:"Path,omitempty"` |
||||
|
||||
// raw fragment
|
||||
RawFragment string `json:"RawFragment,omitempty"` |
||||
|
||||
// raw path
|
||||
RawPath string `json:"RawPath,omitempty"` |
||||
|
||||
// raw query
|
||||
RawQuery string `json:"RawQuery,omitempty"` |
||||
|
||||
// scheme
|
||||
Scheme string `json:"Scheme,omitempty"` |
||||
|
||||
// user
|
||||
User Userinfo `json:"User,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this URL
|
||||
func (m *URL) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *URL) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *URL) UnmarshalBinary(b []byte) error { |
||||
var res URL |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,74 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// UserConfig user config
|
||||
//
|
||||
// swagger:model UserConfig
|
||||
type UserConfig struct { |
||||
|
||||
// template files
|
||||
TemplateFiles map[string]string `json:"template_files,omitempty"` |
||||
|
||||
// alertmanager config
|
||||
AlertmanagerConfig *APIAlertingConfig `json:"alertmanager_config,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this user config
|
||||
func (m *UserConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAlertmanagerConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *UserConfig) validateAlertmanagerConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.AlertmanagerConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.AlertmanagerConfig != nil { |
||||
if err := m.AlertmanagerConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("alertmanager_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *UserConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *UserConfig) UnmarshalBinary(b []byte) error { |
||||
var res UserConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,14 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// Userinfo The Userinfo type is an immutable encapsulation of username and
|
||||
// password details for a URL. An existing Userinfo value is guaranteed
|
||||
// to have a username set (potentially empty, as allowed by RFC 2396),
|
||||
// and optionally a password.
|
||||
//
|
||||
// swagger:model Userinfo
|
||||
type Userinfo interface{} |
||||
@ -0,0 +1,43 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// ValidationError validation error
|
||||
//
|
||||
// swagger:model ValidationError
|
||||
type ValidationError struct { |
||||
|
||||
// msg
|
||||
Msg string `json:"msg,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this validation error
|
||||
func (m *ValidationError) Validate(formats strfmt.Registry) error { |
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ValidationError) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ValidationError) UnmarshalBinary(b []byte) error { |
||||
var res ValidationError |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,46 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"strconv" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// Vector Vector is basically only an alias for model.Samples, but the
|
||||
// contract is that in a Vector, all Samples have the same timestamp.
|
||||
//
|
||||
// swagger:model Vector
|
||||
type Vector []*Sample |
||||
|
||||
// Validate validates this vector
|
||||
func (m Vector) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
for i := 0; i < len(m); i++ { |
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue |
||||
} |
||||
|
||||
if m[i] != nil { |
||||
if err := m[i].Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName(strconv.Itoa(i)) |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
@ -0,0 +1,149 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
"github.com/go-openapi/validate" |
||||
) |
||||
|
||||
// VersionInfo VersionInfo version info
|
||||
//
|
||||
// swagger:model VersionInfo
|
||||
type VersionInfo struct { |
||||
|
||||
// branch
|
||||
// Required: true
|
||||
Branch *string `json:"branch"` |
||||
|
||||
// build date
|
||||
// Required: true
|
||||
BuildDate *string `json:"buildDate"` |
||||
|
||||
// build user
|
||||
// Required: true
|
||||
BuildUser *string `json:"buildUser"` |
||||
|
||||
// go version
|
||||
// Required: true
|
||||
GoVersion *string `json:"goVersion"` |
||||
|
||||
// revision
|
||||
// Required: true
|
||||
Revision *string `json:"revision"` |
||||
|
||||
// version
|
||||
// Required: true
|
||||
Version *string `json:"version"` |
||||
} |
||||
|
||||
// Validate validates this version info
|
||||
func (m *VersionInfo) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateBranch(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateBuildDate(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateBuildUser(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateGoVersion(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateRevision(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateVersion(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *VersionInfo) validateBranch(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("branch", "body", m.Branch); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *VersionInfo) validateBuildDate(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("buildDate", "body", m.BuildDate); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *VersionInfo) validateBuildUser(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("buildUser", "body", m.BuildUser); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *VersionInfo) validateGoVersion(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("goVersion", "body", m.GoVersion); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *VersionInfo) validateRevision(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("revision", "body", m.Revision); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *VersionInfo) validateVersion(formats strfmt.Registry) error { |
||||
|
||||
if err := validate.Required("version", "body", m.Version); err != nil { |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *VersionInfo) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *VersionInfo) UnmarshalBinary(b []byte) error { |
||||
var res VersionInfo |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,140 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// VictorOpsConfig VictorOpsConfig configures notifications via VictorOps.
|
||||
//
|
||||
// swagger:model VictorOpsConfig
|
||||
type VictorOpsConfig struct { |
||||
|
||||
// custom fields
|
||||
CustomFields map[string]string `json:"custom_fields,omitempty"` |
||||
|
||||
// entity display name
|
||||
EntityDisplayName string `json:"entity_display_name,omitempty"` |
||||
|
||||
// message type
|
||||
MessageType string `json:"message_type,omitempty"` |
||||
|
||||
// monitoring tool
|
||||
MonitoringTool string `json:"monitoring_tool,omitempty"` |
||||
|
||||
// routing key
|
||||
RoutingKey string `json:"routing_key,omitempty"` |
||||
|
||||
// state message
|
||||
StateMessage string `json:"state_message,omitempty"` |
||||
|
||||
// v send resolved
|
||||
VSendResolved bool `json:"send_resolved,omitempty"` |
||||
|
||||
// api key
|
||||
APIKey Secret `json:"api_key,omitempty"` |
||||
|
||||
// api url
|
||||
APIURL *URL `json:"api_url,omitempty"` |
||||
|
||||
// http config
|
||||
HTTPConfig *HTTPClientConfig `json:"http_config,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this victor ops config
|
||||
func (m *VictorOpsConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAPIKey(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAPIURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateHTTPConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *VictorOpsConfig) validateAPIKey(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.APIKey) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.APIKey.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("api_key") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *VictorOpsConfig) validateAPIURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.APIURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.APIURL != nil { |
||||
if err := m.APIURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("api_url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *VictorOpsConfig) validateHTTPConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.HTTPConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.HTTPConfig != nil { |
||||
if err := m.HTTPConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("http_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *VictorOpsConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *VictorOpsConfig) UnmarshalBinary(b []byte) error { |
||||
var res VictorOpsConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,104 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// WebhookConfig WebhookConfig configures notifications via a generic webhook.
|
||||
//
|
||||
// swagger:model WebhookConfig
|
||||
type WebhookConfig struct { |
||||
|
||||
// MaxAlerts is the maximum number of alerts to be sent per webhook message.
|
||||
// Alerts exceeding this threshold will be truncated. Setting this to 0
|
||||
// allows an unlimited number of alerts.
|
||||
MaxAlerts uint64 `json:"max_alerts,omitempty"` |
||||
|
||||
// v send resolved
|
||||
VSendResolved bool `json:"send_resolved,omitempty"` |
||||
|
||||
// http config
|
||||
HTTPConfig *HTTPClientConfig `json:"http_config,omitempty"` |
||||
|
||||
// url
|
||||
URL *URL `json:"url,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this webhook config
|
||||
func (m *WebhookConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateHTTPConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *WebhookConfig) validateHTTPConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.HTTPConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.HTTPConfig != nil { |
||||
if err := m.HTTPConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("http_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *WebhookConfig) validateURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.URL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.URL != nil { |
||||
if err := m.URL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *WebhookConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *WebhookConfig) UnmarshalBinary(b []byte) error { |
||||
var res WebhookConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,143 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models |
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import ( |
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/strfmt" |
||||
"github.com/go-openapi/swag" |
||||
) |
||||
|
||||
// WechatConfig WechatConfig configures notifications via Wechat.
|
||||
//
|
||||
// swagger:model WechatConfig
|
||||
type WechatConfig struct { |
||||
|
||||
// agent ID
|
||||
AgentID string `json:"agent_id,omitempty"` |
||||
|
||||
// corp ID
|
||||
CorpID string `json:"corp_id,omitempty"` |
||||
|
||||
// message
|
||||
Message string `json:"message,omitempty"` |
||||
|
||||
// message type
|
||||
MessageType string `json:"message_type,omitempty"` |
||||
|
||||
// to party
|
||||
ToParty string `json:"to_party,omitempty"` |
||||
|
||||
// to tag
|
||||
ToTag string `json:"to_tag,omitempty"` |
||||
|
||||
// to user
|
||||
ToUser string `json:"to_user,omitempty"` |
||||
|
||||
// v send resolved
|
||||
VSendResolved bool `json:"send_resolved,omitempty"` |
||||
|
||||
// api secret
|
||||
APISecret Secret `json:"api_secret,omitempty"` |
||||
|
||||
// api url
|
||||
APIURL *URL `json:"api_url,omitempty"` |
||||
|
||||
// http config
|
||||
HTTPConfig *HTTPClientConfig `json:"http_config,omitempty"` |
||||
} |
||||
|
||||
// Validate validates this wechat config
|
||||
func (m *WechatConfig) Validate(formats strfmt.Registry) error { |
||||
var res []error |
||||
|
||||
if err := m.validateAPISecret(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateAPIURL(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if err := m.validateHTTPConfig(formats); err != nil { |
||||
res = append(res, err) |
||||
} |
||||
|
||||
if len(res) > 0 { |
||||
return errors.CompositeValidationError(res...) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (m *WechatConfig) validateAPISecret(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.APISecret) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if err := m.APISecret.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("api_secret") |
||||
} |
||||
return err |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *WechatConfig) validateAPIURL(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.APIURL) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.APIURL != nil { |
||||
if err := m.APIURL.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("api_url") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (m *WechatConfig) validateHTTPConfig(formats strfmt.Registry) error { |
||||
|
||||
if swag.IsZero(m.HTTPConfig) { // not required
|
||||
return nil |
||||
} |
||||
|
||||
if m.HTTPConfig != nil { |
||||
if err := m.HTTPConfig.Validate(formats); err != nil { |
||||
if ve, ok := err.(*errors.Validation); ok { |
||||
return ve.ValidateName("http_config") |
||||
} |
||||
return err |
||||
} |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *WechatConfig) MarshalBinary() ([]byte, error) { |
||||
if m == nil { |
||||
return nil, nil |
||||
} |
||||
return swag.WriteJSON(m) |
||||
} |
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *WechatConfig) UnmarshalBinary(b []byte) error { |
||||
var res WechatConfig |
||||
if err := swag.ReadJSON(b, &res); err != nil { |
||||
return err |
||||
} |
||||
*m = res |
||||
return nil |
||||
} |
||||
@ -0,0 +1,186 @@ |
||||
// This file is safe to edit. Once it exists it will not be overwritten
|
||||
|
||||
package restapi |
||||
|
||||
import ( |
||||
"crypto/tls" |
||||
"net/http" |
||||
|
||||
"github.com/go-openapi/errors" |
||||
"github.com/go-openapi/runtime" |
||||
"github.com/go-openapi/runtime/middleware" |
||||
|
||||
"github.com/grafana/alerting-api/pkg/gen/restapi/operations" |
||||
"github.com/grafana/alerting-api/pkg/gen/restapi/operations/alertmanager" |
||||
"github.com/grafana/alerting-api/pkg/gen/restapi/operations/permissions" |
||||
"github.com/grafana/alerting-api/pkg/gen/restapi/operations/prometheus" |
||||
"github.com/grafana/alerting-api/pkg/gen/restapi/operations/ruler" |
||||
"github.com/grafana/alerting-api/pkg/gen/restapi/operations/testing" |
||||
) |
||||
|
||||
//go:generate swagger generate server --target ../../gen --name DocumentationOfTheAPI --spec ../../../post.json --principal interface{} --exclude-main
|
||||
|
||||
func configureFlags(api *operations.DocumentationOfTheAPIAPI) { |
||||
// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }
|
||||
} |
||||
|
||||
func configureAPI(api *operations.DocumentationOfTheAPIAPI) http.Handler { |
||||
// configure the api here
|
||||
api.ServeError = errors.ServeError |
||||
|
||||
// Set your custom logger if needed. Default one is log.Printf
|
||||
// Expected interface func(string, ...interface{})
|
||||
//
|
||||
// Example:
|
||||
// api.Logger = log.Printf
|
||||
|
||||
api.UseSwaggerUI() |
||||
// To continue using redoc as your UI, uncomment the following line
|
||||
// api.UseRedoc()
|
||||
|
||||
api.JSONConsumer = runtime.JSONConsumer() |
||||
api.YamlConsumer = yamlpc.YAMLConsumer() |
||||
|
||||
api.JSONProducer = runtime.JSONProducer() |
||||
|
||||
if api.AlertmanagerRouteCreateSilenceHandler == nil { |
||||
api.AlertmanagerRouteCreateSilenceHandler = alertmanager.RouteCreateSilenceHandlerFunc(func(params alertmanager.RouteCreateSilenceParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RouteCreateSilence has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRouteDeleteAlertingConfigHandler == nil { |
||||
api.AlertmanagerRouteDeleteAlertingConfigHandler = alertmanager.RouteDeleteAlertingConfigHandlerFunc(func(params alertmanager.RouteDeleteAlertingConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RouteDeleteAlertingConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.RulerRouteDeleteNamespaceRulesConfigHandler == nil { |
||||
api.RulerRouteDeleteNamespaceRulesConfigHandler = ruler.RouteDeleteNamespaceRulesConfigHandlerFunc(func(params ruler.RouteDeleteNamespaceRulesConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation ruler.RouteDeleteNamespaceRulesConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.RulerRouteDeleteRuleGroupConfigHandler == nil { |
||||
api.RulerRouteDeleteRuleGroupConfigHandler = ruler.RouteDeleteRuleGroupConfigHandlerFunc(func(params ruler.RouteDeleteRuleGroupConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation ruler.RouteDeleteRuleGroupConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRouteDeleteSilenceHandler == nil { |
||||
api.AlertmanagerRouteDeleteSilenceHandler = alertmanager.RouteDeleteSilenceHandlerFunc(func(params alertmanager.RouteDeleteSilenceParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RouteDeleteSilence has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.PrometheusRouteGetAlertStatusesHandler == nil { |
||||
api.PrometheusRouteGetAlertStatusesHandler = prometheus.RouteGetAlertStatusesHandlerFunc(func(params prometheus.RouteGetAlertStatusesParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation prometheus.RouteGetAlertStatuses has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRouteGetAlertingConfigHandler == nil { |
||||
api.AlertmanagerRouteGetAlertingConfigHandler = alertmanager.RouteGetAlertingConfigHandlerFunc(func(params alertmanager.RouteGetAlertingConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RouteGetAlertingConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRouteGetAmAlertGroupsHandler == nil { |
||||
api.AlertmanagerRouteGetAmAlertGroupsHandler = alertmanager.RouteGetAmAlertGroupsHandlerFunc(func(params alertmanager.RouteGetAmAlertGroupsParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RouteGetAmAlertGroups has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRouteGetAmAlertsHandler == nil { |
||||
api.AlertmanagerRouteGetAmAlertsHandler = alertmanager.RouteGetAmAlertsHandlerFunc(func(params alertmanager.RouteGetAmAlertsParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RouteGetAmAlerts has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.PermissionsRouteGetNamespacePermissionsHandler == nil { |
||||
api.PermissionsRouteGetNamespacePermissionsHandler = permissions.RouteGetNamespacePermissionsHandlerFunc(func(params permissions.RouteGetNamespacePermissionsParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation permissions.RouteGetNamespacePermissions has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.RulerRouteGetNamespaceRulesConfigHandler == nil { |
||||
api.RulerRouteGetNamespaceRulesConfigHandler = ruler.RouteGetNamespaceRulesConfigHandlerFunc(func(params ruler.RouteGetNamespaceRulesConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation ruler.RouteGetNamespaceRulesConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.PrometheusRouteGetRuleStatusesHandler == nil { |
||||
api.PrometheusRouteGetRuleStatusesHandler = prometheus.RouteGetRuleStatusesHandlerFunc(func(params prometheus.RouteGetRuleStatusesParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation prometheus.RouteGetRuleStatuses has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.RulerRouteGetRulegGroupConfigHandler == nil { |
||||
api.RulerRouteGetRulegGroupConfigHandler = ruler.RouteGetRulegGroupConfigHandlerFunc(func(params ruler.RouteGetRulegGroupConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation ruler.RouteGetRulegGroupConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.RulerRouteGetRulesConfigHandler == nil { |
||||
api.RulerRouteGetRulesConfigHandler = ruler.RouteGetRulesConfigHandlerFunc(func(params ruler.RouteGetRulesConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation ruler.RouteGetRulesConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRouteGetSilenceHandler == nil { |
||||
api.AlertmanagerRouteGetSilenceHandler = alertmanager.RouteGetSilenceHandlerFunc(func(params alertmanager.RouteGetSilenceParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RouteGetSilence has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRouteGetSilencesHandler == nil { |
||||
api.AlertmanagerRouteGetSilencesHandler = alertmanager.RouteGetSilencesHandlerFunc(func(params alertmanager.RouteGetSilencesParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RouteGetSilences has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRoutePostAlertingConfigHandler == nil { |
||||
api.AlertmanagerRoutePostAlertingConfigHandler = alertmanager.RoutePostAlertingConfigHandlerFunc(func(params alertmanager.RoutePostAlertingConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RoutePostAlertingConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.AlertmanagerRoutePostAmAlertsHandler == nil { |
||||
api.AlertmanagerRoutePostAmAlertsHandler = alertmanager.RoutePostAmAlertsHandlerFunc(func(params alertmanager.RoutePostAmAlertsParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation alertmanager.RoutePostAmAlerts has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.RulerRoutePostNameRulesConfigHandler == nil { |
||||
api.RulerRoutePostNameRulesConfigHandler = ruler.RoutePostNameRulesConfigHandlerFunc(func(params ruler.RoutePostNameRulesConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation ruler.RoutePostNameRulesConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.PermissionsRouteSetNamespacePermissionsHandler == nil { |
||||
api.PermissionsRouteSetNamespacePermissionsHandler = permissions.RouteSetNamespacePermissionsHandlerFunc(func(params permissions.RouteSetNamespacePermissionsParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation permissions.RouteSetNamespacePermissions has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.TestingRouteTestReceiverConfigHandler == nil { |
||||
api.TestingRouteTestReceiverConfigHandler = testing.RouteTestReceiverConfigHandlerFunc(func(params testing.RouteTestReceiverConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation testing.RouteTestReceiverConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
if api.TestingRouteTestRuleConfigHandler == nil { |
||||
api.TestingRouteTestRuleConfigHandler = testing.RouteTestRuleConfigHandlerFunc(func(params testing.RouteTestRuleConfigParams) middleware.Responder { |
||||
return middleware.NotImplemented("operation testing.RouteTestRuleConfig has not yet been implemented") |
||||
}) |
||||
} |
||||
|
||||
api.PreServerShutdown = func() {} |
||||
|
||||
api.ServerShutdown = func() {} |
||||
|
||||
return setupGlobalMiddleware(api.Serve(setupMiddlewares)) |
||||
} |
||||
|
||||
// The TLS configuration before HTTPS server starts.
|
||||
func configureTLS(tlsConfig *tls.Config) { |
||||
// Make all necessary changes to the TLS configuration here.
|
||||
} |
||||
|
||||
// As soon as server is initialized but not run yet, this function will be called.
|
||||
// If you need to modify a config, store server instance to stop it individually later, this is the place.
|
||||
// This function can be called multiple times, depending on the number of serving schemes.
|
||||
// scheme value will be set accordingly: "http", "https" or "unix"
|
||||
func configureServer(s *http.Server, scheme, addr string) { |
||||
} |
||||
|
||||
// The middleware configuration is for the handler executors. These do not apply to the swagger.json document.
|
||||
// The middleware executes after routing but before authentication, binding and validation
|
||||
func setupMiddlewares(handler http.Handler) http.Handler { |
||||
return handler |
||||
} |
||||
|
||||
// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
|
||||
// So this is a good place to plug in a panic handling middleware, logging and metrics
|
||||
func setupGlobalMiddleware(handler http.Handler) http.Handler { |
||||
return handler |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// Package restapi Documentation of the API.
|
||||
//
|
||||
// Schemes:
|
||||
// http
|
||||
// https
|
||||
// Host: localhost
|
||||
// BasePath: /api/v1
|
||||
// Version: 1.0.0
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
// - application/yaml
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// swagger:meta
|
||||
package restapi |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue