crowdsec/pkg/models/bulk_check_allowlist_request.go

71 lines
1.7 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 (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// BulkCheckAllowlistRequest bulk check allowlist request
//
// swagger:model BulkCheckAllowlistRequest
type BulkCheckAllowlistRequest struct {
// Array of IP addresses or CIDR ranges to check
// Required: true
Targets []string `json:"targets"`
}
// Validate validates this bulk check allowlist request
func (m *BulkCheckAllowlistRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateTargets(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *BulkCheckAllowlistRequest) validateTargets(formats strfmt.Registry) error {
if err := validate.Required("targets", "body", m.Targets); err != nil {
return err
}
return nil
}
// ContextValidate validates this bulk check allowlist request based on context it is used
func (m *BulkCheckAllowlistRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *BulkCheckAllowlistRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *BulkCheckAllowlistRequest) UnmarshalBinary(b []byte) error {
var res BulkCheckAllowlistRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}