Compare commits

..

7 commits

Author SHA1 Message Date
03f8cc8abf [#36] Fix frostfs dependencies
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
2023-01-12 16:17:02 +03:00
Denis Kirillov
739447579a [#36] Fix needHash flag
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2023-01-12 15:48:06 +03:00
Denis Kirillov
ada830616b [#36] Add docs
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2023-01-12 15:47:54 +03:00
Denis Kirillov
6e8b6f8b51 [#36] Add test for storage group management
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2023-01-12 15:47:54 +03:00
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
Denis Kirillov
c20eed98f9 [#36] Add route to list storage groups
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2023-01-12 15:47:21 +03:00
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
71 changed files with 3761 additions and 279 deletions

View file

@ -1,45 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: community, triage, bug
assignees: ''
---
<!--- Provide a general summary of the issue in the Title above -->
## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
## Possible Solution
<!--- Not obligatory -->
<!--- If no reason/fix/additions for the bug can be suggested, -->
<!--- uncomment the following phrase: -->
<!--- No fix can be suggested by a QA engineer. Further solutions shall be up to developers. -->
## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. -->
1.
## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
## Regression
<!-- Is this issue a regression? (Yes / No) -->
<!-- If Yes, optionally please include version or commit id or PR# that caused this regression, if you have these details. -->
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Server setup and configuration:
* Operating System and version (`uname -a`):

View file

@ -1 +0,0 @@
blank_issues_enabled: false

View file

@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: community, triage
assignees: ''
---
## Is your feature request related to a problem? Please describe.
<!--- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
## Describe the solution you'd like
<!--- A clear and concise description of what you want to happen. -->
## Describe alternatives you've considered
<!--- A clear and concise description of any alternative solutions or features you've considered. -->
## Additional context
<!--- Add any other context or screenshots about the feature request here. -->

View file

@ -6,7 +6,9 @@
</p>
---
[![Report](https://goreportcard.com/badge/git.frostfs.info/TrueCloudLab/frostfs-rest-gw)](https://goreportcard.com/report/git.frostfs.info/TrueCloudLab/frostfs-rest-gw)
[![Report](https://goreportcard.com/badge/github.com/TrueCloudLab/frostfs-rest-gw)](https://goreportcard.com/report/github.com/TrueCloudLab/frostfs-rest-gw)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/TrueCloudLab/frostfs-rest-gw?sort=semver)
![License](https://img.shields.io/github/license/TrueCloudLab/frostfs-rest-gw.svg?style=popout)
# frostfs-rest-gw
@ -27,7 +29,7 @@ Before building make sure you have the following tools:
First clone this repository:
```shell
$ git clone https://git.frostfs.info/TrueCloudLab/frostfs-rest-gw
$ git clone https://github.com/TrueCloudLab/frostfs-rest-gw
```
Then run make to build `bin/frostfs-rest-gw` binary:
@ -91,7 +93,7 @@ REST gateway itself is not a FrostFS node, so to access FrostFS it uses node's g
node that it will connect to. This can be done either via `-p` parameter or via `REST_GW_POOL_PEERS_<N>_ADDRESS` and
`REST_GW_POOL_PEERS_<N>_WEIGHT` environment variables (the gate supports multiple FrostFS nodes with weighted load balancing).
If you're launching REST gateway in bundle with [frostfs-dev-env](https://git.frostfs.info/TrueCloudLab/frostfs-dev-env), you can get
If you're launching REST gateway in bundle with [frostfs-dev-env](https://github.com/TrueCloudLab/frostfs-dev-env), you can get
an IP address of the node in output of `make hosts` command
(with s0*.frostfs.devenv name).

View file

@ -10,10 +10,10 @@ import (
"strings"
"time"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/handlers"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/metrics"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi"
"github.com/TrueCloudLab/frostfs-rest-gw/handlers"
"github.com/TrueCloudLab/frostfs-rest-gw/metrics"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/nspcc-dev/neo-go/cli/flags"
"github.com/nspcc-dev/neo-go/cli/input"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"

View file

@ -14,22 +14,22 @@ import (
"testing"
"time"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/handlers"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/internal/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/handlers"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/TrueCloudLab/frostfs-sdk-go/bearer"
"github.com/TrueCloudLab/frostfs-sdk-go/container"
"github.com/TrueCloudLab/frostfs-sdk-go/container/acl"
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
frostfsecdsa "github.com/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
"github.com/TrueCloudLab/frostfs-sdk-go/eacl"
"github.com/TrueCloudLab/frostfs-sdk-go/netmap"
"github.com/TrueCloudLab/frostfs-sdk-go/object"
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-sdk-go/user"
"github.com/go-openapi/loads"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/spf13/viper"
@ -135,6 +135,8 @@ func runTests(ctx context.Context, t *testing.T, key *keys.PrivateKey, version s
t.Run("rest put container eacl "+version, func(t *testing.T) { restContainerEACLPut(ctx, t, clientPool, owner) })
t.Run("rest get container eacl "+version, func(t *testing.T) { restContainerEACLGet(ctx, t, clientPool, cnrID) })
t.Run("rest list containers "+version, func(t *testing.T) { restContainerList(ctx, t, clientPool, owner, cnrID) })
t.Run("rest manage storage group "+version, func(t *testing.T) { restManageStorageGroup(ctx, t, clientPool, owner, cnrID) })
}
func createDockerContainer(ctx context.Context, t *testing.T, image string) testcontainers.Container {
@ -443,6 +445,117 @@ func checkGWErrorResponse(t *testing.T, httpClient *http.Client, request *http.R
require.Equal(t, models.ErrorTypeGW, *resp.Type)
}
func restManageStorageGroup(ctx context.Context, t *testing.T, clientPool *pool.Pool, owner user.ID, cnrID cid.ID) {
attributes := map[string]string{object.AttributeFileName: "someFile"}
content := []byte("content")
objID := createObject(ctx, t, clientPool, &owner, cnrID, attributes, content)
bearer := &models.Bearer{Object: getAllowedRules()}
httpClient := defaultHTTPClient()
bearerTokens := makeAuthTokenRequest(ctx, t, []*models.Bearer{bearer}, httpClient)
bearerToken := bearerTokens[0]
query := make(url.Values)
query.Add(walletConnectQuery, strconv.FormatBool(useWalletConnect))
var storageGroupAddress models.Address
storageGroupName := "my-storage-group"
t.Run("put storage group", func(t *testing.T) {
req := &models.StorageGroupPutBody{
Lifetime: util.NewInteger(10),
Members: []string{objID.EncodeToString()},
Name: storageGroupName,
}
body, err := json.Marshal(req)
require.NoError(t, err)
request, err := http.NewRequest(http.MethodPut, testHost+"/v1/containers/"+cnrID.EncodeToString()+"/storagegroups?"+query.Encode(), bytes.NewReader(body))
require.NoError(t, err)
prepareCommonHeaders(request.Header, bearerToken)
doRequest(t, httpClient, request, http.StatusOK, &storageGroupAddress)
require.Equal(t, cnrID.EncodeToString(), *storageGroupAddress.ContainerID)
})
t.Run("list storage groups", func(t *testing.T) {
request, err := http.NewRequest(http.MethodGet, testHost+"/v1/containers/"+cnrID.EncodeToString()+"/storagegroups?"+query.Encode(), nil)
require.NoError(t, err)
prepareCommonHeaders(request.Header, bearerToken)
list := &models.StorageGroupList{}
doRequest(t, httpClient, request, http.StatusOK, list)
require.Equal(t, int64(1), *list.Size)
require.Equal(t, storageGroupAddress.ContainerID, list.StorageGroups[0].Address.ContainerID)
require.Equal(t, storageGroupAddress.ObjectID, list.StorageGroups[0].Address.ObjectID)
require.Equal(t, storageGroupName, list.StorageGroups[0].Name)
require.NotEmpty(t, list.StorageGroups[0].ExpirationEpoch)
})
t.Run("get storage group", func(t *testing.T) {
request, err := http.NewRequest(http.MethodGet, testHost+"/v1/containers/"+cnrID.EncodeToString()+"/storagegroups/"+*storageGroupAddress.ObjectID+"?"+query.Encode(), nil)
require.NoError(t, err)
prepareCommonHeaders(request.Header, bearerToken)
group := &models.StorageGroup{}
doRequest(t, httpClient, request, http.StatusOK, group)
require.Equal(t, strconv.Itoa(len(content)), *group.Size)
require.Equal(t, storageGroupName, group.Name)
require.Equal(t, storageGroupAddress.ContainerID, group.Address.ContainerID)
require.Equal(t, storageGroupAddress.ObjectID, group.Address.ObjectID)
require.NotEmpty(t, *group.ExpirationEpoch)
require.Equal(t, []string{objID.EncodeToString()}, group.Members)
})
t.Run("delete storage group", func(t *testing.T) {
request, err := http.NewRequest(http.MethodDelete, testHost+"/v1/containers/"+cnrID.EncodeToString()+"/storagegroups/"+*storageGroupAddress.ObjectID+"?"+query.Encode(), nil)
require.NoError(t, err)
prepareCommonHeaders(request.Header, bearerToken)
resp := &models.SuccessResponse{}
doRequest(t, httpClient, request, http.StatusOK, resp)
require.True(t, *resp.Success)
var sgObjID oid.ID
err = sgObjID.DecodeString(*storageGroupAddress.ObjectID)
require.NoError(t, err)
var addr oid.Address
addr.SetContainer(cnrID)
addr.SetObject(sgObjID)
var prm pool.PrmObjectHead
prm.SetAddress(addr)
_, err = clientPool.HeadObject(ctx, prm)
require.Error(t, err)
})
}
func getAllowedRules() []*models.Record {
var result []*models.Record
ops := []models.Operation{models.OperationGET, models.OperationHEAD, models.OperationPUT,
models.OperationDELETE, models.OperationSEARCH, models.OperationRANGE, models.OperationRANGEHASH}
for _, op := range ops {
rec := &models.Record{
Operation: models.NewOperation(op),
Action: models.NewAction(models.ActionALLOW),
Filters: []*models.Filter{},
Targets: []*models.Target{{
Role: models.NewRole(models.RoleOTHERS),
Keys: []string{},
}},
}
result = append(result, rec)
}
return result
}
func restObjectPut(ctx context.Context, t *testing.T, clientPool *pool.Pool, cnrID cid.ID) {
bearer := &models.Bearer{
Object: []*models.Record{{
@ -1282,7 +1395,7 @@ func createContainer(ctx context.Context, t *testing.T, clientPool *pool.Pool, o
var waitPrm pool.WaitParams
waitPrm.SetPollInterval(3 * time.Second)
waitPrm.SetTimeout(15 * time.Second)
waitPrm.SetTimeout(30 * time.Second)
var prm pool.PrmContainerPut
prm.SetContainer(cnr)
@ -1335,7 +1448,7 @@ func restrictByEACL(ctx context.Context, t *testing.T, clientPool *pool.Pool, cn
var waitPrm pool.WaitParams
waitPrm.SetPollInterval(3 * time.Second)
waitPrm.SetTimeout(15 * time.Second)
waitPrm.SetTimeout(30 * time.Second)
var prm pool.PrmContainerSetEACL
prm.SetTable(*table)

View file

@ -5,8 +5,8 @@ import (
"os/signal"
"syscall"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/go-openapi/loads"
"go.uber.org/zap"
)

166
gen/models/storage_group.go Normal file
View file

@ -0,0 +1,166 @@
// 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.
// Example: {"address":{"containerId":"5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv","objectId":"9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"},"expirationEpoch":5000,"members":["8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"],"name":"my-storage-group","size":4096}
//
// 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 of storage group.
// Required: true
ExpirationEpoch *string `json:"expirationEpoch"`
// Homomorphic hash from the concatenation of the payloads of the storage group members. Empty means hashing is disabled.
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"`
// Total size of the payloads of objects in the storage group.
// 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
}

View file

@ -0,0 +1,128 @@
// 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"
)
// StorageGroupBaseInfo Storage group info for listing.
// Example: {"address":{"containerId":"5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv","objectId":"9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"},"expirationEpoch":5000,"name":"my-storage-group"}
//
// swagger:model StorageGroupBaseInfo
type StorageGroupBaseInfo struct {
// address
// Required: true
Address *Address `json:"address"`
// expiration epoch
// Required: true
ExpirationEpoch *string `json:"expirationEpoch"`
// name
Name string `json:"name,omitempty"`
}
// Validate validates this storage group base info
func (m *StorageGroupBaseInfo) 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 len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *StorageGroupBaseInfo) 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 *StorageGroupBaseInfo) validateExpirationEpoch(formats strfmt.Registry) error {
if err := validate.Required("expirationEpoch", "body", m.ExpirationEpoch); err != nil {
return err
}
return nil
}
// ContextValidate validate this storage group base info based on the context it is used
func (m *StorageGroupBaseInfo) 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 *StorageGroupBaseInfo) 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 *StorageGroupBaseInfo) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *StorageGroupBaseInfo) UnmarshalBinary(b []byte) error {
var res StorageGroupBaseInfo
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View file

@ -0,0 +1,137 @@
// 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"
"github.com/go-openapi/validate"
)
// StorageGroupList List of storage groups.
// Example: {"size":1,"storageGroups":[{"address":{"containerId":"5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv","objectId":"9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"},"expirationEpoch":5000,"name":"my-storage-group"}]}
//
// swagger:model StorageGroupList
type StorageGroupList struct {
// size
// Required: true
Size *int64 `json:"size"`
// storage groups
// Required: true
StorageGroups []*StorageGroupBaseInfo `json:"storageGroups"`
}
// Validate validates this storage group list
func (m *StorageGroupList) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateSize(formats); err != nil {
res = append(res, err)
}
if err := m.validateStorageGroups(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *StorageGroupList) validateSize(formats strfmt.Registry) error {
if err := validate.Required("size", "body", m.Size); err != nil {
return err
}
return nil
}
func (m *StorageGroupList) validateStorageGroups(formats strfmt.Registry) error {
if err := validate.Required("storageGroups", "body", m.StorageGroups); err != nil {
return err
}
for i := 0; i < len(m.StorageGroups); i++ {
if swag.IsZero(m.StorageGroups[i]) { // not required
continue
}
if m.StorageGroups[i] != nil {
if err := m.StorageGroups[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("storageGroups" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("storageGroups" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this storage group list based on the context it is used
func (m *StorageGroupList) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateStorageGroups(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *StorageGroupList) contextValidateStorageGroups(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.StorageGroups); i++ {
if m.StorageGroups[i] != nil {
if err := m.StorageGroups[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("storageGroups" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("storageGroups" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *StorageGroupList) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *StorageGroupList) UnmarshalBinary(b []byte) error {
var res StorageGroupList
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View file

@ -0,0 +1,92 @@
// 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"
)
// StorageGroupPutBody storage group put body
// Example: {"lifetime":100,"members":["8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"],"name":"my-storage-group"}
//
// swagger:model StorageGroupPutBody
type StorageGroupPutBody struct {
// 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"`
}
// Validate validates this storage group put body
func (m *StorageGroupPutBody) 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 *StorageGroupPutBody) validateLifetime(formats strfmt.Registry) error {
if err := validate.Required("lifetime", "body", m.Lifetime); err != nil {
return err
}
return nil
}
func (m *StorageGroupPutBody) validateMembers(formats strfmt.Registry) error {
if err := validate.Required("members", "body", m.Members); err != nil {
return err
}
return nil
}
// ContextValidate validates this storage group put body based on context it is used
func (m *StorageGroupPutBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *StorageGroupPutBody) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *StorageGroupPutBody) UnmarshalBinary(b []byte) error {
var res StorageGroupPutBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View file

@ -523,6 +523,160 @@ func init() {
}
]
},
"/containers/{containerId}/storagegroups": {
"get": {
"summary": "Find all storage groups in container.",
"operationId": "listStorageGroups",
"parameters": [
{
"$ref": "#/parameters/signatureParam"
},
{
"$ref": "#/parameters/signatureKeyParam"
},
{
"$ref": "#/parameters/signatureScheme"
},
{
"$ref": "#/parameters/fullBearerToken"
}
],
"responses": {
"200": {
"description": "List of storage groups.",
"schema": {
"$ref": "#/definitions/StorageGroupList"
}
},
"400": {
"description": "Bad request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"put": {
"summary": "Create a new storage group in container.",
"operationId": "putStorageGroup",
"parameters": [
{
"$ref": "#/parameters/signatureParam"
},
{
"$ref": "#/parameters/signatureKeyParam"
},
{
"$ref": "#/parameters/signatureScheme"
},
{
"$ref": "#/parameters/fullBearerToken"
},
{
"description": "Storage group co create.",
"name": "storageGroup",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/StorageGroupPutBody"
}
}
],
"responses": {
"200": {
"description": "Address of uploaded storage group.",
"schema": {
"$ref": "#/definitions/Address"
}
},
"400": {
"description": "Bad request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"parameters": [
{
"$ref": "#/parameters/containerId"
}
]
},
"/containers/{containerId}/storagegroups/{storageGroupId}": {
"get": {
"summary": "Get storage group info.",
"operationId": "getStorageGroup",
"parameters": [
{
"$ref": "#/parameters/signatureParam"
},
{
"$ref": "#/parameters/signatureKeyParam"
},
{
"$ref": "#/parameters/signatureScheme"
},
{
"$ref": "#/parameters/fullBearerToken"
}
],
"responses": {
"200": {
"description": "Storage group information.",
"schema": {
"$ref": "#/definitions/StorageGroup"
}
},
"400": {
"description": "Bad request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"delete": {
"summary": "Delete storage group from container.",
"operationId": "deleteStorageGroup",
"parameters": [
{
"$ref": "#/parameters/signatureParam"
},
{
"$ref": "#/parameters/signatureKeyParam"
},
{
"$ref": "#/parameters/signatureScheme"
},
{
"$ref": "#/parameters/fullBearerToken"
}
],
"responses": {
"200": {
"description": "Successful deletion.",
"schema": {
"$ref": "#/definitions/SuccessResponse"
}
},
"400": {
"description": "Bad request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"parameters": [
{
"$ref": "#/parameters/containerId"
},
{
"$ref": "#/parameters/storageGroupId"
}
]
},
"/objects": {
"put": {
"consumes": [
@ -1522,6 +1676,148 @@ func init() {
"MatchCommonPrefix"
]
},
"StorageGroup": {
"description": "Storage group keeps verification information for Data Audit sessions.",
"type": "object",
"required": [
"address",
"expirationEpoch",
"size",
"members"
],
"properties": {
"address": {
"description": "Address of storage group object. Set by server.",
"$ref": "#/definitions/Address",
"readOnly": true
},
"expirationEpoch": {
"description": "Expiration epoch of storage group.",
"type": "string"
},
"hash": {
"description": "Homomorphic hash from the concatenation of the payloads of the storage group members. Empty means hashing is disabled.",
"type": "string"
},
"members": {
"description": "Object identifiers to be placed into storage group. Must be unique.",
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"description": "Name of storage group. It will be the value of the ` + "`" + `FileName` + "`" + ` attribute in storage group object.",
"type": "string"
},
"size": {
"description": "Total size of the payloads of objects in the storage group.",
"type": "string"
}
},
"example": {
"address": {
"containerId": "5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv",
"objectId": "9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
},
"expirationEpoch": 5000,
"members": [
"8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
],
"name": "my-storage-group",
"size": 4096
}
},
"StorageGroupBaseInfo": {
"description": "Storage group info for listing.",
"type": "object",
"required": [
"address",
"expirationEpoch"
],
"properties": {
"address": {
"$ref": "#/definitions/Address"
},
"expirationEpoch": {
"type": "string"
},
"name": {
"type": "string"
}
},
"example": {
"address": {
"containerId": "5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv",
"objectId": "9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
},
"expirationEpoch": 5000,
"name": "my-storage-group"
}
},
"StorageGroupList": {
"description": "List of storage groups.",
"type": "object",
"required": [
"size",
"storageGroups"
],
"properties": {
"size": {
"type": "integer"
},
"storageGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/StorageGroupBaseInfo"
}
}
},
"example": {
"size": 1,
"storageGroups": [
{
"address": {
"containerId": "5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv",
"objectId": "9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
},
"expirationEpoch": 5000,
"name": "my-storage-group"
}
]
}
},
"StorageGroupPutBody": {
"type": "object",
"required": [
"lifetime",
"members"
],
"properties": {
"lifetime": {
"description": "Lifetime in epochs for storage group.",
"type": "integer"
},
"members": {
"description": "Object identifiers to be placed into storage group. Must be unique.",
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"description": "Name of storage group. It will be the value of the ` + "`" + `FileName` + "`" + ` attribute in storage group object.",
"type": "string"
}
},
"example": {
"lifetime": 100,
"members": [
"8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
],
"name": "my-storage-group"
}
},
"SuccessResponse": {
"description": "Success response.",
"type": "object",
@ -1649,6 +1945,13 @@ func init() {
"description": "Use wallet connect signature scheme or native FrostFS signature.",
"name": "walletConnect",
"in": "query"
},
"storageGroupId": {
"type": "string",
"description": "Base58 encoded storage group id.",
"name": "storageGroupId",
"in": "path",
"required": true
}
},
"securityDefinitions": {
@ -2220,6 +2523,228 @@ func init() {
}
]
},
"/containers/{containerId}/storagegroups": {
"get": {
"summary": "Find all storage groups in container.",
"operationId": "listStorageGroups",
"parameters": [
{
"type": "string",
"description": "Base64 encoded signature for bearer token.",
"name": "X-Bearer-Signature",
"in": "header"
},
{
"type": "string",
"description": "Hex encoded the public part of the key that signed the bearer token.",
"name": "X-Bearer-Signature-Key",
"in": "header"
},
{
"type": "boolean",
"default": false,
"description": "Use wallet connect signature scheme or native FrostFS signature.",
"name": "walletConnect",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "Provided bearer token is final or gate should assemble it using signature.",
"name": "fullBearer",
"in": "query"
}
],
"responses": {
"200": {
"description": "List of storage groups.",
"schema": {
"$ref": "#/definitions/StorageGroupList"
}
},
"400": {
"description": "Bad request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"put": {
"summary": "Create a new storage group in container.",
"operationId": "putStorageGroup",
"parameters": [
{
"type": "string",
"description": "Base64 encoded signature for bearer token.",
"name": "X-Bearer-Signature",
"in": "header"
},
{
"type": "string",
"description": "Hex encoded the public part of the key that signed the bearer token.",
"name": "X-Bearer-Signature-Key",
"in": "header"
},
{
"type": "boolean",
"default": false,
"description": "Use wallet connect signature scheme or native FrostFS signature.",
"name": "walletConnect",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "Provided bearer token is final or gate should assemble it using signature.",
"name": "fullBearer",
"in": "query"
},
{
"description": "Storage group co create.",
"name": "storageGroup",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/StorageGroupPutBody"
}
}
],
"responses": {
"200": {
"description": "Address of uploaded storage group.",
"schema": {
"$ref": "#/definitions/Address"
}
},
"400": {
"description": "Bad request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"parameters": [
{
"type": "string",
"description": "Base58 encoded container id.",
"name": "containerId",
"in": "path",
"required": true
}
]
},
"/containers/{containerId}/storagegroups/{storageGroupId}": {
"get": {
"summary": "Get storage group info.",
"operationId": "getStorageGroup",
"parameters": [
{
"type": "string",
"description": "Base64 encoded signature for bearer token.",
"name": "X-Bearer-Signature",
"in": "header"
},
{
"type": "string",
"description": "Hex encoded the public part of the key that signed the bearer token.",
"name": "X-Bearer-Signature-Key",
"in": "header"
},
{
"type": "boolean",
"default": false,
"description": "Use wallet connect signature scheme or native FrostFS signature.",
"name": "walletConnect",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "Provided bearer token is final or gate should assemble it using signature.",
"name": "fullBearer",
"in": "query"
}
],
"responses": {
"200": {
"description": "Storage group information.",
"schema": {
"$ref": "#/definitions/StorageGroup"
}
},
"400": {
"description": "Bad request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"delete": {
"summary": "Delete storage group from container.",
"operationId": "deleteStorageGroup",
"parameters": [
{
"type": "string",
"description": "Base64 encoded signature for bearer token.",
"name": "X-Bearer-Signature",
"in": "header"
},
{
"type": "string",
"description": "Hex encoded the public part of the key that signed the bearer token.",
"name": "X-Bearer-Signature-Key",
"in": "header"
},
{
"type": "boolean",
"default": false,
"description": "Use wallet connect signature scheme or native FrostFS signature.",
"name": "walletConnect",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "Provided bearer token is final or gate should assemble it using signature.",
"name": "fullBearer",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful deletion.",
"schema": {
"$ref": "#/definitions/SuccessResponse"
}
},
"400": {
"description": "Bad request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"parameters": [
{
"type": "string",
"description": "Base58 encoded container id.",
"name": "containerId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Base58 encoded storage group id.",
"name": "storageGroupId",
"in": "path",
"required": true
}
]
},
"/objects": {
"put": {
"consumes": [
@ -3290,6 +3815,148 @@ func init() {
"MatchCommonPrefix"
]
},
"StorageGroup": {
"description": "Storage group keeps verification information for Data Audit sessions.",
"type": "object",
"required": [
"address",
"expirationEpoch",
"size",
"members"
],
"properties": {
"address": {
"description": "Address of storage group object. Set by server.",
"$ref": "#/definitions/Address",
"readOnly": true
},
"expirationEpoch": {
"description": "Expiration epoch of storage group.",
"type": "string"
},
"hash": {
"description": "Homomorphic hash from the concatenation of the payloads of the storage group members. Empty means hashing is disabled.",
"type": "string"
},
"members": {
"description": "Object identifiers to be placed into storage group. Must be unique.",
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"description": "Name of storage group. It will be the value of the ` + "`" + `FileName` + "`" + ` attribute in storage group object.",
"type": "string"
},
"size": {
"description": "Total size of the payloads of objects in the storage group.",
"type": "string"
}
},
"example": {
"address": {
"containerId": "5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv",
"objectId": "9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
},
"expirationEpoch": 5000,
"members": [
"8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
],
"name": "my-storage-group",
"size": 4096
}
},
"StorageGroupBaseInfo": {
"description": "Storage group info for listing.",
"type": "object",
"required": [
"address",
"expirationEpoch"
],
"properties": {
"address": {
"$ref": "#/definitions/Address"
},
"expirationEpoch": {
"type": "string"
},
"name": {
"type": "string"
}
},
"example": {
"address": {
"containerId": "5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv",
"objectId": "9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
},
"expirationEpoch": 5000,
"name": "my-storage-group"
}
},
"StorageGroupList": {
"description": "List of storage groups.",
"type": "object",
"required": [
"size",
"storageGroups"
],
"properties": {
"size": {
"type": "integer"
},
"storageGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/StorageGroupBaseInfo"
}
}
},
"example": {
"size": 1,
"storageGroups": [
{
"address": {
"containerId": "5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv",
"objectId": "9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
},
"expirationEpoch": 5000,
"name": "my-storage-group"
}
]
}
},
"StorageGroupPutBody": {
"type": "object",
"required": [
"lifetime",
"members"
],
"properties": {
"lifetime": {
"description": "Lifetime in epochs for storage group.",
"type": "integer"
},
"members": {
"description": "Object identifiers to be placed into storage group. Must be unique.",
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"description": "Name of storage group. It will be the value of the ` + "`" + `FileName` + "`" + ` attribute in storage group object.",
"type": "string"
}
},
"example": {
"lifetime": 100,
"members": [
"8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd"
],
"name": "my-storage-group"
}
},
"SuccessResponse": {
"description": "Success response.",
"type": "object",
@ -3417,6 +4084,13 @@ func init() {
"description": "Use wallet connect signature scheme or native FrostFS signature.",
"name": "walletConnect",
"in": "query"
},
"storageGroupId": {
"type": "string",
"description": "Base58 encoded storage group id.",
"name": "storageGroupId",
"in": "path",
"required": true
}
},
"securityDefinitions": {

View file

@ -16,7 +16,7 @@ import (
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// NewAuthParams creates a new AuthParams object

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// AuthOKCode is the HTTP code returned for type AuthOK

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime/middleware"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// DeleteContainerHandlerFunc turns a function with the right signature into a delete container handler

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// DeleteContainerOKCode is the HTTP code returned for type DeleteContainerOK

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime/middleware"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// DeleteObjectHandlerFunc turns a function with the right signature into a delete object handler

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// DeleteObjectOKCode is the HTTP code returned for type DeleteObjectOK

View file

@ -0,0 +1,71 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// DeleteStorageGroupHandlerFunc turns a function with the right signature into a delete storage group handler
type DeleteStorageGroupHandlerFunc func(DeleteStorageGroupParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteStorageGroupHandlerFunc) Handle(params DeleteStorageGroupParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// DeleteStorageGroupHandler interface for that can handle valid delete storage group params
type DeleteStorageGroupHandler interface {
Handle(DeleteStorageGroupParams, *models.Principal) middleware.Responder
}
// NewDeleteStorageGroup creates a new http.Handler for the delete storage group operation
func NewDeleteStorageGroup(ctx *middleware.Context, handler DeleteStorageGroupHandler) *DeleteStorageGroup {
return &DeleteStorageGroup{Context: ctx, Handler: handler}
}
/*
DeleteStorageGroup swagger:route DELETE /containers/{containerId}/storagegroups/{storageGroupId} deleteStorageGroup
Delete storage group from container.
*/
type DeleteStorageGroup struct {
Context *middleware.Context
Handler DeleteStorageGroupHandler
}
func (o *DeleteStorageGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewDeleteStorageGroupParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View file

@ -0,0 +1,228 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewDeleteStorageGroupParams creates a new DeleteStorageGroupParams object
// with the default values initialized.
func NewDeleteStorageGroupParams() DeleteStorageGroupParams {
var (
// initialize parameters with default values
fullBearerDefault = bool(false)
walletConnectDefault = bool(false)
)
return DeleteStorageGroupParams{
FullBearer: &fullBearerDefault,
WalletConnect: &walletConnectDefault,
}
}
// DeleteStorageGroupParams contains all the bound params for the delete storage group operation
// typically these are obtained from a http.Request
//
// swagger:parameters deleteStorageGroup
type DeleteStorageGroupParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*Base64 encoded signature for bearer token.
In: header
*/
XBearerSignature *string
/*Hex encoded the public part of the key that signed the bearer token.
In: header
*/
XBearerSignatureKey *string
/*Base58 encoded container id.
Required: true
In: path
*/
ContainerID string
/*Provided bearer token is final or gate should assemble it using signature.
In: query
Default: false
*/
FullBearer *bool
/*Base58 encoded storage group id.
Required: true
In: path
*/
StorageGroupID string
/*Use wallet connect signature scheme or native FrostFS signature.
In: query
Default: false
*/
WalletConnect *bool
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewDeleteStorageGroupParams() beforehand.
func (o *DeleteStorageGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
if err := o.bindXBearerSignature(r.Header[http.CanonicalHeaderKey("X-Bearer-Signature")], true, route.Formats); err != nil {
res = append(res, err)
}
if err := o.bindXBearerSignatureKey(r.Header[http.CanonicalHeaderKey("X-Bearer-Signature-Key")], true, route.Formats); err != nil {
res = append(res, err)
}
rContainerID, rhkContainerID, _ := route.Params.GetOK("containerId")
if err := o.bindContainerID(rContainerID, rhkContainerID, route.Formats); err != nil {
res = append(res, err)
}
qFullBearer, qhkFullBearer, _ := qs.GetOK("fullBearer")
if err := o.bindFullBearer(qFullBearer, qhkFullBearer, route.Formats); err != nil {
res = append(res, err)
}
rStorageGroupID, rhkStorageGroupID, _ := route.Params.GetOK("storageGroupId")
if err := o.bindStorageGroupID(rStorageGroupID, rhkStorageGroupID, route.Formats); err != nil {
res = append(res, err)
}
qWalletConnect, qhkWalletConnect, _ := qs.GetOK("walletConnect")
if err := o.bindWalletConnect(qWalletConnect, qhkWalletConnect, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindXBearerSignature binds and validates parameter XBearerSignature from header.
func (o *DeleteStorageGroupParams) bindXBearerSignature(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
if raw == "" { // empty values pass all other validations
return nil
}
o.XBearerSignature = &raw
return nil
}
// bindXBearerSignatureKey binds and validates parameter XBearerSignatureKey from header.
func (o *DeleteStorageGroupParams) bindXBearerSignatureKey(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
if raw == "" { // empty values pass all other validations
return nil
}
o.XBearerSignatureKey = &raw
return nil
}
// bindContainerID binds and validates parameter ContainerID from path.
func (o *DeleteStorageGroupParams) bindContainerID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.ContainerID = raw
return nil
}
// bindFullBearer binds and validates parameter FullBearer from query.
func (o *DeleteStorageGroupParams) bindFullBearer(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
// Default values have been previously initialized by NewDeleteStorageGroupParams()
return nil
}
value, err := swag.ConvertBool(raw)
if err != nil {
return errors.InvalidType("fullBearer", "query", "bool", raw)
}
o.FullBearer = &value
return nil
}
// bindStorageGroupID binds and validates parameter StorageGroupID from path.
func (o *DeleteStorageGroupParams) bindStorageGroupID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.StorageGroupID = raw
return nil
}
// bindWalletConnect binds and validates parameter WalletConnect from query.
func (o *DeleteStorageGroupParams) bindWalletConnect(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
// Default values have been previously initialized by NewDeleteStorageGroupParams()
return nil
}
value, err := swag.ConvertBool(raw)
if err != nil {
return errors.InvalidType("walletConnect", "query", "bool", raw)
}
o.WalletConnect = &value
return nil
}

View file

@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// DeleteStorageGroupOKCode is the HTTP code returned for type DeleteStorageGroupOK
const DeleteStorageGroupOKCode int = 200
/*
DeleteStorageGroupOK Successful deletion.
swagger:response deleteStorageGroupOK
*/
type DeleteStorageGroupOK struct {
/*
In: Body
*/
Payload *models.SuccessResponse `json:"body,omitempty"`
}
// NewDeleteStorageGroupOK creates DeleteStorageGroupOK with default headers values
func NewDeleteStorageGroupOK() *DeleteStorageGroupOK {
return &DeleteStorageGroupOK{}
}
// WithPayload adds the payload to the delete storage group o k response
func (o *DeleteStorageGroupOK) WithPayload(payload *models.SuccessResponse) *DeleteStorageGroupOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete storage group o k response
func (o *DeleteStorageGroupOK) SetPayload(payload *models.SuccessResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteStorageGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// DeleteStorageGroupBadRequestCode is the HTTP code returned for type DeleteStorageGroupBadRequest
const DeleteStorageGroupBadRequestCode int = 400
/*
DeleteStorageGroupBadRequest Bad request.
swagger:response deleteStorageGroupBadRequest
*/
type DeleteStorageGroupBadRequest struct {
/*
In: Body
*/
Payload *models.ErrorResponse `json:"body,omitempty"`
}
// NewDeleteStorageGroupBadRequest creates DeleteStorageGroupBadRequest with default headers values
func NewDeleteStorageGroupBadRequest() *DeleteStorageGroupBadRequest {
return &DeleteStorageGroupBadRequest{}
}
// WithPayload adds the payload to the delete storage group bad request response
func (o *DeleteStorageGroupBadRequest) WithPayload(payload *models.ErrorResponse) *DeleteStorageGroupBadRequest {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete storage group bad request response
func (o *DeleteStorageGroupBadRequest) SetPayload(payload *models.ErrorResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteStorageGroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(400)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime/middleware"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// FormBinaryBearerHandlerFunc turns a function with the right signature into a form binary bearer handler

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// FormBinaryBearerOKCode is the HTTP code returned for type FormBinaryBearerOK

View file

@ -19,7 +19,7 @@ import (
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// NewFrostfsRestGwAPI creates a new FrostfsRestGw instance
@ -53,6 +53,9 @@ func NewFrostfsRestGwAPI(spec *loads.Document) *FrostfsRestGwAPI {
DeleteObjectHandler: DeleteObjectHandlerFunc(func(params DeleteObjectParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation DeleteObject has not yet been implemented")
}),
DeleteStorageGroupHandler: DeleteStorageGroupHandlerFunc(func(params DeleteStorageGroupParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation DeleteStorageGroup has not yet been implemented")
}),
FormBinaryBearerHandler: FormBinaryBearerHandlerFunc(func(params FormBinaryBearerParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation FormBinaryBearer has not yet been implemented")
}),
@ -68,9 +71,15 @@ func NewFrostfsRestGwAPI(spec *loads.Document) *FrostfsRestGwAPI {
GetObjectInfoHandler: GetObjectInfoHandlerFunc(func(params GetObjectInfoParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation GetObjectInfo has not yet been implemented")
}),
GetStorageGroupHandler: GetStorageGroupHandlerFunc(func(params GetStorageGroupParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation GetStorageGroup has not yet been implemented")
}),
ListContainersHandler: ListContainersHandlerFunc(func(params ListContainersParams) middleware.Responder {
return middleware.NotImplemented("operation ListContainers has not yet been implemented")
}),
ListStorageGroupsHandler: ListStorageGroupsHandlerFunc(func(params ListStorageGroupsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation ListStorageGroups has not yet been implemented")
}),
OptionsAuthHandler: OptionsAuthHandlerFunc(func(params OptionsAuthParams) middleware.Responder {
return middleware.NotImplemented("operation OptionsAuth has not yet been implemented")
}),
@ -104,6 +113,9 @@ func NewFrostfsRestGwAPI(spec *loads.Document) *FrostfsRestGwAPI {
PutObjectHandler: PutObjectHandlerFunc(func(params PutObjectParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation PutObject has not yet been implemented")
}),
PutStorageGroupHandler: PutStorageGroupHandlerFunc(func(params PutStorageGroupParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation PutStorageGroup has not yet been implemented")
}),
SearchObjectsHandler: SearchObjectsHandlerFunc(func(params SearchObjectsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation SearchObjects has not yet been implemented")
}),
@ -163,6 +175,8 @@ type FrostfsRestGwAPI struct {
DeleteContainerHandler DeleteContainerHandler
// DeleteObjectHandler sets the operation handler for the delete object operation
DeleteObjectHandler DeleteObjectHandler
// DeleteStorageGroupHandler sets the operation handler for the delete storage group operation
DeleteStorageGroupHandler DeleteStorageGroupHandler
// FormBinaryBearerHandler sets the operation handler for the form binary bearer operation
FormBinaryBearerHandler FormBinaryBearerHandler
// GetBalanceHandler sets the operation handler for the get balance operation
@ -173,8 +187,12 @@ type FrostfsRestGwAPI struct {
GetContainerEACLHandler GetContainerEACLHandler
// GetObjectInfoHandler sets the operation handler for the get object info operation
GetObjectInfoHandler GetObjectInfoHandler
// GetStorageGroupHandler sets the operation handler for the get storage group operation
GetStorageGroupHandler GetStorageGroupHandler
// ListContainersHandler sets the operation handler for the list containers operation
ListContainersHandler ListContainersHandler
// ListStorageGroupsHandler sets the operation handler for the list storage groups operation
ListStorageGroupsHandler ListStorageGroupsHandler
// OptionsAuthHandler sets the operation handler for the options auth operation
OptionsAuthHandler OptionsAuthHandler
// OptionsAuthBearerHandler sets the operation handler for the options auth bearer operation
@ -197,6 +215,8 @@ type FrostfsRestGwAPI struct {
PutContainerEACLHandler PutContainerEACLHandler
// PutObjectHandler sets the operation handler for the put object operation
PutObjectHandler PutObjectHandler
// PutStorageGroupHandler sets the operation handler for the put storage group operation
PutStorageGroupHandler PutStorageGroupHandler
// SearchObjectsHandler sets the operation handler for the search objects operation
SearchObjectsHandler SearchObjectsHandler
@ -289,6 +309,9 @@ func (o *FrostfsRestGwAPI) Validate() error {
if o.DeleteObjectHandler == nil {
unregistered = append(unregistered, "DeleteObjectHandler")
}
if o.DeleteStorageGroupHandler == nil {
unregistered = append(unregistered, "DeleteStorageGroupHandler")
}
if o.FormBinaryBearerHandler == nil {
unregistered = append(unregistered, "FormBinaryBearerHandler")
}
@ -304,9 +327,15 @@ func (o *FrostfsRestGwAPI) Validate() error {
if o.GetObjectInfoHandler == nil {
unregistered = append(unregistered, "GetObjectInfoHandler")
}
if o.GetStorageGroupHandler == nil {
unregistered = append(unregistered, "GetStorageGroupHandler")
}
if o.ListContainersHandler == nil {
unregistered = append(unregistered, "ListContainersHandler")
}
if o.ListStorageGroupsHandler == nil {
unregistered = append(unregistered, "ListStorageGroupsHandler")
}
if o.OptionsAuthHandler == nil {
unregistered = append(unregistered, "OptionsAuthHandler")
}
@ -340,6 +369,9 @@ func (o *FrostfsRestGwAPI) Validate() error {
if o.PutObjectHandler == nil {
unregistered = append(unregistered, "PutObjectHandler")
}
if o.PutStorageGroupHandler == nil {
unregistered = append(unregistered, "PutStorageGroupHandler")
}
if o.SearchObjectsHandler == nil {
unregistered = append(unregistered, "SearchObjectsHandler")
}
@ -454,6 +486,10 @@ func (o *FrostfsRestGwAPI) initHandlerCache() {
o.handlers["DELETE"] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/objects/{containerId}/{objectId}"] = NewDeleteObject(o.context, o.DeleteObjectHandler)
if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/containers/{containerId}/storagegroups/{storageGroupId}"] = NewDeleteStorageGroup(o.context, o.DeleteStorageGroupHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
@ -477,7 +513,15 @@ func (o *FrostfsRestGwAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/containers/{containerId}/storagegroups/{storageGroupId}"] = NewGetStorageGroup(o.context, o.GetStorageGroupHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/containers"] = NewListContainers(o.context, o.ListContainersHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/containers/{containerId}/storagegroups"] = NewListStorageGroups(o.context, o.ListStorageGroupsHandler)
if o.handlers["OPTIONS"] == nil {
o.handlers["OPTIONS"] = make(map[string]http.Handler)
}
@ -522,6 +566,10 @@ func (o *FrostfsRestGwAPI) initHandlerCache() {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/objects"] = NewPutObject(o.context, o.PutObjectHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/containers/{containerId}/storagegroups"] = NewPutStorageGroup(o.context, o.PutStorageGroupHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// GetBalanceOKCode is the HTTP code returned for type GetBalanceOK

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// GetContainerEACLOKCode is the HTTP code returned for type GetContainerEACLOK

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// GetContainerOKCode is the HTTP code returned for type GetContainerOK

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime/middleware"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// GetObjectInfoHandlerFunc turns a function with the right signature into a get object info handler

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// GetObjectInfoOKCode is the HTTP code returned for type GetObjectInfoOK

View file

@ -0,0 +1,71 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// GetStorageGroupHandlerFunc turns a function with the right signature into a get storage group handler
type GetStorageGroupHandlerFunc func(GetStorageGroupParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn GetStorageGroupHandlerFunc) Handle(params GetStorageGroupParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// GetStorageGroupHandler interface for that can handle valid get storage group params
type GetStorageGroupHandler interface {
Handle(GetStorageGroupParams, *models.Principal) middleware.Responder
}
// NewGetStorageGroup creates a new http.Handler for the get storage group operation
func NewGetStorageGroup(ctx *middleware.Context, handler GetStorageGroupHandler) *GetStorageGroup {
return &GetStorageGroup{Context: ctx, Handler: handler}
}
/*
GetStorageGroup swagger:route GET /containers/{containerId}/storagegroups/{storageGroupId} getStorageGroup
Get storage group info.
*/
type GetStorageGroup struct {
Context *middleware.Context
Handler GetStorageGroupHandler
}
func (o *GetStorageGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewGetStorageGroupParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View file

@ -0,0 +1,228 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewGetStorageGroupParams creates a new GetStorageGroupParams object
// with the default values initialized.
func NewGetStorageGroupParams() GetStorageGroupParams {
var (
// initialize parameters with default values
fullBearerDefault = bool(false)
walletConnectDefault = bool(false)
)
return GetStorageGroupParams{
FullBearer: &fullBearerDefault,
WalletConnect: &walletConnectDefault,
}
}
// GetStorageGroupParams contains all the bound params for the get storage group operation
// typically these are obtained from a http.Request
//
// swagger:parameters getStorageGroup
type GetStorageGroupParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*Base64 encoded signature for bearer token.
In: header
*/
XBearerSignature *string
/*Hex encoded the public part of the key that signed the bearer token.
In: header
*/
XBearerSignatureKey *string
/*Base58 encoded container id.
Required: true
In: path
*/
ContainerID string
/*Provided bearer token is final or gate should assemble it using signature.
In: query
Default: false
*/
FullBearer *bool
/*Base58 encoded storage group id.
Required: true
In: path
*/
StorageGroupID string
/*Use wallet connect signature scheme or native FrostFS signature.
In: query
Default: false
*/
WalletConnect *bool
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewGetStorageGroupParams() beforehand.
func (o *GetStorageGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
if err := o.bindXBearerSignature(r.Header[http.CanonicalHeaderKey("X-Bearer-Signature")], true, route.Formats); err != nil {
res = append(res, err)
}
if err := o.bindXBearerSignatureKey(r.Header[http.CanonicalHeaderKey("X-Bearer-Signature-Key")], true, route.Formats); err != nil {
res = append(res, err)
}
rContainerID, rhkContainerID, _ := route.Params.GetOK("containerId")
if err := o.bindContainerID(rContainerID, rhkContainerID, route.Formats); err != nil {
res = append(res, err)
}
qFullBearer, qhkFullBearer, _ := qs.GetOK("fullBearer")
if err := o.bindFullBearer(qFullBearer, qhkFullBearer, route.Formats); err != nil {
res = append(res, err)
}
rStorageGroupID, rhkStorageGroupID, _ := route.Params.GetOK("storageGroupId")
if err := o.bindStorageGroupID(rStorageGroupID, rhkStorageGroupID, route.Formats); err != nil {
res = append(res, err)
}
qWalletConnect, qhkWalletConnect, _ := qs.GetOK("walletConnect")
if err := o.bindWalletConnect(qWalletConnect, qhkWalletConnect, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindXBearerSignature binds and validates parameter XBearerSignature from header.
func (o *GetStorageGroupParams) bindXBearerSignature(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
if raw == "" { // empty values pass all other validations
return nil
}
o.XBearerSignature = &raw
return nil
}
// bindXBearerSignatureKey binds and validates parameter XBearerSignatureKey from header.
func (o *GetStorageGroupParams) bindXBearerSignatureKey(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
if raw == "" { // empty values pass all other validations
return nil
}
o.XBearerSignatureKey = &raw
return nil
}
// bindContainerID binds and validates parameter ContainerID from path.
func (o *GetStorageGroupParams) bindContainerID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.ContainerID = raw
return nil
}
// bindFullBearer binds and validates parameter FullBearer from query.
func (o *GetStorageGroupParams) bindFullBearer(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
// Default values have been previously initialized by NewGetStorageGroupParams()
return nil
}
value, err := swag.ConvertBool(raw)
if err != nil {
return errors.InvalidType("fullBearer", "query", "bool", raw)
}
o.FullBearer = &value
return nil
}
// bindStorageGroupID binds and validates parameter StorageGroupID from path.
func (o *GetStorageGroupParams) bindStorageGroupID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.StorageGroupID = raw
return nil
}
// bindWalletConnect binds and validates parameter WalletConnect from query.
func (o *GetStorageGroupParams) bindWalletConnect(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
// Default values have been previously initialized by NewGetStorageGroupParams()
return nil
}
value, err := swag.ConvertBool(raw)
if err != nil {
return errors.InvalidType("walletConnect", "query", "bool", raw)
}
o.WalletConnect = &value
return nil
}

View file

@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// GetStorageGroupOKCode is the HTTP code returned for type GetStorageGroupOK
const GetStorageGroupOKCode int = 200
/*
GetStorageGroupOK Storage group information.
swagger:response getStorageGroupOK
*/
type GetStorageGroupOK struct {
/*
In: Body
*/
Payload *models.StorageGroup `json:"body,omitempty"`
}
// NewGetStorageGroupOK creates GetStorageGroupOK with default headers values
func NewGetStorageGroupOK() *GetStorageGroupOK {
return &GetStorageGroupOK{}
}
// WithPayload adds the payload to the get storage group o k response
func (o *GetStorageGroupOK) WithPayload(payload *models.StorageGroup) *GetStorageGroupOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get storage group o k response
func (o *GetStorageGroupOK) SetPayload(payload *models.StorageGroup) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetStorageGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// GetStorageGroupBadRequestCode is the HTTP code returned for type GetStorageGroupBadRequest
const GetStorageGroupBadRequestCode int = 400
/*
GetStorageGroupBadRequest Bad request.
swagger:response getStorageGroupBadRequest
*/
type GetStorageGroupBadRequest struct {
/*
In: Body
*/
Payload *models.ErrorResponse `json:"body,omitempty"`
}
// NewGetStorageGroupBadRequest creates GetStorageGroupBadRequest with default headers values
func NewGetStorageGroupBadRequest() *GetStorageGroupBadRequest {
return &GetStorageGroupBadRequest{}
}
// WithPayload adds the payload to the get storage group bad request response
func (o *GetStorageGroupBadRequest) WithPayload(payload *models.ErrorResponse) *GetStorageGroupBadRequest {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get storage group bad request response
func (o *GetStorageGroupBadRequest) SetPayload(payload *models.ErrorResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetStorageGroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(400)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// ListContainersOKCode is the HTTP code returned for type ListContainersOK

View file

@ -0,0 +1,71 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// ListStorageGroupsHandlerFunc turns a function with the right signature into a list storage groups handler
type ListStorageGroupsHandlerFunc func(ListStorageGroupsParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn ListStorageGroupsHandlerFunc) Handle(params ListStorageGroupsParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// ListStorageGroupsHandler interface for that can handle valid list storage groups params
type ListStorageGroupsHandler interface {
Handle(ListStorageGroupsParams, *models.Principal) middleware.Responder
}
// NewListStorageGroups creates a new http.Handler for the list storage groups operation
func NewListStorageGroups(ctx *middleware.Context, handler ListStorageGroupsHandler) *ListStorageGroups {
return &ListStorageGroups{Context: ctx, Handler: handler}
}
/*
ListStorageGroups swagger:route GET /containers/{containerId}/storagegroups listStorageGroups
Find all storage groups in container.
*/
type ListStorageGroups struct {
Context *middleware.Context
Handler ListStorageGroupsHandler
}
func (o *ListStorageGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewListStorageGroupsParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View file

@ -0,0 +1,203 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewListStorageGroupsParams creates a new ListStorageGroupsParams object
// with the default values initialized.
func NewListStorageGroupsParams() ListStorageGroupsParams {
var (
// initialize parameters with default values
fullBearerDefault = bool(false)
walletConnectDefault = bool(false)
)
return ListStorageGroupsParams{
FullBearer: &fullBearerDefault,
WalletConnect: &walletConnectDefault,
}
}
// ListStorageGroupsParams contains all the bound params for the list storage groups operation
// typically these are obtained from a http.Request
//
// swagger:parameters listStorageGroups
type ListStorageGroupsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*Base64 encoded signature for bearer token.
In: header
*/
XBearerSignature *string
/*Hex encoded the public part of the key that signed the bearer token.
In: header
*/
XBearerSignatureKey *string
/*Base58 encoded container id.
Required: true
In: path
*/
ContainerID string
/*Provided bearer token is final or gate should assemble it using signature.
In: query
Default: false
*/
FullBearer *bool
/*Use wallet connect signature scheme or native FrostFS signature.
In: query
Default: false
*/
WalletConnect *bool
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewListStorageGroupsParams() beforehand.
func (o *ListStorageGroupsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
if err := o.bindXBearerSignature(r.Header[http.CanonicalHeaderKey("X-Bearer-Signature")], true, route.Formats); err != nil {
res = append(res, err)
}
if err := o.bindXBearerSignatureKey(r.Header[http.CanonicalHeaderKey("X-Bearer-Signature-Key")], true, route.Formats); err != nil {
res = append(res, err)
}
rContainerID, rhkContainerID, _ := route.Params.GetOK("containerId")
if err := o.bindContainerID(rContainerID, rhkContainerID, route.Formats); err != nil {
res = append(res, err)
}
qFullBearer, qhkFullBearer, _ := qs.GetOK("fullBearer")
if err := o.bindFullBearer(qFullBearer, qhkFullBearer, route.Formats); err != nil {
res = append(res, err)
}
qWalletConnect, qhkWalletConnect, _ := qs.GetOK("walletConnect")
if err := o.bindWalletConnect(qWalletConnect, qhkWalletConnect, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindXBearerSignature binds and validates parameter XBearerSignature from header.
func (o *ListStorageGroupsParams) bindXBearerSignature(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
if raw == "" { // empty values pass all other validations
return nil
}
o.XBearerSignature = &raw
return nil
}
// bindXBearerSignatureKey binds and validates parameter XBearerSignatureKey from header.
func (o *ListStorageGroupsParams) bindXBearerSignatureKey(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
if raw == "" { // empty values pass all other validations
return nil
}
o.XBearerSignatureKey = &raw
return nil
}
// bindContainerID binds and validates parameter ContainerID from path.
func (o *ListStorageGroupsParams) bindContainerID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.ContainerID = raw
return nil
}
// bindFullBearer binds and validates parameter FullBearer from query.
func (o *ListStorageGroupsParams) bindFullBearer(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
// Default values have been previously initialized by NewListStorageGroupsParams()
return nil
}
value, err := swag.ConvertBool(raw)
if err != nil {
return errors.InvalidType("fullBearer", "query", "bool", raw)
}
o.FullBearer = &value
return nil
}
// bindWalletConnect binds and validates parameter WalletConnect from query.
func (o *ListStorageGroupsParams) bindWalletConnect(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
// Default values have been previously initialized by NewListStorageGroupsParams()
return nil
}
value, err := swag.ConvertBool(raw)
if err != nil {
return errors.InvalidType("walletConnect", "query", "bool", raw)
}
o.WalletConnect = &value
return nil
}

View file

@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// ListStorageGroupsOKCode is the HTTP code returned for type ListStorageGroupsOK
const ListStorageGroupsOKCode int = 200
/*
ListStorageGroupsOK List of storage groups.
swagger:response listStorageGroupsOK
*/
type ListStorageGroupsOK struct {
/*
In: Body
*/
Payload *models.StorageGroupList `json:"body,omitempty"`
}
// NewListStorageGroupsOK creates ListStorageGroupsOK with default headers values
func NewListStorageGroupsOK() *ListStorageGroupsOK {
return &ListStorageGroupsOK{}
}
// WithPayload adds the payload to the list storage groups o k response
func (o *ListStorageGroupsOK) WithPayload(payload *models.StorageGroupList) *ListStorageGroupsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the list storage groups o k response
func (o *ListStorageGroupsOK) SetPayload(payload *models.StorageGroupList) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ListStorageGroupsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// ListStorageGroupsBadRequestCode is the HTTP code returned for type ListStorageGroupsBadRequest
const ListStorageGroupsBadRequestCode int = 400
/*
ListStorageGroupsBadRequest Bad request.
swagger:response listStorageGroupsBadRequest
*/
type ListStorageGroupsBadRequest struct {
/*
In: Body
*/
Payload *models.ErrorResponse `json:"body,omitempty"`
}
// NewListStorageGroupsBadRequest creates ListStorageGroupsBadRequest with default headers values
func NewListStorageGroupsBadRequest() *ListStorageGroupsBadRequest {
return &ListStorageGroupsBadRequest{}
}
// WithPayload adds the payload to the list storage groups bad request response
func (o *ListStorageGroupsBadRequest) WithPayload(payload *models.ErrorResponse) *ListStorageGroupsBadRequest {
o.Payload = payload
return o
}
// SetPayload sets the payload to the list storage groups bad request response
func (o *ListStorageGroupsBadRequest) SetPayload(payload *models.ErrorResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ListStorageGroupsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(400)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View file

@ -15,7 +15,7 @@ import (
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// PutContainerHandlerFunc turns a function with the right signature into a put container handler

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime/middleware"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// PutContainerEACLHandlerFunc turns a function with the right signature into a put container e ACL handler

View file

@ -17,7 +17,7 @@ import (
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// NewPutContainerEACLParams creates a new PutContainerEACLParams object

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// PutContainerEACLOKCode is the HTTP code returned for type PutContainerEACLOK

View file

@ -17,7 +17,7 @@ import (
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// NewPutContainerParams creates a new PutContainerParams object

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// PutContainerOKCode is the HTTP code returned for type PutContainerOK

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime/middleware"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// PutObjectHandlerFunc turns a function with the right signature into a put object handler

View file

@ -17,7 +17,7 @@ import (
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// NewPutObjectParams creates a new PutObjectParams object

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// PutObjectOKCode is the HTTP code returned for type PutObjectOK

View file

@ -0,0 +1,71 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// PutStorageGroupHandlerFunc turns a function with the right signature into a put storage group handler
type PutStorageGroupHandlerFunc func(PutStorageGroupParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn PutStorageGroupHandlerFunc) Handle(params PutStorageGroupParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// PutStorageGroupHandler interface for that can handle valid put storage group params
type PutStorageGroupHandler interface {
Handle(PutStorageGroupParams, *models.Principal) middleware.Responder
}
// NewPutStorageGroup creates a new http.Handler for the put storage group operation
func NewPutStorageGroup(ctx *middleware.Context, handler PutStorageGroupHandler) *PutStorageGroup {
return &PutStorageGroup{Context: ctx, Handler: handler}
}
/*
PutStorageGroup swagger:route PUT /containers/{containerId}/storagegroups putStorageGroup
Create a new storage group in container.
*/
type PutStorageGroup struct {
Context *middleware.Context
Handler PutStorageGroupHandler
}
func (o *PutStorageGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewPutStorageGroupParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View file

@ -0,0 +1,242 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// NewPutStorageGroupParams creates a new PutStorageGroupParams object
// with the default values initialized.
func NewPutStorageGroupParams() PutStorageGroupParams {
var (
// initialize parameters with default values
fullBearerDefault = bool(false)
walletConnectDefault = bool(false)
)
return PutStorageGroupParams{
FullBearer: &fullBearerDefault,
WalletConnect: &walletConnectDefault,
}
}
// PutStorageGroupParams contains all the bound params for the put storage group operation
// typically these are obtained from a http.Request
//
// swagger:parameters putStorageGroup
type PutStorageGroupParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*Base64 encoded signature for bearer token.
In: header
*/
XBearerSignature *string
/*Hex encoded the public part of the key that signed the bearer token.
In: header
*/
XBearerSignatureKey *string
/*Base58 encoded container id.
Required: true
In: path
*/
ContainerID string
/*Provided bearer token is final or gate should assemble it using signature.
In: query
Default: false
*/
FullBearer *bool
/*Storage group co create.
Required: true
In: body
*/
StorageGroup *models.StorageGroupPutBody
/*Use wallet connect signature scheme or native FrostFS signature.
In: query
Default: false
*/
WalletConnect *bool
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewPutStorageGroupParams() beforehand.
func (o *PutStorageGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
if err := o.bindXBearerSignature(r.Header[http.CanonicalHeaderKey("X-Bearer-Signature")], true, route.Formats); err != nil {
res = append(res, err)
}
if err := o.bindXBearerSignatureKey(r.Header[http.CanonicalHeaderKey("X-Bearer-Signature-Key")], true, route.Formats); err != nil {
res = append(res, err)
}
rContainerID, rhkContainerID, _ := route.Params.GetOK("containerId")
if err := o.bindContainerID(rContainerID, rhkContainerID, route.Formats); err != nil {
res = append(res, err)
}
qFullBearer, qhkFullBearer, _ := qs.GetOK("fullBearer")
if err := o.bindFullBearer(qFullBearer, qhkFullBearer, route.Formats); err != nil {
res = append(res, err)
}
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.StorageGroupPutBody
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("storageGroup", "body", ""))
} else {
res = append(res, errors.NewParseError("storageGroup", "body", "", err))
}
} else {
// validate body object
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
ctx := validate.WithOperationRequest(context.Background())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.StorageGroup = &body
}
}
} else {
res = append(res, errors.Required("storageGroup", "body", ""))
}
qWalletConnect, qhkWalletConnect, _ := qs.GetOK("walletConnect")
if err := o.bindWalletConnect(qWalletConnect, qhkWalletConnect, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindXBearerSignature binds and validates parameter XBearerSignature from header.
func (o *PutStorageGroupParams) bindXBearerSignature(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
if raw == "" { // empty values pass all other validations
return nil
}
o.XBearerSignature = &raw
return nil
}
// bindXBearerSignatureKey binds and validates parameter XBearerSignatureKey from header.
func (o *PutStorageGroupParams) bindXBearerSignatureKey(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
if raw == "" { // empty values pass all other validations
return nil
}
o.XBearerSignatureKey = &raw
return nil
}
// bindContainerID binds and validates parameter ContainerID from path.
func (o *PutStorageGroupParams) bindContainerID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.ContainerID = raw
return nil
}
// bindFullBearer binds and validates parameter FullBearer from query.
func (o *PutStorageGroupParams) bindFullBearer(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
// Default values have been previously initialized by NewPutStorageGroupParams()
return nil
}
value, err := swag.ConvertBool(raw)
if err != nil {
return errors.InvalidType("fullBearer", "query", "bool", raw)
}
o.FullBearer = &value
return nil
}
// bindWalletConnect binds and validates parameter WalletConnect from query.
func (o *PutStorageGroupParams) bindWalletConnect(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
// Default values have been previously initialized by NewPutStorageGroupParams()
return nil
}
value, err := swag.ConvertBool(raw)
if err != nil {
return errors.InvalidType("walletConnect", "query", "bool", raw)
}
o.WalletConnect = &value
return nil
}

View file

@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// PutStorageGroupOKCode is the HTTP code returned for type PutStorageGroupOK
const PutStorageGroupOKCode int = 200
/*
PutStorageGroupOK Address of uploaded storage group.
swagger:response putStorageGroupOK
*/
type PutStorageGroupOK struct {
/*
In: Body
*/
Payload *models.Address `json:"body,omitempty"`
}
// NewPutStorageGroupOK creates PutStorageGroupOK with default headers values
func NewPutStorageGroupOK() *PutStorageGroupOK {
return &PutStorageGroupOK{}
}
// WithPayload adds the payload to the put storage group o k response
func (o *PutStorageGroupOK) WithPayload(payload *models.Address) *PutStorageGroupOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the put storage group o k response
func (o *PutStorageGroupOK) SetPayload(payload *models.Address) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PutStorageGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// PutStorageGroupBadRequestCode is the HTTP code returned for type PutStorageGroupBadRequest
const PutStorageGroupBadRequestCode int = 400
/*
PutStorageGroupBadRequest Bad request.
swagger:response putStorageGroupBadRequest
*/
type PutStorageGroupBadRequest struct {
/*
In: Body
*/
Payload *models.ErrorResponse `json:"body,omitempty"`
}
// NewPutStorageGroupBadRequest creates PutStorageGroupBadRequest with default headers values
func NewPutStorageGroupBadRequest() *PutStorageGroupBadRequest {
return &PutStorageGroupBadRequest{}
}
// WithPayload adds the payload to the put storage group bad request response
func (o *PutStorageGroupBadRequest) WithPayload(payload *models.ErrorResponse) *PutStorageGroupBadRequest {
o.Payload = payload
return o
}
// SetPayload sets the payload to the put storage group bad request response
func (o *PutStorageGroupBadRequest) SetPayload(payload *models.ErrorResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PutStorageGroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(400)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime/middleware"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// SearchObjectsHandlerFunc turns a function with the right signature into a search objects handler

View file

@ -17,7 +17,7 @@ import (
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// NewSearchObjectsParams creates a new SearchObjectsParams object

View file

@ -10,7 +10,7 @@ import (
"github.com/go-openapi/runtime"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
)
// SearchObjectsOKCode is the HTTP code returned for type SearchObjectsOK

View file

@ -22,7 +22,7 @@ import (
"github.com/go-openapi/swag"
"golang.org/x/net/netutil"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
)
const (

43
go.mod
View file

@ -1,11 +1,12 @@
module git.frostfs.info/TrueCloudLab/frostfs-rest-gw
module github.com/TrueCloudLab/frostfs-rest-gw
go 1.17
require (
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.11.2-0.20230307104236-f69d2ad83c51
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230307124721-94476f905599
github.com/TrueCloudLab/frostfs-api-go/v2 v2.0.0-20221212144048-1351b6656d68
github.com/TrueCloudLab/frostfs-crypto v0.5.0
github.com/TrueCloudLab/frostfs-sdk-go v0.0.0-20221214065929-4c779423f556
github.com/TrueCloudLab/tzhash v1.7.0
github.com/go-openapi/errors v0.20.2
github.com/go-openapi/loads v0.21.1
github.com/go-openapi/runtime v0.23.3
@ -14,22 +15,12 @@ require (
github.com/go-openapi/swag v0.21.1
github.com/go-openapi/validate v0.21.0
github.com/google/uuid v1.3.0
github.com/nspcc-dev/neo-go v0.100.1
github.com/nspcc-dev/neo-go v0.99.4
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.0
github.com/testcontainers/testcontainers-go v0.13.0
go.uber.org/zap v1.24.0
golang.org/x/net v0.3.0
)
require (
git.frostfs.info/TrueCloudLab/hrw v1.2.0 // indirect
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect
git.frostfs.info/TrueCloudLab/tzhash v1.8.0 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect
golang.org/x/exp v0.0.0-20221227203929-1b447090c38c // indirect
go.uber.org/zap v1.23.0
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b
)
require (
@ -38,8 +29,12 @@ require (
github.com/Microsoft/hcsshim v0.8.23 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/TrueCloudLab/hrw v1.1.0 // indirect
github.com/TrueCloudLab/rfc6979 v0.3.0 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/cgroups v1.0.1 // indirect
@ -58,7 +53,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/golang-lru v0.6.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
@ -95,11 +90,11 @@ require (
go.mongodb.org/mongo-driver v1.8.4 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.4.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect

97
go.sum
View file

@ -46,19 +46,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.11.2-0.20230307104236-f69d2ad83c51 h1:l4+K1hN+NuWNtlZZoV8yRRP3Uu7PifL05ukEqKcb0Ks=
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.11.2-0.20230307104236-f69d2ad83c51/go.mod h1:n0DxKYulu2Ar73R6OcNF34LiL/Xa+iDR7GZuaOChbLE=
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o=
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230307124721-94476f905599 h1:mzGX2RX8R8H/tUqrUu1TcYk4QRDBcBIWGYscPncfLOQ=
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230307124721-94476f905599/go.mod h1:z7zcpGY+puI5puyy5oyFbf20vWp84WtslCxcr6/kv5c=
git.frostfs.info/TrueCloudLab/hrw v1.2.0 h1:KvAES7xIqmQBGd2q8KanNosD9+4BhU/zqD5Kt5KSflk=
git.frostfs.info/TrueCloudLab/hrw v1.2.0/go.mod h1:mq2sbvYfO+BB6iFZwYBkgC0yc6mJNx+qZi4jW918m+Y=
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA=
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc=
git.frostfs.info/TrueCloudLab/tzhash v1.8.0 h1:UFMnUIk0Zh17m8rjGHJMqku2hCgaXDqjqZzS4gsb4UA=
git.frostfs.info/TrueCloudLab/tzhash v1.8.0/go.mod h1:dhY+oy274hV8wGvGL4MwwMpdL3GYvaX1a8GQZQHvlF8=
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
@ -107,6 +94,19 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
github.com/TrueCloudLab/frostfs-api-go/v2 v2.0.0-20221212144048-1351b6656d68 h1:mwZr15qCuIcWojIOmH6LILPohbWIkknZe9vhBRapmfQ=
github.com/TrueCloudLab/frostfs-api-go/v2 v2.0.0-20221212144048-1351b6656d68/go.mod h1:u3P6aL/NpAIY5IFRsJhmV+61Q3pJ3BkLENqySkf5zZQ=
github.com/TrueCloudLab/frostfs-contract v0.0.0-20221213081248-6c805c1b4e42/go.mod h1:qmf648elr+FWBZH3hqND8KVrXMnqu/e0z48k+sX8C2s=
github.com/TrueCloudLab/frostfs-crypto v0.5.0 h1:ZoLjixSkQv3j1EwZ1WJzMEJY2NR+9nO4Pd8WSyM/RRI=
github.com/TrueCloudLab/frostfs-crypto v0.5.0/go.mod h1:775MUewpH8AWpXrimAG2NYWOXB6lpKOI5kqgu+eI5zs=
github.com/TrueCloudLab/frostfs-sdk-go v0.0.0-20221214065929-4c779423f556 h1:Cc1jjYxKPfyw7TIJh3Bje7m8DOSn2dx+2zmr0yusWGw=
github.com/TrueCloudLab/frostfs-sdk-go v0.0.0-20221214065929-4c779423f556/go.mod h1:4ZiG4jNLzrqeJbmZUrPI7wDZhQVPaf0zEIWa/eBsqBg=
github.com/TrueCloudLab/hrw v1.1.0 h1:2U69PpUX1UtMWgh/RAg6D8mQW+/WsxbLNE+19EUhLhY=
github.com/TrueCloudLab/hrw v1.1.0/go.mod h1:Pzi8Hy3qx12cew+ajVxgbtDVM4sRG9/gJnJLcL/yRyY=
github.com/TrueCloudLab/rfc6979 v0.3.0 h1:0SYMAfQWh/TjnofqYQHy+s3rmQ5gi0fvOaDbqd60/Ic=
github.com/TrueCloudLab/rfc6979 v0.3.0/go.mod h1:qylxFXFQ/sMvpZC/8JyWp+mfzk5Zj/KDT5FAbekhobc=
github.com/TrueCloudLab/tzhash v1.7.0 h1:btGORepc7Dg+n4MxgJxv73c9eYhwSBI5HqsqUBRmJiw=
github.com/TrueCloudLab/tzhash v1.7.0/go.mod h1:gDQxqjhTqhR58Qfx0gxGtuyGAkixOukwbFGX9O6UGg4=
github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA=
github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg=
github.com/abiosoft/ishell/v2 v2.0.2/go.mod h1:E4oTCXfo6QjoCart0QYa5m9w4S+deXs/P/9jA77A9Bs=
@ -121,10 +121,9 @@ github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:C
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521073959-f0d4d129b7f1 h1:zFRi26YWd7NIorBXe8UkevRl0dIvk/AnXHWaAiZG+Yk=
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521073959-f0d4d129b7f1/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 h1:npHgfD4Tl2WJS3AJaMUi5ynGDPUBfkg3U3fCzDyXZ+4=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM=
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 h1:yL7+Jz0jTC6yykIK/Wh74gnTJnrGr5AyrNMXuA0gves=
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
@ -151,6 +150,7 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo=
github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
@ -293,6 +293,7 @@ github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmeka
github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU=
github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
@ -318,9 +319,6 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0=
github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
@ -600,11 +598,8 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4=
github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru/v2 v2.0.1 h1:5pv5N1lT1fjLg2VQ5KWc7kmucp2x/kvFOnxuVTqZ6x4=
github.com/hashicorp/golang-lru/v2 v2.0.1/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
@ -754,18 +749,15 @@ github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxx
github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ=
github.com/nspcc-dev/dbft v0.0.0-20210721160347-1b03241391ac/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y=
github.com/nspcc-dev/dbft v0.0.0-20220902113116-58a5e763e647/go.mod h1:g9xisXmX9NP9MjioaTe862n9SlZTrP+6PVUWLBYOr98=
github.com/nspcc-dev/dbft v0.0.0-20221020093431-31c1bbdc74f2/go.mod h1:g9xisXmX9NP9MjioaTe862n9SlZTrP+6PVUWLBYOr98=
github.com/nspcc-dev/go-ordered-json v0.0.0-20210915112629-e1b6cce73d02/go.mod h1:79bEUDEviBHJMFV6Iq6in57FEOCMcRhfQnfaf0ETA5U=
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 h1:n4ZaFCKt1pQJd7PXoMJabZWK9ejjbLOVrkl/lOUmshg=
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22/go.mod h1:79bEUDEviBHJMFV6Iq6in57FEOCMcRhfQnfaf0ETA5U=
github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU=
github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg=
github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM=
github.com/nspcc-dev/neo-go v0.99.4 h1:8Y+SdRxksC72a4PNkcGCh/aaQinh9Gu+c5LilbcsXOI=
github.com/nspcc-dev/neo-go v0.99.4/go.mod h1:mKTolfRUfKjFso5HPvGSQtUZc70n0VKBMs16eGuC5gA=
github.com/nspcc-dev/neo-go v0.100.1 h1:yugxbQRdzM+ObVa5mtr9/n4rYjxSIrryne8MVr9NBwU=
github.com/nspcc-dev/neo-go v0.100.1/go.mod h1:Nnp7F4e9IBccsgtCeLtUWV+0T6gk1PtP5HRtA13hUfc=
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=
@ -953,7 +945,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
@ -962,9 +953,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
@ -1012,7 +1002,6 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
@ -1052,13 +1041,13 @@ go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@ -1082,10 +1071,8 @@ golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -1096,9 +1083,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
golang.org/x/exp v0.0.0-20221227203929-1b447090c38c h1:Govq2W3bnHJimHT2ium65kXcI7ZzTniZHcFATnLJM0Q=
golang.org/x/exp v0.0.0-20221227203929-1b447090c38c/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@ -1126,9 +1110,6 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -1186,12 +1167,11 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211108170745-6635138e15ea/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk=
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b h1:vI32FkLJNAWtGD4BwkThwEy6XS7ZLLMHkSkYfF8M0W0=
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -1222,9 +1202,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -1338,18 +1317,13 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -1358,10 +1332,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -1435,9 +1407,6 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View file

@ -7,13 +7,13 @@ import (
"strings"
"time"
sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/internal/util"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/metrics"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
sessionv2 "github.com/TrueCloudLab/frostfs-api-go/v2/session"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/TrueCloudLab/frostfs-rest-gw/metrics"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-sdk-go/user"
"github.com/go-openapi/errors"
"github.com/google/uuid"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
@ -126,6 +126,12 @@ func (a *API) Configure(api *operations.FrostfsRestGwAPI) http.Handler {
api.OptionsContainersEACLHandler = operations.OptionsContainersEACLHandlerFunc(a.OptionsContainersEACL)
api.PutContainerEACLHandler = operations.PutContainerEACLHandlerFunc(a.PutContainerEACL)
api.GetContainerEACLHandler = operations.GetContainerEACLHandlerFunc(a.GetContainerEACL)
api.ListContainersHandler = operations.ListContainersHandlerFunc(a.ListContainer)
api.PutStorageGroupHandler = operations.PutStorageGroupHandlerFunc(a.PutStorageGroup)
api.ListStorageGroupsHandler = operations.ListStorageGroupsHandlerFunc(a.ListStorageGroups)
api.GetStorageGroupHandler = operations.GetStorageGroupHandlerFunc(a.GetStorageGroup)
api.DeleteStorageGroupHandler = operations.DeleteStorageGroupHandlerFunc(a.DeleteStorageGroup)
api.BearerAuthAuth = func(s string) (*models.Principal, error) {
if !strings.HasPrefix(s, BearerPrefix) {

View file

@ -5,15 +5,15 @@ import (
"encoding/base64"
"fmt"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/internal/util"
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"github.com/TrueCloudLab/frostfs-api-go/v2/acl"
"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
sessionv2 "github.com/TrueCloudLab/frostfs-api-go/v2/session"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
frostfsecdsa "github.com/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-sdk-go/user"
"github.com/go-openapi/runtime/middleware"
"github.com/google/uuid"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"

View file

@ -7,11 +7,11 @@ import (
"math"
"testing"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/internal/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"github.com/TrueCloudLab/frostfs-api-go/v2/acl"
crypto "github.com/TrueCloudLab/frostfs-crypto"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/TrueCloudLab/frostfs-sdk-go/user"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/stretchr/testify/require"
)

View file

@ -3,11 +3,11 @@ package handlers
import (
"strconv"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/internal/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-sdk-go/user"
"github.com/go-openapi/runtime/middleware"
)

View file

@ -3,7 +3,7 @@ package handlers
import (
"testing"
sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
sessionv2 "github.com/TrueCloudLab/frostfs-api-go/v2/session"
"github.com/stretchr/testify/require"
)

View file

@ -9,20 +9,20 @@ import (
"strings"
"time"
containerv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/internal/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
containerv2 "github.com/TrueCloudLab/frostfs-api-go/v2/container"
"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
sessionv2 "github.com/TrueCloudLab/frostfs-api-go/v2/session"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/TrueCloudLab/frostfs-sdk-go/container"
"github.com/TrueCloudLab/frostfs-sdk-go/container/acl"
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
"github.com/TrueCloudLab/frostfs-sdk-go/netmap"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-sdk-go/session"
"github.com/TrueCloudLab/frostfs-sdk-go/user"
"github.com/TrueCloudLab/frostfs-sdk-go/version"
"github.com/go-openapi/runtime/middleware"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"go.uber.org/zap"
@ -413,6 +413,10 @@ func createContainer(ctx context.Context, p *pool.Pool, stoken session.Container
container.WriteDomain(&cnr, domain)
}
if err = pool.SyncContainerWithNetwork(ctx, &cnr, p); err != nil {
return cid.ID{}, fmt.Errorf("sync container with network: %w", err)
}
var prm pool.PrmContainerPut
prm.SetContainer(cnr)
prm.WithinSession(stoken)

View file

@ -9,16 +9,16 @@ import (
"io"
"strings"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/internal/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-api-go/v2/acl"
"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/TrueCloudLab/frostfs-sdk-go/bearer"
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
"github.com/TrueCloudLab/frostfs-sdk-go/object"
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/go-openapi/runtime/middleware"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"go.uber.org/zap"

View file

@ -3,8 +3,8 @@ package handlers
import (
"testing"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/stretchr/testify/require"
)

View file

@ -1,7 +1,7 @@
package handlers
import (
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/go-openapi/runtime/middleware"
)

403
handlers/storagegroup.go Normal file
View file

@ -0,0 +1,403 @@
package handlers
import (
"bytes"
"context"
"encoding/hex"
"fmt"
"io"
"strconv"
objectv2 "github.com/TrueCloudLab/frostfs-api-go/v2/object"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/restapi/operations"
"github.com/TrueCloudLab/frostfs-rest-gw/internal/util"
"github.com/TrueCloudLab/frostfs-sdk-go/bearer"
"github.com/TrueCloudLab/frostfs-sdk-go/checksum"
"github.com/TrueCloudLab/frostfs-sdk-go/container"
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
"github.com/TrueCloudLab/frostfs-sdk-go/object"
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-sdk-go/storagegroup"
"github.com/TrueCloudLab/tzhash/tz"
"github.com/go-openapi/runtime/middleware"
)
// PutStorageGroup handler that create a new storage group.
func (a *API) PutStorageGroup(params operations.PutStorageGroupParams, principal *models.Principal) middleware.Responder {
ctx := params.HTTPRequest.Context()
cnrID, err := parseContainerID(params.ContainerID)
if err != nil {
resp := a.logAndGetErrorResponse("invalid container id", err)
return operations.NewPutStorageGroupBadRequest().WithPayload(resp)
}
btoken, err := getBearerToken(principal, params.XBearerSignature, params.XBearerSignatureKey, *params.WalletConnect, *params.FullBearer)
if err != nil {
resp := a.logAndGetErrorResponse("invalid bearer token", err)
return operations.NewPutStorageGroupBadRequest().WithPayload(resp)
}
sg, err := a.formStorageGroup(ctx, cnrID, btoken, params.StorageGroup)
if err != nil {
resp := a.logAndGetErrorResponse("form storage group", err)
return operations.NewPutStorageGroupBadRequest().WithPayload(resp)
}
objID, err := a.putStorageGroupObject(ctx, cnrID, btoken, params.StorageGroup.Name, *sg)
if err != nil {
resp := a.logAndGetErrorResponse("put storage group", err)
return operations.NewPutStorageGroupBadRequest().WithPayload(resp)
}
var resp models.Address
resp.ContainerID = util.NewString(params.ContainerID)
resp.ObjectID = util.NewString(objID.String())
return operations.NewPutStorageGroupOK().WithPayload(&resp)
}
// ListStorageGroups handler that create a new storage group.
func (a *API) ListStorageGroups(params operations.ListStorageGroupsParams, principal *models.Principal) middleware.Responder {
ctx := params.HTTPRequest.Context()
cnrID, err := parseContainerID(params.ContainerID)
if err != nil {
resp := a.logAndGetErrorResponse("invalid container id", err)
return operations.NewListStorageGroupsBadRequest().WithPayload(resp)
}
btoken, err := getBearerToken(principal, params.XBearerSignature, params.XBearerSignatureKey, *params.WalletConnect, *params.FullBearer)
if err != nil {
resp := a.logAndGetErrorResponse("invalid bearer token", err)
return operations.NewListStorageGroupsBadRequest().WithPayload(resp)
}
var filters object.SearchFilters
filters.AddTypeFilter(object.MatchStringEqual, object.TypeStorageGroup)
var prm pool.PrmObjectSearch
prm.SetContainerID(cnrID)
attachBearer(&prm, btoken)
prm.SetFilters(filters)
resSearch, err := a.pool.SearchObjects(ctx, prm)
if err != nil {
resp := a.logAndGetErrorResponse("failed to search objects", err)
return operations.NewListStorageGroupsBadRequest().WithPayload(resp)
}
var iterateErr error
var sgInfo *models.StorageGroupBaseInfo
var storageGroups []*models.StorageGroupBaseInfo
err = resSearch.Iterate(func(id oid.ID) bool {
if sgInfo, iterateErr = headObjectStorageGroupBaseInfo(ctx, a.pool, cnrID, id, btoken); iterateErr != nil {
return true
}
storageGroups = append(storageGroups, sgInfo)
return false
})
if err == nil {
err = iterateErr
}
if err != nil {
resp := a.logAndGetErrorResponse("failed to search storage groups", err)
return operations.NewListStorageGroupsBadRequest().WithPayload(resp)
}
resp := &models.StorageGroupList{
Size: util.NewInteger(int64(len(storageGroups))),
StorageGroups: storageGroups,
}
return operations.NewListStorageGroupsOK().WithPayload(resp)
}
func headObjectStorageGroupBaseInfo(ctx context.Context, p *pool.Pool, cnrID cid.ID, objID oid.ID, btoken *bearer.Token) (*models.StorageGroupBaseInfo, error) {
var addr oid.Address
addr.SetContainer(cnrID)
addr.SetObject(objID)
var prm pool.PrmObjectHead
prm.SetAddress(addr)
attachBearer(&prm, btoken)
objInfo, err := p.HeadObject(ctx, prm)
if err != nil {
return nil, fmt.Errorf("head object '%s': %w", objID.EncodeToString(), err)
}
resp := &models.StorageGroupBaseInfo{
Address: &models.Address{
ContainerID: util.NewString(cnrID.String()),
ObjectID: util.NewString(objID.String()),
},
}
expEpoch := "0"
for _, attr := range objInfo.Attributes() {
switch attr.Key() {
case object.AttributeFileName:
resp.Name = attr.Value()
case objectv2.SysAttributeExpEpoch:
if _, err = strconv.ParseUint(attr.Value(), 10, 64); err != nil {
return nil, fmt.Errorf("invalid expiration epoch '%s': %w", attr.Value(), err)
}
expEpoch = attr.Value()
}
}
resp.ExpirationEpoch = &expEpoch
return resp, nil
}
// DeleteStorageGroup handler that removes storage group from NeoFS.
func (a *API) DeleteStorageGroup(params operations.DeleteStorageGroupParams, principal *models.Principal) middleware.Responder {
ctx := params.HTTPRequest.Context()
addr, err := parseAddress(params.ContainerID, params.StorageGroupID)
if err != nil {
resp := a.logAndGetErrorResponse("invalid address", err)
return operations.NewDeleteStorageGroupBadRequest().WithPayload(resp)
}
btoken, err := getBearerToken(principal, params.XBearerSignature, params.XBearerSignatureKey, *params.WalletConnect, *params.FullBearer)
if err != nil {
resp := a.logAndGetErrorResponse("failed to get bearer token", err)
return operations.NewDeleteStorageGroupBadRequest().WithPayload(resp)
}
var prm pool.PrmObjectDelete
prm.SetAddress(addr)
attachBearer(&prm, btoken)
if err = a.pool.DeleteObject(ctx, prm); err != nil {
resp := a.logAndGetErrorResponse("failed to delete storage group", err)
return operations.NewDeleteStorageGroupBadRequest().WithPayload(resp)
}
return operations.NewDeleteStorageGroupOK().WithPayload(util.NewSuccessResponse())
}
// GetStorageGroup handler that get storage group info.
func (a *API) GetStorageGroup(params operations.GetStorageGroupParams, principal *models.Principal) middleware.Responder {
errorResponse := operations.NewGetObjectInfoBadRequest()
ctx := params.HTTPRequest.Context()
addr, err := parseAddress(params.ContainerID, params.StorageGroupID)
if err != nil {
resp := a.logAndGetErrorResponse("invalid address", err)
return errorResponse.WithPayload(resp)
}
btoken, err := getBearerToken(principal, params.XBearerSignature, params.XBearerSignatureKey, *params.WalletConnect, *params.FullBearer)
if err != nil {
resp := a.logAndGetErrorResponse("get bearer token", err)
return errorResponse.WithPayload(resp)
}
var prm pool.PrmObjectGet
prm.SetAddress(addr)
attachBearer(&prm, btoken)
objRes, err := a.pool.GetObject(ctx, prm)
if err != nil {
resp := a.logAndGetErrorResponse("get storage group object", err)
return errorResponse.WithPayload(resp)
}
sb, err := a.readStorageGroup(objRes)
if err != nil {
resp := a.logAndGetErrorResponse("read storage group", err)
return errorResponse.WithPayload(resp)
}
var sbHash string
cs, ok := sb.ValidationDataHash()
if ok {
sbHash = hex.EncodeToString(cs.Value())
}
members := make([]string, len(sb.Members()))
for i, objID := range sb.Members() {
members[i] = objID.EncodeToString()
}
resp := &models.StorageGroup{
Address: &models.Address{
ContainerID: util.NewString(addr.Container().String()),
ObjectID: util.NewString(addr.Object().String()),
},
ExpirationEpoch: util.NewString(strconv.FormatUint(sb.ExpirationEpoch(), 10)),
Size: util.NewString(strconv.FormatUint(sb.ValidationDataSize(), 10)),
Hash: sbHash,
Members: members,
Name: getStorageGroupName(objRes.Header),
}
return operations.NewGetStorageGroupOK().WithPayload(resp)
}
func getStorageGroupName(obj object.Object) string {
for _, attribute := range obj.Attributes() {
if attribute.Key() == object.AttributeFileName {
return attribute.Value()
}
}
return ""
}
func (a *API) readStorageGroup(objRes pool.ResGetObject) (*storagegroup.StorageGroup, error) {
buf := bytes.NewBuffer(nil)
if _, err := io.Copy(buf, objRes.Payload); err != nil {
return nil, fmt.Errorf("failed to copy storage group payload: %w", err)
}
obj := objRes.Header
obj.SetPayload(buf.Bytes())
var sb storagegroup.StorageGroup
if err := storagegroup.ReadFromObject(&sb, obj); err != nil {
return nil, fmt.Errorf("read storage group from object: %w", err)
}
return &sb, nil
}
func (a *API) formStorageGroup(ctx context.Context, cnrID cid.ID, btoken *bearer.Token, storageGroup *models.StorageGroupPutBody) (*storagegroup.StorageGroup, error) {
members, err := a.parseStorageGroupMembers(storageGroup)
if err != nil {
return nil, fmt.Errorf("parse storage group members: %w", err)
}
hashDisabled, err := isHomomorphicHashingDisabled(ctx, a.pool, cnrID)
if err != nil {
return nil, fmt.Errorf("check if homomorphic hash disabled: %w", err)
}
sgSize, cs, err := a.getStorageGroupSizeAndHash(ctx, cnrID, btoken, members, !hashDisabled)
if err != nil {
return nil, fmt.Errorf("get storage group size: %w", err)
}
networkInfo, err := a.pool.NetworkInfo(ctx)
if err != nil {
return nil, fmt.Errorf("get network info: %w", err)
}
var sg storagegroup.StorageGroup
sg.SetMembers(members)
sg.SetValidationDataSize(sgSize)
sg.SetExpirationEpoch(networkInfo.CurrentEpoch() + uint64(*storageGroup.Lifetime))
if !hashDisabled {
sg.SetValidationDataHash(*cs)
}
return &sg, nil
}
func (a *API) putStorageGroupObject(ctx context.Context, cnrID cid.ID, btoken *bearer.Token, fileName string, sg storagegroup.StorageGroup) (*oid.ID, error) {
var attrFileName object.Attribute
attrFileName.SetKey(object.AttributeFileName)
attrFileName.SetValue(fileName)
obj := object.New()
obj.SetContainerID(cnrID)
attachOwner(obj, btoken)
obj.SetAttributes(attrFileName)
storagegroup.WriteToObject(sg, obj)
var prmPut pool.PrmObjectPut
prmPut.SetHeader(*obj)
attachBearer(&prmPut, btoken)
objID, err := a.pool.PutObject(ctx, prmPut)
if err != nil {
return nil, fmt.Errorf("put object: %w", err)
}
return &objID, nil
}
func (a *API) getStorageGroupSizeAndHash(ctx context.Context, cnrID cid.ID, btoken *bearer.Token, members []oid.ID, needCalcHash bool) (uint64, *checksum.Checksum, error) {
var (
sgSize uint64
objHashes [][]byte
addr oid.Address
prm pool.PrmObjectHead
)
addr.SetContainer(cnrID)
attachBearer(&prm, btoken)
for _, objID := range members {
addr.SetObject(objID)
prm.SetAddress(addr)
objInfo, err := a.pool.HeadObject(ctx, prm)
if err != nil {
return 0, nil, fmt.Errorf("chead object from storage group members, id '%s': %w", objID.EncodeToString(), err)
}
sgSize += objInfo.PayloadSize()
if needCalcHash {
cs, _ := objInfo.PayloadHomomorphicHash()
objHashes = append(objHashes, cs.Value())
}
}
if needCalcHash {
sumHash, err := tz.Concat(objHashes)
if err != nil {
return 0, nil, fmt.Errorf("concat tz hashes: %w", err)
}
var cs checksum.Checksum
tzHash := [64]byte{}
copy(tzHash[:], sumHash)
cs.SetTillichZemor(tzHash)
return sgSize, &cs, nil
}
return sgSize, nil, nil
}
func (a *API) parseStorageGroupMembers(storageGroup *models.StorageGroupPutBody) ([]oid.ID, error) {
var err error
members := make([]oid.ID, len(storageGroup.Members))
uniqueFilter := make(map[oid.ID]struct{}, len(members))
for i, objIDStr := range storageGroup.Members {
if err = members[i].DecodeString(objIDStr); err != nil {
return nil, fmt.Errorf("invalid object id '%s': %w", objIDStr, err)
}
if _, ok := uniqueFilter[members[i]]; ok {
return nil, fmt.Errorf("invalid storage group members: duplicate id '%s': %w", objIDStr, err)
}
uniqueFilter[members[i]] = struct{}{}
}
return members, nil
}
func isHomomorphicHashingDisabled(ctx context.Context, p *pool.Pool, cnrID cid.ID) (bool, error) {
var prm pool.PrmContainerGet
prm.SetContainerID(cnrID)
cnr, err := p.GetContainer(ctx, prm)
if err != nil {
return false, fmt.Errorf("get container: %w", err)
}
return container.IsHomomorphicHashingDisabled(cnr), nil
}

View file

@ -9,12 +9,12 @@ import (
"strings"
"time"
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
objectv2 "github.com/TrueCloudLab/frostfs-api-go/v2/object"
sessionv2 "github.com/TrueCloudLab/frostfs-api-go/v2/session"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-sdk-go/container/acl"
"github.com/TrueCloudLab/frostfs-sdk-go/object"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
)
// PrmAttributes groups parameters to form attributes from request headers.

View file

@ -6,7 +6,7 @@ import (
"testing"
"time"
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
objectv2 "github.com/TrueCloudLab/frostfs-api-go/v2/object"
"github.com/stretchr/testify/require"
)

View file

@ -5,13 +5,13 @@ import (
"errors"
"fmt"
"git.frostfs.info/TrueCloudLab/frostfs-rest-gw/gen/models"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
"github.com/TrueCloudLab/frostfs-rest-gw/gen/models"
"github.com/TrueCloudLab/frostfs-sdk-go/bearer"
apistatus "github.com/TrueCloudLab/frostfs-sdk-go/client/status"
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
"github.com/TrueCloudLab/frostfs-sdk-go/eacl"
"github.com/TrueCloudLab/frostfs-sdk-go/object"
"github.com/TrueCloudLab/frostfs-sdk-go/session"
)
// ToNativeAction converts models.Action to appropriate eacl.Action.

View file

@ -6,7 +6,7 @@ import (
"fmt"
"testing"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
apistatus "github.com/TrueCloudLab/frostfs-sdk-go/client/status"
"github.com/stretchr/testify/require"
)

View file

@ -3,7 +3,7 @@ package metrics
import (
"net/http"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/TrueCloudLab/frostfs-sdk-go/pool"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/zap"

View file

@ -56,6 +56,12 @@ parameters:
type: string
required: true
description: Base58 encoded object id.
storageGroupId:
in: path
name: storageGroupId
type: string
required: true
description: Base58 encoded storage group id.
paths:
/auth:
@ -557,6 +563,89 @@ paths:
schema:
$ref: '#/definitions/ErrorResponse'
/containers/{containerId}/storagegroups:
parameters:
- $ref: '#/parameters/containerId'
put:
operationId: putStorageGroup
summary: Create a new storage group in container.
parameters:
- $ref: '#/parameters/signatureParam'
- $ref: '#/parameters/signatureKeyParam'
- $ref: '#/parameters/signatureScheme'
- $ref: '#/parameters/fullBearerToken'
- in: body
name: storageGroup
required: true
description: Storage group co create.
schema:
$ref: '#/definitions/StorageGroupPutBody'
responses:
200:
description: Address of uploaded storage group.
schema:
$ref: '#/definitions/Address'
400:
description: Bad request.
schema:
$ref: '#/definitions/ErrorResponse'
get:
operationId: listStorageGroups
summary: Find all storage groups in container.
parameters:
- $ref: '#/parameters/signatureParam'
- $ref: '#/parameters/signatureKeyParam'
- $ref: '#/parameters/signatureScheme'
- $ref: '#/parameters/fullBearerToken'
responses:
200:
description: List of storage groups.
schema:
$ref: '#/definitions/StorageGroupList'
400:
description: Bad request.
schema:
$ref: '#/definitions/ErrorResponse'
/containers/{containerId}/storagegroups/{storageGroupId}:
parameters:
- $ref: '#/parameters/containerId'
- $ref: '#/parameters/storageGroupId'
get:
operationId: getStorageGroup
summary: Get storage group info.
parameters:
- $ref: '#/parameters/signatureParam'
- $ref: '#/parameters/signatureKeyParam'
- $ref: '#/parameters/signatureScheme'
- $ref: '#/parameters/fullBearerToken'
responses:
200:
description: Storage group information.
schema:
$ref: '#/definitions/StorageGroup'
400:
description: Bad request.
schema:
$ref: '#/definitions/ErrorResponse'
delete:
operationId: deleteStorageGroup
summary: Delete storage group from container.
parameters:
- $ref: '#/parameters/signatureParam'
- $ref: '#/parameters/signatureKeyParam'
- $ref: '#/parameters/signatureScheme'
- $ref: '#/parameters/fullBearerToken'
responses:
200:
description: Successful deletion.
schema:
$ref: '#/definitions/SuccessResponse'
400:
description: Bad request.
schema:
$ref: '#/definitions/ErrorResponse'
definitions:
BinaryBearer:
description: Bearer token for object operations that is represented in binary form.
@ -1030,6 +1119,107 @@ definitions:
value: myfile
targets:
- role: OTHERS
StorageGroupPutBody:
type: object
properties:
name:
description: Name of storage group. It will be the value of the `FileName` attribute in storage group object.
type: string
lifetime:
description: Lifetime in epochs for storage group.
type: integer
members:
description: Object identifiers to be placed into storage group. Must be unique.
type: array
items:
type: string
required:
- lifetime
- members
example:
name: my-storage-group
lifetime: 100
members:
- 8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd
StorageGroup:
description: Storage group keeps verification information for Data Audit sessions.
type: object
properties:
name:
description: Name of storage group. It will be the value of the `FileName` attribute in storage group object.
type: string
address:
description: Address of storage group object. Set by server.
readOnly: true
$ref: '#/definitions/Address'
expirationEpoch:
description: Expiration epoch of storage group.
type: string
hash:
description: Homomorphic hash from the concatenation of the payloads of the storage group members. Empty means hashing is disabled.
type: string
size:
description: Total size of the payloads of objects in the storage group.
type: string
members:
description: Object identifiers to be placed into storage group. Must be unique.
type: array
items:
type: string
required:
- address
- expirationEpoch
- size
- members
example:
name: my-storage-group
address:
objectId: 9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd
containerId: 5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv
expirationEpoch: 5000
size: 4096
members:
- 8N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd
StorageGroupBaseInfo:
description: Storage group info for listing.
type: object
properties:
name:
type: string
address:
$ref: '#/definitions/Address'
expirationEpoch:
type: string
required:
- address
- expirationEpoch
example:
name: my-storage-group
address:
objectId: 9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd
containerId: 5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv
expirationEpoch: 5000
StorageGroupList:
description: List of storage groups.
type: object
properties:
size:
type: integer
storageGroups:
type: array
items:
$ref: '#/definitions/StorageGroupBaseInfo'
required:
- size
- storageGroups
example:
size: 1
storageGroups:
- name: my-storage-group
address:
objectId: 9N3o7Dtr6T1xteCt6eRwhpmJ7JhME58Hyu1dvaswuTDd
containerId: 5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv
expirationEpoch: 5000
Attribute:
description: Attribute is a pair of strings that can be attached to a container or an object.
type: object

View file

@ -75,4 +75,24 @@ Also, you can use this attribute to further object searching.
More about FrostFS status code you can
find [here](https://github.com/nspcc-dev/neofs-spec/blob/master/20-api-v2/status.md).
### Storage groups
The concept of a storage group has been introduced to reduce the dependence of the complexity of
the check on the number of stored objects in the system.
The consistency and availability of multiple objects on the network are achieved by validating the
storage group without saving meta information and performing validation on each object.
`StorageGroup` keeps verification information for Data Audit sessions. Objects that require paid storage
guaranties are gathered in `StorageGroups` with additional information used for proof of storage
checks. A `StorageGroup` can be created only for objects from the same container.
A `StorageGroup` are objects of a special type with the payload containing the serialized protobuf
structure. For the details on the format please refer to the [API specification](https://github.com/nspcc-dev/neofs-spec/blob/master/20-api-v2/storagegroup.md) in the corresponding section.
StorageGroup structure has information about:
* Total size of the payloads of objects in the storage group
* Homomorphic hash from the concatenation of the payloads of the storage group members. The order of concatenation is the same as the order of the members in the members field.
* Last NeoFS epoch number of the storage group lifetime
* Alpha-numerically sorted list of member objects