forked from TrueCloudLab/frostfs-api-go
1031f3122e
Implement `message.Message` interface on all structures and use new methods for conversion instead of functions. make `Unmarshal` and JSON methods to use encoding functions from `message` library. Remove all per-service clients and implement `rpc` library of the functions which execute NeoFS API RPC through new RPC client. Remove no longer used gRPC per-service clients. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
28 lines
622 B
Go
28 lines
622 B
Go
package rpc
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-api-go/rpc/client"
|
|
"github.com/nspcc-dev/neofs-api-go/rpc/common"
|
|
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
|
)
|
|
|
|
const serviceSession = serviceNamePrefix + "session.SessionService"
|
|
|
|
const (
|
|
rpcSessionCreate = "Create"
|
|
)
|
|
|
|
func CreateSession(
|
|
cli *client.Client,
|
|
req *session.CreateRequest,
|
|
opts ...client.CallOption,
|
|
) (*session.CreateResponse, error) {
|
|
resp := new(session.CreateResponse)
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceSession, rpcSessionCreate), req, resp, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return resp, nil
|
|
}
|