Documentation
¶
Index ¶
- func ApplyToAllContainers(c *ContainerContext)
- type ContainerContext
- func (x *ContainerContext) ApplyTo(id *cid.ID)
- func (x *ContainerContext) Container() *cid.ID
- func (x *ContainerContext) ForDelete()
- func (x *ContainerContext) ForPut()
- func (x *ContainerContext) ForSetEACL()
- func (x *ContainerContext) IsForDelete() bool
- func (x *ContainerContext) IsForPut() bool
- func (x *ContainerContext) IsForSetEACL() bool
- func (x *ContainerContext) Marshal() ([]byte, error)
- func (x *ContainerContext) MarshalJSON() ([]byte, error)
- func (x *ContainerContext) ToV2() *session.ContainerSessionContext
- func (x *ContainerContext) Unmarshal(data []byte) error
- func (x *ContainerContext) UnmarshalJSON(data []byte) error
- type ObjectContext
- func (x *ObjectContext) Address() *address.Address
- func (x *ObjectContext) ApplyTo(id *address.Address)
- func (x *ObjectContext) ForDelete()
- func (x *ObjectContext) ForGet()
- func (x *ObjectContext) ForHead()
- func (x *ObjectContext) ForPut()
- func (x *ObjectContext) ForRange()
- func (x *ObjectContext) ForRangeHash()
- func (x *ObjectContext) ForSearch()
- func (x *ObjectContext) IsForDelete() bool
- func (x *ObjectContext) IsForGet() bool
- func (x *ObjectContext) IsForHead() bool
- func (x *ObjectContext) IsForPut() bool
- func (x *ObjectContext) IsForRange() bool
- func (x *ObjectContext) IsForRangeHash() bool
- func (x *ObjectContext) IsForSearch() bool
- func (x *ObjectContext) Marshal() ([]byte, error)
- func (x *ObjectContext) MarshalJSON() ([]byte, error)
- func (x *ObjectContext) ToV2() *session.ObjectSessionContext
- func (x *ObjectContext) Unmarshal(data []byte) error
- func (x *ObjectContext) UnmarshalJSON(data []byte) error
- type Token
- func (t *Token) Context() interface{}
- func (t *Token) Exp() uint64
- func (t *Token) ID() []byte
- func (t *Token) Iat() uint64
- func (t *Token) Marshal() ([]byte, error)
- func (t *Token) MarshalJSON() ([]byte, error)
- func (t *Token) Nbf() uint64
- func (t *Token) OwnerID() *owner.ID
- func (t *Token) SessionKey() []byte
- func (t *Token) SetContext(v interface{})
- func (t *Token) SetExp(exp uint64)
- func (t *Token) SetID(v []byte)
- func (t *Token) SetIat(iat uint64)
- func (t *Token) SetNbf(nbf uint64)
- func (t *Token) SetOwnerID(v *owner.ID)
- func (t *Token) SetSessionKey(v []byte)
- func (t *Token) Sign(key *ecdsa.PrivateKey) error
- func (t *Token) Signature() *signature.Signature
- func (t *Token) ToV2() *session.Token
- func (t *Token) Unmarshal(data []byte) error
- func (t *Token) UnmarshalJSON(data []byte) error
- func (t *Token) VerifySignature() bool
- type XHeader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyToAllContainers ¶
func ApplyToAllContainers(c *ContainerContext)
ApplyToAllContainers is a helper function that conveniently applies ContainerContext to all containers.
Types ¶
type ContainerContext ¶
type ContainerContext session.ContainerSessionContext
ContainerContext represents NeoFS API v2-compatible context of the container session.
It is a wrapper over session.ContainerSessionContext which allows to abstract from details of the message structure.
func GetContainerContext ¶
func GetContainerContext(t *Token) *ContainerContext
GetContainerContext is a helper function that casts Token context to ContainerContext.
Returns nil if context is not a ContainerContext.
func NewContainerContext ¶
func NewContainerContext() *ContainerContext
NewContainerContext creates and returns blank ContainerSessionContext.
Defaults:
- not bound to any operation;
- applied to all containers.
func NewContainerContextFromV2 ¶
func NewContainerContextFromV2(v *session.ContainerSessionContext) *ContainerContext
NewContainerContextFromV2 wraps session.ContainerSessionContext into ContainerContext.
func (*ContainerContext) ApplyTo ¶
func (x *ContainerContext) ApplyTo(id *cid.ID)
ApplyTo specifies which container the ContainerContext applies to.
If id is nil, ContainerContext is applied to all containers.
func (*ContainerContext) Container ¶
func (x *ContainerContext) Container() *cid.ID
Container returns identifier of the container to which the ContainerContext applies.
Returns nil if ContainerContext is applied to all containers.
func (*ContainerContext) ForDelete ¶
func (x *ContainerContext) ForDelete()
ForDelete binds the ContainerContext to DELETE operation.
func (*ContainerContext) ForPut ¶
func (x *ContainerContext) ForPut()
ForPut binds the ContainerContext to PUT operation.
func (*ContainerContext) ForSetEACL ¶
func (x *ContainerContext) ForSetEACL()
ForSetEACL binds the ContainerContext to SETEACL operation.
func (*ContainerContext) IsForDelete ¶
func (x *ContainerContext) IsForDelete() bool
IsForDelete checks if ContainerContext is bound to DELETE operation.
func (*ContainerContext) IsForPut ¶
func (x *ContainerContext) IsForPut() bool
IsForPut checks if ContainerContext is bound to PUT operation.
func (*ContainerContext) IsForSetEACL ¶
func (x *ContainerContext) IsForSetEACL() bool
IsForSetEACL checks if ContainerContext is bound to SETEACL operation.
func (*ContainerContext) Marshal ¶
func (x *ContainerContext) Marshal() ([]byte, error)
Marshal marshals ContainerContext into a protobuf binary form.
func (*ContainerContext) MarshalJSON ¶
func (x *ContainerContext) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContainerContext to protobuf JSON format.
func (*ContainerContext) ToV2 ¶
func (x *ContainerContext) ToV2() *session.ContainerSessionContext
ToV2 converts ContainerContext to session.ContainerSessionContext message structure.
func (*ContainerContext) Unmarshal ¶
func (x *ContainerContext) Unmarshal(data []byte) error
Unmarshal unmarshals protobuf binary representation of ContainerContext.
func (*ContainerContext) UnmarshalJSON ¶
func (x *ContainerContext) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContainerContext from protobuf JSON format.
type ObjectContext ¶
type ObjectContext session.ObjectSessionContext
ObjectContext represents NeoFS API v2-compatible context of the object session.
It is a wrapper over session.ObjectSessionContext which allows abstracting from details of the message structure.
func NewObjectContext ¶
func NewObjectContext() *ObjectContext
NewObjectContext creates and returns blank ObjectContext.
Defaults:
- not bound to any operation;
- nil object address.
func NewObjectContextFromV2 ¶
func NewObjectContextFromV2(v *session.ObjectSessionContext) *ObjectContext
NewObjectContextFromV2 wraps session.ObjectSessionContext into ObjectContext.
func (*ObjectContext) Address ¶
func (x *ObjectContext) Address() *address.Address
Address returns identifier of the object to which the ObjectContext applies.
func (*ObjectContext) ApplyTo ¶
func (x *ObjectContext) ApplyTo(id *address.Address)
ApplyTo specifies which object the ObjectContext applies to.
func (*ObjectContext) ForDelete ¶
func (x *ObjectContext) ForDelete()
ForDelete binds the ObjectContext to DELETE operation.
func (*ObjectContext) ForGet ¶
func (x *ObjectContext) ForGet()
ForGet binds the ObjectContext to GET operation.
func (*ObjectContext) ForHead ¶
func (x *ObjectContext) ForHead()
ForHead binds the ObjectContext to HEAD operation.
func (*ObjectContext) ForPut ¶
func (x *ObjectContext) ForPut()
ForPut binds the ObjectContext to PUT operation.
func (*ObjectContext) ForRange ¶
func (x *ObjectContext) ForRange()
ForRange binds the ObjectContext to RANGE operation.
func (*ObjectContext) ForRangeHash ¶
func (x *ObjectContext) ForRangeHash()
ForRangeHash binds the ObjectContext to RANGEHASH operation.
func (*ObjectContext) ForSearch ¶
func (x *ObjectContext) ForSearch()
ForSearch binds the ObjectContext to SEARCH operation.
func (*ObjectContext) IsForDelete ¶
func (x *ObjectContext) IsForDelete() bool
IsForDelete checks if ObjectContext is bound to DELETE operation.
func (*ObjectContext) IsForGet ¶
func (x *ObjectContext) IsForGet() bool
IsForGet checks if ObjectContext is bound to GET operation.
func (*ObjectContext) IsForHead ¶
func (x *ObjectContext) IsForHead() bool
IsForHead checks if ObjectContext is bound to HEAD operation.
func (*ObjectContext) IsForPut ¶
func (x *ObjectContext) IsForPut() bool
IsForPut checks if ObjectContext is bound to PUT operation.
func (*ObjectContext) IsForRange ¶
func (x *ObjectContext) IsForRange() bool
IsForRange checks if ObjectContext is bound to RANGE operation.
func (*ObjectContext) IsForRangeHash ¶
func (x *ObjectContext) IsForRangeHash() bool
IsForRangeHash checks if ObjectContext is bound to RANGEHASH operation.
func (*ObjectContext) IsForSearch ¶
func (x *ObjectContext) IsForSearch() bool
IsForSearch checks if ObjectContext is bound to SEARCH operation.
func (*ObjectContext) Marshal ¶
func (x *ObjectContext) Marshal() ([]byte, error)
Marshal marshals ObjectContext into a protobuf binary form.
func (*ObjectContext) MarshalJSON ¶
func (x *ObjectContext) MarshalJSON() ([]byte, error)
MarshalJSON encodes ObjectContext to protobuf JSON format.
func (*ObjectContext) ToV2 ¶
func (x *ObjectContext) ToV2() *session.ObjectSessionContext
ToV2 converts ObjectContext to session.ObjectSessionContext message structure.
func (*ObjectContext) Unmarshal ¶
func (x *ObjectContext) Unmarshal(data []byte) error
Unmarshal unmarshals protobuf binary representation of ObjectContext.
func (*ObjectContext) UnmarshalJSON ¶
func (x *ObjectContext) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ObjectContext from protobuf JSON format.
type Token ¶
Token represents NeoFS API v2-compatible session token.
func NewToken ¶
func NewToken() *Token
NewToken creates and returns blank Token.
Defaults:
- body: nil;
- id: nil;
- ownerId: nil;
- sessionKey: nil;
- exp: 0;
- iat: 0;
- nbf: 0;
func NewTokenFromV2 ¶
NewTokenFromV2 wraps session.Token message structure into Token.
Nil session.Token converts to nil.
func (*Token) Context ¶
func (t *Token) Context() interface{}
Context returns context of the Token.
Supports same contexts as SetContext.
Returns nil if context is not supported.
func (*Token) MarshalJSON ¶
MarshalJSON encodes Token to protobuf JSON format.
func (*Token) SessionKey ¶
SessionKey returns public key of the session in a binary format.
func (*Token) SetContext ¶
func (t *Token) SetContext(v interface{})
SetContext sets context of the Token.
Supported contexts:
- *ContainerContext,
- *ObjectContext.
Resets context if it is not supported.
func (*Token) SetOwnerID ¶
SetOwnerID sets Token's owner identifier.
func (*Token) SetSessionKey ¶
SetSessionKey sets public key of the session in a binary format.
func (*Token) Sign ¶
func (t *Token) Sign(key *ecdsa.PrivateKey) error
Sign calculates and writes signature of the Token data.
Returns signature calculation errors.
func (*Token) ToV2 ¶
ToV2 converts Token to session.Token message structure.
Nil Token converts to nil.
func (*Token) UnmarshalJSON ¶
UnmarshalJSON decodes Token from protobuf JSON format.
func (*Token) VerifySignature ¶
VerifySignature checks if token signature is presented and valid.
type XHeader ¶
XHeader represents v2-compatible XHeader.
func NewXHeader ¶
func NewXHeader() *XHeader
NewXHeader creates, initializes and returns blank XHeader instance.
Defaults:
- key: "";
- value: "".
func NewXHeaderFromV2 ¶
NewXHeaderFromV2 wraps v2 XHeader message to XHeader.
Nil session.XHeader converts to nil.