crowdsec/pkg/models/bulk_check_allowlist_result.go

88 lines
2.1 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"
)
// BulkCheckAllowlistResult bulk check allowlist result
//
// swagger:model BulkCheckAllowlistResult
type BulkCheckAllowlistResult struct {
// Matching ip or range, name of the allowlist and comment related to the target
// Required: true
Allowlists []string `json:"allowlists"`
// The IP or range that is allowlisted
// Required: true
Target *string `json:"target"`
}
// Validate validates this bulk check allowlist result
func (m *BulkCheckAllowlistResult) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAllowlists(formats); err != nil {
res = append(res, err)
}
if err := m.validateTarget(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *BulkCheckAllowlistResult) validateAllowlists(formats strfmt.Registry) error {
if err := validate.Required("allowlists", "body", m.Allowlists); err != nil {
return err
}
return nil
}
func (m *BulkCheckAllowlistResult) validateTarget(formats strfmt.Registry) error {
if err := validate.Required("target", "body", m.Target); err != nil {
return err
}
return nil
}
// ContextValidate validates this bulk check allowlist result based on context it is used
func (m *BulkCheckAllowlistResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *BulkCheckAllowlistResult) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *BulkCheckAllowlistResult) UnmarshalBinary(b []byte) error {
var res BulkCheckAllowlistResult
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}