chronograf/models/cell.go

143 lines
2.3 KiB
Go

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 (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
/*Cell cell
swagger:model Cell
*/
type Cell struct {
/* Height of Cell in the Layout
Required: true
*/
H *int32 `json:"h"`
/* Time-series data queries for Cell.
*/
Queries []*Proxy `json:"queries,omitempty"`
/* Width of Cell in the Layout
Required: true
*/
W *int32 `json:"w"`
/* X-coordinate of Cell in the Layout
Required: true
*/
X *int32 `json:"x"`
/* Y-coordinate of Cell in the Layout
Required: true
*/
Y *int32 `json:"y"`
}
// Validate validates this cell
func (m *Cell) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateH(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateQueries(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateW(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateX(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateY(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Cell) validateH(formats strfmt.Registry) error {
if err := validate.Required("h", "body", m.H); err != nil {
return err
}
return nil
}
func (m *Cell) validateQueries(formats strfmt.Registry) error {
if swag.IsZero(m.Queries) { // not required
return nil
}
for i := 0; i < len(m.Queries); i++ {
if swag.IsZero(m.Queries[i]) { // not required
continue
}
if m.Queries[i] != nil {
if err := m.Queries[i].Validate(formats); err != nil {
return err
}
}
}
return nil
}
func (m *Cell) validateW(formats strfmt.Registry) error {
if err := validate.Required("w", "body", m.W); err != nil {
return err
}
return nil
}
func (m *Cell) validateX(formats strfmt.Registry) error {
if err := validate.Required("x", "body", m.X); err != nil {
return err
}
return nil
}
func (m *Cell) validateY(formats strfmt.Registry) error {
if err := validate.Required("y", "body", m.Y); err != nil {
return err
}
return nil
}