Commit graph

47 commits

Author SHA1 Message Date
Evgenii Stratonikov
a8d10704d5 [#1182] neofs-cli: use BasicACL.String() for user output
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-22 11:26:34 +03:00
Leonard Lyubich
4f3323f084 [#1101] *: Adopt interface changes of API client from SDK library
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-03 14:00:14 +03:00
Pavel Karpy
fee2f5a330 [#1100] *: Adopt new SDK's owner.ID API
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-21 17:58:30 +03:00
Pavel Karpy
7c02a2e251 [#1087] *: Adopt SDK changes
- Update `neofs-sdk-go`:
v0.0.0-20211230072947-1fe37df88f80 => v0.0.0-20220113123743-7f3162110659

- Add client interface that duplicates SDK's client behaviour and new
`MultiAddressClient` interface that has method that iterates over wrapped
clients.

- Also start using simple client mode that does not require parsing statuses
outside the SDK library.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-01-14 17:29:03 +03:00
Alex Vanin
90f05d4448 [#1066] cli: Support basic ACL constants without final flag
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-12-30 14:07:18 +03:00
Pavel Karpy
6207a2f261 [#988] cli: Add subnet flag to container create
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-11-29 11:03:56 +03:00
Evgenii Stratonikov
95893927aa *: replace neofs-api-go with neofs-sdk-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-12 17:29:09 +03:00
Leonard Lyubich
bbc2b873ab [#950] cli: Refactor usage of NeoFS API client
The client needs of the CLI application are limited and change not often.
Interface changes of the client library should not affect the operation of
various application packages, if they do not change their requirements for
the provided functionality. To localize the use of the base client and
facilitate further support, an auxiliary package is implemented that will
only be used by the CLI application.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-03 18:26:36 +03:00
Pavel Karpy
4615ff1392 [#886] cli: Fix API flags
Bind API cobra flags(`ttl' and xhdr')
to the Viper.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-10-07 18:54:34 +03:00
Pavel Karpy
8c59ade4ed [#854] cli: Do not use global flags
Also delete `ttl` and `xhdr` flags from
`accounting balance` command and refactor
command initialization.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-10-04 12:12:21 +03:00
Pavel Karpy
3c848b2cad [#788] cli: Wrap/sync errors
Add context to error messages. Sync error
messages for errors with the same context.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 09:52:53 +03:00
Pavel Karpy
cf8f640726 [#675] cli/container: Support binary eACL format
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-07-09 09:36:02 +03:00
Pavel Karpy
3a7d7bdecd [#665] cli: Set non-zero exit codes in err cases
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-07-06 18:10:38 +03:00
Leonard Lyubich
d610346a7b [#660] cli/container: Use version.IsValid in parseEACL
Extended ACL input can have version later than CLI one, and it should not be
downgraded. But the version should be still adequate.

Set `pkg.SDKVersion` on false return of `version.IsValid`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-07-05 11:05:44 +03:00
Leonard Lyubich
56d4410913 [#638] Update to Go 1.16
Changes:

  * replace `iotuil` elements with the ones from `os` package;
  * replace `os.Filemode` with `fs.FileMode`;
  * use `signal.NotifyContext` instead of `NewGracefulContext` (removed).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-29 13:44:59 +03:00
Pavel Karpy
02ca1c4cc1 [#624] cli: Do not print help on any failure
Change usage function to `Run`(does not return
err). Log errors with `cmd.PrintErrln`. Change
all `fmt.Print*` to `cmd.Print*`.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-23 10:08:40 +03:00
Alex Vanin
bce92168c1 [#587] cmd/neofs-cli: Make session token parser reusable
containerSessionToken() actually parses any session token.
We can reuse this function to resign session token when it
takes filepath as an argument, instead of public variable.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-06-03 18:40:31 +03:00
Leonard Lyubich
3dd10b6795 [#570] *: Remove usage of deprecated elements from API Go library
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-31 20:45:15 +03:00
Leonard Lyubich
2e814941c0 [#560] cli/container: Support session tokens
Container sessions allow to perform some operations on behalf of another
user. There is a need to to attach session tokens to commands.

Add `session` flag to `put`, `delete` and `set-eacl` commands from
`container` section. It should be a path to the JSON-encoded session token.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-31 11:53:06 +03:00
Angira Kekteeva
7eab752923 [#116] *: Replace pkg policy by neofs-sdk policy
Processing transfer of policy pkg to neofs-sdk repository.

Replace local dependency in neofs-cli.

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-05-24 09:49:15 +03:00
Evgenii Stratonikov
71b87155ef [#521] *: use stdlib errors package
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-05-19 16:42:54 +03:00
Leonard Lyubich
43e575cec2 [#528] cli/container: Use AWS-style names in basic ACL keywords
When user creates a container using neofs-cli, he can set a pre-defined ACL.
Current keywords are confusing: for example, `public` really means that
everyone can write to the container, while the expectation is just public
visibility. Perform the following renames for a better understanding of the
purpose:

 * `readonly` -> `public-read`;

 * `public` -> `public-read-write`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-19 16:42:14 +03:00
Leonard Lyubich
8f9e7c2a63 [#528] cli: Define keyword constants for predefined basic ACL values
Define constants for `public`/`private`/`readonly` keywords of predefined
basic ACL values. Use constants instead of repeating string literals.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-19 16:42:14 +03:00
Evgenii Stratonikov
60d74bce67 [#466] cli: support NEP-2 and NEP-6 key formats
NEP-2 is contains WIF encrypted with password.
NEP-6 is format used for neo-go wallets.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-04-23 10:11:47 +03:00
Leonard Lyubich
6204ca8308 [#425] cli: Support latest changes from API library
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 15:00:37 +03:00
Alex Vanin
a89567a88d [#317] morph/client: Return complete eACL signature from contract
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-15 16:25:49 +03:00
Leonard Lyubich
51b85b0a73 [#278] cli: Support request X-Headers
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-24 15:03:02 +03:00
Leonard Lyubich
e53bf574b5 [#279] container: Use new methods to work with container format
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-24 13:38:20 +03:00
Leonard Lyubich
0168740c9a [#206] cli/container: Set default version of eACL table in set-eacl
Set version of parsed eACL table to using SDK version if unsupported version
was set in source data.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-25 14:35:27 +03:00
Leonard Lyubich
b4699b1e9f [#206] cli/container: Use GetEACLWithSignature in set-eacl polling
Replace GetEACL call with GetEACLWithSignature one in polling step of
set-eacl command of container CLI.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-25 14:35:27 +03:00
Leonard Lyubich
e8bc03d92f [#206] cli/container: Use GetEACLWithSignature client method
Use GetEACLWithSignature client method in get-eacl cmd of container CLI in
order to print eACL table and signature regardless of their correctness. The
ability to check the correctness of the signature will be added later.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-25 14:35:27 +03:00
Leonard Lyubich
400b65801d [#201] cli/container: Do not check eACL version
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-24 13:56:03 +03:00
Leonard Lyubich
58fcb35fb0 [#174] Use Marshal(JSON)/Unmarshal(JSON) methods for encoding/decoding
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-17 11:56:00 +03:00
Leonard Lyubich
3de8febe57 [#174] Update to latest neofs-api-go changes
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-17 11:56:00 +03:00
Alex Vanin
e47c866d6a [#169] Add --ttl argument in CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-16 12:50:21 +03:00
Alex Vanin
65be09d3db [#155] Update neofs-api-go with refactored pkg/netmap
Refactored pkg/netmap package provides JSON converters for
NodeInfo and PlacementPolicy structures, that has been used
by client applications.

It also updates Node structure itself so it is a part of
grpc <-> v2 <-> pkg conversion chain.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-06 09:55:05 +03:00
Alex Vanin
83926647d7 [#144] Support well-known application attributes for container in CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-05 09:28:13 +03:00
Alex Vanin
b12d26f974 Update neofs-api-go to latest version
Handle errors provided by JSON encoders.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-30 11:28:49 +03:00
Alex Vanin
c28641d290 [#95] Support --json flag in container.get command
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-21 18:22:59 +03:00
Alex Vanin
e40dc0412d [#26] Add get and set EACL commands in CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-21 18:22:59 +03:00
Alex Vanin
e6f04f7785 [#104] Update neofs-api-go with new protobuf API
Also update contains JSON converters for neofs-cli
and fixes bug in container.set-acl command of SDK.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-20 17:31:59 +03:00
Alex Vanin
b7dfc73bbc [#25] Use comma separated container attributes in CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-17 13:16:59 +03:00
Alex Vanin
feac279ced [#25] Add container.get command in CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-17 13:16:59 +03:00
Alex Vanin
26e13f4b28 [#25] Add container.list-objects command in CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-17 13:16:59 +03:00
Alex Vanin
c0a4343282 [#25] Use api-go stringers and parsers for ID types in CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-17 13:16:59 +03:00
Alex Vanin
db0dd6363f [#25] Add container.create, list, delete commands to CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-15 10:25:41 +03:00
Stanislav Bogatyrev
246a15de35 cli: Add empty neofs-cli app structure
In the following release `neofs-cli` will be used to directly manage NeoFS Node.
All required definitions and interfaces are also moving from `neofs-api` to
`neofs-node` repository, so it's more convinient to have `neofs-cli` here.

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
2020-10-02 11:25:35 +03:00