// Code generated by go-swagger; DO NOT EDIT. // This file is part of MinIO Console Server // Copyright (c) 2021 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // 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 ( "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Widget widget // // swagger:model widget type Widget struct { // options Options *WidgetOptions `json:"options,omitempty"` // targets Targets []*ResultTarget `json:"targets"` // title Title string `json:"title,omitempty"` // type Type string `json:"type,omitempty"` } // Validate validates this widget func (m *Widget) Validate(formats strfmt.Registry) error { var res []error if err := m.validateOptions(formats); err != nil { res = append(res, err) } if err := m.validateTargets(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Widget) validateOptions(formats strfmt.Registry) error { if swag.IsZero(m.Options) { // not required return nil } if m.Options != nil { if err := m.Options.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("options") } return err } } return nil } func (m *Widget) validateTargets(formats strfmt.Registry) error { if swag.IsZero(m.Targets) { // not required return nil } for i := 0; i < len(m.Targets); i++ { if swag.IsZero(m.Targets[i]) { // not required continue } if m.Targets[i] != nil { if err := m.Targets[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("targets" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *Widget) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Widget) UnmarshalBinary(b []byte) error { var res Widget if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // WidgetOptions widget options // // swagger:model WidgetOptions type WidgetOptions struct { // reduce options ReduceOptions *WidgetOptionsReduceOptions `json:"reduceOptions,omitempty"` } // Validate validates this widget options func (m *WidgetOptions) Validate(formats strfmt.Registry) error { var res []error if err := m.validateReduceOptions(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *WidgetOptions) validateReduceOptions(formats strfmt.Registry) error { if swag.IsZero(m.ReduceOptions) { // not required return nil } if m.ReduceOptions != nil { if err := m.ReduceOptions.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("options" + "." + "reduceOptions") } return err } } return nil } // MarshalBinary interface implementation func (m *WidgetOptions) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WidgetOptions) UnmarshalBinary(b []byte) error { var res WidgetOptions if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil } // WidgetOptionsReduceOptions widget options reduce options // // swagger:model WidgetOptionsReduceOptions type WidgetOptionsReduceOptions struct { // calcs Calcs []string `json:"calcs"` } // Validate validates this widget options reduce options func (m *WidgetOptionsReduceOptions) Validate(formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *WidgetOptionsReduceOptions) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *WidgetOptionsReduceOptions) UnmarshalBinary(b []byte) error { var res WidgetOptionsReduceOptions if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }