update prometheus dependencies (#5520)
Signed-off-by: junot <junotxiang@kubesphere.io>
This commit is contained in:
41
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/alert_client.go
generated
vendored
41
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/alert_client.go
generated
vendored
@@ -23,12 +23,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new alert API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -40,16 +39,27 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetAlerts(params *GetAlertsParams, opts ...ClientOption) (*GetAlertsOK, error)
|
||||
|
||||
PostAlerts(params *PostAlertsParams, opts ...ClientOption) (*PostAlertsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAlerts Get a list of alerts
|
||||
*/
|
||||
func (a *Client) GetAlerts(params *GetAlertsParams) (*GetAlertsOK, error) {
|
||||
func (a *Client) GetAlerts(params *GetAlertsParams, opts ...ClientOption) (*GetAlertsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetAlertsParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getAlerts",
|
||||
Method: "GET",
|
||||
PathPattern: "/alerts",
|
||||
@@ -60,7 +70,12 @@ func (a *Client) GetAlerts(params *GetAlertsParams) (*GetAlertsOK, error) {
|
||||
Reader: &GetAlertsReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -77,13 +92,12 @@ func (a *Client) GetAlerts(params *GetAlertsParams) (*GetAlertsOK, error) {
|
||||
/*
|
||||
PostAlerts Create new Alerts
|
||||
*/
|
||||
func (a *Client) PostAlerts(params *PostAlertsParams) (*PostAlertsOK, error) {
|
||||
func (a *Client) PostAlerts(params *PostAlertsParams, opts ...ClientOption) (*PostAlertsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewPostAlertsParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "postAlerts",
|
||||
Method: "POST",
|
||||
PathPattern: "/alerts",
|
||||
@@ -94,7 +108,12 @@ func (a *Client) PostAlerts(params *PostAlertsParams) (*PostAlertsOK, error) {
|
||||
Reader: &PostAlertsReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
187
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/get_alerts_parameters.go
generated
vendored
187
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/get_alerts_parameters.go
generated
vendored
@@ -27,119 +27,96 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetAlertsParams creates a new GetAlertsParams object
|
||||
// with the default values initialized.
|
||||
// NewGetAlertsParams creates a new GetAlertsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetAlertsParams() *GetAlertsParams {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
inhibitedDefault = bool(true)
|
||||
silencedDefault = bool(true)
|
||||
unprocessedDefault = bool(true)
|
||||
)
|
||||
return &GetAlertsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
Unprocessed: &unprocessedDefault,
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAlertsParamsWithTimeout creates a new GetAlertsParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetAlertsParamsWithTimeout(timeout time.Duration) *GetAlertsParams {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
inhibitedDefault = bool(true)
|
||||
silencedDefault = bool(true)
|
||||
unprocessedDefault = bool(true)
|
||||
)
|
||||
return &GetAlertsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
Unprocessed: &unprocessedDefault,
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAlertsParamsWithContext creates a new GetAlertsParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetAlertsParamsWithContext(ctx context.Context) *GetAlertsParams {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
inhibitedDefault = bool(true)
|
||||
silencedDefault = bool(true)
|
||||
unprocessedDefault = bool(true)
|
||||
)
|
||||
return &GetAlertsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
Unprocessed: &unprocessedDefault,
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAlertsParamsWithHTTPClient creates a new GetAlertsParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetAlertsParamsWithHTTPClient(client *http.Client) *GetAlertsParams {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
inhibitedDefault = bool(true)
|
||||
silencedDefault = bool(true)
|
||||
unprocessedDefault = bool(true)
|
||||
)
|
||||
return &GetAlertsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
Unprocessed: &unprocessedDefault,
|
||||
HTTPClient: client,
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*GetAlertsParams contains all the parameters to send to the API endpoint
|
||||
for the get alerts operation typically these are written to a http.Request
|
||||
/*
|
||||
GetAlertsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get alerts operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetAlertsParams struct {
|
||||
|
||||
/*Active
|
||||
Show active alerts
|
||||
/* Active.
|
||||
|
||||
Show active alerts
|
||||
|
||||
Default: true
|
||||
*/
|
||||
Active *bool
|
||||
/*Filter
|
||||
A list of matchers to filter alerts by
|
||||
|
||||
/* Filter.
|
||||
|
||||
A list of matchers to filter alerts by
|
||||
*/
|
||||
Filter []string
|
||||
/*Inhibited
|
||||
Show inhibited alerts
|
||||
|
||||
/* Inhibited.
|
||||
|
||||
Show inhibited alerts
|
||||
|
||||
Default: true
|
||||
*/
|
||||
Inhibited *bool
|
||||
/*Receiver
|
||||
A regex matching receivers to filter alerts by
|
||||
|
||||
/* Receiver.
|
||||
|
||||
A regex matching receivers to filter alerts by
|
||||
*/
|
||||
Receiver *string
|
||||
/*Silenced
|
||||
Show silenced alerts
|
||||
|
||||
/* Silenced.
|
||||
|
||||
Show silenced alerts
|
||||
|
||||
Default: true
|
||||
*/
|
||||
Silenced *bool
|
||||
/*Unprocessed
|
||||
Show unprocessed alerts
|
||||
|
||||
/* Unprocessed.
|
||||
|
||||
Show unprocessed alerts
|
||||
|
||||
Default: true
|
||||
*/
|
||||
Unprocessed *bool
|
||||
|
||||
@@ -148,6 +125,41 @@ type GetAlertsParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get alerts params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAlertsParams) WithDefaults() *GetAlertsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get alerts params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAlertsParams) SetDefaults() {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
|
||||
inhibitedDefault = bool(true)
|
||||
|
||||
silencedDefault = bool(true)
|
||||
|
||||
unprocessedDefault = bool(true)
|
||||
)
|
||||
|
||||
val := GetAlertsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
Unprocessed: &unprocessedDefault,
|
||||
}
|
||||
|
||||
val.timeout = o.timeout
|
||||
val.Context = o.Context
|
||||
val.HTTPClient = o.HTTPClient
|
||||
*o = val
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get alerts params
|
||||
func (o *GetAlertsParams) WithTimeout(timeout time.Duration) *GetAlertsParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -259,88 +271,96 @@ func (o *GetAlertsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg
|
||||
|
||||
// query param active
|
||||
var qrActive bool
|
||||
|
||||
if o.Active != nil {
|
||||
qrActive = *o.Active
|
||||
}
|
||||
qActive := swag.FormatBool(qrActive)
|
||||
if qActive != "" {
|
||||
|
||||
if err := r.SetQueryParam("active", qActive); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
valuesFilter := o.Filter
|
||||
if o.Filter != nil {
|
||||
|
||||
joinedFilter := swag.JoinByFormat(valuesFilter, "multi")
|
||||
// query array param filter
|
||||
if err := r.SetQueryParam("filter", joinedFilter...); err != nil {
|
||||
return err
|
||||
// binding items for filter
|
||||
joinedFilter := o.bindParamFilter(reg)
|
||||
|
||||
// query array param filter
|
||||
if err := r.SetQueryParam("filter", joinedFilter...); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if o.Inhibited != nil {
|
||||
|
||||
// query param inhibited
|
||||
var qrInhibited bool
|
||||
|
||||
if o.Inhibited != nil {
|
||||
qrInhibited = *o.Inhibited
|
||||
}
|
||||
qInhibited := swag.FormatBool(qrInhibited)
|
||||
if qInhibited != "" {
|
||||
|
||||
if err := r.SetQueryParam("inhibited", qInhibited); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Receiver != nil {
|
||||
|
||||
// query param receiver
|
||||
var qrReceiver string
|
||||
|
||||
if o.Receiver != nil {
|
||||
qrReceiver = *o.Receiver
|
||||
}
|
||||
qReceiver := qrReceiver
|
||||
if qReceiver != "" {
|
||||
|
||||
if err := r.SetQueryParam("receiver", qReceiver); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Silenced != nil {
|
||||
|
||||
// query param silenced
|
||||
var qrSilenced bool
|
||||
|
||||
if o.Silenced != nil {
|
||||
qrSilenced = *o.Silenced
|
||||
}
|
||||
qSilenced := swag.FormatBool(qrSilenced)
|
||||
if qSilenced != "" {
|
||||
|
||||
if err := r.SetQueryParam("silenced", qSilenced); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Unprocessed != nil {
|
||||
|
||||
// query param unprocessed
|
||||
var qrUnprocessed bool
|
||||
|
||||
if o.Unprocessed != nil {
|
||||
qrUnprocessed = *o.Unprocessed
|
||||
}
|
||||
qUnprocessed := swag.FormatBool(qrUnprocessed)
|
||||
if qUnprocessed != "" {
|
||||
|
||||
if err := r.SetQueryParam("unprocessed", qUnprocessed); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
@@ -348,3 +368,20 @@ func (o *GetAlertsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindParamGetAlerts binds the parameter filter
|
||||
func (o *GetAlertsParams) bindParamFilter(formats strfmt.Registry) []string {
|
||||
filterIR := o.Filter
|
||||
|
||||
var filterIC []string
|
||||
for _, filterIIR := range filterIR { // explode []string
|
||||
|
||||
filterIIV := filterIIR // string as string
|
||||
filterIC = append(filterIC, filterIIV)
|
||||
}
|
||||
|
||||
// items.CollectionFormat: "multi"
|
||||
filterIS := swag.JoinByFormat(filterIC, "multi")
|
||||
|
||||
return filterIS
|
||||
}
|
||||
|
||||
104
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/get_alerts_responses.go
generated
vendored
104
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/get_alerts_responses.go
generated
vendored
@@ -24,10 +24,9 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
)
|
||||
|
||||
// GetAlertsReader is a Reader for the GetAlerts structure.
|
||||
@@ -56,9 +55,8 @@ func (o *GetAlertsReader) ReadResponse(response runtime.ClientResponse, consumer
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +65,8 @@ func NewGetAlertsOK() *GetAlertsOK {
|
||||
return &GetAlertsOK{}
|
||||
}
|
||||
|
||||
/*GetAlertsOK handles this case with default header values.
|
||||
/*
|
||||
GetAlertsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Get alerts response
|
||||
*/
|
||||
@@ -75,10 +74,39 @@ type GetAlertsOK struct {
|
||||
Payload models.GettableAlerts
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get alerts o k response has a 2xx status code
|
||||
func (o *GetAlertsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get alerts o k response has a 3xx status code
|
||||
func (o *GetAlertsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get alerts o k response has a 4xx status code
|
||||
func (o *GetAlertsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get alerts o k response has a 5xx status code
|
||||
func (o *GetAlertsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get alerts o k response a status code equal to that given
|
||||
func (o *GetAlertsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetAlertsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsOK) String() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsOK) GetPayload() models.GettableAlerts {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -98,7 +126,8 @@ func NewGetAlertsBadRequest() *GetAlertsBadRequest {
|
||||
return &GetAlertsBadRequest{}
|
||||
}
|
||||
|
||||
/*GetAlertsBadRequest handles this case with default header values.
|
||||
/*
|
||||
GetAlertsBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
Bad request
|
||||
*/
|
||||
@@ -106,10 +135,39 @@ type GetAlertsBadRequest struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get alerts bad request response has a 2xx status code
|
||||
func (o *GetAlertsBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get alerts bad request response has a 3xx status code
|
||||
func (o *GetAlertsBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get alerts bad request response has a 4xx status code
|
||||
func (o *GetAlertsBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get alerts bad request response has a 5xx status code
|
||||
func (o *GetAlertsBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get alerts bad request response a status code equal to that given
|
||||
func (o *GetAlertsBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
func (o *GetAlertsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsBadRequest) String() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsBadRequest) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -129,7 +187,8 @@ func NewGetAlertsInternalServerError() *GetAlertsInternalServerError {
|
||||
return &GetAlertsInternalServerError{}
|
||||
}
|
||||
|
||||
/*GetAlertsInternalServerError handles this case with default header values.
|
||||
/*
|
||||
GetAlertsInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
@@ -137,10 +196,39 @@ type GetAlertsInternalServerError struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get alerts internal server error response has a 2xx status code
|
||||
func (o *GetAlertsInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get alerts internal server error response has a 3xx status code
|
||||
func (o *GetAlertsInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get alerts internal server error response has a 4xx status code
|
||||
func (o *GetAlertsInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get alerts internal server error response has a 5xx status code
|
||||
func (o *GetAlertsInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this get alerts internal server error response a status code equal to that given
|
||||
func (o *GetAlertsInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *GetAlertsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsInternalServerError) String() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
54
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/post_alerts_parameters.go
generated
vendored
54
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/post_alerts_parameters.go
generated
vendored
@@ -27,59 +27,59 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
)
|
||||
|
||||
// NewPostAlertsParams creates a new PostAlertsParams object
|
||||
// with the default values initialized.
|
||||
// NewPostAlertsParams creates a new PostAlertsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewPostAlertsParams() *PostAlertsParams {
|
||||
var ()
|
||||
return &PostAlertsParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAlertsParamsWithTimeout creates a new PostAlertsParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPostAlertsParamsWithTimeout(timeout time.Duration) *PostAlertsParams {
|
||||
var ()
|
||||
return &PostAlertsParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAlertsParamsWithContext creates a new PostAlertsParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewPostAlertsParamsWithContext(ctx context.Context) *PostAlertsParams {
|
||||
var ()
|
||||
return &PostAlertsParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAlertsParamsWithHTTPClient creates a new PostAlertsParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPostAlertsParamsWithHTTPClient(client *http.Client) *PostAlertsParams {
|
||||
var ()
|
||||
return &PostAlertsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*PostAlertsParams contains all the parameters to send to the API endpoint
|
||||
for the post alerts operation typically these are written to a http.Request
|
||||
/*
|
||||
PostAlertsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the post alerts operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PostAlertsParams struct {
|
||||
|
||||
/*Alerts
|
||||
The alerts to create
|
||||
/* Alerts.
|
||||
|
||||
The alerts to create
|
||||
*/
|
||||
Alerts models.PostableAlerts
|
||||
|
||||
@@ -88,6 +88,21 @@ type PostAlertsParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the post alerts params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostAlertsParams) WithDefaults() *PostAlertsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the post alerts params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostAlertsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the post alerts params
|
||||
func (o *PostAlertsParams) WithTimeout(timeout time.Duration) *PostAlertsParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -139,7 +154,6 @@ func (o *PostAlertsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Alerts != nil {
|
||||
if err := r.SetBodyParam(o.Alerts); err != nil {
|
||||
return err
|
||||
|
||||
102
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/post_alerts_responses.go
generated
vendored
102
vendor/github.com/prometheus/alertmanager/api/v2/client/alert/post_alerts_responses.go
generated
vendored
@@ -24,8 +24,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// PostAlertsReader is a Reader for the PostAlerts structure.
|
||||
@@ -54,9 +53,8 @@ func (o *PostAlertsReader) ReadResponse(response runtime.ClientResponse, consume
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,17 +63,47 @@ func NewPostAlertsOK() *PostAlertsOK {
|
||||
return &PostAlertsOK{}
|
||||
}
|
||||
|
||||
/*PostAlertsOK handles this case with default header values.
|
||||
/*
|
||||
PostAlertsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Create alerts response
|
||||
*/
|
||||
type PostAlertsOK struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post alerts o k response has a 2xx status code
|
||||
func (o *PostAlertsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post alerts o k response has a 3xx status code
|
||||
func (o *PostAlertsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post alerts o k response has a 4xx status code
|
||||
func (o *PostAlertsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post alerts o k response has a 5xx status code
|
||||
func (o *PostAlertsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post alerts o k response a status code equal to that given
|
||||
func (o *PostAlertsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *PostAlertsOK) Error() string {
|
||||
return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200)
|
||||
}
|
||||
|
||||
func (o *PostAlertsOK) String() string {
|
||||
return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200)
|
||||
}
|
||||
|
||||
func (o *PostAlertsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
@@ -86,7 +114,8 @@ func NewPostAlertsBadRequest() *PostAlertsBadRequest {
|
||||
return &PostAlertsBadRequest{}
|
||||
}
|
||||
|
||||
/*PostAlertsBadRequest handles this case with default header values.
|
||||
/*
|
||||
PostAlertsBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
Bad request
|
||||
*/
|
||||
@@ -94,10 +123,39 @@ type PostAlertsBadRequest struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post alerts bad request response has a 2xx status code
|
||||
func (o *PostAlertsBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post alerts bad request response has a 3xx status code
|
||||
func (o *PostAlertsBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post alerts bad request response has a 4xx status code
|
||||
func (o *PostAlertsBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post alerts bad request response has a 5xx status code
|
||||
func (o *PostAlertsBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post alerts bad request response a status code equal to that given
|
||||
func (o *PostAlertsBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
func (o *PostAlertsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAlertsBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAlertsBadRequest) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -117,7 +175,8 @@ func NewPostAlertsInternalServerError() *PostAlertsInternalServerError {
|
||||
return &PostAlertsInternalServerError{}
|
||||
}
|
||||
|
||||
/*PostAlertsInternalServerError handles this case with default header values.
|
||||
/*
|
||||
PostAlertsInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
@@ -125,10 +184,39 @@ type PostAlertsInternalServerError struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post alerts internal server error response has a 2xx status code
|
||||
func (o *PostAlertsInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post alerts internal server error response has a 3xx status code
|
||||
func (o *PostAlertsInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post alerts internal server error response has a 4xx status code
|
||||
func (o *PostAlertsInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post alerts internal server error response has a 5xx status code
|
||||
func (o *PostAlertsInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this post alerts internal server error response a status code equal to that given
|
||||
func (o *PostAlertsInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *PostAlertsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAlertsInternalServerError) String() string {
|
||||
return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAlertsInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
27
vendor/github.com/prometheus/alertmanager/api/v2/client/alertgroup/alertgroup_client.go
generated
vendored
27
vendor/github.com/prometheus/alertmanager/api/v2/client/alertgroup/alertgroup_client.go
generated
vendored
@@ -23,12 +23,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new alertgroup API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -40,16 +39,25 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetAlertGroups(params *GetAlertGroupsParams, opts ...ClientOption) (*GetAlertGroupsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAlertGroups Get a list of alert groups
|
||||
*/
|
||||
func (a *Client) GetAlertGroups(params *GetAlertGroupsParams) (*GetAlertGroupsOK, error) {
|
||||
func (a *Client) GetAlertGroups(params *GetAlertGroupsParams, opts ...ClientOption) (*GetAlertGroupsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetAlertGroupsParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getAlertGroups",
|
||||
Method: "GET",
|
||||
PathPattern: "/alerts/groups",
|
||||
@@ -60,7 +68,12 @@ func (a *Client) GetAlertGroups(params *GetAlertGroupsParams) (*GetAlertGroupsOK
|
||||
Reader: &GetAlertGroupsReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -27,106 +27,88 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetAlertGroupsParams creates a new GetAlertGroupsParams object
|
||||
// with the default values initialized.
|
||||
// NewGetAlertGroupsParams creates a new GetAlertGroupsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetAlertGroupsParams() *GetAlertGroupsParams {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
inhibitedDefault = bool(true)
|
||||
silencedDefault = bool(true)
|
||||
)
|
||||
return &GetAlertGroupsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAlertGroupsParamsWithTimeout creates a new GetAlertGroupsParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetAlertGroupsParamsWithTimeout(timeout time.Duration) *GetAlertGroupsParams {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
inhibitedDefault = bool(true)
|
||||
silencedDefault = bool(true)
|
||||
)
|
||||
return &GetAlertGroupsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAlertGroupsParamsWithContext creates a new GetAlertGroupsParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetAlertGroupsParamsWithContext(ctx context.Context) *GetAlertGroupsParams {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
inhibitedDefault = bool(true)
|
||||
silencedDefault = bool(true)
|
||||
)
|
||||
return &GetAlertGroupsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAlertGroupsParamsWithHTTPClient creates a new GetAlertGroupsParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetAlertGroupsParamsWithHTTPClient(client *http.Client) *GetAlertGroupsParams {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
inhibitedDefault = bool(true)
|
||||
silencedDefault = bool(true)
|
||||
)
|
||||
return &GetAlertGroupsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*GetAlertGroupsParams contains all the parameters to send to the API endpoint
|
||||
for the get alert groups operation typically these are written to a http.Request
|
||||
/*
|
||||
GetAlertGroupsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get alert groups operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetAlertGroupsParams struct {
|
||||
|
||||
/*Active
|
||||
Show active alerts
|
||||
/* Active.
|
||||
|
||||
Show active alerts
|
||||
|
||||
Default: true
|
||||
*/
|
||||
Active *bool
|
||||
/*Filter
|
||||
A list of matchers to filter alerts by
|
||||
|
||||
/* Filter.
|
||||
|
||||
A list of matchers to filter alerts by
|
||||
*/
|
||||
Filter []string
|
||||
/*Inhibited
|
||||
Show inhibited alerts
|
||||
|
||||
/* Inhibited.
|
||||
|
||||
Show inhibited alerts
|
||||
|
||||
Default: true
|
||||
*/
|
||||
Inhibited *bool
|
||||
/*Receiver
|
||||
A regex matching receivers to filter alerts by
|
||||
|
||||
/* Receiver.
|
||||
|
||||
A regex matching receivers to filter alerts by
|
||||
*/
|
||||
Receiver *string
|
||||
/*Silenced
|
||||
Show silenced alerts
|
||||
|
||||
/* Silenced.
|
||||
|
||||
Show silenced alerts
|
||||
|
||||
Default: true
|
||||
*/
|
||||
Silenced *bool
|
||||
|
||||
@@ -135,6 +117,38 @@ type GetAlertGroupsParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get alert groups params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAlertGroupsParams) WithDefaults() *GetAlertGroupsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get alert groups params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAlertGroupsParams) SetDefaults() {
|
||||
var (
|
||||
activeDefault = bool(true)
|
||||
|
||||
inhibitedDefault = bool(true)
|
||||
|
||||
silencedDefault = bool(true)
|
||||
)
|
||||
|
||||
val := GetAlertGroupsParams{
|
||||
Active: &activeDefault,
|
||||
Inhibited: &inhibitedDefault,
|
||||
Silenced: &silencedDefault,
|
||||
}
|
||||
|
||||
val.timeout = o.timeout
|
||||
val.Context = o.Context
|
||||
val.HTTPClient = o.HTTPClient
|
||||
*o = val
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get alert groups params
|
||||
func (o *GetAlertGroupsParams) WithTimeout(timeout time.Duration) *GetAlertGroupsParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -235,72 +249,79 @@ func (o *GetAlertGroupsParams) WriteToRequest(r runtime.ClientRequest, reg strfm
|
||||
|
||||
// query param active
|
||||
var qrActive bool
|
||||
|
||||
if o.Active != nil {
|
||||
qrActive = *o.Active
|
||||
}
|
||||
qActive := swag.FormatBool(qrActive)
|
||||
if qActive != "" {
|
||||
|
||||
if err := r.SetQueryParam("active", qActive); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
valuesFilter := o.Filter
|
||||
if o.Filter != nil {
|
||||
|
||||
joinedFilter := swag.JoinByFormat(valuesFilter, "multi")
|
||||
// query array param filter
|
||||
if err := r.SetQueryParam("filter", joinedFilter...); err != nil {
|
||||
return err
|
||||
// binding items for filter
|
||||
joinedFilter := o.bindParamFilter(reg)
|
||||
|
||||
// query array param filter
|
||||
if err := r.SetQueryParam("filter", joinedFilter...); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if o.Inhibited != nil {
|
||||
|
||||
// query param inhibited
|
||||
var qrInhibited bool
|
||||
|
||||
if o.Inhibited != nil {
|
||||
qrInhibited = *o.Inhibited
|
||||
}
|
||||
qInhibited := swag.FormatBool(qrInhibited)
|
||||
if qInhibited != "" {
|
||||
|
||||
if err := r.SetQueryParam("inhibited", qInhibited); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Receiver != nil {
|
||||
|
||||
// query param receiver
|
||||
var qrReceiver string
|
||||
|
||||
if o.Receiver != nil {
|
||||
qrReceiver = *o.Receiver
|
||||
}
|
||||
qReceiver := qrReceiver
|
||||
if qReceiver != "" {
|
||||
|
||||
if err := r.SetQueryParam("receiver", qReceiver); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Silenced != nil {
|
||||
|
||||
// query param silenced
|
||||
var qrSilenced bool
|
||||
|
||||
if o.Silenced != nil {
|
||||
qrSilenced = *o.Silenced
|
||||
}
|
||||
qSilenced := swag.FormatBool(qrSilenced)
|
||||
if qSilenced != "" {
|
||||
|
||||
if err := r.SetQueryParam("silenced", qSilenced); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
@@ -308,3 +329,20 @@ func (o *GetAlertGroupsParams) WriteToRequest(r runtime.ClientRequest, reg strfm
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindParamGetAlertGroups binds the parameter filter
|
||||
func (o *GetAlertGroupsParams) bindParamFilter(formats strfmt.Registry) []string {
|
||||
filterIR := o.Filter
|
||||
|
||||
var filterIC []string
|
||||
for _, filterIIR := range filterIR { // explode []string
|
||||
|
||||
filterIIV := filterIIR // string as string
|
||||
filterIC = append(filterIC, filterIIV)
|
||||
}
|
||||
|
||||
// items.CollectionFormat: "multi"
|
||||
filterIS := swag.JoinByFormat(filterIC, "multi")
|
||||
|
||||
return filterIS
|
||||
}
|
||||
|
||||
@@ -24,10 +24,9 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
)
|
||||
|
||||
// GetAlertGroupsReader is a Reader for the GetAlertGroups structure.
|
||||
@@ -56,9 +55,8 @@ func (o *GetAlertGroupsReader) ReadResponse(response runtime.ClientResponse, con
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +65,8 @@ func NewGetAlertGroupsOK() *GetAlertGroupsOK {
|
||||
return &GetAlertGroupsOK{}
|
||||
}
|
||||
|
||||
/*GetAlertGroupsOK handles this case with default header values.
|
||||
/*
|
||||
GetAlertGroupsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Get alert groups response
|
||||
*/
|
||||
@@ -75,10 +74,39 @@ type GetAlertGroupsOK struct {
|
||||
Payload models.AlertGroups
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get alert groups o k response has a 2xx status code
|
||||
func (o *GetAlertGroupsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get alert groups o k response has a 3xx status code
|
||||
func (o *GetAlertGroupsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get alert groups o k response has a 4xx status code
|
||||
func (o *GetAlertGroupsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get alert groups o k response has a 5xx status code
|
||||
func (o *GetAlertGroupsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get alert groups o k response a status code equal to that given
|
||||
func (o *GetAlertGroupsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsOK) String() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsOK) GetPayload() models.AlertGroups {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -98,7 +126,8 @@ func NewGetAlertGroupsBadRequest() *GetAlertGroupsBadRequest {
|
||||
return &GetAlertGroupsBadRequest{}
|
||||
}
|
||||
|
||||
/*GetAlertGroupsBadRequest handles this case with default header values.
|
||||
/*
|
||||
GetAlertGroupsBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
Bad request
|
||||
*/
|
||||
@@ -106,10 +135,39 @@ type GetAlertGroupsBadRequest struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get alert groups bad request response has a 2xx status code
|
||||
func (o *GetAlertGroupsBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get alert groups bad request response has a 3xx status code
|
||||
func (o *GetAlertGroupsBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get alert groups bad request response has a 4xx status code
|
||||
func (o *GetAlertGroupsBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get alert groups bad request response has a 5xx status code
|
||||
func (o *GetAlertGroupsBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get alert groups bad request response a status code equal to that given
|
||||
func (o *GetAlertGroupsBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsBadRequest) String() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsBadRequest) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -129,7 +187,8 @@ func NewGetAlertGroupsInternalServerError() *GetAlertGroupsInternalServerError {
|
||||
return &GetAlertGroupsInternalServerError{}
|
||||
}
|
||||
|
||||
/*GetAlertGroupsInternalServerError handles this case with default header values.
|
||||
/*
|
||||
GetAlertGroupsInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
@@ -137,10 +196,39 @@ type GetAlertGroupsInternalServerError struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get alert groups internal server error response has a 2xx status code
|
||||
func (o *GetAlertGroupsInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get alert groups internal server error response has a 3xx status code
|
||||
func (o *GetAlertGroupsInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get alert groups internal server error response has a 4xx status code
|
||||
func (o *GetAlertGroupsInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get alert groups internal server error response has a 5xx status code
|
||||
func (o *GetAlertGroupsInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this get alert groups internal server error response a status code equal to that given
|
||||
func (o *GetAlertGroupsInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsInternalServerError) String() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ package client
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/prometheus/alertmanager/api/v2/client/alert"
|
||||
"github.com/prometheus/alertmanager/api/v2/client/alertgroup"
|
||||
@@ -32,7 +31,7 @@ import (
|
||||
"github.com/prometheus/alertmanager/api/v2/client/silence"
|
||||
)
|
||||
|
||||
// Default alertmanager HTTP client.
|
||||
// Default alertmanager API HTTP client.
|
||||
var Default = NewHTTPClient(nil)
|
||||
|
||||
const (
|
||||
@@ -41,20 +40,20 @@ const (
|
||||
DefaultHost string = "localhost"
|
||||
// DefaultBasePath is the default BasePath
|
||||
// found in Meta (info) section of spec file
|
||||
DefaultBasePath string = "/"
|
||||
DefaultBasePath string = "/api/v2/"
|
||||
)
|
||||
|
||||
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
|
||||
var DefaultSchemes = []string{"http"}
|
||||
|
||||
// NewHTTPClient creates a new alertmanager HTTP client.
|
||||
func NewHTTPClient(formats strfmt.Registry) *Alertmanager {
|
||||
// NewHTTPClient creates a new alertmanager API HTTP client.
|
||||
func NewHTTPClient(formats strfmt.Registry) *AlertmanagerAPI {
|
||||
return NewHTTPClientWithConfig(formats, nil)
|
||||
}
|
||||
|
||||
// NewHTTPClientWithConfig creates a new alertmanager HTTP client,
|
||||
// NewHTTPClientWithConfig creates a new alertmanager API HTTP client,
|
||||
// using a customizable transport config.
|
||||
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Alertmanager {
|
||||
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *AlertmanagerAPI {
|
||||
// ensure nullable parameters have default
|
||||
if cfg == nil {
|
||||
cfg = DefaultTransportConfig()
|
||||
@@ -65,26 +64,20 @@ func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Ale
|
||||
return New(transport, formats)
|
||||
}
|
||||
|
||||
// New creates a new alertmanager client
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Alertmanager {
|
||||
// New creates a new alertmanager API client
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *AlertmanagerAPI {
|
||||
// ensure nullable parameters have default
|
||||
if formats == nil {
|
||||
formats = strfmt.Default
|
||||
}
|
||||
|
||||
cli := new(Alertmanager)
|
||||
cli := new(AlertmanagerAPI)
|
||||
cli.Transport = transport
|
||||
|
||||
cli.Alert = alert.New(transport, formats)
|
||||
|
||||
cli.Alertgroup = alertgroup.New(transport, formats)
|
||||
|
||||
cli.General = general.New(transport, formats)
|
||||
|
||||
cli.Receiver = receiver.New(transport, formats)
|
||||
|
||||
cli.Silence = silence.New(transport, formats)
|
||||
|
||||
return cli
|
||||
}
|
||||
|
||||
@@ -127,33 +120,27 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
||||
return cfg
|
||||
}
|
||||
|
||||
// Alertmanager is a client for alertmanager
|
||||
type Alertmanager struct {
|
||||
Alert *alert.Client
|
||||
// AlertmanagerAPI is a client for alertmanager API
|
||||
type AlertmanagerAPI struct {
|
||||
Alert alert.ClientService
|
||||
|
||||
Alertgroup *alertgroup.Client
|
||||
Alertgroup alertgroup.ClientService
|
||||
|
||||
General *general.Client
|
||||
General general.ClientService
|
||||
|
||||
Receiver *receiver.Client
|
||||
Receiver receiver.ClientService
|
||||
|
||||
Silence *silence.Client
|
||||
Silence silence.ClientService
|
||||
|
||||
Transport runtime.ClientTransport
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client and all its subresources
|
||||
func (c *Alertmanager) SetTransport(transport runtime.ClientTransport) {
|
||||
func (c *AlertmanagerAPI) SetTransport(transport runtime.ClientTransport) {
|
||||
c.Transport = transport
|
||||
|
||||
c.Alert.SetTransport(transport)
|
||||
|
||||
c.Alertgroup.SetTransport(transport)
|
||||
|
||||
c.General.SetTransport(transport)
|
||||
|
||||
c.Receiver.SetTransport(transport)
|
||||
|
||||
c.Silence.SetTransport(transport)
|
||||
|
||||
}
|
||||
27
vendor/github.com/prometheus/alertmanager/api/v2/client/general/general_client.go
generated
vendored
27
vendor/github.com/prometheus/alertmanager/api/v2/client/general/general_client.go
generated
vendored
@@ -23,12 +23,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new general API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -40,16 +39,25 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetStatus(params *GetStatusParams, opts ...ClientOption) (*GetStatusOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetStatus Get current status of an Alertmanager instance and its cluster
|
||||
*/
|
||||
func (a *Client) GetStatus(params *GetStatusParams) (*GetStatusOK, error) {
|
||||
func (a *Client) GetStatus(params *GetStatusParams, opts ...ClientOption) (*GetStatusOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetStatusParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getStatus",
|
||||
Method: "GET",
|
||||
PathPattern: "/status",
|
||||
@@ -60,7 +68,12 @@ func (a *Client) GetStatus(params *GetStatusParams) (*GetStatusOK, error) {
|
||||
Reader: &GetStatusReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
47
vendor/github.com/prometheus/alertmanager/api/v2/client/general/get_status_parameters.go
generated
vendored
47
vendor/github.com/prometheus/alertmanager/api/v2/client/general/get_status_parameters.go
generated
vendored
@@ -27,51 +27,51 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetStatusParams creates a new GetStatusParams object
|
||||
// with the default values initialized.
|
||||
// NewGetStatusParams creates a new GetStatusParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetStatusParams() *GetStatusParams {
|
||||
|
||||
return &GetStatusParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetStatusParamsWithTimeout creates a new GetStatusParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetStatusParamsWithTimeout(timeout time.Duration) *GetStatusParams {
|
||||
|
||||
return &GetStatusParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetStatusParamsWithContext creates a new GetStatusParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetStatusParamsWithContext(ctx context.Context) *GetStatusParams {
|
||||
|
||||
return &GetStatusParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetStatusParamsWithHTTPClient creates a new GetStatusParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetStatusParamsWithHTTPClient(client *http.Client) *GetStatusParams {
|
||||
|
||||
return &GetStatusParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*GetStatusParams contains all the parameters to send to the API endpoint
|
||||
for the get status operation typically these are written to a http.Request
|
||||
/*
|
||||
GetStatusParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get status operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetStatusParams struct {
|
||||
timeout time.Duration
|
||||
@@ -79,6 +79,21 @@ type GetStatusParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get status params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetStatusParams) WithDefaults() *GetStatusParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get status params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetStatusParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get status params
|
||||
func (o *GetStatusParams) WithTimeout(timeout time.Duration) *GetStatusParams {
|
||||
o.SetTimeout(timeout)
|
||||
|
||||
40
vendor/github.com/prometheus/alertmanager/api/v2/client/general/get_status_responses.go
generated
vendored
40
vendor/github.com/prometheus/alertmanager/api/v2/client/general/get_status_responses.go
generated
vendored
@@ -24,10 +24,9 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
)
|
||||
|
||||
// GetStatusReader is a Reader for the GetStatus structure.
|
||||
@@ -44,9 +43,8 @@ func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +53,8 @@ func NewGetStatusOK() *GetStatusOK {
|
||||
return &GetStatusOK{}
|
||||
}
|
||||
|
||||
/*GetStatusOK handles this case with default header values.
|
||||
/*
|
||||
GetStatusOK describes a response with status code 200, with default header values.
|
||||
|
||||
Get status response
|
||||
*/
|
||||
@@ -63,10 +62,39 @@ type GetStatusOK struct {
|
||||
Payload *models.AlertmanagerStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get status o k response has a 2xx status code
|
||||
func (o *GetStatusOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get status o k response has a 3xx status code
|
||||
func (o *GetStatusOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get status o k response has a 4xx status code
|
||||
func (o *GetStatusOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get status o k response has a 5xx status code
|
||||
func (o *GetStatusOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get status o k response a status code equal to that given
|
||||
func (o *GetStatusOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetStatusOK) Error() string {
|
||||
return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetStatusOK) String() string {
|
||||
return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetStatusOK) GetPayload() *models.AlertmanagerStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -27,51 +27,51 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetReceiversParams creates a new GetReceiversParams object
|
||||
// with the default values initialized.
|
||||
// NewGetReceiversParams creates a new GetReceiversParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetReceiversParams() *GetReceiversParams {
|
||||
|
||||
return &GetReceiversParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetReceiversParamsWithTimeout creates a new GetReceiversParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetReceiversParamsWithTimeout(timeout time.Duration) *GetReceiversParams {
|
||||
|
||||
return &GetReceiversParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetReceiversParamsWithContext creates a new GetReceiversParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetReceiversParamsWithContext(ctx context.Context) *GetReceiversParams {
|
||||
|
||||
return &GetReceiversParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetReceiversParamsWithHTTPClient creates a new GetReceiversParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetReceiversParamsWithHTTPClient(client *http.Client) *GetReceiversParams {
|
||||
|
||||
return &GetReceiversParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*GetReceiversParams contains all the parameters to send to the API endpoint
|
||||
for the get receivers operation typically these are written to a http.Request
|
||||
/*
|
||||
GetReceiversParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get receivers operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetReceiversParams struct {
|
||||
timeout time.Duration
|
||||
@@ -79,6 +79,21 @@ type GetReceiversParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get receivers params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetReceiversParams) WithDefaults() *GetReceiversParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get receivers params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetReceiversParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get receivers params
|
||||
func (o *GetReceiversParams) WithTimeout(timeout time.Duration) *GetReceiversParams {
|
||||
o.SetTimeout(timeout)
|
||||
|
||||
@@ -24,10 +24,9 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
)
|
||||
|
||||
// GetReceiversReader is a Reader for the GetReceivers structure.
|
||||
@@ -44,9 +43,8 @@ func (o *GetReceiversReader) ReadResponse(response runtime.ClientResponse, consu
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +53,8 @@ func NewGetReceiversOK() *GetReceiversOK {
|
||||
return &GetReceiversOK{}
|
||||
}
|
||||
|
||||
/*GetReceiversOK handles this case with default header values.
|
||||
/*
|
||||
GetReceiversOK describes a response with status code 200, with default header values.
|
||||
|
||||
Get receivers response
|
||||
*/
|
||||
@@ -63,10 +62,39 @@ type GetReceiversOK struct {
|
||||
Payload []*models.Receiver
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get receivers o k response has a 2xx status code
|
||||
func (o *GetReceiversOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get receivers o k response has a 3xx status code
|
||||
func (o *GetReceiversOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get receivers o k response has a 4xx status code
|
||||
func (o *GetReceiversOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get receivers o k response has a 5xx status code
|
||||
func (o *GetReceiversOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get receivers o k response a status code equal to that given
|
||||
func (o *GetReceiversOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetReceiversOK) Error() string {
|
||||
return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetReceiversOK) String() string {
|
||||
return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetReceiversOK) GetPayload() []*models.Receiver {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
27
vendor/github.com/prometheus/alertmanager/api/v2/client/receiver/receiver_client.go
generated
vendored
27
vendor/github.com/prometheus/alertmanager/api/v2/client/receiver/receiver_client.go
generated
vendored
@@ -23,12 +23,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new receiver API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -40,16 +39,25 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetReceivers(params *GetReceiversParams, opts ...ClientOption) (*GetReceiversOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetReceivers Get list of all receivers (name of notification integrations)
|
||||
*/
|
||||
func (a *Client) GetReceivers(params *GetReceiversParams) (*GetReceiversOK, error) {
|
||||
func (a *Client) GetReceivers(params *GetReceiversParams, opts ...ClientOption) (*GetReceiversOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetReceiversParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getReceivers",
|
||||
Method: "GET",
|
||||
PathPattern: "/receivers",
|
||||
@@ -60,7 +68,12 @@ func (a *Client) GetReceivers(params *GetReceiversParams) (*GetReceiversOK, erro
|
||||
Reader: &GetReceiversReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -27,57 +27,59 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteSilenceParams creates a new DeleteSilenceParams object
|
||||
// with the default values initialized.
|
||||
// NewDeleteSilenceParams creates a new DeleteSilenceParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteSilenceParams() *DeleteSilenceParams {
|
||||
var ()
|
||||
return &DeleteSilenceParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteSilenceParamsWithTimeout creates a new DeleteSilenceParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteSilenceParamsWithTimeout(timeout time.Duration) *DeleteSilenceParams {
|
||||
var ()
|
||||
return &DeleteSilenceParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteSilenceParamsWithContext creates a new DeleteSilenceParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteSilenceParamsWithContext(ctx context.Context) *DeleteSilenceParams {
|
||||
var ()
|
||||
return &DeleteSilenceParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteSilenceParamsWithHTTPClient creates a new DeleteSilenceParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteSilenceParamsWithHTTPClient(client *http.Client) *DeleteSilenceParams {
|
||||
var ()
|
||||
return &DeleteSilenceParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*DeleteSilenceParams contains all the parameters to send to the API endpoint
|
||||
for the delete silence operation typically these are written to a http.Request
|
||||
/*
|
||||
DeleteSilenceParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete silence operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteSilenceParams struct {
|
||||
|
||||
/*SilenceID
|
||||
ID of the silence to get
|
||||
/* SilenceID.
|
||||
|
||||
ID of the silence to get
|
||||
|
||||
Format: uuid
|
||||
*/
|
||||
SilenceID strfmt.UUID
|
||||
|
||||
@@ -86,6 +88,21 @@ type DeleteSilenceParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete silence params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteSilenceParams) WithDefaults() *DeleteSilenceParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete silence params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteSilenceParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete silence params
|
||||
func (o *DeleteSilenceParams) WithTimeout(timeout time.Duration) *DeleteSilenceParams {
|
||||
o.SetTimeout(timeout)
|
||||
|
||||
@@ -24,8 +24,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// DeleteSilenceReader is a Reader for the DeleteSilence structure.
|
||||
@@ -48,9 +47,8 @@ func (o *DeleteSilenceReader) ReadResponse(response runtime.ClientResponse, cons
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,17 +57,47 @@ func NewDeleteSilenceOK() *DeleteSilenceOK {
|
||||
return &DeleteSilenceOK{}
|
||||
}
|
||||
|
||||
/*DeleteSilenceOK handles this case with default header values.
|
||||
/*
|
||||
DeleteSilenceOK describes a response with status code 200, with default header values.
|
||||
|
||||
Delete silence response
|
||||
*/
|
||||
type DeleteSilenceOK struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete silence o k response has a 2xx status code
|
||||
func (o *DeleteSilenceOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete silence o k response has a 3xx status code
|
||||
func (o *DeleteSilenceOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete silence o k response has a 4xx status code
|
||||
func (o *DeleteSilenceOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete silence o k response has a 5xx status code
|
||||
func (o *DeleteSilenceOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete silence o k response a status code equal to that given
|
||||
func (o *DeleteSilenceOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *DeleteSilenceOK) Error() string {
|
||||
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceOK ", 200)
|
||||
}
|
||||
|
||||
func (o *DeleteSilenceOK) String() string {
|
||||
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceOK ", 200)
|
||||
}
|
||||
|
||||
func (o *DeleteSilenceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
@@ -80,7 +108,8 @@ func NewDeleteSilenceInternalServerError() *DeleteSilenceInternalServerError {
|
||||
return &DeleteSilenceInternalServerError{}
|
||||
}
|
||||
|
||||
/*DeleteSilenceInternalServerError handles this case with default header values.
|
||||
/*
|
||||
DeleteSilenceInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
@@ -88,10 +117,39 @@ type DeleteSilenceInternalServerError struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete silence internal server error response has a 2xx status code
|
||||
func (o *DeleteSilenceInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete silence internal server error response has a 3xx status code
|
||||
func (o *DeleteSilenceInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete silence internal server error response has a 4xx status code
|
||||
func (o *DeleteSilenceInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete silence internal server error response has a 5xx status code
|
||||
func (o *DeleteSilenceInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete silence internal server error response a status code equal to that given
|
||||
func (o *DeleteSilenceInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *DeleteSilenceInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteSilenceInternalServerError) String() string {
|
||||
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteSilenceInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -27,57 +27,59 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetSilenceParams creates a new GetSilenceParams object
|
||||
// with the default values initialized.
|
||||
// NewGetSilenceParams creates a new GetSilenceParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetSilenceParams() *GetSilenceParams {
|
||||
var ()
|
||||
return &GetSilenceParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetSilenceParamsWithTimeout creates a new GetSilenceParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetSilenceParamsWithTimeout(timeout time.Duration) *GetSilenceParams {
|
||||
var ()
|
||||
return &GetSilenceParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetSilenceParamsWithContext creates a new GetSilenceParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetSilenceParamsWithContext(ctx context.Context) *GetSilenceParams {
|
||||
var ()
|
||||
return &GetSilenceParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetSilenceParamsWithHTTPClient creates a new GetSilenceParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetSilenceParamsWithHTTPClient(client *http.Client) *GetSilenceParams {
|
||||
var ()
|
||||
return &GetSilenceParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*GetSilenceParams contains all the parameters to send to the API endpoint
|
||||
for the get silence operation typically these are written to a http.Request
|
||||
/*
|
||||
GetSilenceParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get silence operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetSilenceParams struct {
|
||||
|
||||
/*SilenceID
|
||||
ID of the silence to get
|
||||
/* SilenceID.
|
||||
|
||||
ID of the silence to get
|
||||
|
||||
Format: uuid
|
||||
*/
|
||||
SilenceID strfmt.UUID
|
||||
|
||||
@@ -86,6 +88,21 @@ type GetSilenceParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get silence params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetSilenceParams) WithDefaults() *GetSilenceParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get silence params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetSilenceParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get silence params
|
||||
func (o *GetSilenceParams) WithTimeout(timeout time.Duration) *GetSilenceParams {
|
||||
o.SetTimeout(timeout)
|
||||
|
||||
104
vendor/github.com/prometheus/alertmanager/api/v2/client/silence/get_silence_responses.go
generated
vendored
104
vendor/github.com/prometheus/alertmanager/api/v2/client/silence/get_silence_responses.go
generated
vendored
@@ -24,10 +24,9 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
)
|
||||
|
||||
// GetSilenceReader is a Reader for the GetSilence structure.
|
||||
@@ -56,9 +55,8 @@ func (o *GetSilenceReader) ReadResponse(response runtime.ClientResponse, consume
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +65,8 @@ func NewGetSilenceOK() *GetSilenceOK {
|
||||
return &GetSilenceOK{}
|
||||
}
|
||||
|
||||
/*GetSilenceOK handles this case with default header values.
|
||||
/*
|
||||
GetSilenceOK describes a response with status code 200, with default header values.
|
||||
|
||||
Get silence response
|
||||
*/
|
||||
@@ -75,10 +74,39 @@ type GetSilenceOK struct {
|
||||
Payload *models.GettableSilence
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get silence o k response has a 2xx status code
|
||||
func (o *GetSilenceOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get silence o k response has a 3xx status code
|
||||
func (o *GetSilenceOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get silence o k response has a 4xx status code
|
||||
func (o *GetSilenceOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get silence o k response has a 5xx status code
|
||||
func (o *GetSilenceOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get silence o k response a status code equal to that given
|
||||
func (o *GetSilenceOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetSilenceOK) Error() string {
|
||||
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilenceOK) String() string {
|
||||
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilenceOK) GetPayload() *models.GettableSilence {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -100,17 +128,47 @@ func NewGetSilenceNotFound() *GetSilenceNotFound {
|
||||
return &GetSilenceNotFound{}
|
||||
}
|
||||
|
||||
/*GetSilenceNotFound handles this case with default header values.
|
||||
/*
|
||||
GetSilenceNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
A silence with the specified ID was not found
|
||||
*/
|
||||
type GetSilenceNotFound struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get silence not found response has a 2xx status code
|
||||
func (o *GetSilenceNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get silence not found response has a 3xx status code
|
||||
func (o *GetSilenceNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get silence not found response has a 4xx status code
|
||||
func (o *GetSilenceNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get silence not found response has a 5xx status code
|
||||
func (o *GetSilenceNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get silence not found response a status code equal to that given
|
||||
func (o *GetSilenceNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
func (o *GetSilenceNotFound) Error() string {
|
||||
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceNotFound ", 404)
|
||||
}
|
||||
|
||||
func (o *GetSilenceNotFound) String() string {
|
||||
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceNotFound ", 404)
|
||||
}
|
||||
|
||||
func (o *GetSilenceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
@@ -121,7 +179,8 @@ func NewGetSilenceInternalServerError() *GetSilenceInternalServerError {
|
||||
return &GetSilenceInternalServerError{}
|
||||
}
|
||||
|
||||
/*GetSilenceInternalServerError handles this case with default header values.
|
||||
/*
|
||||
GetSilenceInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
@@ -129,10 +188,39 @@ type GetSilenceInternalServerError struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get silence internal server error response has a 2xx status code
|
||||
func (o *GetSilenceInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get silence internal server error response has a 3xx status code
|
||||
func (o *GetSilenceInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get silence internal server error response has a 4xx status code
|
||||
func (o *GetSilenceInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get silence internal server error response has a 5xx status code
|
||||
func (o *GetSilenceInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this get silence internal server error response a status code equal to that given
|
||||
func (o *GetSilenceInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *GetSilenceInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilenceInternalServerError) String() string {
|
||||
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilenceInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -27,58 +27,58 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetSilencesParams creates a new GetSilencesParams object
|
||||
// with the default values initialized.
|
||||
// NewGetSilencesParams creates a new GetSilencesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetSilencesParams() *GetSilencesParams {
|
||||
var ()
|
||||
return &GetSilencesParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetSilencesParamsWithTimeout creates a new GetSilencesParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetSilencesParamsWithTimeout(timeout time.Duration) *GetSilencesParams {
|
||||
var ()
|
||||
return &GetSilencesParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetSilencesParamsWithContext creates a new GetSilencesParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetSilencesParamsWithContext(ctx context.Context) *GetSilencesParams {
|
||||
var ()
|
||||
return &GetSilencesParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetSilencesParamsWithHTTPClient creates a new GetSilencesParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetSilencesParamsWithHTTPClient(client *http.Client) *GetSilencesParams {
|
||||
var ()
|
||||
return &GetSilencesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*GetSilencesParams contains all the parameters to send to the API endpoint
|
||||
for the get silences operation typically these are written to a http.Request
|
||||
/*
|
||||
GetSilencesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get silences operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetSilencesParams struct {
|
||||
|
||||
/*Filter
|
||||
A list of matchers to filter silences by
|
||||
/* Filter.
|
||||
|
||||
A list of matchers to filter silences by
|
||||
*/
|
||||
Filter []string
|
||||
|
||||
@@ -87,6 +87,21 @@ type GetSilencesParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get silences params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetSilencesParams) WithDefaults() *GetSilencesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get silences params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetSilencesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get silences params
|
||||
func (o *GetSilencesParams) WithTimeout(timeout time.Duration) *GetSilencesParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -139,12 +154,15 @@ func (o *GetSilencesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
}
|
||||
var res []error
|
||||
|
||||
valuesFilter := o.Filter
|
||||
if o.Filter != nil {
|
||||
|
||||
joinedFilter := swag.JoinByFormat(valuesFilter, "multi")
|
||||
// query array param filter
|
||||
if err := r.SetQueryParam("filter", joinedFilter...); err != nil {
|
||||
return err
|
||||
// binding items for filter
|
||||
joinedFilter := o.bindParamFilter(reg)
|
||||
|
||||
// query array param filter
|
||||
if err := r.SetQueryParam("filter", joinedFilter...); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
@@ -152,3 +170,20 @@ func (o *GetSilencesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindParamGetSilences binds the parameter filter
|
||||
func (o *GetSilencesParams) bindParamFilter(formats strfmt.Registry) []string {
|
||||
filterIR := o.Filter
|
||||
|
||||
var filterIC []string
|
||||
for _, filterIIR := range filterIR { // explode []string
|
||||
|
||||
filterIIV := filterIIR // string as string
|
||||
filterIC = append(filterIC, filterIIV)
|
||||
}
|
||||
|
||||
// items.CollectionFormat: "multi"
|
||||
filterIS := swag.JoinByFormat(filterIC, "multi")
|
||||
|
||||
return filterIS
|
||||
}
|
||||
|
||||
@@ -24,10 +24,9 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
)
|
||||
|
||||
// GetSilencesReader is a Reader for the GetSilences structure.
|
||||
@@ -50,9 +49,8 @@ func (o *GetSilencesReader) ReadResponse(response runtime.ClientResponse, consum
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +59,8 @@ func NewGetSilencesOK() *GetSilencesOK {
|
||||
return &GetSilencesOK{}
|
||||
}
|
||||
|
||||
/*GetSilencesOK handles this case with default header values.
|
||||
/*
|
||||
GetSilencesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Get silences response
|
||||
*/
|
||||
@@ -69,10 +68,39 @@ type GetSilencesOK struct {
|
||||
Payload models.GettableSilences
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get silences o k response has a 2xx status code
|
||||
func (o *GetSilencesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get silences o k response has a 3xx status code
|
||||
func (o *GetSilencesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get silences o k response has a 4xx status code
|
||||
func (o *GetSilencesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get silences o k response has a 5xx status code
|
||||
func (o *GetSilencesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get silences o k response a status code equal to that given
|
||||
func (o *GetSilencesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetSilencesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /silences][%d] getSilencesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilencesOK) String() string {
|
||||
return fmt.Sprintf("[GET /silences][%d] getSilencesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilencesOK) GetPayload() models.GettableSilences {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -92,7 +120,8 @@ func NewGetSilencesInternalServerError() *GetSilencesInternalServerError {
|
||||
return &GetSilencesInternalServerError{}
|
||||
}
|
||||
|
||||
/*GetSilencesInternalServerError handles this case with default header values.
|
||||
/*
|
||||
GetSilencesInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
Internal server error
|
||||
*/
|
||||
@@ -100,10 +129,39 @@ type GetSilencesInternalServerError struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get silences internal server error response has a 2xx status code
|
||||
func (o *GetSilencesInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get silences internal server error response has a 3xx status code
|
||||
func (o *GetSilencesInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get silences internal server error response has a 4xx status code
|
||||
func (o *GetSilencesInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get silences internal server error response has a 5xx status code
|
||||
func (o *GetSilencesInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this get silences internal server error response a status code equal to that given
|
||||
func (o *GetSilencesInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *GetSilencesInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilencesInternalServerError) String() string {
|
||||
return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilencesInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -27,59 +27,59 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/api/v2/models"
|
||||
)
|
||||
|
||||
// NewPostSilencesParams creates a new PostSilencesParams object
|
||||
// with the default values initialized.
|
||||
// NewPostSilencesParams creates a new PostSilencesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewPostSilencesParams() *PostSilencesParams {
|
||||
var ()
|
||||
return &PostSilencesParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostSilencesParamsWithTimeout creates a new PostSilencesParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPostSilencesParamsWithTimeout(timeout time.Duration) *PostSilencesParams {
|
||||
var ()
|
||||
return &PostSilencesParams{
|
||||
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostSilencesParamsWithContext creates a new PostSilencesParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
// with the ability to set a context for a request.
|
||||
func NewPostSilencesParamsWithContext(ctx context.Context) *PostSilencesParams {
|
||||
var ()
|
||||
return &PostSilencesParams{
|
||||
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostSilencesParamsWithHTTPClient creates a new PostSilencesParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPostSilencesParamsWithHTTPClient(client *http.Client) *PostSilencesParams {
|
||||
var ()
|
||||
return &PostSilencesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*PostSilencesParams contains all the parameters to send to the API endpoint
|
||||
for the post silences operation typically these are written to a http.Request
|
||||
/*
|
||||
PostSilencesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the post silences operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PostSilencesParams struct {
|
||||
|
||||
/*Silence
|
||||
The silence to create
|
||||
/* Silence.
|
||||
|
||||
The silence to create
|
||||
*/
|
||||
Silence *models.PostableSilence
|
||||
|
||||
@@ -88,6 +88,21 @@ type PostSilencesParams struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the post silences params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostSilencesParams) WithDefaults() *PostSilencesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the post silences params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostSilencesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the post silences params
|
||||
func (o *PostSilencesParams) WithTimeout(timeout time.Duration) *PostSilencesParams {
|
||||
o.SetTimeout(timeout)
|
||||
@@ -139,7 +154,6 @@ func (o *PostSilencesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Silence != nil {
|
||||
if err := r.SetBodyParam(o.Silence); err != nil {
|
||||
return err
|
||||
|
||||
111
vendor/github.com/prometheus/alertmanager/api/v2/client/silence/post_silences_responses.go
generated
vendored
111
vendor/github.com/prometheus/alertmanager/api/v2/client/silence/post_silences_responses.go
generated
vendored
@@ -20,13 +20,13 @@ package silence
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// PostSilencesReader is a Reader for the PostSilences structure.
|
||||
@@ -55,9 +55,8 @@ func (o *PostSilencesReader) ReadResponse(response runtime.ClientResponse, consu
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +65,8 @@ func NewPostSilencesOK() *PostSilencesOK {
|
||||
return &PostSilencesOK{}
|
||||
}
|
||||
|
||||
/*PostSilencesOK handles this case with default header values.
|
||||
/*
|
||||
PostSilencesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Create / update silence response
|
||||
*/
|
||||
@@ -74,10 +74,39 @@ type PostSilencesOK struct {
|
||||
Payload *PostSilencesOKBody
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post silences o k response has a 2xx status code
|
||||
func (o *PostSilencesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post silences o k response has a 3xx status code
|
||||
func (o *PostSilencesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post silences o k response has a 4xx status code
|
||||
func (o *PostSilencesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post silences o k response has a 5xx status code
|
||||
func (o *PostSilencesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post silences o k response a status code equal to that given
|
||||
func (o *PostSilencesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *PostSilencesOK) Error() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesOK) String() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesOK) GetPayload() *PostSilencesOKBody {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -99,7 +128,8 @@ func NewPostSilencesBadRequest() *PostSilencesBadRequest {
|
||||
return &PostSilencesBadRequest{}
|
||||
}
|
||||
|
||||
/*PostSilencesBadRequest handles this case with default header values.
|
||||
/*
|
||||
PostSilencesBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
Bad request
|
||||
*/
|
||||
@@ -107,10 +137,39 @@ type PostSilencesBadRequest struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post silences bad request response has a 2xx status code
|
||||
func (o *PostSilencesBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post silences bad request response has a 3xx status code
|
||||
func (o *PostSilencesBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post silences bad request response has a 4xx status code
|
||||
func (o *PostSilencesBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post silences bad request response has a 5xx status code
|
||||
func (o *PostSilencesBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post silences bad request response a status code equal to that given
|
||||
func (o *PostSilencesBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
func (o *PostSilencesBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesBadRequest) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -130,7 +189,8 @@ func NewPostSilencesNotFound() *PostSilencesNotFound {
|
||||
return &PostSilencesNotFound{}
|
||||
}
|
||||
|
||||
/*PostSilencesNotFound handles this case with default header values.
|
||||
/*
|
||||
PostSilencesNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
A silence with the specified ID was not found
|
||||
*/
|
||||
@@ -138,10 +198,39 @@ type PostSilencesNotFound struct {
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post silences not found response has a 2xx status code
|
||||
func (o *PostSilencesNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post silences not found response has a 3xx status code
|
||||
func (o *PostSilencesNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post silences not found response has a 4xx status code
|
||||
func (o *PostSilencesNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post silences not found response has a 5xx status code
|
||||
func (o *PostSilencesNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post silences not found response a status code equal to that given
|
||||
func (o *PostSilencesNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
func (o *PostSilencesNotFound) Error() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesNotFound) String() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesNotFound) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -156,7 +245,8 @@ func (o *PostSilencesNotFound) readResponse(response runtime.ClientResponse, con
|
||||
return nil
|
||||
}
|
||||
|
||||
/*PostSilencesOKBody post silences o k body
|
||||
/*
|
||||
PostSilencesOKBody post silences o k body
|
||||
swagger:model PostSilencesOKBody
|
||||
*/
|
||||
type PostSilencesOKBody struct {
|
||||
@@ -170,6 +260,11 @@ func (o *PostSilencesOKBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this post silences o k body based on context it is used
|
||||
func (o *PostSilencesOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *PostSilencesOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
|
||||
69
vendor/github.com/prometheus/alertmanager/api/v2/client/silence/silence_client.go
generated
vendored
69
vendor/github.com/prometheus/alertmanager/api/v2/client/silence/silence_client.go
generated
vendored
@@ -23,12 +23,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new silence API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -40,16 +39,31 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
DeleteSilence(params *DeleteSilenceParams, opts ...ClientOption) (*DeleteSilenceOK, error)
|
||||
|
||||
GetSilence(params *GetSilenceParams, opts ...ClientOption) (*GetSilenceOK, error)
|
||||
|
||||
GetSilences(params *GetSilencesParams, opts ...ClientOption) (*GetSilencesOK, error)
|
||||
|
||||
PostSilences(params *PostSilencesParams, opts ...ClientOption) (*PostSilencesOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteSilence Delete a silence by its ID
|
||||
*/
|
||||
func (a *Client) DeleteSilence(params *DeleteSilenceParams) (*DeleteSilenceOK, error) {
|
||||
func (a *Client) DeleteSilence(params *DeleteSilenceParams, opts ...ClientOption) (*DeleteSilenceOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteSilenceParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "deleteSilence",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/silence/{silenceID}",
|
||||
@@ -60,7 +74,12 @@ func (a *Client) DeleteSilence(params *DeleteSilenceParams) (*DeleteSilenceOK, e
|
||||
Reader: &DeleteSilenceReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -77,13 +96,12 @@ func (a *Client) DeleteSilence(params *DeleteSilenceParams) (*DeleteSilenceOK, e
|
||||
/*
|
||||
GetSilence Get a silence by its ID
|
||||
*/
|
||||
func (a *Client) GetSilence(params *GetSilenceParams) (*GetSilenceOK, error) {
|
||||
func (a *Client) GetSilence(params *GetSilenceParams, opts ...ClientOption) (*GetSilenceOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetSilenceParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getSilence",
|
||||
Method: "GET",
|
||||
PathPattern: "/silence/{silenceID}",
|
||||
@@ -94,7 +112,12 @@ func (a *Client) GetSilence(params *GetSilenceParams) (*GetSilenceOK, error) {
|
||||
Reader: &GetSilenceReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -111,13 +134,12 @@ func (a *Client) GetSilence(params *GetSilenceParams) (*GetSilenceOK, error) {
|
||||
/*
|
||||
GetSilences Get a list of silences
|
||||
*/
|
||||
func (a *Client) GetSilences(params *GetSilencesParams) (*GetSilencesOK, error) {
|
||||
func (a *Client) GetSilences(params *GetSilencesParams, opts ...ClientOption) (*GetSilencesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetSilencesParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "getSilences",
|
||||
Method: "GET",
|
||||
PathPattern: "/silences",
|
||||
@@ -128,7 +150,12 @@ func (a *Client) GetSilences(params *GetSilencesParams) (*GetSilencesOK, error)
|
||||
Reader: &GetSilencesReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -145,13 +172,12 @@ func (a *Client) GetSilences(params *GetSilencesParams) (*GetSilencesOK, error)
|
||||
/*
|
||||
PostSilences Post a new silence or update an existing one
|
||||
*/
|
||||
func (a *Client) PostSilences(params *PostSilencesParams) (*PostSilencesOK, error) {
|
||||
func (a *Client) PostSilences(params *PostSilencesParams, opts ...ClientOption) (*PostSilencesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewPostSilencesParams()
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(&runtime.ClientOperation{
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "postSilences",
|
||||
Method: "POST",
|
||||
PathPattern: "/silences",
|
||||
@@ -162,7 +188,12 @@ func (a *Client) PostSilences(params *PostSilencesParams) (*PostSilencesOK, erro
|
||||
Reader: &PostSilencesReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
})
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
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