Make `nil` as a default value for attributes.
Document field values of instance constructed
via `New`. Assert the values in corresponding
unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewAttribute`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `Attribute.ToV2` method returns
`nil` when is called on `nil`. Add
corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewAnnouncement`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `UsedSpaceAnnouncement.ToV2` method returns
`nil` when is called on `nil`. Document that `NewAnnouncementFromV2`
method returns `nil` when is called on `nil`. Add
corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `ID.ToV2` method returns
`nil` when is called on `nil`. Document
that `NewFromV2` method returns
`nil` when is called on `nil`. Add
corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewResult`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `Result.ToV2` method returns
`nil` when is called on `nil`. Document that
`NewResultFromV2` method returns `nil` when
is called on `nil`. Add
corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Implement `Exp`/`SetExp`/`Nbf`/`SetNbf`/`Iat`/`SetIat` methods on `Token`
type which provide access to the message fields of the same name.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add `WithURIAddress` option to client.
It parses passed address with
`url.ParseRequestURI` function and
use(or not) TLS over grpc connection
based on retrieved scheme('grpc' or
'grpcs').
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Remove usage of deprecated of `container.ID` and `token.SessionToken` code
elements. Replace using of custom message generators with the ones provided
by packages. Replace string comparison with `Equal` method call.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add `Conn` method to `Client` interface which must return the underlying
connection. Implement new method on the core structure. `Conn` can be used
to control the connection (e.g. for closing).
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Implement `Context` / `SetContext` methods on `Token` which reads / sets
token context. Support container context (`ContainerContext`).
Add helper function `GetContainerContext` for easy reading of the container
context.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define `ContainerContext` type for container sessions. Implement basic
functionality to work with its data.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add `sessiontest.GenerateSigned` function which returns signed random token.
Clarify that `sessiontest.Generate` returns an unsigned token. Use these
functions to assert the correctness of `Sign` / `VerifySignature` methods.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Implement `Token.Sign` method which calculates signature of the data of the
`Token` and writes the signature into it. Implement `Token.VerifySignature`
which checks if `Token` signature is presented and valid. These methods
allow to abstract the external context from the details of what kind of data
is being signed and how the signature is stored.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Create `ownertest` package with functions which generate random `owner.ID`
instances. These functions is going to be used for testing.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Nil slice of records of the `Table` should be converted to nil slice in
corresponding field of API v2 message structure.
Add nil-check in `Table.ToV2` implementation. The changes fix corresponding
unit test.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Document field values of instance constructed via `NewTable`. Assert the
values in corresponding unit test.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Nil slices of targets and filters of the `Record` should be converted to nil
slices in corresponding fields of API v2 message structure.
Add nil-check in `Record.ToV2` implementation. The changes fix corresponding
unit test.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Document field values of instance constructed via `NewRecord`. Assert the
values in corresponding unit test.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Document field values of instance constructed via `NewTarget`. Assert the
values in corresponding unit test.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Document field values of instance constructed via `NewFilter`. Assert the
values in corresponding unit test.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Call `SetSessionToken` and `SetSignature` methods on resulting eACL table
with items from response body. From now eACL signature can be accessed from
the table itself, so `EACLWithSignature.Signature` is marked deprecated.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Write session token of `container.Container` to container SetExtendedACL
request body inside `client.SetEACL` call.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>