influxdb/models/kapacitor.go

134 lines
2.4 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"
)
/*Kapacitor kapacitor
swagger:model Kapacitor
*/
type Kapacitor struct {
/* Unique identifier representing a kapacitor instance.
Read Only: true
*/
ID string `json:"id,omitempty"`
/* links
*/
Links *KapacitorLinks `json:"links,omitempty"`
/* User facing name of kapacitor instance.
Required: true
*/
Name *string `json:"name"`
/* Password in cleartext!
*/
Password string `json:"password,omitempty"`
/* URL for the kapacitor backend (e.g. http://localhost:9092)
Required: true
*/
URL *string `json:"url"`
/* Username for authentication to kapacitor
*/
Username string `json:"username,omitempty"`
}
// Validate validates this kapacitor
func (m *Kapacitor) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLinks(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateURL(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Kapacitor) validateLinks(formats strfmt.Registry) error {
if swag.IsZero(m.Links) { // not required
return nil
}
if m.Links != nil {
if err := m.Links.Validate(formats); err != nil {
return err
}
}
return nil
}
func (m *Kapacitor) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
func (m *Kapacitor) validateURL(formats strfmt.Registry) error {
if err := validate.Required("url", "body", m.URL); err != nil {
return err
}
return nil
}
/*KapacitorLinks kapacitor links
swagger:model KapacitorLinks
*/
type KapacitorLinks struct {
/* URL location of proxy endpoint for this source
*/
Proxy string `json:"proxy,omitempty"`
/* Self link mapping to this resource
*/
Self string `json:"self,omitempty"`
}
// Validate validates this kapacitor links
func (m *KapacitorLinks) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}