You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.5 KiB
97 lines
2.5 KiB
3 years ago
|
// Code generated by go-swagger; DO NOT EDIT.
|
||
|
|
||
|
package trigger_management
|
||
|
|
||
|
// 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"
|
||
|
"github.com/go-openapi/runtime/middleware"
|
||
|
"github.com/go-openapi/strfmt"
|
||
|
"github.com/go-openapi/validate"
|
||
|
)
|
||
|
|
||
|
// NewPeriodicRunParams creates a new PeriodicRunParams object
|
||
|
// no default values defined in spec.
|
||
|
func NewPeriodicRunParams() PeriodicRunParams {
|
||
|
|
||
|
return PeriodicRunParams{}
|
||
|
}
|
||
|
|
||
|
// PeriodicRunParams contains all the bound params for the periodic run operation
|
||
|
// typically these are obtained from a http.Request
|
||
|
//
|
||
|
// swagger:parameters periodicRun
|
||
|
type PeriodicRunParams struct {
|
||
|
|
||
|
// HTTP Request Object
|
||
|
HTTPRequest *http.Request `json:"-"`
|
||
|
|
||
|
/*Datetime to override the time.now() to simulate other days
|
||
|
In: query
|
||
|
*/
|
||
|
Today *strfmt.DateTime
|
||
|
}
|
||
|
|
||
|
// 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 NewPeriodicRunParams() beforehand.
|
||
|
func (o *PeriodicRunParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||
|
var res []error
|
||
|
|
||
|
o.HTTPRequest = r
|
||
|
|
||
|
qs := runtime.Values(r.URL.Query())
|
||
|
|
||
|
qToday, qhkToday, _ := qs.GetOK("today")
|
||
|
if err := o.bindToday(qToday, qhkToday, route.Formats); err != nil {
|
||
|
res = append(res, err)
|
||
|
}
|
||
|
|
||
|
if len(res) > 0 {
|
||
|
return errors.CompositeValidationError(res...)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// bindToday binds and validates parameter Today from query.
|
||
|
func (o *PeriodicRunParams) bindToday(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||
|
var raw string
|
||
|
if len(rawData) > 0 {
|
||
|
raw = rawData[len(rawData)-1]
|
||
|
}
|
||
|
|
||
|
// Required: false
|
||
|
// AllowEmptyValue: false
|
||
|
if raw == "" { // empty values pass all other validations
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// Format: datetime
|
||
|
value, err := formats.Parse("datetime", raw)
|
||
|
if err != nil {
|
||
|
return errors.InvalidType("today", "query", "strfmt.DateTime", raw)
|
||
|
}
|
||
|
o.Today = (value.(*strfmt.DateTime))
|
||
|
|
||
|
if err := o.validateToday(formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// validateToday carries on validations for parameter Today
|
||
|
func (o *PeriodicRunParams) validateToday(formats strfmt.Registry) error {
|
||
|
|
||
|
if err := validate.FormatOf("today", "query", "datetime", o.Today.String(), formats); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|