crowdsec/pkg/models/topx_response.go
Thibault "bui" Koechlin dbb420f79e
local api (#482)
Co-authored-by: AlteredCoder
Co-authored-by: erenJag
2020-11-30 10:37:17 +01:00

110 lines
2.3 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// TopxResponse TopxResponse
//
// swagger:model TopxResponse
type TopxResponse struct {
// We keep the deleted array for the duration of the initial decision. So that when the initial decision is expired, it won't be present in deleted array anymore.
Deleted [][]GetDecisionsResponse `json:"deleted"`
// new
New [][]GetDecisionsResponse `json:"new"`
}
// Validate validates this topx response
func (m *TopxResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDeleted(formats); err != nil {
res = append(res, err)
}
if err := m.validateNew(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *TopxResponse) validateDeleted(formats strfmt.Registry) error {
if swag.IsZero(m.Deleted) { // not required
return nil
}
for i := 0; i < len(m.Deleted); i++ {
for ii := 0; ii < len(m.Deleted[i]); ii++ {
if err := m.Deleted[i][ii].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("deleted" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii))
}
return err
}
}
}
return nil
}
func (m *TopxResponse) validateNew(formats strfmt.Registry) error {
if swag.IsZero(m.New) { // not required
return nil
}
for i := 0; i < len(m.New); i++ {
for ii := 0; ii < len(m.New[i]); ii++ {
if err := m.New[i][ii].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("new" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *TopxResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TopxResponse) UnmarshalBinary(b []byte) error {
var res TopxResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}