mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-10 20:05:55 +02:00
88 lines
2 KiB
Go
88 lines
2 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"
|
|
)
|
|
|
|
// MetricsMeta MetricsMeta
|
|
//
|
|
// swagger:model MetricsMeta
|
|
type MetricsMeta struct {
|
|
|
|
// UTC timestamp of the current time
|
|
// Required: true
|
|
UtcNowTimestamp *int64 `json:"utc_now_timestamp"`
|
|
|
|
// Size, in seconds, of the window used to compute the metric
|
|
// Required: true
|
|
WindowSizeSeconds *int64 `json:"window_size_seconds"`
|
|
}
|
|
|
|
// Validate validates this metrics meta
|
|
func (m *MetricsMeta) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateUtcNowTimestamp(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateWindowSizeSeconds(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *MetricsMeta) validateUtcNowTimestamp(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("utc_now_timestamp", "body", m.UtcNowTimestamp); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *MetricsMeta) validateWindowSizeSeconds(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("window_size_seconds", "body", m.WindowSizeSeconds); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this metrics meta based on context it is used
|
|
func (m *MetricsMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *MetricsMeta) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *MetricsMeta) UnmarshalBinary(b []byte) error {
|
|
var res MetricsMeta
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|