2022-06-02 12:24:31 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
2022-06-02 12:24:31 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2022-10-17 12:03:55 +00:00
|
|
|
// Cmd represents the container command.
|
2022-06-02 12:24:31 +00:00
|
|
|
var Cmd = &cobra.Command{
|
|
|
|
Use: "container",
|
|
|
|
Short: "Operations with containers",
|
|
|
|
Long: "Operations with containers",
|
2024-03-11 14:11:49 +00:00
|
|
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
2022-06-02 12:24:31 +00:00
|
|
|
// bind exactly that cmd's flags to
|
|
|
|
// the viper before execution
|
|
|
|
commonflags.Bind(cmd)
|
|
|
|
commonflags.BindAPI(cmd)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
containerChildCommand := []*cobra.Command{
|
|
|
|
listContainersCmd,
|
|
|
|
createContainerCmd,
|
|
|
|
deleteContainerCmd,
|
|
|
|
listContainerObjectsCmd,
|
|
|
|
getContainerInfoCmd,
|
2022-10-05 13:52:46 +00:00
|
|
|
containerNodesCmd,
|
2023-06-01 09:56:51 +00:00
|
|
|
policyPlaygroundCmd,
|
2022-06-02 12:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Cmd.AddCommand(containerChildCommand...)
|
|
|
|
|
|
|
|
initContainerListContainersCmd()
|
|
|
|
initContainerCreateCmd()
|
|
|
|
initContainerDeleteCmd()
|
|
|
|
initContainerListObjectsCmd()
|
|
|
|
initContainerInfoCmd()
|
2022-10-05 13:52:46 +00:00
|
|
|
initContainerNodesCmd()
|
2023-06-01 09:56:51 +00:00
|
|
|
initContainerPolicyPlaygroundCmd()
|
2022-06-02 12:24:31 +00:00
|
|
|
|
|
|
|
for _, containerCommand := range containerChildCommand {
|
|
|
|
commonflags.InitAPI(containerCommand)
|
|
|
|
}
|
|
|
|
|
2022-10-20 09:40:33 +00:00
|
|
|
for _, el := range []struct {
|
|
|
|
cmd *cobra.Command
|
|
|
|
verb string
|
|
|
|
}{
|
|
|
|
{createContainerCmd, "PUT"},
|
|
|
|
{deleteContainerCmd, "DELETE"},
|
2022-06-02 12:24:31 +00:00
|
|
|
} {
|
2022-10-20 09:40:33 +00:00
|
|
|
commonflags.InitSession(el.cmd, "container "+el.verb)
|
2022-06-02 12:24:31 +00:00
|
|
|
}
|
|
|
|
}
|