forked from TrueCloudLab/frostfs-rest-gw
[#1] Support GET/RANGE object payload
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
dc1926f9c6
commit
3727f5561d
8 changed files with 395 additions and 10 deletions
|
@ -33,9 +33,20 @@ type ObjectInfo struct {
|
|||
// Required: true
|
||||
ObjectID *string `json:"objectId"`
|
||||
|
||||
// Object full payload size
|
||||
// Required: true
|
||||
ObjectSize *int64 `json:"objectSize"`
|
||||
|
||||
// owner Id
|
||||
// Required: true
|
||||
OwnerID *string `json:"ownerId"`
|
||||
|
||||
// Base64 encoded object payload
|
||||
Payload string `json:"payload,omitempty"`
|
||||
|
||||
// Payload size in response
|
||||
// Required: true
|
||||
PayloadSize *int64 `json:"payloadSize"`
|
||||
}
|
||||
|
||||
// Validate validates this object info
|
||||
|
@ -54,10 +65,18 @@ func (m *ObjectInfo) Validate(formats strfmt.Registry) error {
|
|||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateObjectSize(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateOwnerID(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validatePayloadSize(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
|
@ -109,6 +128,15 @@ func (m *ObjectInfo) validateObjectID(formats strfmt.Registry) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *ObjectInfo) validateObjectSize(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("objectSize", "body", m.ObjectSize); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ObjectInfo) validateOwnerID(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("ownerId", "body", m.OwnerID); err != nil {
|
||||
|
@ -118,6 +146,15 @@ func (m *ObjectInfo) validateOwnerID(formats strfmt.Registry) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *ObjectInfo) validatePayloadSize(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("payloadSize", "body", m.PayloadSize); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this object info based on the context it is used
|
||||
func (m *ObjectInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue