159 lines
4 KiB
Go
159 lines
4 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"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// AllMetrics AllMetrics
|
|
//
|
|
// swagger:model AllMetrics
|
|
type AllMetrics struct {
|
|
|
|
// log processors metrics
|
|
LogProcessors []LogProcessorsMetrics `json:"log_processors"`
|
|
|
|
// remediation components metrics
|
|
RemediationComponents []RemediationComponentsMetrics `json:"remediation_components"`
|
|
}
|
|
|
|
// Validate validates this all metrics
|
|
func (m *AllMetrics) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateLogProcessors(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRemediationComponents(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *AllMetrics) validateLogProcessors(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.LogProcessors) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(m.LogProcessors); i++ {
|
|
|
|
if err := m.LogProcessors[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("log_processors" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("log_processors" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *AllMetrics) validateRemediationComponents(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.RemediationComponents) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(m.RemediationComponents); i++ {
|
|
|
|
if err := m.RemediationComponents[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("remediation_components" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("remediation_components" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this all metrics based on the context it is used
|
|
func (m *AllMetrics) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateLogProcessors(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateRemediationComponents(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *AllMetrics) contextValidateLogProcessors(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.LogProcessors); i++ {
|
|
|
|
if err := m.LogProcessors[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("log_processors" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("log_processors" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *AllMetrics) contextValidateRemediationComponents(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.RemediationComponents); i++ {
|
|
|
|
if err := m.RemediationComponents[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("remediation_components" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("remediation_components" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *AllMetrics) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *AllMetrics) UnmarshalBinary(b []byte) error {
|
|
var res AllMetrics
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|