forked from TrueCloudLab/frostfs-rest-gw
b412af2e22
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
111 lines
2.6 KiB
Go
111 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"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// ObjectBaseInfo Basic object information.
|
|
// Example: {"address":{"containerId":"5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv","objectId":"8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"},"name":"/my/object/name"}
|
|
//
|
|
// swagger:model ObjectBaseInfo
|
|
type ObjectBaseInfo struct {
|
|
|
|
// address
|
|
// Required: true
|
|
Address *Address `json:"address"`
|
|
|
|
// name
|
|
Name string `json:"name,omitempty"`
|
|
}
|
|
|
|
// Validate validates this object base info
|
|
func (m *ObjectBaseInfo) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateAddress(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *ObjectBaseInfo) validateAddress(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("address", "body", m.Address); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.Address != nil {
|
|
if err := m.Address.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("address")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("address")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this object base info based on the context it is used
|
|
func (m *ObjectBaseInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateAddress(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *ObjectBaseInfo) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Address != nil {
|
|
if err := m.Address.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("address")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("address")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *ObjectBaseInfo) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *ObjectBaseInfo) UnmarshalBinary(b []byte) error {
|
|
var res ObjectBaseInfo
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|