mirror of
https://github.com/prymitive/karma
synced 2026-08-23 11:56:20 +00:00
chore(backend): regenerate openapi code (#2647)
This commit is contained in:
@@ -17,114 +17,90 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// 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
|
||||
|
||||
@@ -133,6 +109,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)
|
||||
@@ -244,88 +255,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 {
|
||||
@@ -333,3 +352,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
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ func (o *GetAlertsReader) ReadResponse(response runtime.ClientResponse, consumer
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -52,7 +51,7 @@ 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
|
||||
*/
|
||||
@@ -63,7 +62,6 @@ type GetAlertsOK struct {
|
||||
func (o *GetAlertsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsOK) GetPayload() models.GettableAlerts {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -83,7 +81,7 @@ 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
|
||||
*/
|
||||
@@ -94,7 +92,6 @@ type GetAlertsBadRequest struct {
|
||||
func (o *GetAlertsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsBadRequest) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -114,7 +111,7 @@ 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
|
||||
*/
|
||||
@@ -125,7 +122,6 @@ type GetAlertsInternalServerError struct {
|
||||
func (o *GetAlertsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertsInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -18,53 +18,52 @@ import (
|
||||
"github.com/prymitive/karma/internal/mapper/v017/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
|
||||
|
||||
@@ -73,6 +72,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)
|
||||
@@ -124,7 +138,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
|
||||
|
||||
@@ -39,7 +39,6 @@ func (o *PostAlertsReader) ReadResponse(response runtime.ClientResponse, consume
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -50,7 +49,7 @@ 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
|
||||
*/
|
||||
@@ -71,7 +70,7 @@ 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
|
||||
*/
|
||||
@@ -82,7 +81,6 @@ type PostAlertsBadRequest struct {
|
||||
func (o *PostAlertsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAlertsBadRequest) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -102,7 +100,7 @@ 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
|
||||
*/
|
||||
@@ -113,7 +111,6 @@ type PostAlertsInternalServerError struct {
|
||||
func (o *PostAlertsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAlertsInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -17,101 +17,82 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// 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
|
||||
|
||||
@@ -120,6 +101,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)
|
||||
@@ -220,72 +233,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 {
|
||||
@@ -293,3 +313,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
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ func (o *GetAlertGroupsReader) ReadResponse(response runtime.ClientResponse, con
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -52,7 +51,7 @@ 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
|
||||
*/
|
||||
@@ -63,7 +62,6 @@ type GetAlertGroupsOK struct {
|
||||
func (o *GetAlertGroupsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsOK) GetPayload() models.AlertGroups {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -83,7 +81,7 @@ 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
|
||||
*/
|
||||
@@ -94,7 +92,6 @@ type GetAlertGroupsBadRequest struct {
|
||||
func (o *GetAlertGroupsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsBadRequest) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -114,7 +111,7 @@ 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
|
||||
*/
|
||||
@@ -125,7 +122,6 @@ type GetAlertGroupsInternalServerError struct {
|
||||
func (o *GetAlertGroupsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAlertGroupsInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -16,47 +16,46 @@ import (
|
||||
"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
|
||||
@@ -64,6 +63,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)
|
||||
|
||||
@@ -29,7 +29,6 @@ func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -40,7 +39,7 @@ 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
|
||||
*/
|
||||
@@ -51,7 +50,6 @@ type GetStatusOK struct {
|
||||
func (o *GetStatusOK) Error() string {
|
||||
return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetStatusOK) GetPayload() *models.AlertmanagerStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -16,47 +16,46 @@ import (
|
||||
"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
|
||||
@@ -64,6 +63,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)
|
||||
|
||||
@@ -29,7 +29,6 @@ func (o *GetReceiversReader) ReadResponse(response runtime.ClientResponse, consu
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -40,7 +39,7 @@ 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
|
||||
*/
|
||||
@@ -51,7 +50,6 @@ type GetReceiversOK struct {
|
||||
func (o *GetReceiversOK) Error() string {
|
||||
return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetReceiversOK) GetPayload() []*models.Receiver {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -16,53 +16,54 @@ import (
|
||||
"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
|
||||
|
||||
@@ -71,6 +72,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)
|
||||
|
||||
@@ -33,7 +33,6 @@ func (o *DeleteSilenceReader) ReadResponse(response runtime.ClientResponse, cons
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -44,7 +43,7 @@ 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
|
||||
*/
|
||||
@@ -65,7 +64,7 @@ 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
|
||||
*/
|
||||
@@ -76,7 +75,6 @@ type DeleteSilenceInternalServerError struct {
|
||||
func (o *DeleteSilenceInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *DeleteSilenceInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -16,53 +16,54 @@ import (
|
||||
"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
|
||||
|
||||
@@ -71,6 +72,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)
|
||||
|
||||
@@ -41,7 +41,6 @@ func (o *GetSilenceReader) ReadResponse(response runtime.ClientResponse, consume
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -52,7 +51,7 @@ 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
|
||||
*/
|
||||
@@ -63,7 +62,6 @@ type GetSilenceOK struct {
|
||||
func (o *GetSilenceOK) Error() string {
|
||||
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilenceOK) GetPayload() *models.GettableSilence {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -85,7 +83,7 @@ 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
|
||||
*/
|
||||
@@ -106,7 +104,7 @@ 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
|
||||
*/
|
||||
@@ -117,7 +115,6 @@ type GetSilenceInternalServerError struct {
|
||||
func (o *GetSilenceInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilenceInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -17,53 +17,52 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// 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
|
||||
|
||||
@@ -72,6 +71,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)
|
||||
@@ -124,12 +138,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 {
|
||||
@@ -137,3 +154,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
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ func (o *GetSilencesReader) ReadResponse(response runtime.ClientResponse, consum
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -46,7 +45,7 @@ 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
|
||||
*/
|
||||
@@ -57,7 +56,6 @@ type GetSilencesOK struct {
|
||||
func (o *GetSilencesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /silences][%d] getSilencesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilencesOK) GetPayload() models.GettableSilences {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -77,7 +75,7 @@ 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
|
||||
*/
|
||||
@@ -88,7 +86,6 @@ type GetSilencesInternalServerError struct {
|
||||
func (o *GetSilencesInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %+v", 500, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetSilencesInternalServerError) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@@ -18,53 +18,52 @@ import (
|
||||
"github.com/prymitive/karma/internal/mapper/v017/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
|
||||
|
||||
@@ -73,6 +72,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)
|
||||
@@ -124,7 +138,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
|
||||
|
||||
@@ -6,6 +6,7 @@ package silence
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -40,7 +41,6 @@ func (o *PostSilencesReader) ReadResponse(response runtime.ClientResponse, consu
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
@@ -51,7 +51,7 @@ 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
|
||||
*/
|
||||
@@ -62,7 +62,6 @@ type PostSilencesOK struct {
|
||||
func (o *PostSilencesOK) Error() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesOK) GetPayload() *PostSilencesOKBody {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -84,7 +83,7 @@ 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
|
||||
*/
|
||||
@@ -95,7 +94,6 @@ type PostSilencesBadRequest struct {
|
||||
func (o *PostSilencesBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %+v", 400, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesBadRequest) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -115,7 +113,7 @@ 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
|
||||
*/
|
||||
@@ -126,7 +124,6 @@ type PostSilencesNotFound struct {
|
||||
func (o *PostSilencesNotFound) Error() string {
|
||||
return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %+v", 404, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostSilencesNotFound) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
@@ -155,6 +152,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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -45,7 +47,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
|
||||
}
|
||||
@@ -59,7 +60,39 @@ 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")
|
||||
}
|
||||
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")
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -81,13 +82,19 @@ 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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -109,6 +116,72 @@ func (m *AlertGroup) validateReceiver(formats strfmt.Registry) error {
|
||||
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))
|
||||
}
|
||||
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")
|
||||
}
|
||||
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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertGroup) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -43,3 +44,26 @@ func (m AlertGroups) Validate(formats strfmt.Registry) error {
|
||||
}
|
||||
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))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -119,6 +120,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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -45,6 +47,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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -128,6 +130,70 @@ func (m *AlertmanagerStatus) validateVersionInfo(formats strfmt.Registry) error
|
||||
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")
|
||||
}
|
||||
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")
|
||||
}
|
||||
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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AlertmanagerStatus) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
@@ -51,7 +52,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
|
||||
}
|
||||
@@ -121,6 +121,38 @@ 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))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ClusterStatus) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -192,13 +193,19 @@ 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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -293,6 +300,77 @@ 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")
|
||||
}
|
||||
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))
|
||||
}
|
||||
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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GettableAlert) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -43,3 +44,26 @@ func (m GettableAlerts) Validate(formats strfmt.Registry) error {
|
||||
}
|
||||
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))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -162,6 +164,39 @@ 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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GettableSilence) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -43,3 +44,26 @@ func (m GettableSilences) Validate(formats strfmt.Registry) error {
|
||||
}
|
||||
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))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
@@ -18,3 +20,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
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -79,6 +81,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 {
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -50,3 +51,26 @@ func (m Matchers) Validate(formats strfmt.Registry) error {
|
||||
}
|
||||
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))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -62,6 +64,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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -126,11 +128,13 @@ 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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -162,6 +166,37 @@ 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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PostableAlert) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -43,3 +44,26 @@ func (m PostableAlerts) Validate(formats strfmt.Registry) error {
|
||||
}
|
||||
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))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -83,6 +85,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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -45,6 +47,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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -130,6 +132,32 @@ 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")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Silence) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
@@ -85,6 +86,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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -130,6 +132,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