alertmanager/api/v2/restapi/operations/silence/delete_silence_parameters.go
Goutham Veeramachaneni e26425473c
Update go-openapi to latest
go-swagger 0.25.0+ are failing though :/

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2021-03-10 19:00:22 +01:00

106 lines
3.0 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// Copyright Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package silence
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
)
// NewDeleteSilenceParams creates a new DeleteSilenceParams object
// no default values defined in spec.
func NewDeleteSilenceParams() DeleteSilenceParams {
return DeleteSilenceParams{}
}
// DeleteSilenceParams contains all the bound params for the delete silence operation
// typically these are obtained from a http.Request
//
// swagger:parameters deleteSilence
type DeleteSilenceParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*ID of the silence to get
Required: true
In: path
*/
SilenceID strfmt.UUID
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewDeleteSilenceParams() beforehand.
func (o *DeleteSilenceParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rSilenceID, rhkSilenceID, _ := route.Params.GetOK("silenceID")
if err := o.bindSilenceID(rSilenceID, rhkSilenceID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindSilenceID binds and validates parameter SilenceID from path.
func (o *DeleteSilenceParams) bindSilenceID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
// Format: uuid
value, err := formats.Parse("uuid", raw)
if err != nil {
return errors.InvalidType("silenceID", "path", "strfmt.UUID", raw)
}
o.SilenceID = *(value.(*strfmt.UUID))
if err := o.validateSilenceID(formats); err != nil {
return err
}
return nil
}
// validateSilenceID carries on validations for parameter SilenceID
func (o *DeleteSilenceParams) validateSilenceID(formats strfmt.Registry) error {
if err := validate.FormatOf("silenceID", "path", "uuid", o.SilenceID.String(), formats); err != nil {
return err
}
return nil
}