[#463] Move DefaultLocationConstraint constant into api

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-05-30 14:33:46 +03:00 committed by Kirillov Denis
parent 80d4d071d8
commit 0e37242b65
3 changed files with 6 additions and 5 deletions

View file

@ -66,6 +66,8 @@ const (
AccessControlRequestHeaders = "Access-Control-Request-Headers" AccessControlRequestHeaders = "Access-Control-Request-Headers"
Vary = "Vary" Vary = "Vary"
DefaultLocationConstraint = "default"
) )
// S3 request query params. // S3 request query params.

View file

@ -28,7 +28,6 @@ type (
const ( const (
attributeLocationConstraint = ".s3-location-constraint" attributeLocationConstraint = ".s3-location-constraint"
DefaultLocationConstraint = "default"
AttributeLockEnabled = "LockEnabled" AttributeLockEnabled = "LockEnabled"
) )
@ -125,7 +124,7 @@ func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*da
var err error var err error
ownerID := n.Owner(ctx) ownerID := n.Owner(ctx)
if p.LocationConstraint == "" { if p.LocationConstraint == "" {
p.LocationConstraint = DefaultLocationConstraint // s3tests_boto3.functional.test_s3:test_bucket_get_location p.LocationConstraint = api.DefaultLocationConstraint // s3tests_boto3.functional.test_s3:test_bucket_get_location
} }
bktInfo := &data.BucketInfo{ bktInfo := &data.BucketInfo{
Name: p.Name, Name: p.Name,

View file

@ -12,7 +12,7 @@ import (
"time" "time"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neofs-s3-gw/api/layer" "github.com/nspcc-dev/neofs-s3-gw/api"
"github.com/nspcc-dev/neofs-s3-gw/authmate" "github.com/nspcc-dev/neofs-s3-gw/authmate"
"github.com/nspcc-dev/neofs-s3-gw/internal/neofs" "github.com/nspcc-dev/neofs-s3-gw/internal/neofs"
"github.com/nspcc-dev/neofs-s3-gw/internal/version" "github.com/nspcc-dev/neofs-s3-gw/internal/version"
@ -323,8 +323,8 @@ func parsePolicies(val string) (authmate.ContainerPolicies, error) {
if err = json.Unmarshal(data, &policies); err != nil { if err = json.Unmarshal(data, &policies); err != nil {
return nil, err return nil, err
} }
if _, ok := policies[layer.DefaultLocationConstraint]; ok { if _, ok := policies[api.DefaultLocationConstraint]; ok {
return nil, fmt.Errorf("config overrides %s location constraint", layer.DefaultLocationConstraint) return nil, fmt.Errorf("config overrides %s location constraint", api.DefaultLocationConstraint)
} }
return policies, nil return policies, nil