update prometheus dependencies (#5520)

Signed-off-by: junot <junotxiang@kubesphere.io>
This commit is contained in:
junot
2023-02-14 09:46:22 +08:00
committed by GitHub
parent a979342f56
commit 2cd5f45d47
769 changed files with 81283 additions and 30511 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}