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

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

View File

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

View File

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

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

View File

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

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

View File

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

View File

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

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