[#733] frostfs-cli: Add control ir remove-container

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-10-16 18:15:04 +03:00
parent f2437f7ae9
commit 189dbb01be
14 changed files with 806 additions and 110 deletions

View file

@ -3,6 +3,7 @@ package control
import (
"fmt"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/container"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap"
)
@ -12,10 +13,10 @@ import (
// To gain access to the service, any request must be
// signed with a key from the white list.
type Server struct {
prm Prm
netmapClient *netmap.Client
allowedKeys [][]byte
prm Prm
netmapClient *netmap.Client
containerClient *container.Client
allowedKeys [][]byte
}
func panicOnPrmValue(n string, v any) {
@ -32,7 +33,7 @@ func panicOnPrmValue(n string, v any) {
// Forms white list from all keys specified via
// WithAllowedKeys option and a public key of
// the parameterized private key.
func New(prm Prm, netmapClient *netmap.Client, opts ...Option) *Server {
func New(prm Prm, netmapClient *netmap.Client, containerClient *container.Client, opts ...Option) *Server {
// verify required parameters
switch {
case prm.healthChecker == nil:
@ -47,8 +48,9 @@ func New(prm Prm, netmapClient *netmap.Client, opts ...Option) *Server {
}
return &Server{
prm: prm,
netmapClient: netmapClient,
prm: prm,
netmapClient: netmapClient,
containerClient: containerClient,
allowedKeys: append(o.allowedKeys, prm.key.PublicKey().Bytes()),
}