github.com/crowdsecurity/crowdsec@v1.6.1/pkg/modelscapi/decisions_delete_request.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package modelscapi
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  	"strconv"
    11  
    12  	"github.com/go-openapi/errors"
    13  	"github.com/go-openapi/strfmt"
    14  )
    15  
    16  // DecisionsDeleteRequest delete decisions
    17  //
    18  // delete decision model
    19  //
    20  // swagger:model DecisionsDeleteRequest
    21  type DecisionsDeleteRequest []DecisionsDeleteRequestItem
    22  
    23  // Validate validates this decisions delete request
    24  func (m DecisionsDeleteRequest) Validate(formats strfmt.Registry) error {
    25  	var res []error
    26  
    27  	for i := 0; i < len(m); i++ {
    28  
    29  		if err := m[i].Validate(formats); err != nil {
    30  			if ve, ok := err.(*errors.Validation); ok {
    31  				return ve.ValidateName(strconv.Itoa(i))
    32  			} else if ce, ok := err.(*errors.CompositeError); ok {
    33  				return ce.ValidateName(strconv.Itoa(i))
    34  			}
    35  			return err
    36  		}
    37  
    38  	}
    39  
    40  	if len(res) > 0 {
    41  		return errors.CompositeValidationError(res...)
    42  	}
    43  	return nil
    44  }
    45  
    46  // ContextValidate validate this decisions delete request based on the context it is used
    47  func (m DecisionsDeleteRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    48  	var res []error
    49  
    50  	for i := 0; i < len(m); i++ {
    51  
    52  		if err := m[i].ContextValidate(ctx, formats); err != nil {
    53  			if ve, ok := err.(*errors.Validation); ok {
    54  				return ve.ValidateName(strconv.Itoa(i))
    55  			} else if ce, ok := err.(*errors.CompositeError); ok {
    56  				return ce.ValidateName(strconv.Itoa(i))
    57  			}
    58  			return err
    59  		}
    60  
    61  	}
    62  
    63  	if len(res) > 0 {
    64  		return errors.CompositeValidationError(res...)
    65  	}
    66  	return nil
    67  }