This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
frostfs-rest-gw/gen/models/storage_group.go
Denis Kirillov e5b9fd5f5a [#36] Add route to put storage group
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2023-01-12 15:46:06 +03:00

130 lines
3.1 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 {
// Container id to which storage group is belong. Set by server.
// Read Only: true
ContainerID string `json:"containerId,omitempty"`
// Lifetime in epochs for storage group.
// Required: true
Lifetime *int64 `json:"lifetime"`
// 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"`
// Object id of storage group. Set by server.
// Read Only: true
ObjectID string `json:"objectId,omitempty"`
}
// Validate validates this storage group
func (m *StorageGroup) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLifetime(formats); err != nil {
res = append(res, err)
}
if err := m.validateMembers(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *StorageGroup) validateLifetime(formats strfmt.Registry) error {
if err := validate.Required("lifetime", "body", m.Lifetime); 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
}
// 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.contextValidateContainerID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateObjectID(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *StorageGroup) contextValidateContainerID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "containerId", "body", string(m.ContainerID)); err != nil {
return err
}
return nil
}
func (m *StorageGroup) contextValidateObjectID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "objectId", "body", string(m.ObjectID)); err != nil {
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
}