2023-03-15 16:00:52 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2019-07-16 07:31:00 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ cli.Command = (*OperatorRaftSnapshotCommand)(nil)
|
|
|
|
|
|
|
|
type OperatorRaftSnapshotCommand struct {
|
|
|
|
*BaseCommand
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *OperatorRaftSnapshotCommand) Synopsis() string {
|
2020-03-17 13:46:44 +00:00
|
|
|
return "Restores and saves snapshots from the Raft cluster"
|
2019-07-16 07:31:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *OperatorRaftSnapshotCommand) Help() string {
|
|
|
|
helpText := `
|
|
|
|
Usage: vault operator raft snapshot <subcommand> [options] [args]
|
|
|
|
|
2020-03-17 13:46:44 +00:00
|
|
|
This command groups subcommands for operators interacting with the snapshot
|
|
|
|
functionality of the integrated Raft storage backend. Here are a few examples of
|
|
|
|
the Raft snapshot operator commands:
|
2019-07-16 07:31:00 +00:00
|
|
|
|
|
|
|
Installs the provided snapshot, returning the cluster to the state defined in it:
|
|
|
|
|
|
|
|
$ vault operator raft snapshot restore raft.snap
|
|
|
|
|
2020-03-17 13:46:44 +00:00
|
|
|
Saves a snapshot of the current state of the Raft cluster into a file:
|
2019-07-16 07:31:00 +00:00
|
|
|
|
|
|
|
$ vault operator raft snapshot save raft.snap
|
|
|
|
|
2023-10-31 20:18:21 +00:00
|
|
|
Inspects a snapshot based on a file:
|
|
|
|
|
|
|
|
$ vault operator raft snapshot inspect raft.snap
|
|
|
|
|
2019-07-16 07:31:00 +00:00
|
|
|
Please see the individual subcommand help for detailed usage information.
|
|
|
|
`
|
|
|
|
|
|
|
|
return strings.TrimSpace(helpText)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *OperatorRaftSnapshotCommand) Run(args []string) int {
|
|
|
|
return cli.RunResultHelp
|
|
|
|
}
|