crowdsec/pkg/modelscapi/get_decisions_stream_response_links.go
Cristian Nitescu 987f119c4b
v3 capi and blocklists links support (#2019)
* v3 model generation

* v3 model generation

* comms

* fixes after master merge

* missing reader close

* use constants defined for types

---------

Co-authored-by: bui <thibault@crowdsec.net>
2023-02-06 14:06:14 +01:00

116 lines
2.9 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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// GetDecisionsStreamResponseLinks Decisions list
//
// swagger:model GetDecisionsStreamResponseLinks
type GetDecisionsStreamResponseLinks struct {
// blocklists
Blocklists []*BlocklistLink `json:"blocklists"`
}
// Validate validates this get decisions stream response links
func (m *GetDecisionsStreamResponseLinks) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBlocklists(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *GetDecisionsStreamResponseLinks) validateBlocklists(formats strfmt.Registry) error {
if swag.IsZero(m.Blocklists) { // not required
return nil
}
for i := 0; i < len(m.Blocklists); i++ {
if swag.IsZero(m.Blocklists[i]) { // not required
continue
}
if m.Blocklists[i] != nil {
if err := m.Blocklists[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("blocklists" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("blocklists" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this get decisions stream response links based on the context it is used
func (m *GetDecisionsStreamResponseLinks) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateBlocklists(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *GetDecisionsStreamResponseLinks) contextValidateBlocklists(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Blocklists); i++ {
if m.Blocklists[i] != nil {
if err := m.Blocklists[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("blocklists" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("blocklists" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *GetDecisionsStreamResponseLinks) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *GetDecisionsStreamResponseLinks) UnmarshalBinary(b []byte) error {
var res GetDecisionsStreamResponseLinks
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}