173 lines
3.5 KiB
Go
173 lines
3.5 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 (
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// EmailConfig EmailConfig configures notifications via mail.
|
|
//
|
|
// swagger:model EmailConfig
|
|
type EmailConfig struct {
|
|
|
|
// auth identity
|
|
AuthIdentity string `json:"auth_identity,omitempty"`
|
|
|
|
// auth username
|
|
AuthUsername string `json:"auth_username,omitempty"`
|
|
|
|
// from
|
|
From string `json:"from,omitempty"`
|
|
|
|
// HTML
|
|
HTML string `json:"html,omitempty"`
|
|
|
|
// headers
|
|
Headers map[string]string `json:"headers,omitempty"`
|
|
|
|
// hello
|
|
Hello string `json:"hello,omitempty"`
|
|
|
|
// require TLS
|
|
RequireTLS bool `json:"require_tls,omitempty"`
|
|
|
|
// text
|
|
Text string `json:"text,omitempty"`
|
|
|
|
// Email address to notify.
|
|
To string `json:"to,omitempty"`
|
|
|
|
// v send resolved
|
|
VSendResolved bool `json:"send_resolved,omitempty"`
|
|
|
|
// auth password
|
|
AuthPassword Secret `json:"auth_password,omitempty"`
|
|
|
|
// auth secret
|
|
AuthSecret Secret `json:"auth_secret,omitempty"`
|
|
|
|
// smarthost
|
|
Smarthost *HostPort `json:"smarthost,omitempty"`
|
|
|
|
// tls config
|
|
TLSConfig *TLSConfig `json:"tls_config,omitempty"`
|
|
}
|
|
|
|
// Validate validates this email config
|
|
func (m *EmailConfig) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateAuthPassword(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateAuthSecret(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSmarthost(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTLSConfig(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *EmailConfig) validateAuthPassword(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.AuthPassword) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.AuthPassword.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("auth_password")
|
|
}
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *EmailConfig) validateAuthSecret(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.AuthSecret) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.AuthSecret.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("auth_secret")
|
|
}
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *EmailConfig) validateSmarthost(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Smarthost) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Smarthost != nil {
|
|
if err := m.Smarthost.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("smarthost")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *EmailConfig) validateTLSConfig(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.TLSConfig) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.TLSConfig != nil {
|
|
if err := m.TLSConfig.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("tls_config")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *EmailConfig) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *EmailConfig) UnmarshalBinary(b []byte) error {
|
|
var res EmailConfig
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|