From 9cf99ce5ec453582c899742e430f57ac4b11c8e5 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Tue, 1 Mar 2022 13:30:30 -0500 Subject: [PATCH] csi: subcommand for volume snapshot (#12152) --- command/commands.go | 5 +++++ command/volume_snapshot.go | 45 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 command/volume_snapshot.go diff --git a/command/commands.go b/command/commands.go index 287cdfaf1..5282f2831 100644 --- a/command/commands.go +++ b/command/commands.go @@ -854,6 +854,11 @@ func Commands(metaPtr *Meta, agentUi cli.Ui) map[string]cli.CommandFactory { Meta: meta, }, nil }, + "volume snapshot": func() (cli.Command, error) { + return &VolumeSnapshotCommand{ + Meta: meta, + }, nil + }, "volume snapshot create": func() (cli.Command, error) { return &VolumeSnapshotCreateCommand{ Meta: meta, diff --git a/command/volume_snapshot.go b/command/volume_snapshot.go new file mode 100644 index 000000000..ccaad6b74 --- /dev/null +++ b/command/volume_snapshot.go @@ -0,0 +1,45 @@ +package command + +import ( + "strings" + + "github.com/mitchellh/cli" +) + +type VolumeSnapshotCommand struct { + Meta +} + +func (f *VolumeSnapshotCommand) Name() string { return "snapshot" } + +func (f *VolumeSnapshotCommand) Run(args []string) int { + return cli.RunResultHelp +} + +func (f *VolumeSnapshotCommand) Synopsis() string { + return "Interact with volume snapshots" +} + +func (f *VolumeSnapshotCommand) Help() string { + helpText := ` +Usage: nomad volume snapshot [options] [args] + + This command groups subcommands for interacting with CSI volume snapshots. + + Create a snapshot of an external storage volume: + + $ nomad volume snapshot create + + Display a list of CSI volume snapshots along with their + source volume ID as known to the external storage provider. + + $ nomad volume snapshot list -plugin + + Delete a snapshot of an external storage volume: + + $ nomad volume snapshot delete + + Please see the individual subcommand help for detailed usage information. +` + return strings.TrimSpace(helpText) +}