2020-08-20 10:32:02 +00:00
|
|
|
package session
|
2020-08-12 19:06:10 +00:00
|
|
|
|
|
|
|
import (
|
2020-08-14 16:00:16 +00:00
|
|
|
acl "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc"
|
|
|
|
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
|
2021-11-06 10:40:15 +00:00
|
|
|
status "github.com/nspcc-dev/neofs-api-go/v2/status/grpc"
|
2020-08-12 19:06:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// SetKey sets key to the X-Header.
|
|
|
|
func (m *XHeader) SetKey(v string) {
|
|
|
|
if m != nil {
|
|
|
|
m.Key = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetValue sets value of the X-Header.
|
|
|
|
func (m *XHeader) SetValue(v string) {
|
|
|
|
if m != nil {
|
|
|
|
m.Value = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetExp sets epoch number of the token expiration.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *SessionToken_Body_TokenLifetime) SetExp(v uint64) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Exp = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNbf sets starting epoch number of the token.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *SessionToken_Body_TokenLifetime) SetNbf(v uint64) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Nbf = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetIat sets the number of the epoch in which the token was issued.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *SessionToken_Body_TokenLifetime) SetIat(v uint64) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Iat = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetId sets identifier of the session token.
|
|
|
|
func (m *SessionToken_Body) SetId(v []byte) {
|
|
|
|
if m != nil {
|
|
|
|
m.Id = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetOwnerId sets identifier of the session token owner.
|
|
|
|
func (m *SessionToken_Body) SetOwnerId(v *refs.OwnerID) {
|
|
|
|
if m != nil {
|
|
|
|
m.OwnerId = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetLifetime sets lifetime of the session token.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *SessionToken_Body) SetLifetime(v *SessionToken_Body_TokenLifetime) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Lifetime = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSessionKey sets public session key in a binary format.
|
|
|
|
func (m *SessionToken_Body) SetSessionKey(v []byte) {
|
|
|
|
if m != nil {
|
|
|
|
m.SessionKey = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetObjectAddressContext sets object context of the session token.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *SessionToken_Body) SetObjectSessionContext(v *ObjectSessionContext) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
2020-08-18 12:48:39 +00:00
|
|
|
m.Context = &SessionToken_Body_Object{
|
|
|
|
Object: v,
|
2020-08-12 19:06:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-24 12:54:49 +00:00
|
|
|
// SetContainerSessionContext sets container context of the session token.
|
|
|
|
func (m *SessionToken_Body) SetContainerSessionContext(v *ContainerSessionContext) {
|
|
|
|
if m != nil {
|
|
|
|
m.Context = &SessionToken_Body_Container{
|
|
|
|
Container: v,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-24 12:50:19 +00:00
|
|
|
// SetAddress sets address of the object related to the session.
|
2020-08-18 12:48:39 +00:00
|
|
|
func (m *ObjectSessionContext) SetAddress(v *refs.Address) {
|
2020-08-17 11:30:09 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Address = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-24 12:50:19 +00:00
|
|
|
// SetVerb sets type of request for which the token is issued.
|
2020-08-18 12:48:39 +00:00
|
|
|
func (m *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) {
|
2020-08-17 11:30:09 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Verb = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-24 12:54:49 +00:00
|
|
|
// SetVerb sets type of request for which the token is issued.
|
|
|
|
func (x *ContainerSessionContext) SetVerb(v ContainerSessionContext_Verb) {
|
|
|
|
if x != nil {
|
|
|
|
x.Verb = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetWildcard sets wildcard flag of the container session.
|
|
|
|
func (x *ContainerSessionContext) SetWildcard(v bool) {
|
|
|
|
if x != nil {
|
|
|
|
x.Wildcard = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetContainerId sets identifier of the container related to the session.
|
|
|
|
func (x *ContainerSessionContext) SetContainerId(v *refs.ContainerID) {
|
|
|
|
if x != nil {
|
|
|
|
x.ContainerId = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 19:06:10 +00:00
|
|
|
// SetBody sets session token body.
|
|
|
|
func (m *SessionToken) SetBody(v *SessionToken_Body) {
|
|
|
|
if m != nil {
|
2020-08-14 07:22:15 +00:00
|
|
|
m.Body = v
|
2020-08-12 19:06:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSignature sets session token signature.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *SessionToken) SetSignature(v *refs.Signature) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Signature = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetVersion sets client protocol version.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *RequestMetaHeader) SetVersion(v *refs.Version) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Version = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetEpoch sets client local epoch.
|
|
|
|
func (m *RequestMetaHeader) SetEpoch(v uint64) {
|
|
|
|
if m != nil {
|
|
|
|
m.Epoch = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetTtl sets request TTL.
|
|
|
|
func (m *RequestMetaHeader) SetTtl(v uint32) {
|
|
|
|
if m != nil {
|
|
|
|
m.Ttl = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetXHeaders sets request X-Headers.
|
|
|
|
func (m *RequestMetaHeader) SetXHeaders(v []*XHeader) {
|
|
|
|
if m != nil {
|
|
|
|
m.XHeaders = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSessionToken sets session token of the request.
|
|
|
|
func (m *RequestMetaHeader) SetSessionToken(v *SessionToken) {
|
|
|
|
if m != nil {
|
2020-08-14 07:22:15 +00:00
|
|
|
m.SessionToken = v
|
2020-08-12 19:06:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetBearerToken sets bearer token of the request.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *RequestMetaHeader) SetBearerToken(v *acl.BearerToken) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
2020-08-14 07:22:15 +00:00
|
|
|
m.BearerToken = v
|
2020-08-12 19:06:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetOrigin sets origin request meta header.
|
|
|
|
func (m *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) {
|
|
|
|
if m != nil {
|
|
|
|
m.Origin = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetVersion sets server protocol version.
|
2020-08-20 10:32:02 +00:00
|
|
|
func (m *ResponseMetaHeader) SetVersion(v *refs.Version) {
|
2020-08-12 19:06:10 +00:00
|
|
|
if m != nil {
|
|
|
|
m.Version = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetEpoch sets server local epoch.
|
|
|
|
func (m *ResponseMetaHeader) SetEpoch(v uint64) {
|
|
|
|
if m != nil {
|
|
|
|
m.Epoch = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetTtl sets response TTL.
|
|
|
|
func (m *ResponseMetaHeader) SetTtl(v uint32) {
|
|
|
|
if m != nil {
|
|
|
|
m.Ttl = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetXHeaders sets response X-Headers.
|
|
|
|
func (m *ResponseMetaHeader) SetXHeaders(v []*XHeader) {
|
|
|
|
if m != nil {
|
|
|
|
m.XHeaders = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetOrigin sets origin response meta header.
|
|
|
|
func (m *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) {
|
|
|
|
if m != nil {
|
|
|
|
m.Origin = v
|
|
|
|
}
|
|
|
|
}
|
2020-08-20 10:32:02 +00:00
|
|
|
|
2021-11-06 10:40:15 +00:00
|
|
|
// SetStatus sets response status.
|
|
|
|
func (m *ResponseMetaHeader) SetStatus(v *status.Status) {
|
|
|
|
if m != nil {
|
|
|
|
m.Status = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-20 10:32:02 +00:00
|
|
|
// SetBodySignature sets signature of the request body.
|
|
|
|
func (m *RequestVerificationHeader) SetBodySignature(v *refs.Signature) {
|
|
|
|
if m != nil {
|
|
|
|
m.BodySignature = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMetaSignature sets signature of the request meta.
|
|
|
|
func (m *RequestVerificationHeader) SetMetaSignature(v *refs.Signature) {
|
|
|
|
if m != nil {
|
|
|
|
m.MetaSignature = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetOriginSignature sets signature of the origin verification header of the request.
|
|
|
|
func (m *RequestVerificationHeader) SetOriginSignature(v *refs.Signature) {
|
|
|
|
if m != nil {
|
|
|
|
m.OriginSignature = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetOrigin sets origin verification header of the request.
|
|
|
|
func (m *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) {
|
|
|
|
if m != nil {
|
|
|
|
m.Origin = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetBodySignature sets signature of the response body.
|
|
|
|
func (m *ResponseVerificationHeader) SetBodySignature(v *refs.Signature) {
|
|
|
|
if m != nil {
|
|
|
|
m.BodySignature = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMetaSignature sets signature of the response meta.
|
|
|
|
func (m *ResponseVerificationHeader) SetMetaSignature(v *refs.Signature) {
|
|
|
|
if m != nil {
|
|
|
|
m.MetaSignature = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetOriginSignature sets signature of the origin verification header of the response.
|
|
|
|
func (m *ResponseVerificationHeader) SetOriginSignature(v *refs.Signature) {
|
|
|
|
if m != nil {
|
|
|
|
m.OriginSignature = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetOrigin sets origin verification header of the response.
|
|
|
|
func (m *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) {
|
|
|
|
if m != nil {
|
|
|
|
m.Origin = v
|
|
|
|
}
|
|
|
|
}
|
2021-06-18 12:27:01 +00:00
|
|
|
|
|
|
|
// FromString parses ObjectSessionContext_Verb from a string representation,
|
|
|
|
// It is a reverse action to String().
|
|
|
|
//
|
|
|
|
// Returns true if s was parsed successfully.
|
|
|
|
func (x *ObjectSessionContext_Verb) FromString(s string) bool {
|
|
|
|
i, ok := ObjectSessionContext_Verb_value[s]
|
|
|
|
if ok {
|
|
|
|
*x = ObjectSessionContext_Verb(i)
|
|
|
|
}
|
|
|
|
|
|
|
|
return ok
|
|
|
|
}
|
|
|
|
|
|
|
|
// FromString parses ContainerSessionContext_Verb from a string representation,
|
|
|
|
// It is a reverse action to String().
|
|
|
|
//
|
|
|
|
// Returns true if s was parsed successfully.
|
|
|
|
func (x *ContainerSessionContext_Verb) FromString(s string) bool {
|
|
|
|
i, ok := ContainerSessionContext_Verb_value[s]
|
|
|
|
if ok {
|
|
|
|
*x = ContainerSessionContext_Verb(i)
|
|
|
|
}
|
|
|
|
|
|
|
|
return ok
|
|
|
|
}
|