134 lines
2.3 KiB
Go
134 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"
|
|
)
|
|
|
|
/*Layout layout
|
|
|
|
swagger:model Layout
|
|
*/
|
|
type Layout struct {
|
|
|
|
/* App is the user facing name of this Layout
|
|
|
|
Required: true
|
|
*/
|
|
App *string `json:"app"`
|
|
|
|
/* Cells are the individual visualization elements.
|
|
|
|
Required: true
|
|
*/
|
|
Cells []*Cell `json:"cells"`
|
|
|
|
/* ID is an opaque string that uniquely identifies this layout.
|
|
*/
|
|
ID string `json:"id,omitempty"`
|
|
|
|
/* link
|
|
*/
|
|
Link *Link `json:"link,omitempty"`
|
|
|
|
/* Measurement is the descriptive name of the time series data.
|
|
|
|
Required: true
|
|
*/
|
|
Measurement *string `json:"measurement"`
|
|
}
|
|
|
|
// Validate validates this layout
|
|
func (m *Layout) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateApp(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateCells(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateLink(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateMeasurement(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Layout) validateApp(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("app", "body", m.App); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Layout) validateCells(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("cells", "body", m.Cells); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Cells); i++ {
|
|
|
|
if swag.IsZero(m.Cells[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Cells[i] != nil {
|
|
|
|
if err := m.Cells[i].Validate(formats); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Layout) validateLink(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Link) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Link != nil {
|
|
|
|
if err := m.Link.Validate(formats); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Layout) validateMeasurement(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("measurement", "body", m.Measurement); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|