mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
parent
5f339ab312
commit
dbb420f79e
563 changed files with 64363 additions and 10714 deletions
86
pkg/models/watcher_registration_request.go
Normal file
86
pkg/models/watcher_registration_request.go
Normal file
|
@ -0,0 +1,86 @@
|
|||
// 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"
|
||||
)
|
||||
|
||||
// WatcherRegistrationRequest WatcherRegistrationRequest
|
||||
//
|
||||
// swagger:model WatcherRegistrationRequest
|
||||
type WatcherRegistrationRequest struct {
|
||||
|
||||
// machine id
|
||||
// Required: true
|
||||
MachineID *string `json:"machine_id"`
|
||||
|
||||
// password
|
||||
// Required: true
|
||||
// Format: password
|
||||
Password *strfmt.Password `json:"password"`
|
||||
}
|
||||
|
||||
// Validate validates this watcher registration request
|
||||
func (m *WatcherRegistrationRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMachineID(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validatePassword(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *WatcherRegistrationRequest) validateMachineID(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("machine_id", "body", m.MachineID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *WatcherRegistrationRequest) validatePassword(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("password", "body", m.Password); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.FormatOf("password", "body", "password", m.Password.String(), formats); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *WatcherRegistrationRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *WatcherRegistrationRequest) UnmarshalBinary(b []byte) error {
|
||||
var res WatcherRegistrationRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue