gtslib/models/host_meta.go
decentral1se e4ade9c758
All checks were successful
continuous-integration/drone/push Build is passing
feat: init
2024-07-31 22:47:18 +02:00

130 lines
2.7 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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// HostMeta HostMeta represents a hostmeta document.
//
// See: https://www.rfc-editor.org/rfc/rfc6415.html#section-3
//
// swagger:model HostMeta
type HostMeta struct {
// link
Link []*Link `json:"Link"`
// XML n s
XMLNS string `json:"XMLNS,omitempty"`
// XML name
XMLName interface{} `json:"XMLName,omitempty"`
}
// Validate validates this host meta
func (m *HostMeta) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLink(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *HostMeta) validateLink(formats strfmt.Registry) error {
if swag.IsZero(m.Link) { // not required
return nil
}
for i := 0; i < len(m.Link); i++ {
if swag.IsZero(m.Link[i]) { // not required
continue
}
if m.Link[i] != nil {
if err := m.Link[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Link" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Link" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this host meta based on the context it is used
func (m *HostMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateLink(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *HostMeta) contextValidateLink(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Link); i++ {
if m.Link[i] != nil {
if swag.IsZero(m.Link[i]) { // not required
return nil
}
if err := m.Link[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Link" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Link" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *HostMeta) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HostMeta) UnmarshalBinary(b []byte) error {
var res HostMeta
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}