From 252b7036c70fdda5c80075f0743ecd78596840e1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 20 Aug 2020 13:41:55 +0300 Subject: [PATCH] Adopt service session removal in packages Signed-off-by: Alex Vanin --- v2/accounting/accounting.go | 26 ++--- v2/accounting/convert.go | 10 +- v2/accounting/grpc/service.go | 10 +- v2/container/convert.go | 50 +++++----- v2/container/grpc/service.go | 50 +++++----- v2/container/types.go | 146 ++++++++++++++-------------- v2/object/convert.go | 62 ++++++------ v2/object/grpc/service.go | 58 +++++------ v2/object/grpc/types.go | 4 +- v2/object/marshal_test.go | 14 +-- v2/object/types.go | 176 +++++++++++++++++----------------- v2/signature/sign.go | 37 ++++--- v2/signature/sign_test.go | 6 +- 13 files changed, 324 insertions(+), 325 deletions(-) diff --git a/v2/accounting/accounting.go b/v2/accounting/accounting.go index 1ca3d26..f2c0d98 100644 --- a/v2/accounting/accounting.go +++ b/v2/accounting/accounting.go @@ -2,7 +2,7 @@ package accounting import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) type BalanceRequestBody struct { @@ -12,9 +12,9 @@ type BalanceRequestBody struct { type BalanceRequest struct { body *BalanceRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type BalanceResponseBody struct { @@ -24,9 +24,9 @@ type BalanceResponseBody struct { type BalanceResponse struct { body *BalanceResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type Decimal struct { @@ -63,7 +63,7 @@ func (b *BalanceRequest) SetBody(v *BalanceRequestBody) { } } -func (b *BalanceRequest) GetMetaHeader() *service.RequestMetaHeader { +func (b *BalanceRequest) GetMetaHeader() *session.RequestMetaHeader { if b != nil { return b.metaHeader } @@ -71,13 +71,13 @@ func (b *BalanceRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (b *BalanceRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (b *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) { if b != nil { b.metaHeader = v } } -func (b *BalanceRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (b *BalanceRequest) GetVerificationHeader() *session.RequestVerificationHeader { if b != nil { return b.verifyHeader } @@ -85,7 +85,7 @@ func (b *BalanceRequest) GetVerificationHeader() *service.RequestVerificationHea return nil } -func (b *BalanceRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (b *BalanceRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if b != nil { b.verifyHeader = v } @@ -147,7 +147,7 @@ func (br *BalanceResponse) SetBody(v *BalanceResponseBody) { } } -func (br *BalanceResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (br *BalanceResponse) GetMetaHeader() *session.ResponseMetaHeader { if br != nil { return br.metaHeader } @@ -155,13 +155,13 @@ func (br *BalanceResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (br *BalanceResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (br *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if br != nil { br.metaHeader = v } } -func (br *BalanceResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (br *BalanceResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if br != nil { return br.verifyHeader } @@ -169,7 +169,7 @@ func (br *BalanceResponse) GetVerificationHeader() *service.ResponseVerification return nil } -func (br *BalanceResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (br *BalanceResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if br != nil { br.verifyHeader = v } diff --git a/v2/accounting/convert.go b/v2/accounting/convert.go index 5a0b6ed..d7fe95c 100644 --- a/v2/accounting/convert.go +++ b/v2/accounting/convert.go @@ -3,7 +3,7 @@ package accounting import ( accounting "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) func BalanceRequestBodyToGRPCMessage(b *BalanceRequestBody) *accounting.BalanceRequest_Body { @@ -45,7 +45,7 @@ func BalanceRequestToGRPCMessage(b *BalanceRequest) *accounting.BalanceRequest { BalanceRequestBodyToGRPCMessage(b.GetBody()), ) - service.RequestHeadersToGRPC(b, m) + session.RequestHeadersToGRPC(b, m) return m } @@ -61,7 +61,7 @@ func BalanceRequestFromGRPCMessage(m *accounting.BalanceRequest) *BalanceRequest BalanceRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, b) + session.RequestHeadersFromGRPC(m, b) return b } @@ -131,7 +131,7 @@ func BalanceResponseToGRPCMessage(br *BalanceResponse) *accounting.BalanceRespon BalanceResponseBodyToGRPCMessage(br.GetBody()), ) - service.ResponseHeadersToGRPC(br, m) + session.ResponseHeadersToGRPC(br, m) return m } @@ -147,7 +147,7 @@ func BalanceResponseFromGRPCMessage(m *accounting.BalanceResponse) *BalanceRespo BalanceResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, br) + session.ResponseHeadersFromGRPC(m, br) return br } diff --git a/v2/accounting/grpc/service.go b/v2/accounting/grpc/service.go index 058067b..78adedb 100644 --- a/v2/accounting/grpc/service.go +++ b/v2/accounting/grpc/service.go @@ -2,7 +2,7 @@ package accounting import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetOwnerId sets identifier of the account owner. @@ -20,14 +20,14 @@ func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *BalanceRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *BalanceRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *BalanceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -48,14 +48,14 @@ func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *BalanceResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *BalanceResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *BalanceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } diff --git a/v2/container/convert.go b/v2/container/convert.go index 34d5b97..b60d9a3 100644 --- a/v2/container/convert.go +++ b/v2/container/convert.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) func AttributeToGRPCMessage(a *Attribute) *container.Container_Attribute { @@ -152,7 +152,7 @@ func PutRequestToGRPCMessage(r *PutRequest) *container.PutRequest { PutRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -168,7 +168,7 @@ func PutRequestFromGRPCMessage(m *container.PutRequest) *PutRequest { PutRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -212,7 +212,7 @@ func PutResponseToGRPCMessage(r *PutResponse) *container.PutResponse { PutResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -228,7 +228,7 @@ func PutResponseFromGRPCMessage(m *container.PutResponse) *PutResponse { PutResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -272,7 +272,7 @@ func GetRequestToGRPCMessage(r *GetRequest) *container.GetRequest { GetRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -288,7 +288,7 @@ func GetRequestFromGRPCMessage(m *container.GetRequest) *GetRequest { GetRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -332,7 +332,7 @@ func GetResponseToGRPCMessage(r *GetResponse) *container.GetResponse { GetResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -348,7 +348,7 @@ func GetResponseFromGRPCMessage(m *container.GetResponse) *GetResponse { GetResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -400,7 +400,7 @@ func DeleteRequestToGRPCMessage(r *DeleteRequest) *container.DeleteRequest { DeleteRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -416,7 +416,7 @@ func DeleteRequestFromGRPCMessage(m *container.DeleteRequest) *DeleteRequest { DeleteRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -452,7 +452,7 @@ func DeleteResponseToGRPCMessage(r *DeleteResponse) *container.DeleteResponse { DeleteResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -468,7 +468,7 @@ func DeleteResponseFromGRPCMessage(m *container.DeleteResponse) *DeleteResponse DeleteResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -512,7 +512,7 @@ func ListRequestToGRPCMessage(r *ListRequest) *container.ListRequest { ListRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -528,7 +528,7 @@ func ListRequestFromGRPCMessage(m *container.ListRequest) *ListRequest { ListRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -582,7 +582,7 @@ func ListResponseToGRPCMessage(r *ListResponse) *container.ListResponse { ListResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -598,7 +598,7 @@ func ListResponseFromGRPCMessage(m *container.ListResponse) *ListResponse { ListResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -649,7 +649,7 @@ func SetExtendedACLRequestToGRPCMessage(r *SetExtendedACLRequest) *container.Set SetExtendedACLRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -665,7 +665,7 @@ func SetExtendedACLRequestFromGRPCMessage(m *container.SetExtendedACLRequest) *S SetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -701,7 +701,7 @@ func SetExtendedACLResponseToGRPCMessage(r *SetExtendedACLResponse) *container.S SetExtendedACLResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -717,7 +717,7 @@ func SetExtendedACLResponseFromGRPCMessage(m *container.SetExtendedACLResponse) SetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -761,7 +761,7 @@ func GetExtendedACLRequestToGRPCMessage(r *GetExtendedACLRequest) *container.Get GetExtendedACLRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -777,7 +777,7 @@ func GetExtendedACLRequestFromGRPCMessage(m *container.GetExtendedACLRequest) *G GetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -829,7 +829,7 @@ func GetExtendedACLResponseToGRPCMessage(r *GetExtendedACLResponse) *container.G GetExtendedACLResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -845,7 +845,7 @@ func GetExtendedACLResponseFromGRPCMessage(m *container.GetExtendedACLResponse) GetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } diff --git a/v2/container/grpc/service.go b/v2/container/grpc/service.go index 4da5e0f..61648b5 100644 --- a/v2/container/grpc/service.go +++ b/v2/container/grpc/service.go @@ -3,7 +3,7 @@ package container import ( acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc" refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetContainer sets container of the request. @@ -28,14 +28,14 @@ func (m *PutRequest) SetBody(v *PutRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *PutRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -56,14 +56,14 @@ func (m *PutResponse) SetBody(v *PutResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *PutResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -91,14 +91,14 @@ func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *DeleteRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -112,14 +112,14 @@ func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -138,14 +138,14 @@ func (m *GetRequest) SetBody(v *GetRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -166,14 +166,14 @@ func (m *GetResponse) SetBody(v *GetResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -194,14 +194,14 @@ func (m *ListRequest) SetBody(v *ListRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *ListRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *ListRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *ListRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -222,14 +222,14 @@ func (m *ListResponse) SetBody(v *ListResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *ListResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *ListResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *ListResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -257,14 +257,14 @@ func (m *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *SetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *SetExtendedACLRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *SetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -278,14 +278,14 @@ func (m *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *SetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *SetExtendedACLResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *SetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -306,14 +306,14 @@ func (m *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetExtendedACLRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -341,14 +341,14 @@ func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetExtendedACLResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } diff --git a/v2/container/types.go b/v2/container/types.go index 79d97c4..ae4a3c1 100644 --- a/v2/container/types.go +++ b/v2/container/types.go @@ -4,7 +4,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) type Attribute struct { @@ -34,9 +34,9 @@ type PutRequestBody struct { type PutRequest struct { body *PutRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type PutResponseBody struct { @@ -46,9 +46,9 @@ type PutResponseBody struct { type PutResponse struct { body *PutResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type GetRequestBody struct { @@ -58,9 +58,9 @@ type GetRequestBody struct { type GetRequest struct { body *GetRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetResponseBody struct { @@ -70,9 +70,9 @@ type GetResponseBody struct { type GetResponse struct { body *GetResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type DeleteRequestBody struct { @@ -84,9 +84,9 @@ type DeleteRequestBody struct { type DeleteRequest struct { body *DeleteRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type DeleteResponseBody struct{} @@ -94,9 +94,9 @@ type DeleteResponseBody struct{} type DeleteResponse struct { body *DeleteResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type ListRequestBody struct { @@ -106,9 +106,9 @@ type ListRequestBody struct { type ListRequest struct { body *ListRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type ListResponseBody struct { @@ -118,9 +118,9 @@ type ListResponseBody struct { type ListResponse struct { body *ListResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type SetExtendedACLRequestBody struct { @@ -132,9 +132,9 @@ type SetExtendedACLRequestBody struct { type SetExtendedACLRequest struct { body *SetExtendedACLRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type SetExtendedACLResponseBody struct{} @@ -142,9 +142,9 @@ type SetExtendedACLResponseBody struct{} type SetExtendedACLResponse struct { body *SetExtendedACLResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type GetExtendedACLRequestBody struct { @@ -154,9 +154,9 @@ type GetExtendedACLRequestBody struct { type GetExtendedACLRequest struct { body *GetExtendedACLRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetExtendedACLResponseBody struct { @@ -168,9 +168,9 @@ type GetExtendedACLResponseBody struct { type GetExtendedACLResponse struct { body *GetExtendedACLResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } func (a *Attribute) GetKey() string { @@ -327,7 +327,7 @@ func (r *PutRequest) SetBody(v *PutRequestBody) { } } -func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *PutRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -335,13 +335,13 @@ func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *PutRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -349,7 +349,7 @@ func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *PutRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *PutRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -383,7 +383,7 @@ func (r *PutResponse) SetBody(v *PutResponseBody) { } } -func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *PutResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -391,13 +391,13 @@ func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *PutResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -405,7 +405,7 @@ func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeade return nil } -func (r *PutResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *PutResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -439,7 +439,7 @@ func (r *GetRequest) SetBody(v *GetRequestBody) { } } -func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -447,13 +447,13 @@ func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -461,7 +461,7 @@ func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *GetRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -495,7 +495,7 @@ func (r *GetResponse) SetBody(v *GetResponseBody) { } } -func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -503,13 +503,13 @@ func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -517,7 +517,7 @@ func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeade return nil } -func (r *GetResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -565,7 +565,7 @@ func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { } } -func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *DeleteRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -573,13 +573,13 @@ func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *DeleteRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -587,7 +587,7 @@ func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHead return nil } -func (r *DeleteRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *DeleteRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -607,7 +607,7 @@ func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { } } -func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *DeleteResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -615,13 +615,13 @@ func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *DeleteResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -629,7 +629,7 @@ func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHe return nil } -func (r *DeleteResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *DeleteResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -663,7 +663,7 @@ func (r *ListRequest) SetBody(v *ListRequestBody) { } } -func (r *ListRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *ListRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -671,13 +671,13 @@ func (r *ListRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *ListRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *ListRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *ListRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -685,7 +685,7 @@ func (r *ListRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *ListRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *ListRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -719,7 +719,7 @@ func (r *ListResponse) SetBody(v *ListResponseBody) { } } -func (r *ListResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *ListResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -727,13 +727,13 @@ func (r *ListResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *ListResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *ListResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *ListResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -741,7 +741,7 @@ func (r *ListResponse) GetVerificationHeader() *service.ResponseVerificationHead return nil } -func (r *ListResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *ListResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -789,7 +789,7 @@ func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) { } } -func (r *SetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *SetExtendedACLRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -797,13 +797,13 @@ func (r *SetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *SetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *SetExtendedACLRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *SetExtendedACLRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -811,7 +811,7 @@ func (r *SetExtendedACLRequest) GetVerificationHeader() *service.RequestVerifica return nil } -func (r *SetExtendedACLRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *SetExtendedACLRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -831,7 +831,7 @@ func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) { } } -func (r *SetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *SetExtendedACLResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -839,13 +839,13 @@ func (r *SetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *SetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *SetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *SetExtendedACLResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -853,7 +853,7 @@ func (r *SetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerifi return nil } -func (r *SetExtendedACLResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *SetExtendedACLResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -887,7 +887,7 @@ func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) { } } -func (r *GetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetExtendedACLRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -895,13 +895,13 @@ func (r *GetExtendedACLRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetExtendedACLRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetExtendedACLRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -909,7 +909,7 @@ func (r *GetExtendedACLRequest) GetVerificationHeader() *service.RequestVerifica return nil } -func (r *GetExtendedACLRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetExtendedACLRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -957,7 +957,7 @@ func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) { } } -func (r *GetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetExtendedACLResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -965,13 +965,13 @@ func (r *GetExtendedACLResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetExtendedACLResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -979,7 +979,7 @@ func (r *GetExtendedACLResponse) GetVerificationHeader() *service.ResponseVerifi return nil } -func (r *GetExtendedACLResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetExtendedACLResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } diff --git a/v2/object/convert.go b/v2/object/convert.go index 949bb13..7beb640 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -6,7 +6,7 @@ import ( object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) func TypeToGRPCField(t Type) object.ObjectType { @@ -209,7 +209,7 @@ func HeaderToGRPCMessage(h *Header) *object.Header { ) m.SetSessionToken( - service.SessionTokenToGRPCMessage(h.GetSessionToken()), + session.SessionTokenToGRPCMessage(h.GetSessionToken()), ) attr := h.GetAttributes() @@ -264,7 +264,7 @@ func HeaderFromGRPCMessage(m *object.Header) *Header { ) h.SetSessionToken( - service.SessionTokenFromGRPCMessage(m.GetSessionToken()), + session.SessionTokenFromGRPCMessage(m.GetSessionToken()), ) attrMsg := m.GetAttributes() @@ -374,7 +374,7 @@ func GetRequestToGRPCMessage(r *GetRequest) *object.GetRequest { GetRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -390,7 +390,7 @@ func GetRequestFromGRPCMessage(m *object.GetRequest) *GetRequest { GetRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -522,7 +522,7 @@ func GetResponseToGRPCMessage(r *GetResponse) *object.GetResponse { GetResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -538,7 +538,7 @@ func GetResponseFromGRPCMessage(m *object.GetResponse) *GetResponse { GetResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -674,7 +674,7 @@ func PutRequestToGRPCMessage(r *PutRequest) *object.PutRequest { PutRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -690,7 +690,7 @@ func PutRequestFromGRPCMessage(m *object.PutRequest) *PutRequest { PutRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -734,7 +734,7 @@ func PutResponseToGRPCMessage(r *PutResponse) *object.PutResponse { PutResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -750,7 +750,7 @@ func PutResponseFromGRPCMessage(m *object.PutResponse) *PutResponse { PutResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -794,7 +794,7 @@ func DeleteRequestToGRPCMessage(r *DeleteRequest) *object.DeleteRequest { DeleteRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -810,7 +810,7 @@ func DeleteRequestFromGRPCMessage(m *object.DeleteRequest) *DeleteRequest { DeleteRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -846,7 +846,7 @@ func DeleteResponseToGRPCMessage(r *DeleteResponse) *object.DeleteResponse { DeleteResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -862,7 +862,7 @@ func DeleteResponseFromGRPCMessage(m *object.DeleteResponse) *DeleteResponse { DeleteResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -914,7 +914,7 @@ func HeadRequestToGRPCMessage(r *HeadRequest) *object.HeadRequest { HeadRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -930,7 +930,7 @@ func HeadRequestFromGRPCMessage(m *object.HeadRequest) *HeadRequest { HeadRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -1050,7 +1050,7 @@ func HeadResponseToGRPCMessage(r *HeadResponse) *object.HeadResponse { HeadResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -1066,7 +1066,7 @@ func HeadResponseFromGRPCMessage(m *object.HeadResponse) *HeadResponse { HeadResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -1168,7 +1168,7 @@ func SearchRequestToGRPCMessage(r *SearchRequest) *object.SearchRequest { SearchRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -1184,7 +1184,7 @@ func SearchRequestFromGRPCMessage(m *object.SearchRequest) *SearchRequest { SearchRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -1238,7 +1238,7 @@ func SearchResponseToGRPCMessage(r *SearchResponse) *object.SearchResponse { SearchResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -1254,7 +1254,7 @@ func SearchResponseFromGRPCMessage(m *object.SearchResponse) *SearchResponse { SearchResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -1332,7 +1332,7 @@ func GetRangeRequestToGRPCMessage(r *GetRangeRequest) *object.GetRangeRequest { GetRangeRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -1348,7 +1348,7 @@ func GetRangeRequestFromGRPCMessage(m *object.GetRangeRequest) *GetRangeRequest GetRangeRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -1388,7 +1388,7 @@ func GetRangeResponseToGRPCMessage(r *GetRangeResponse) *object.GetRangeResponse GetRangeResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -1404,7 +1404,7 @@ func GetRangeResponseFromGRPCMessage(m *object.GetRangeResponse) *GetRangeRespon GetRangeResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } @@ -1474,7 +1474,7 @@ func GetRangeHashRequestToGRPCMessage(r *GetRangeHashRequest) *object.GetRangeHa GetRangeHashRequestBodyToGRPCMessage(r.GetBody()), ) - service.RequestHeadersToGRPC(r, m) + session.RequestHeadersToGRPC(r, m) return m } @@ -1490,7 +1490,7 @@ func GetRangeHashRequestFromGRPCMessage(m *object.GetRangeHashRequest) *GetRange GetRangeHashRequestBodyFromGRPCMessage(m.GetBody()), ) - service.RequestHeadersFromGRPC(m, r) + session.RequestHeadersFromGRPC(m, r) return r } @@ -1534,7 +1534,7 @@ func GetRangeHashResponseToGRPCMessage(r *GetRangeHashResponse) *object.GetRange GetRangeHashResponseBodyToGRPCMessage(r.GetBody()), ) - service.ResponseHeadersToGRPC(r, m) + session.ResponseHeadersToGRPC(r, m) return m } @@ -1550,7 +1550,7 @@ func GetRangeHashResponseFromGRPCMessage(m *object.GetRangeHashResponse) *GetRan GetRangeHashResponseBodyFromGRPCMessage(m.GetBody()), ) - service.ResponseHeadersFromGRPC(m, r) + session.ResponseHeadersFromGRPC(m, r) return r } diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 04cebfa..515d3e8 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -2,7 +2,7 @@ package object import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetAddress sets address of the requested object. @@ -27,14 +27,14 @@ func (m *GetRequest) SetBody(v *GetRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -101,14 +101,14 @@ func (m *GetResponse) SetBody(v *GetResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -182,14 +182,14 @@ func (m *PutRequest) SetBody(v *PutRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *PutRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -210,14 +210,14 @@ func (m *PutResponse) SetBody(v *PutResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *PutResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -238,14 +238,14 @@ func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *DeleteRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -259,14 +259,14 @@ func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -301,14 +301,14 @@ func (m *HeadRequest) SetBody(v *HeadRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *HeadRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *HeadRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *HeadRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -368,14 +368,14 @@ func (m *HeadResponse) SetBody(v *HeadResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *HeadResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *HeadResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *HeadResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -431,14 +431,14 @@ func (m *SearchRequest) SetBody(v *SearchRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *SearchRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *SearchRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *SearchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -459,14 +459,14 @@ func (m *SearchResponse) SetBody(v *SearchResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *SearchResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *SearchResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *SearchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -508,14 +508,14 @@ func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetRangeRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetRangeRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetRangeRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -536,14 +536,14 @@ func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetRangeResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetRangeResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetRangeResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -585,14 +585,14 @@ func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { } // SetMetaHeader sets meta header of the request. -func (m *GetRangeHashRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (m *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (m *GetRangeHashRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { +func (m *GetRangeHashRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if m != nil { m.VerifyHeader = v } @@ -620,14 +620,14 @@ func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { } // SetMetaHeader sets meta header of the response. -func (m *GetRangeHashResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (m *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if m != nil { m.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (m *GetRangeHashResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { +func (m *GetRangeHashResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if m != nil { m.VerifyHeader = v } diff --git a/v2/object/grpc/types.go b/v2/object/grpc/types.go index 24216ab..fa3ae76 100644 --- a/v2/object/grpc/types.go +++ b/v2/object/grpc/types.go @@ -2,7 +2,7 @@ package object import ( refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" - service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc" + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" ) // SetKey sets key to the object attribute. @@ -111,7 +111,7 @@ func (m *Header) SetHomomorphicHash(v *refs.Checksum) { } // SetSessionToken sets session token. -func (m *Header) SetSessionToken(v *service.SessionToken) { +func (m *Header) SetSessionToken(v *session.SessionToken) { if m != nil { m.SessionToken = v } diff --git a/v2/object/marshal_test.go b/v2/object/marshal_test.go index 02480bd..19ab6d5 100644 --- a/v2/object/marshal_test.go +++ b/v2/object/marshal_test.go @@ -7,7 +7,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/object" grpc "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/stretchr/testify/require" ) @@ -405,24 +405,24 @@ func generateAddress(cid, oid string) *refs.Address { return addr } -func generateSessionToken(id string) *service.SessionToken { - lifetime := new(service.TokenLifetime) +func generateSessionToken(id string) *session.SessionToken { + lifetime := new(session.TokenLifetime) lifetime.SetExp(1) lifetime.SetNbf(2) lifetime.SetIat(3) - objectCtx := new(service.ObjectSessionContext) - objectCtx.SetVerb(service.ObjectVerbPut) + objectCtx := new(session.ObjectSessionContext) + objectCtx.SetVerb(session.ObjectVerbPut) objectCtx.SetAddress(generateAddress("Container ID", "Object ID")) - tokenBody := new(service.SessionTokenBody) + tokenBody := new(session.SessionTokenBody) tokenBody.SetID([]byte(id)) tokenBody.SetOwnerID(generateOwner("Owner ID")) tokenBody.SetSessionKey([]byte(id)) tokenBody.SetLifetime(lifetime) tokenBody.SetContext(objectCtx) - sessionToken := new(service.SessionToken) + sessionToken := new(session.SessionToken) sessionToken.SetBody(tokenBody) sessionToken.SetSignature(generateSignature("public key", id)) diff --git a/v2/object/types.go b/v2/object/types.go index 5f421fc..d1328f8 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -2,7 +2,7 @@ package object import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" ) type Type uint32 @@ -50,7 +50,7 @@ type Header struct { typ Type - sessionToken *service.SessionToken + sessionToken *session.SessionToken attr []*Attribute @@ -76,9 +76,9 @@ type GetRequestBody struct { type GetRequest struct { body *GetRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetObjectPart interface { @@ -104,9 +104,9 @@ type GetResponseBody struct { type GetResponse struct { body *GetResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type PutObjectPart interface { @@ -134,9 +134,9 @@ type PutRequestBody struct { type PutRequest struct { body *PutRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type PutResponseBody struct { @@ -146,9 +146,9 @@ type PutResponseBody struct { type PutResponse struct { body *PutResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type DeleteRequestBody struct { @@ -158,9 +158,9 @@ type DeleteRequestBody struct { type DeleteRequest struct { body *DeleteRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type DeleteResponseBody struct{} @@ -168,9 +168,9 @@ type DeleteResponseBody struct{} type DeleteResponse struct { body *DeleteResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type HeadRequestBody struct { @@ -182,9 +182,9 @@ type HeadRequestBody struct { type HeadRequest struct { body *HeadRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetHeaderPart interface { @@ -206,9 +206,9 @@ type HeadResponseBody struct { type HeadResponse struct { body *HeadResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type SearchFilter struct { @@ -228,9 +228,9 @@ type SearchRequestBody struct { type SearchRequest struct { body *SearchRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type SearchResponseBody struct { @@ -240,9 +240,9 @@ type SearchResponseBody struct { type SearchResponse struct { body *SearchResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type Range struct { @@ -258,9 +258,9 @@ type GetRangeRequestBody struct { type GetRangeRequest struct { body *GetRangeRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetRangeResponseBody struct { @@ -270,9 +270,9 @@ type GetRangeResponseBody struct { type GetRangeResponse struct { body *GetRangeResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } type GetRangeHashRequestBody struct { @@ -288,9 +288,9 @@ type GetRangeHashRequestBody struct { type GetRangeHashRequest struct { body *GetRangeHashRequestBody - metaHeader *service.RequestMetaHeader + metaHeader *session.RequestMetaHeader - verifyHeader *service.RequestVerificationHeader + verifyHeader *session.RequestVerificationHeader } type GetRangeHashResponseBody struct { @@ -302,9 +302,9 @@ type GetRangeHashResponseBody struct { type GetRangeHashResponse struct { body *GetRangeHashResponseBody - metaHeader *service.ResponseMetaHeader + metaHeader *session.ResponseMetaHeader - verifyHeader *service.ResponseVerificationHeader + verifyHeader *session.ResponseVerificationHeader } const ( @@ -598,7 +598,7 @@ func (h *Header) SetHomomorphicHash(v *refs.Checksum) { } } -func (h *Header) GetSessionToken() *service.SessionToken { +func (h *Header) GetSessionToken() *session.SessionToken { if h != nil { return h.sessionToken } @@ -606,7 +606,7 @@ func (h *Header) GetSessionToken() *service.SessionToken { return nil } -func (h *Header) SetSessionToken(v *service.SessionToken) { +func (h *Header) SetSessionToken(v *session.SessionToken) { if h != nil { h.sessionToken = v } @@ -738,7 +738,7 @@ func (r *GetRequest) SetBody(v *GetRequestBody) { } } -func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -746,13 +746,13 @@ func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -760,7 +760,7 @@ func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *GetRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -854,7 +854,7 @@ func (r *GetResponse) SetBody(v *GetResponseBody) { } } -func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -862,13 +862,13 @@ func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -876,7 +876,7 @@ func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeade return nil } -func (r *GetResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -984,7 +984,7 @@ func (r *PutRequest) SetBody(v *PutRequestBody) { } } -func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *PutRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -992,13 +992,13 @@ func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *PutRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1006,7 +1006,7 @@ func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *PutRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *PutRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1040,7 +1040,7 @@ func (r *PutResponse) SetBody(v *PutResponseBody) { } } -func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *PutResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1048,13 +1048,13 @@ func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *PutResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1062,7 +1062,7 @@ func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeade return nil } -func (r *PutResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *PutResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1096,7 +1096,7 @@ func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { } } -func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *DeleteRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1104,13 +1104,13 @@ func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *DeleteRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1118,7 +1118,7 @@ func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHead return nil } -func (r *DeleteRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *DeleteRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1138,7 +1138,7 @@ func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { } } -func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *DeleteResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1146,13 +1146,13 @@ func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *DeleteResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1160,7 +1160,7 @@ func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHe return nil } -func (r *DeleteResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *DeleteResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1222,7 +1222,7 @@ func (r *HeadRequest) SetBody(v *HeadRequestBody) { } } -func (r *HeadRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *HeadRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1230,13 +1230,13 @@ func (r *HeadRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *HeadRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *HeadRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *HeadRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1244,7 +1244,7 @@ func (r *HeadRequest) GetVerificationHeader() *service.RequestVerificationHeader return nil } -func (r *HeadRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *HeadRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1310,7 +1310,7 @@ func (r *HeadResponse) SetBody(v *HeadResponseBody) { } } -func (r *HeadResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *HeadResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1318,13 +1318,13 @@ func (r *HeadResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *HeadResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *HeadResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *HeadResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1332,7 +1332,7 @@ func (r *HeadResponse) GetVerificationHeader() *service.ResponseVerificationHead return nil } -func (r *HeadResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *HeadResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1436,7 +1436,7 @@ func (r *SearchRequest) SetBody(v *SearchRequestBody) { } } -func (r *SearchRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *SearchRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1444,13 +1444,13 @@ func (r *SearchRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *SearchRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *SearchRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *SearchRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1458,7 +1458,7 @@ func (r *SearchRequest) GetVerificationHeader() *service.RequestVerificationHead return nil } -func (r *SearchRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *SearchRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1492,7 +1492,7 @@ func (r *SearchResponse) SetBody(v *SearchResponseBody) { } } -func (r *SearchResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *SearchResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1500,13 +1500,13 @@ func (r *SearchResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *SearchResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *SearchResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *SearchResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1514,7 +1514,7 @@ func (r *SearchResponse) GetVerificationHeader() *service.ResponseVerificationHe return nil } -func (r *SearchResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *SearchResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1590,7 +1590,7 @@ func (r *GetRangeRequest) SetBody(v *GetRangeRequestBody) { } } -func (r *GetRangeRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetRangeRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1598,13 +1598,13 @@ func (r *GetRangeRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetRangeRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRangeRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetRangeRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1612,7 +1612,7 @@ func (r *GetRangeRequest) GetVerificationHeader() *service.RequestVerificationHe return nil } -func (r *GetRangeRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetRangeRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1646,7 +1646,7 @@ func (r *GetRangeResponse) SetBody(v *GetRangeResponseBody) { } } -func (r *GetRangeResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetRangeResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1654,13 +1654,13 @@ func (r *GetRangeResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetRangeResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRangeResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetRangeResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1668,7 +1668,7 @@ func (r *GetRangeResponse) GetVerificationHeader() *service.ResponseVerification return nil } -func (r *GetRangeResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetRangeResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1744,7 +1744,7 @@ func (r *GetRangeHashRequest) SetBody(v *GetRangeHashRequestBody) { } } -func (r *GetRangeHashRequest) GetMetaHeader() *service.RequestMetaHeader { +func (r *GetRangeHashRequest) GetMetaHeader() *session.RequestMetaHeader { if r != nil { return r.metaHeader } @@ -1752,13 +1752,13 @@ func (r *GetRangeHashRequest) GetMetaHeader() *service.RequestMetaHeader { return nil } -func (r *GetRangeHashRequest) SetMetaHeader(v *service.RequestMetaHeader) { +func (r *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRangeHashRequest) GetVerificationHeader() *service.RequestVerificationHeader { +func (r *GetRangeHashRequest) GetVerificationHeader() *session.RequestVerificationHeader { if r != nil { return r.verifyHeader } @@ -1766,7 +1766,7 @@ func (r *GetRangeHashRequest) GetVerificationHeader() *service.RequestVerificati return nil } -func (r *GetRangeHashRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { +func (r *GetRangeHashRequest) SetVerificationHeader(v *session.RequestVerificationHeader) { if r != nil { r.verifyHeader = v } @@ -1814,7 +1814,7 @@ func (r *GetRangeHashResponse) SetBody(v *GetRangeHashResponseBody) { } } -func (r *GetRangeHashResponse) GetMetaHeader() *service.ResponseMetaHeader { +func (r *GetRangeHashResponse) GetMetaHeader() *session.ResponseMetaHeader { if r != nil { return r.metaHeader } @@ -1822,13 +1822,13 @@ func (r *GetRangeHashResponse) GetMetaHeader() *service.ResponseMetaHeader { return nil } -func (r *GetRangeHashResponse) SetMetaHeader(v *service.ResponseMetaHeader) { +func (r *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if r != nil { r.metaHeader = v } } -func (r *GetRangeHashResponse) GetVerificationHeader() *service.ResponseVerificationHeader { +func (r *GetRangeHashResponse) GetVerificationHeader() *session.ResponseVerificationHeader { if r != nil { return r.verifyHeader } @@ -1836,7 +1836,7 @@ func (r *GetRangeHashResponse) GetVerificationHeader() *service.ResponseVerifica return nil } -func (r *GetRangeHashResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { +func (r *GetRangeHashResponse) SetVerificationHeader(v *session.ResponseVerificationHeader) { if r != nil { r.verifyHeader = v } diff --git a/v2/signature/sign.go b/v2/signature/sign.go index 2cb768a..8adaf3e 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -9,21 +9,20 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/container" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/pkg/errors" ) type serviceRequest interface { - GetMetaHeader() *service.RequestMetaHeader - GetVerificationHeader() *service.RequestVerificationHeader - SetVerificationHeader(*service.RequestVerificationHeader) + GetMetaHeader() *session.RequestMetaHeader + GetVerificationHeader() *session.RequestVerificationHeader + SetVerificationHeader(*session.RequestVerificationHeader) } type serviceResponse interface { - GetMetaHeader() *service.ResponseMetaHeader - GetVerificationHeader() *service.ResponseVerificationHeader - SetVerificationHeader(*service.ResponseVerificationHeader) + GetMetaHeader() *session.ResponseMetaHeader + GetVerificationHeader() *session.ResponseVerificationHeader + SetVerificationHeader(*session.ResponseVerificationHeader) } type stableMarshaler interface { @@ -55,19 +54,19 @@ type verificationHeader interface { } type requestMetaHeader struct { - *service.RequestMetaHeader + *session.RequestMetaHeader } type responseMetaHeader struct { - *service.ResponseMetaHeader + *session.ResponseMetaHeader } type requestVerificationHeader struct { - *service.RequestVerificationHeader + *session.RequestVerificationHeader } type responseVerificationHeader struct { - *service.ResponseVerificationHeader + *session.ResponseVerificationHeader } func (h *requestMetaHeader) getOrigin() metaHeader { @@ -94,7 +93,7 @@ func (h *requestVerificationHeader) getOrigin() verificationHeader { func (h *requestVerificationHeader) setOrigin(m stableMarshaler) { if m != nil { - h.SetOrigin(m.(*service.RequestVerificationHeader)) + h.SetOrigin(m.(*session.RequestVerificationHeader)) } } @@ -110,7 +109,7 @@ func (r *responseVerificationHeader) getOrigin() verificationHeader { func (r *responseVerificationHeader) setOrigin(m stableMarshaler) { if m != nil { - r.SetOrigin(m.(*service.ResponseVerificationHeader)) + r.SetOrigin(m.(*session.ResponseVerificationHeader)) } } @@ -156,7 +155,7 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { case serviceRequest: body = serviceMessageBody(v) meta = v.GetMetaHeader() - verifyHdr = &requestVerificationHeader{new(service.RequestVerificationHeader)} + verifyHdr = &requestVerificationHeader{new(session.RequestVerificationHeader)} verifyHdrSetter = func(h verificationHeader) { v.SetVerificationHeader(h.(*requestVerificationHeader).RequestVerificationHeader) } @@ -167,7 +166,7 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { case serviceResponse: body = serviceMessageBody(v) meta = v.GetMetaHeader() - verifyHdr = &responseVerificationHeader{new(service.ResponseVerificationHeader)} + verifyHdr = &responseVerificationHeader{new(session.ResponseVerificationHeader)} verifyHdrSetter = func(h verificationHeader) { v.SetVerificationHeader(h.(*responseVerificationHeader).ResponseVerificationHeader) } @@ -176,11 +175,11 @@ func SignServiceMessage(key *ecdsa.PrivateKey, msg interface{}) error { verifyOrigin = h } default: - panic(fmt.Sprintf("unsupported service message %T", v)) + panic(fmt.Sprintf("unsupported session message %T", v)) } if verifyOrigin == nil { - // sign service message body + // sign session message body if err := signServiceMessagePart(key, body, verifyHdr.SetBodySignature); err != nil { return errors.Wrap(err, "could not sign body") } @@ -249,7 +248,7 @@ func VerifyServiceMessage(msg interface{}) error { ResponseVerificationHeader: v.GetVerificationHeader(), } default: - panic(fmt.Sprintf("unsupported service message %T", v)) + panic(fmt.Sprintf("unsupported session message %T", v)) } return verifyMatryoshkaLevel(serviceMessageBody(msg), meta, verify) @@ -291,7 +290,7 @@ func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signatur func serviceMessageBody(req interface{}) stableMarshaler { switch v := req.(type) { default: - panic(fmt.Sprintf("unsupported service message %T", req)) + panic(fmt.Sprintf("unsupported session message %T", req)) /* Accounting */ case *accounting.BalanceRequest: diff --git a/v2/signature/sign_test.go b/v2/signature/sign_test.go index a1bfcab..cd3aee8 100644 --- a/v2/signature/sign_test.go +++ b/v2/signature/sign_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" crypto "github.com/nspcc-dev/neofs-crypto" "github.com/stretchr/testify/require" ) @@ -16,7 +16,7 @@ func TestBalanceResponse(t *testing.T) { body := new(accounting.BalanceResponseBody) body.SetBalance(dec) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) req := new(accounting.BalanceResponse) @@ -36,7 +36,7 @@ func TestBalanceResponse(t *testing.T) { require.NoError(t, VerifyServiceMessage(req)) // add level to meta header matryoshka - meta = new(service.ResponseMetaHeader) + meta = new(session.ResponseMetaHeader) meta.SetOrigin(req.GetMetaHeader()) req.SetMetaHeader(meta)