From 0e37242b65765331807b9ec72785c628042bb973 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 30 May 2022 14:33:46 +0300 Subject: [PATCH] [#463] Move DefaultLocationConstraint constant into api Signed-off-by: Alex Vanin --- api/headers.go | 2 ++ api/layer/container.go | 3 +-- cmd/authmate/main.go | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/headers.go b/api/headers.go index ddee405..82fe81e 100644 --- a/api/headers.go +++ b/api/headers.go @@ -66,6 +66,8 @@ const ( AccessControlRequestHeaders = "Access-Control-Request-Headers" Vary = "Vary" + + DefaultLocationConstraint = "default" ) // S3 request query params. diff --git a/api/layer/container.go b/api/layer/container.go index e726c2e..d59b3fa 100644 --- a/api/layer/container.go +++ b/api/layer/container.go @@ -28,7 +28,6 @@ type ( const ( attributeLocationConstraint = ".s3-location-constraint" - DefaultLocationConstraint = "default" AttributeLockEnabled = "LockEnabled" ) @@ -125,7 +124,7 @@ func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*da var err error ownerID := n.Owner(ctx) 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{ Name: p.Name, diff --git a/cmd/authmate/main.go b/cmd/authmate/main.go index 22a168d..def0300 100644 --- a/cmd/authmate/main.go +++ b/cmd/authmate/main.go @@ -12,7 +12,7 @@ import ( "time" "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/internal/neofs" "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 { return nil, err } - if _, ok := policies[layer.DefaultLocationConstraint]; ok { - return nil, fmt.Errorf("config overrides %s location constraint", layer.DefaultLocationConstraint) + if _, ok := policies[api.DefaultLocationConstraint]; ok { + return nil, fmt.Errorf("config overrides %s location constraint", api.DefaultLocationConstraint) } return policies, nil