[#68] *: Replace deprecated

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
Angira Kekteeva 2021-06-04 16:01:42 +03:00
parent abfaa0bd48
commit b3b190adc0
7 changed files with 24 additions and 22 deletions

View file

@ -6,6 +6,7 @@ import (
"time" "time"
"github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/container"
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
"github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api"
"go.uber.org/zap" "go.uber.org/zap"
@ -15,7 +16,7 @@ type (
// BucketInfo stores basic bucket data. // BucketInfo stores basic bucket data.
BucketInfo struct { BucketInfo struct {
Name string Name string
CID *container.ID CID *cid.ID
Owner *owner.ID Owner *owner.ID
Created time.Time Created time.Time
} }
@ -30,7 +31,7 @@ type (
} }
) )
func (n *layer) containerInfo(ctx context.Context, cid *container.ID) (*BucketInfo, error) { func (n *layer) containerInfo(ctx context.Context, cid *cid.ID) (*BucketInfo, error) {
var ( var (
err error err error
res *container.Container res *container.Container
@ -88,7 +89,7 @@ func (n *layer) containerList(ctx context.Context) ([]*BucketInfo, error) {
var ( var (
err error err error
own = n.Owner(ctx) own = n.Owner(ctx)
res []*container.ID res []*cid.ID
rid = api.GetRequestID(ctx) rid = api.GetRequestID(ctx)
) )

View file

@ -10,7 +10,7 @@ import (
"time" "time"
"github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-api-go/pkg/container" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
"github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/pkg/token"
@ -259,7 +259,7 @@ func (n *layer) GetObject(ctx context.Context, p *GetObjectParams) error {
return nil return nil
} }
func (n *layer) checkObject(ctx context.Context, cid *container.ID, filename string) error { func (n *layer) checkObject(ctx context.Context, cid *cid.ID, filename string) error {
var err error var err error
if _, err = n.objectFindID(ctx, &findParams{cid: cid, val: filename}); err == nil { if _, err = n.objectFindID(ctx, &findParams{cid: cid, val: filename}); err == nil {

View file

@ -9,7 +9,7 @@ import (
"time" "time"
"github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-api-go/pkg/container" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
"github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-s3-gw/api" "github.com/nspcc-dev/neofs-s3-gw/api"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
@ -19,7 +19,7 @@ import (
type ( type (
findParams struct { findParams struct {
val string val string
cid *container.ID cid *cid.ID
} }
getParams struct { getParams struct {

View file

@ -7,7 +7,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/nspcc-dev/neofs-api-go/pkg/container" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
"github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -83,11 +83,11 @@ func testNameFromObjectName(name string) (string, string) {
func Test_objectInfoFromMeta(t *testing.T) { func Test_objectInfoFromMeta(t *testing.T) {
uid := owner.NewID() uid := owner.NewID()
oid := object.NewID() oid := object.NewID()
cid := container.NewID() containerID := cid.New()
bkt := &BucketInfo{ bkt := &BucketInfo{
Name: "test-container", Name: "test-container",
CID: cid, CID: containerID,
Owner: uid, Owner: uid,
Created: time.Now(), Created: time.Now(),
} }

View file

@ -14,6 +14,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
"github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/container"
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
"github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/netmap"
"github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/owner"
@ -45,7 +46,7 @@ func New(log *zap.Logger, conns pool.Pool) *Agent {
type ( type (
// IssueSecretOptions contains options for passing to Agent.IssueSecret method. // IssueSecretOptions contains options for passing to Agent.IssueSecret method.
IssueSecretOptions struct { IssueSecretOptions struct {
ContainerID *container.ID ContainerID *cid.ID
ContainerFriendlyName string ContainerFriendlyName string
NeoFSKey *ecdsa.PrivateKey NeoFSKey *ecdsa.PrivateKey
OwnerPrivateKey hcs.PrivateKey OwnerPrivateKey hcs.PrivateKey
@ -73,7 +74,7 @@ type (
} }
) )
func (a *Agent) checkContainer(ctx context.Context, cid *container.ID, friendlyName string) (*container.ID, error) { func (a *Agent) checkContainer(ctx context.Context, cid *cid.ID, friendlyName string) (*cid.ID, error) {
conn, _, err := a.pool.Connection() conn, _, err := a.pool.Connection()
if err != nil { if err != nil {
return nil, err return nil, err
@ -127,7 +128,7 @@ func (a *Agent) checkContainer(ctx context.Context, cid *container.ID, friendlyN
func (a *Agent) IssueSecret(ctx context.Context, w io.Writer, options *IssueSecretOptions) error { func (a *Agent) IssueSecret(ctx context.Context, w io.Writer, options *IssueSecretOptions) error {
var ( var (
err error err error
cid *container.ID cid *cid.ID
) )
a.log.Info("check container", zap.Stringer("cid", options.ContainerID)) a.log.Info("check container", zap.Stringer("cid", options.ContainerID))
@ -238,7 +239,7 @@ func newReplica(name string, count uint32) (r *netmap.Replica) {
return return
} }
func buildEACLTable(cid *container.ID, eaclTable []byte) (*eacl.Table, error) { func buildEACLTable(cid *cid.ID, eaclTable []byte) (*eacl.Table, error) {
table := eacl.NewTable() table := eacl.NewTable()
if len(eaclTable) != 0 { if len(eaclTable) != 0 {
return table, table.UnmarshalJSON(eaclTable) return table, table.UnmarshalJSON(eaclTable)

View file

@ -12,7 +12,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/nspcc-dev/neofs-api-go/pkg/container" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
crypto "github.com/nspcc-dev/neofs-crypto" crypto "github.com/nspcc-dev/neofs-crypto"
"github.com/nspcc-dev/neofs-s3-gw/authmate" "github.com/nspcc-dev/neofs-s3-gw/authmate"
"github.com/nspcc-dev/neofs-s3-gw/creds/hcs" "github.com/nspcc-dev/neofs-s3-gw/creds/hcs"
@ -246,10 +246,10 @@ func issueSecret() *cli.Command {
} }
agent := authmate.New(log, client) agent := authmate.New(log, client)
var cid *container.ID var containerID *cid.ID
if len(containerIDFlag) > 0 { if len(containerIDFlag) > 0 {
cid = container.NewID() containerID = cid.New()
if err := cid.Parse(containerIDFlag); err != nil { if err := containerID.Parse(containerIDFlag); err != nil {
return cli.Exit(fmt.Sprintf("failed to parse auth container id: %s", err), 3) return cli.Exit(fmt.Sprintf("failed to parse auth container id: %s", err), 3)
} }
} }
@ -269,7 +269,7 @@ func issueSecret() *cli.Command {
} }
issueSecretOptions := &authmate.IssueSecretOptions{ issueSecretOptions := &authmate.IssueSecretOptions{
ContainerID: cid, ContainerID: containerID,
ContainerFriendlyName: containerFriendlyName, ContainerFriendlyName: containerFriendlyName,
NeoFSKey: key, NeoFSKey: key,
OwnerPrivateKey: owner.PrivateKey(), OwnerPrivateKey: owner.PrivateKey(),

View file

@ -9,7 +9,7 @@ import (
"time" "time"
"github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-api-go/pkg/container" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
"github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/pkg/token"
"github.com/nspcc-dev/neofs-s3-gw/creds/accessbox" "github.com/nspcc-dev/neofs-s3-gw/creds/accessbox"
@ -21,7 +21,7 @@ type (
// Credentials is a bearer token get/put interface. // Credentials is a bearer token get/put interface.
Credentials interface { Credentials interface {
Get(context.Context, *object.Address) (*token.BearerToken, error) Get(context.Context, *object.Address) (*token.BearerToken, error)
Put(context.Context, *container.ID, *token.BearerToken, ...hcs.PublicKey) (*object.Address, error) Put(context.Context, *cid.ID, *token.BearerToken, ...hcs.PublicKey) (*object.Address, error)
} }
cred struct { cred struct {
@ -88,7 +88,7 @@ func (c *cred) Get(ctx context.Context, address *object.Address) (*token.BearerT
return box.Token(), nil return box.Token(), nil
} }
func (c *cred) Put(ctx context.Context, cid *container.ID, tkn *token.BearerToken, keys ...hcs.PublicKey) (*object.Address, error) { func (c *cred) Put(ctx context.Context, cid *cid.ID, tkn *token.BearerToken, keys ...hcs.PublicKey) (*object.Address, error) {
var ( var (
err error err error
buf = c.acquireBuffer() buf = c.acquireBuffer()