forked from TrueCloudLab/frostfs-s3-gw
[#399] Use bearer token for system objects
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
7710de39ec
commit
3c5c2f20d8
2 changed files with 12 additions and 6 deletions
|
@ -189,17 +189,15 @@ func (n *layer) PutObject(ctx context.Context, p *PutObjectParams) (*data.Object
|
|||
prm.Attributes = append(prm.Attributes, [2]string{k, v})
|
||||
}
|
||||
|
||||
n.prepareAuthParameters(ctx, &prm.PrmAuth)
|
||||
|
||||
if p.Header[VersionsDeleteMarkAttr] == DelMarkFullObject {
|
||||
if last := versions.getLast(); last != nil {
|
||||
n.objCache.Delete(last.Address())
|
||||
}
|
||||
}
|
||||
|
||||
id, err := n.neoFS.CreateObject(ctx, prm)
|
||||
id, err := n.objectPut(ctx, prm)
|
||||
if err != nil {
|
||||
return nil, n.transformNeofsError(ctx, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if p.Lock != nil {
|
||||
|
@ -451,6 +449,14 @@ func (n *layer) objectDelete(ctx context.Context, idCnr *cid.ID, idObj *oid.ID)
|
|||
return n.transformNeofsError(ctx, n.neoFS.DeleteObject(ctx, prm))
|
||||
}
|
||||
|
||||
// objectPut prepare auth parameters and invoke neofs.CreateObject.
|
||||
func (n *layer) objectPut(ctx context.Context, prm neofs.PrmObjectCreate) (*oid.ID, error) {
|
||||
n.prepareAuthParameters(ctx, &prm.PrmAuth)
|
||||
|
||||
id, err := n.neoFS.CreateObject(ctx, prm)
|
||||
return id, n.transformNeofsError(ctx, err)
|
||||
}
|
||||
|
||||
// ListObjectsV1 returns objects in a bucket for requests of Version 1.
|
||||
func (n *layer) ListObjectsV1(ctx context.Context, p *ListObjectsParamsV1) (*ListObjectsInfoV1, error) {
|
||||
var (
|
||||
|
|
|
@ -117,9 +117,9 @@ func (n *layer) putSystemObjectIntoNeoFS(ctx context.Context, p *PutSystemObject
|
|||
prm.Attributes = append(prm.Attributes, [2]string{k, v})
|
||||
}
|
||||
|
||||
id, err := n.neoFS.CreateObject(ctx, prm)
|
||||
id, err := n.objectPut(ctx, prm)
|
||||
if err != nil {
|
||||
return nil, n.transformNeofsError(ctx, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
meta, err := n.objectHead(ctx, p.BktInfo.CID, id)
|
||||
|
|
Loading…
Reference in a new issue