crowdsec/pkg/modelscapi/allowlist_link.go

166 lines
3.6 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package modelscapi
// 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"
)
// AllowlistLink allowlist link
//
// swagger:model AllowlistLink
type AllowlistLink struct {
// the creation date of the allowlist
// Required: true
// Format: date-time
CreatedAt *strfmt.DateTime `json:"created_at"`
// the description of the allowlist
// Required: true
Description *string `json:"description"`
// the id of the allowlist
// Required: true
ID *string `json:"id"`
// the name of the allowlist
// Required: true
Name *string `json:"name"`
// the last update date of the allowlist
// Required: true
// Format: date-time
UpdatedAt *strfmt.DateTime `json:"updated_at"`
// the url from which the allowlist content can be downloaded
// Required: true
URL *string `json:"url"`
}
// Validate validates this allowlist link
func (m *AllowlistLink) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCreatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateDescription(formats); err != nil {
res = append(res, err)
}
if err := m.validateID(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateUpdatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateURL(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AllowlistLink) validateCreatedAt(formats strfmt.Registry) error {
if err := validate.Required("created_at", "body", m.CreatedAt); err != nil {
return err
}
if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil {
return err
}
return nil
}
func (m *AllowlistLink) validateDescription(formats strfmt.Registry) error {
if err := validate.Required("description", "body", m.Description); err != nil {
return err
}
return nil
}
func (m *AllowlistLink) validateID(formats strfmt.Registry) error {
if err := validate.Required("id", "body", m.ID); err != nil {
return err
}
return nil
}
func (m *AllowlistLink) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
func (m *AllowlistLink) validateUpdatedAt(formats strfmt.Registry) error {
if err := validate.Required("updated_at", "body", m.UpdatedAt); err != nil {
return err
}
if err := validate.FormatOf("updated_at", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
return err
}
return nil
}
func (m *AllowlistLink) validateURL(formats strfmt.Registry) error {
if err := validate.Required("url", "body", m.URL); err != nil {
return err
}
return nil
}
// ContextValidate validates this allowlist link based on context it is used
func (m *AllowlistLink) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *AllowlistLink) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AllowlistLink) UnmarshalBinary(b []byte) error {
var res AllowlistLink
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}