forked from TrueCloudLab/frostfs-api-go
[#295] pkg: Remove usage of deprecated elements
Remove usage of deprecated of `container.ID` and `token.SessionToken` code elements. Replace using of custom message generators with the ones provided by packages. Replace string comparison with `Equal` method call. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
89be8d3f5a
commit
65080c8b69
22 changed files with 97 additions and 209 deletions
|
@ -6,7 +6,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"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/session"
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/client"
|
||||
rpcapi "github.com/nspcc-dev/neofs-api-go/v2/rpc"
|
||||
v2session "github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
|
@ -16,12 +16,12 @@ import (
|
|||
// Session contains session-related methods.
|
||||
type Session interface {
|
||||
// CreateSession creates session using provided expiration time.
|
||||
CreateSession(context.Context, uint64, ...CallOption) (*token.SessionToken, error)
|
||||
CreateSession(context.Context, uint64, ...CallOption) (*session.Token, error)
|
||||
}
|
||||
|
||||
var errMalformedResponseBody = errors.New("malformed response body")
|
||||
|
||||
func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error) {
|
||||
func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*session.Token, error) {
|
||||
// apply all available options
|
||||
callOptions := c.defaultCallOptions()
|
||||
|
||||
|
@ -65,7 +65,7 @@ func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts
|
|||
return nil, errMalformedResponseBody
|
||||
}
|
||||
|
||||
sessionToken := token.NewSessionToken()
|
||||
sessionToken := session.NewToken()
|
||||
sessionToken.SetID(body.GetID())
|
||||
sessionToken.SetSessionKey(body.GetSessionKey())
|
||||
sessionToken.SetOwnerID(ownerID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue