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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user