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

181 lines
3.8 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 (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// AddSignalsRequestItem Signal
//
// swagger:model AddSignalsRequestItem
type AddSignalsRequestItem struct {
// created at
CreatedAt string `json:"created_at,omitempty"`
// machine id
MachineID string `json:"machine_id,omitempty"`
// a human readable message
// Required: true
Message *string `json:"message"`
// scenario
// Required: true
Scenario *string `json:"scenario"`
// scenario hash
// Required: true
ScenarioHash *string `json:"scenario_hash"`
// scenario version
// Required: true
ScenarioVersion *string `json:"scenario_version"`
// source
// Required: true
Source *Source `json:"source"`
// start at
// Required: true
StartAt *string `json:"start_at"`
// stop at
// Required: true
StopAt *string `json:"stop_at"`
}
// Validate validates this add signals request item
func (m *AddSignalsRequestItem) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateMessage(formats); err != nil {
res = append(res, err)
}
if err := m.validateScenario(formats); err != nil {
res = append(res, err)
}
if err := m.validateScenarioHash(formats); err != nil {
res = append(res, err)
}
if err := m.validateScenarioVersion(formats); err != nil {
res = append(res, err)
}
if err := m.validateSource(formats); err != nil {
res = append(res, err)
}
if err := m.validateStartAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateStopAt(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AddSignalsRequestItem) validateMessage(formats strfmt.Registry) error {
if err := validate.Required("message", "body", m.Message); err != nil {
return err
}
return nil
}
func (m *AddSignalsRequestItem) validateScenario(formats strfmt.Registry) error {
if err := validate.Required("scenario", "body", m.Scenario); err != nil {
return err
}
return nil
}
func (m *AddSignalsRequestItem) validateScenarioHash(formats strfmt.Registry) error {
if err := validate.Required("scenario_hash", "body", m.ScenarioHash); err != nil {
return err
}
return nil
}
func (m *AddSignalsRequestItem) validateScenarioVersion(formats strfmt.Registry) error {
if err := validate.Required("scenario_version", "body", m.ScenarioVersion); err != nil {
return err
}
return nil
}
func (m *AddSignalsRequestItem) validateSource(formats strfmt.Registry) error {
if err := validate.Required("source", "body", m.Source); err != nil {
return err
}
if m.Source != nil {
if err := m.Source.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("source")
}
return err
}
}
return nil
}
func (m *AddSignalsRequestItem) validateStartAt(formats strfmt.Registry) error {
if err := validate.Required("start_at", "body", m.StartAt); err != nil {
return err
}
return nil
}
func (m *AddSignalsRequestItem) validateStopAt(formats strfmt.Registry) error {
if err := validate.Required("stop_at", "body", m.StopAt); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *AddSignalsRequestItem) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AddSignalsRequestItem) UnmarshalBinary(b []byte) error {
var res AddSignalsRequestItem
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}