update prometheus dependencies (#5520)
Signed-off-by: junot <junotxiang@kubesphere.io>
This commit is contained in:
43
vendor/github.com/prometheus/alertmanager/api/v2/models/alert.go
generated
vendored
43
vendor/github.com/prometheus/alertmanager/api/v2/models/alert.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// Alert alert
|
||||
//
|
||||
// swagger:model alert
|
||||
type Alert struct {
|
||||
|
||||
@@ -59,7 +61,6 @@ func (m *Alert) Validate(formats strfmt.Registry) error {
|
||||
}
|
||||
|
||||
func (m *Alert) validateGeneratorURL(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.GeneratorURL) { // not required
|
||||
return nil
|
||||
}
|
||||
@@ -73,9 +74,45 @@ func (m *Alert) validateGeneratorURL(formats strfmt.Registry) error {
|
||||
|
||||
func (m *Alert) validateLabels(formats strfmt.Registry) error {
|
||||
|
||||
if err := m.Labels.Validate(formats); err != nil {
|
||||
if err := validate.Required("labels", "body", m.Labels); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.Labels != nil {
|
||||
if err := m.Labels.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labels")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("labels")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this alert based on the context it is used
|
||||
func (m *Alert) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateLabels(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Alert) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if err := m.Labels.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labels")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("labels")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
97
vendor/github.com/prometheus/alertmanager/api/v2/models/alert_group.go
generated
vendored
97
vendor/github.com/prometheus/alertmanager/api/v2/models/alert_group.go
generated
vendored
@@ -20,16 +20,17 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AlertGroup alert group
|
||||
//
|
||||
// swagger:model alertGroup
|
||||
type AlertGroup struct {
|
||||
|
||||
@@ -83,6 +84,8 @@ func (m *AlertGroup) validateAlerts(formats strfmt.Registry) error {
|
||||
if err := m.Alerts[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("alerts" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("alerts" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -95,13 +98,21 @@ func (m *AlertGroup) validateAlerts(formats strfmt.Registry) error {
|
||||
|
||||
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")
|
||||
}
|
||||
if err := validate.Required("labels", "body", m.Labels); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.Labels != nil {
|
||||
if err := m.Labels.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labels")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("labels")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -115,6 +126,80 @@ func (m *AlertGroup) validateReceiver(formats strfmt.Registry) error {
|
||||
if err := m.Receiver.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("receiver")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("receiver")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this alert group based on the context it is used
|
||||
func (m *AlertGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateAlerts(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateLabels(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateReceiver(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertGroup) contextValidateAlerts(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Alerts); i++ {
|
||||
|
||||
if m.Alerts[i] != nil {
|
||||
if err := m.Alerts[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("alerts" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("alerts" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertGroup) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if err := m.Labels.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labels")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("labels")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertGroup) contextValidateReceiver(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Receiver != nil {
|
||||
if err := m.Receiver.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("receiver")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("receiver")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
32
vendor/github.com/prometheus/alertmanager/api/v2/models/alert_groups.go
generated
vendored
32
vendor/github.com/prometheus/alertmanager/api/v2/models/alert_groups.go
generated
vendored
@@ -20,15 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// AlertGroups alert groups
|
||||
//
|
||||
// swagger:model alertGroups
|
||||
type AlertGroups []*AlertGroup
|
||||
|
||||
@@ -45,6 +46,33 @@ func (m AlertGroups) Validate(formats strfmt.Registry) error {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this alert groups based on the context it is used
|
||||
func (m AlertGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if m[i] != nil {
|
||||
if err := m[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
12
vendor/github.com/prometheus/alertmanager/api/v2/models/alert_status.go
generated
vendored
12
vendor/github.com/prometheus/alertmanager/api/v2/models/alert_status.go
generated
vendored
@@ -20,16 +20,17 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AlertStatus alert status
|
||||
//
|
||||
// swagger:model alertStatus
|
||||
type AlertStatus struct {
|
||||
|
||||
@@ -113,7 +114,7 @@ const (
|
||||
|
||||
// prop value enum
|
||||
func (m *AlertStatus) validateStateEnum(path, location string, value string) error {
|
||||
if err := validate.Enum(path, location, value, alertStatusTypeStatePropEnum); err != nil {
|
||||
if err := validate.EnumCase(path, location, value, alertStatusTypeStatePropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -133,6 +134,11 @@ func (m *AlertStatus) validateState(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this alert status based on context it is used
|
||||
func (m *AlertStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertStatus) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
9
vendor/github.com/prometheus/alertmanager/api/v2/models/alertmanager_config.go
generated
vendored
9
vendor/github.com/prometheus/alertmanager/api/v2/models/alertmanager_config.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AlertmanagerConfig alertmanager config
|
||||
//
|
||||
// swagger:model alertmanagerConfig
|
||||
type AlertmanagerConfig struct {
|
||||
|
||||
@@ -59,6 +61,11 @@ func (m *AlertmanagerConfig) validateOriginal(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this alertmanager config based on context it is used
|
||||
func (m *AlertmanagerConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertmanagerConfig) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
80
vendor/github.com/prometheus/alertmanager/api/v2/models/alertmanager_status.go
generated
vendored
80
vendor/github.com/prometheus/alertmanager/api/v2/models/alertmanager_status.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AlertmanagerStatus alertmanager status
|
||||
//
|
||||
// swagger:model alertmanagerStatus
|
||||
type AlertmanagerStatus struct {
|
||||
|
||||
@@ -85,6 +87,8 @@ func (m *AlertmanagerStatus) validateCluster(formats strfmt.Registry) error {
|
||||
if err := m.Cluster.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("cluster")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("cluster")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +107,8 @@ func (m *AlertmanagerStatus) validateConfig(formats strfmt.Registry) error {
|
||||
if err := m.Config.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("config")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("config")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -134,6 +140,78 @@ func (m *AlertmanagerStatus) validateVersionInfo(formats strfmt.Registry) error
|
||||
if err := m.VersionInfo.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("versionInfo")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("versionInfo")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this alertmanager status based on the context it is used
|
||||
func (m *AlertmanagerStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateCluster(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateConfig(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateVersionInfo(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertmanagerStatus) contextValidateCluster(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Cluster != nil {
|
||||
if err := m.Cluster.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("cluster")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("cluster")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertmanagerStatus) contextValidateConfig(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Config != nil {
|
||||
if err := m.Config.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("config")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("config")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertmanagerStatus) contextValidateVersionInfo(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.VersionInfo != nil {
|
||||
if err := m.VersionInfo.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("versionInfo")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("versionInfo")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
44
vendor/github.com/prometheus/alertmanager/api/v2/models/cluster_status.go
generated
vendored
44
vendor/github.com/prometheus/alertmanager/api/v2/models/cluster_status.go
generated
vendored
@@ -20,17 +20,18 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// ClusterStatus cluster status
|
||||
//
|
||||
// swagger:model clusterStatus
|
||||
type ClusterStatus struct {
|
||||
|
||||
@@ -65,7 +66,6 @@ func (m *ClusterStatus) Validate(formats strfmt.Registry) error {
|
||||
}
|
||||
|
||||
func (m *ClusterStatus) validatePeers(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Peers) { // not required
|
||||
return nil
|
||||
}
|
||||
@@ -79,6 +79,8 @@ func (m *ClusterStatus) validatePeers(formats strfmt.Registry) error {
|
||||
if err := m.Peers[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("peers" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("peers" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -115,7 +117,7 @@ const (
|
||||
|
||||
// prop value enum
|
||||
func (m *ClusterStatus) validateStatusEnum(path, location string, value string) error {
|
||||
if err := validate.Enum(path, location, value, clusterStatusTypeStatusPropEnum); err != nil {
|
||||
if err := validate.EnumCase(path, location, value, clusterStatusTypeStatusPropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -135,6 +137,40 @@ func (m *ClusterStatus) validateStatus(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this cluster status based on the context it is used
|
||||
func (m *ClusterStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidatePeers(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ClusterStatus) contextValidatePeers(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Peers); i++ {
|
||||
|
||||
if m.Peers[i] != nil {
|
||||
if err := m.Peers[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("peers" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("peers" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ClusterStatus) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
103
vendor/github.com/prometheus/alertmanager/api/v2/models/gettable_alert.go
generated
vendored
103
vendor/github.com/prometheus/alertmanager/api/v2/models/gettable_alert.go
generated
vendored
@@ -20,16 +20,17 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// GettableAlert gettable alert
|
||||
//
|
||||
// swagger:model gettableAlert
|
||||
type GettableAlert struct {
|
||||
|
||||
@@ -158,7 +159,6 @@ func (m GettableAlert) MarshalJSON() ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
_parts = append(_parts, aO1)
|
||||
|
||||
return swag.ConcatJSON(_parts...), nil
|
||||
}
|
||||
|
||||
@@ -207,13 +207,21 @@ func (m *GettableAlert) Validate(formats strfmt.Registry) error {
|
||||
|
||||
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")
|
||||
}
|
||||
if err := validate.Required("annotations", "body", m.Annotations); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.Annotations != nil {
|
||||
if err := m.Annotations.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("annotations")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("annotations")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -254,6 +262,8 @@ func (m *GettableAlert) validateReceivers(formats strfmt.Registry) error {
|
||||
if err := m.Receivers[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("receivers" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("receivers" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -287,6 +297,8 @@ func (m *GettableAlert) validateStatus(formats strfmt.Registry) error {
|
||||
if err := m.Status.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("status")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("status")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -308,6 +320,83 @@ func (m *GettableAlert) validateUpdatedAt(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this gettable alert based on the context it is used
|
||||
func (m *GettableAlert) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateAnnotations(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateReceivers(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateStatus(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
// validation for a type composition with Alert
|
||||
if err := m.Alert.ContextValidate(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GettableAlert) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if err := m.Annotations.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("annotations")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("annotations")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GettableAlert) contextValidateReceivers(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Receivers); i++ {
|
||||
|
||||
if m.Receivers[i] != nil {
|
||||
if err := m.Receivers[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("receivers" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("receivers" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GettableAlert) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Status != nil {
|
||||
if err := m.Status.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("status")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("status")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GettableAlert) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
32
vendor/github.com/prometheus/alertmanager/api/v2/models/gettable_alerts.go
generated
vendored
32
vendor/github.com/prometheus/alertmanager/api/v2/models/gettable_alerts.go
generated
vendored
@@ -20,15 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// GettableAlerts gettable alerts
|
||||
//
|
||||
// swagger:model gettableAlerts
|
||||
type GettableAlerts []*GettableAlert
|
||||
|
||||
@@ -45,6 +46,33 @@ func (m GettableAlerts) Validate(formats strfmt.Registry) error {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this gettable alerts based on the context it is used
|
||||
func (m GettableAlerts) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if m[i] != nil {
|
||||
if err := m[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
42
vendor/github.com/prometheus/alertmanager/api/v2/models/gettable_silence.go
generated
vendored
42
vendor/github.com/prometheus/alertmanager/api/v2/models/gettable_silence.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// GettableSilence gettable silence
|
||||
//
|
||||
// swagger:model gettableSilence
|
||||
type GettableSilence struct {
|
||||
|
||||
@@ -106,7 +108,6 @@ func (m GettableSilence) MarshalJSON() ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
_parts = append(_parts, aO1)
|
||||
|
||||
return swag.ConcatJSON(_parts...), nil
|
||||
}
|
||||
|
||||
@@ -156,6 +157,8 @@ func (m *GettableSilence) validateStatus(formats strfmt.Registry) error {
|
||||
if err := m.Status.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("status")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("status")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -177,6 +180,41 @@ func (m *GettableSilence) validateUpdatedAt(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this gettable silence based on the context it is used
|
||||
func (m *GettableSilence) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateStatus(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
// validation for a type composition with Silence
|
||||
if err := m.Silence.ContextValidate(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GettableSilence) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Status != nil {
|
||||
if err := m.Status.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("status")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("status")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GettableSilence) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
32
vendor/github.com/prometheus/alertmanager/api/v2/models/gettable_silences.go
generated
vendored
32
vendor/github.com/prometheus/alertmanager/api/v2/models/gettable_silences.go
generated
vendored
@@ -20,15 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// GettableSilences gettable silences
|
||||
//
|
||||
// swagger:model gettableSilences
|
||||
type GettableSilences []*GettableSilence
|
||||
|
||||
@@ -45,6 +46,33 @@ func (m GettableSilences) Validate(formats strfmt.Registry) error {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this gettable silences based on the context it is used
|
||||
func (m GettableSilences) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if m[i] != nil {
|
||||
if err := m[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
10
vendor/github.com/prometheus/alertmanager/api/v2/models/label_set.go
generated
vendored
10
vendor/github.com/prometheus/alertmanager/api/v2/models/label_set.go
generated
vendored
@@ -20,10 +20,13 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// LabelSet label set
|
||||
//
|
||||
// swagger:model labelSet
|
||||
type LabelSet map[string]string
|
||||
|
||||
@@ -31,3 +34,8 @@ type LabelSet map[string]string
|
||||
func (m LabelSet) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this label set based on context it is used
|
||||
func (m LabelSet) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
12
vendor/github.com/prometheus/alertmanager/api/v2/models/matcher.go
generated
vendored
12
vendor/github.com/prometheus/alertmanager/api/v2/models/matcher.go
generated
vendored
@@ -20,17 +20,22 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// Matcher matcher
|
||||
//
|
||||
// swagger:model matcher
|
||||
type Matcher struct {
|
||||
|
||||
// is equal
|
||||
IsEqual *bool `json:"isEqual,omitempty"`
|
||||
|
||||
// is regex
|
||||
// Required: true
|
||||
IsRegex *bool `json:"isRegex"`
|
||||
@@ -93,6 +98,11 @@ func (m *Matcher) validateValue(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this matcher based on context it is used
|
||||
func (m *Matcher) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Matcher) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
32
vendor/github.com/prometheus/alertmanager/api/v2/models/matchers.go
generated
vendored
32
vendor/github.com/prometheus/alertmanager/api/v2/models/matchers.go
generated
vendored
@@ -20,16 +20,17 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// Matchers matchers
|
||||
//
|
||||
// swagger:model matchers
|
||||
type Matchers []*Matcher
|
||||
|
||||
@@ -52,6 +53,33 @@ func (m Matchers) Validate(formats strfmt.Registry) error {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this matchers based on the context it is used
|
||||
func (m Matchers) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if m[i] != nil {
|
||||
if err := m[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
9
vendor/github.com/prometheus/alertmanager/api/v2/models/peer_status.go
generated
vendored
9
vendor/github.com/prometheus/alertmanager/api/v2/models/peer_status.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// PeerStatus peer status
|
||||
//
|
||||
// swagger:model peerStatus
|
||||
type PeerStatus struct {
|
||||
|
||||
@@ -76,6 +78,11 @@ func (m *PeerStatus) validateName(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this peer status based on context it is used
|
||||
func (m *PeerStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PeerStatus) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
50
vendor/github.com/prometheus/alertmanager/api/v2/models/postable_alert.go
generated
vendored
50
vendor/github.com/prometheus/alertmanager/api/v2/models/postable_alert.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// PostableAlert postable alert
|
||||
//
|
||||
// swagger:model postableAlert
|
||||
type PostableAlert struct {
|
||||
|
||||
@@ -104,7 +106,6 @@ func (m PostableAlert) MarshalJSON() ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
_parts = append(_parts, aO1)
|
||||
|
||||
return swag.ConcatJSON(_parts...), nil
|
||||
}
|
||||
|
||||
@@ -141,11 +142,15 @@ func (m *PostableAlert) validateAnnotations(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Annotations.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("annotations")
|
||||
if m.Annotations != nil {
|
||||
if err := m.Annotations.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("annotations")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("annotations")
|
||||
}
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -177,6 +182,39 @@ func (m *PostableAlert) validateStartsAt(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this postable alert based on the context it is used
|
||||
func (m *PostableAlert) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateAnnotations(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
// validation for a type composition with Alert
|
||||
if err := m.Alert.ContextValidate(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PostableAlert) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if err := m.Annotations.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("annotations")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("annotations")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PostableAlert) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
32
vendor/github.com/prometheus/alertmanager/api/v2/models/postable_alerts.go
generated
vendored
32
vendor/github.com/prometheus/alertmanager/api/v2/models/postable_alerts.go
generated
vendored
@@ -20,15 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// PostableAlerts postable alerts
|
||||
//
|
||||
// swagger:model postableAlerts
|
||||
type PostableAlerts []*PostableAlert
|
||||
|
||||
@@ -45,6 +46,33 @@ func (m PostableAlerts) Validate(formats strfmt.Registry) error {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this postable alerts based on the context it is used
|
||||
func (m PostableAlerts) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if m[i] != nil {
|
||||
if err := m[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
20
vendor/github.com/prometheus/alertmanager/api/v2/models/postable_silence.go
generated
vendored
20
vendor/github.com/prometheus/alertmanager/api/v2/models/postable_silence.go
generated
vendored
@@ -20,13 +20,15 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// PostableSilence postable silence
|
||||
//
|
||||
// swagger:model postableSilence
|
||||
type PostableSilence struct {
|
||||
|
||||
@@ -79,7 +81,6 @@ func (m PostableSilence) MarshalJSON() ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
_parts = append(_parts, aO1)
|
||||
|
||||
return swag.ConcatJSON(_parts...), nil
|
||||
}
|
||||
|
||||
@@ -98,6 +99,21 @@ func (m *PostableSilence) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this postable silence based on the context it is used
|
||||
func (m *PostableSilence) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
// validation for a type composition with Silence
|
||||
if err := m.Silence.ContextValidate(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PostableSilence) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
9
vendor/github.com/prometheus/alertmanager/api/v2/models/receiver.go
generated
vendored
9
vendor/github.com/prometheus/alertmanager/api/v2/models/receiver.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// Receiver receiver
|
||||
//
|
||||
// swagger:model receiver
|
||||
type Receiver struct {
|
||||
|
||||
@@ -59,6 +61,11 @@ func (m *Receiver) validateName(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this receiver based on context it is used
|
||||
func (m *Receiver) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Receiver) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
34
vendor/github.com/prometheus/alertmanager/api/v2/models/silence.go
generated
vendored
34
vendor/github.com/prometheus/alertmanager/api/v2/models/silence.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// Silence silence
|
||||
//
|
||||
// swagger:model silence
|
||||
type Silence struct {
|
||||
|
||||
@@ -124,6 +126,8 @@ func (m *Silence) validateMatchers(formats strfmt.Registry) error {
|
||||
if err := m.Matchers.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("matchers")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("matchers")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -144,6 +148,34 @@ func (m *Silence) validateStartsAt(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this silence based on the context it is used
|
||||
func (m *Silence) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateMatchers(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Silence) contextValidateMatchers(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if err := m.Matchers.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("matchers")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("matchers")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Silence) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
12
vendor/github.com/prometheus/alertmanager/api/v2/models/silence_status.go
generated
vendored
12
vendor/github.com/prometheus/alertmanager/api/v2/models/silence_status.go
generated
vendored
@@ -20,16 +20,17 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// SilenceStatus silence status
|
||||
//
|
||||
// swagger:model silenceStatus
|
||||
type SilenceStatus struct {
|
||||
|
||||
@@ -79,7 +80,7 @@ const (
|
||||
|
||||
// prop value enum
|
||||
func (m *SilenceStatus) validateStateEnum(path, location string, value string) error {
|
||||
if err := validate.Enum(path, location, value, silenceStatusTypeStatePropEnum); err != nil {
|
||||
if err := validate.EnumCase(path, location, value, silenceStatusTypeStatePropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -99,6 +100,11 @@ func (m *SilenceStatus) validateState(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this silence status based on context it is used
|
||||
func (m *SilenceStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SilenceStatus) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
9
vendor/github.com/prometheus/alertmanager/api/v2/models/version_info.go
generated
vendored
9
vendor/github.com/prometheus/alertmanager/api/v2/models/version_info.go
generated
vendored
@@ -20,14 +20,16 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// VersionInfo version info
|
||||
//
|
||||
// swagger:model versionInfo
|
||||
type VersionInfo struct {
|
||||
|
||||
@@ -144,6 +146,11 @@ func (m *VersionInfo) validateVersion(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this version info based on context it is used
|
||||
func (m *VersionInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *VersionInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
Reference in New Issue
Block a user