mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> wip: use tmpfs for swarm secrets Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> wip: inject secrets from swarm secret store Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> secrets: use secret names in cli for service create Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> switch to use mounts instead of volumes Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> vendor: use ehazlett swarmkit Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> secrets: finish secret update Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
43 lines
824 B
Go
43 lines
824 B
Go
package secret
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/docker/docker/cli"
|
|
"github.com/docker/docker/cli/command"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
type removeOptions struct {
|
|
ids []string
|
|
}
|
|
|
|
func newSecretRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "rm [id]",
|
|
Short: "Remove a secret",
|
|
Args: cli.RequiresMinArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
opts := removeOptions{
|
|
ids: args,
|
|
}
|
|
return runSecretRemove(dockerCli, opts)
|
|
},
|
|
}
|
|
}
|
|
|
|
func runSecretRemove(dockerCli *command.DockerCli, opts removeOptions) error {
|
|
client := dockerCli.Client()
|
|
ctx := context.Background()
|
|
|
|
for _, id := range opts.ids {
|
|
if err := client.SecretRemove(ctx, id); err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Fprintln(dockerCli.Out(), id)
|
|
}
|
|
|
|
return nil
|
|
}
|