All checks were successful
continuous-integration/drone/push Build is passing
115 lines
2.6 KiB
Go
115 lines
2.6 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 (
|
|
"context"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// InstanceV2Contact Hints related to contacting a representative of the instance.
|
|
//
|
|
// swagger:model InstanceV2Contact
|
|
type InstanceV2Contact struct {
|
|
|
|
// An email address that can be messaged regarding inquiries or issues.
|
|
// Empty string if no email address set.
|
|
// Example: someone@example.org
|
|
Email string `json:"email,omitempty"`
|
|
|
|
// account
|
|
Account *Account `json:"account,omitempty"`
|
|
}
|
|
|
|
// Validate validates this instance v2 contact
|
|
func (m *InstanceV2Contact) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateAccount(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *InstanceV2Contact) validateAccount(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Account) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Account != nil {
|
|
if err := m.Account.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("account")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("account")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this instance v2 contact based on the context it is used
|
|
func (m *InstanceV2Contact) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateAccount(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *InstanceV2Contact) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Account != nil {
|
|
|
|
if swag.IsZero(m.Account) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Account.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("account")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("account")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *InstanceV2Contact) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *InstanceV2Contact) UnmarshalBinary(b []byte) error {
|
|
var res InstanceV2Contact
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|