frostfs-rest-gw/gen/models/storage_group.go
Denis Kirillov e83cef6d24 [#36] Add route to get and delete storage group
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2023-01-12 15:47:53 +03:00

165 lines
3.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"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// StorageGroup Storage group keeps verification information for Data Audit sessions.
//
// swagger:model StorageGroup
type StorageGroup struct {
// Address of storage group object. Set by server.
// Required: true
// Read Only: true
Address *Address `json:"address"`
// expiration epoch
// Required: true
ExpirationEpoch *string `json:"expirationEpoch"`
// hash
Hash string `json:"hash,omitempty"`
// Object identifiers to be placed into storage group. Must be unique.
// Required: true
Members []string `json:"members"`
// Name of storage group. It will be the value of the `FileName` attribute in storage group object.
Name string `json:"name,omitempty"`
// size
// Required: true
Size *string `json:"size"`
}
// Validate validates this storage group
func (m *StorageGroup) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateExpirationEpoch(formats); err != nil {
res = append(res, err)
}
if err := m.validateMembers(formats); err != nil {
res = append(res, err)
}
if err := m.validateSize(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *StorageGroup) 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
}
func (m *StorageGroup) validateExpirationEpoch(formats strfmt.Registry) error {
if err := validate.Required("expirationEpoch", "body", m.ExpirationEpoch); err != nil {
return err
}
return nil
}
func (m *StorageGroup) validateMembers(formats strfmt.Registry) error {
if err := validate.Required("members", "body", m.Members); err != nil {
return err
}
return nil
}
func (m *StorageGroup) validateSize(formats strfmt.Registry) error {
if err := validate.Required("size", "body", m.Size); err != nil {
return err
}
return nil
}
// ContextValidate validate this storage group based on the context it is used
func (m *StorageGroup) 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 *StorageGroup) 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 *StorageGroup) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *StorageGroup) UnmarshalBinary(b []byte) error {
var res StorageGroup
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}