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

View File

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

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"
)
// 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
}