[#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"
"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-s3-gw/api"
"go.uber.org/zap"
@ -15,7 +16,7 @@ type (
// BucketInfo stores basic bucket data.
BucketInfo struct {
Name string
CID *container.ID
CID *cid.ID
Owner *owner.ID
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 (
err error
res *container.Container
@ -88,7 +89,7 @@ func (n *layer) containerList(ctx context.Context) ([]*BucketInfo, error) {
var (
err error
own = n.Owner(ctx)
res []*container.ID
res []*cid.ID
rid = api.GetRequestID(ctx)
)

View file

@ -10,7 +10,7 @@ import (
"time"
"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/owner"
"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
}
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
if _, err = n.objectFindID(ctx, &findParams{cid: cid, val: filename}); err == nil {

View file

@ -9,7 +9,7 @@ import (
"time"
"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-s3-gw/api"
"google.golang.org/grpc/codes"
@ -19,7 +19,7 @@ import (
type (
findParams struct {
val string
cid *container.ID
cid *cid.ID
}
getParams struct {

View file

@ -7,7 +7,7 @@ import (
"testing"
"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/owner"
"github.com/stretchr/testify/require"
@ -83,11 +83,11 @@ func testNameFromObjectName(name string) (string, string) {
func Test_objectInfoFromMeta(t *testing.T) {
uid := owner.NewID()
oid := object.NewID()
cid := container.NewID()
containerID := cid.New()
bkt := &BucketInfo{
Name: "test-container",
CID: cid,
CID: containerID,
Owner: uid,
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/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/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
@ -45,7 +46,7 @@ func New(log *zap.Logger, conns pool.Pool) *Agent {
type (
// IssueSecretOptions contains options for passing to Agent.IssueSecret method.
IssueSecretOptions struct {
ContainerID *container.ID
ContainerID *cid.ID
ContainerFriendlyName string
NeoFSKey *ecdsa.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()
if err != nil {
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 {
var (
err error
cid *container.ID
cid *cid.ID
)
a.log.Info("check container", zap.Stringer("cid", options.ContainerID))
@ -238,7 +239,7 @@ func newReplica(name string, count uint32) (r *netmap.Replica) {
return
}
func buildEACLTable(cid *container.ID, eaclTable []byte) (*eacl.Table, error) {
func buildEACLTable(cid *cid.ID, eaclTable []byte) (*eacl.Table, error) {
table := eacl.NewTable()
if len(eaclTable) != 0 {
return table, table.UnmarshalJSON(eaclTable)

View file

@ -12,7 +12,7 @@ import (
"syscall"
"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"
"github.com/nspcc-dev/neofs-s3-gw/authmate"
"github.com/nspcc-dev/neofs-s3-gw/creds/hcs"
@ -246,10 +246,10 @@ func issueSecret() *cli.Command {
}
agent := authmate.New(log, client)
var cid *container.ID
var containerID *cid.ID
if len(containerIDFlag) > 0 {
cid = container.NewID()
if err := cid.Parse(containerIDFlag); err != nil {
containerID = cid.New()
if err := containerID.Parse(containerIDFlag); err != nil {
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{
ContainerID: cid,
ContainerID: containerID,
ContainerFriendlyName: containerFriendlyName,
NeoFSKey: key,
OwnerPrivateKey: owner.PrivateKey(),

View file

@ -9,7 +9,7 @@ import (
"time"
"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/token"
"github.com/nspcc-dev/neofs-s3-gw/creds/accessbox"
@ -21,7 +21,7 @@ type (
// Credentials is a bearer token get/put interface.
Credentials interface {
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 {
@ -88,7 +88,7 @@ func (c *cred) Get(ctx context.Context, address *object.Address) (*token.BearerT
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 (
err error
buf = c.acquireBuffer()