From 8ac630ee71f28c84b346073df9f7533a15e05076 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 10 Feb 2023 15:09:32 +0300 Subject: [PATCH] [TrueCloudLab#25] Add zone data to BucketInfo Signed-off-by: Alex Vanin --- api/data/info.go | 3 ++- api/layer/container.go | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/data/info.go b/api/data/info.go index c8f9351..d0580a8 100644 --- a/api/data/info.go +++ b/api/data/info.go @@ -22,7 +22,8 @@ const ( type ( // BucketInfo stores basic bucket data. BucketInfo struct { - Name string + Name string // container name from system attribute + Zone string // container zone from system attribute CID cid.ID Owner user.ID Created time.Time diff --git a/api/layer/container.go b/api/layer/container.go index a9638a5..7dc3e1f 100644 --- a/api/layer/container.go +++ b/api/layer/container.go @@ -5,6 +5,7 @@ import ( "fmt" "strconv" + v2container "github.com/TrueCloudLab/frostfs-api-go/v2/container" "github.com/TrueCloudLab/frostfs-s3-gw/api" "github.com/TrueCloudLab/frostfs-s3-gw/api/data" "github.com/TrueCloudLab/frostfs-s3-gw/api/errors" @@ -56,6 +57,7 @@ func (n *layer) containerInfo(ctx context.Context, idCnr cid.ID) (*data.BucketIn info.Owner = cnr.Owner() if domain := container.ReadDomain(cnr); domain.Name() != "" { info.Name = domain.Name() + info.Zone = domain.Zone() } info.Created = container.CreatedAt(cnr) info.LocationConstraint = cnr.Attribute(attributeLocationConstraint) @@ -114,6 +116,7 @@ func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*da } bktInfo := &data.BucketInfo{ Name: p.Name, + Zone: v2container.SysAttributeZoneDefault, Owner: ownerID, Created: TimeNow(ctx), LocationConstraint: p.LocationConstraint,