mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	 63ab253cb4
			
		
	
	63ab253cb4
	
	
	
		
			
			* add vault operator inspect command * tidy * add tests * add changelog * Update command/operator_raft_snapshot_inspect.go Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> * Update command/operator_raft_snapshot_inspect.go Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> * Update command/operator_raft_snapshot_inspect.go Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> * Update command/operator_raft_snapshot_inspect.go Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> * Update command/operator_raft_snapshot_inspect.go Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> * remove test.snapshot file and create snapshot during test * fix help text and add custom format flag * Update changelog/23457.txt Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> * add check that kvdepth is not less than zero * remove kvprefix from flag names * set details flag to default to true * remove total size, we don't use it * fix test that referenced old flag names * add size calculations * return all keys if depth set to 0 * Update command/operator_raft_snapshot_inspect.go Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> * Update command/operator_raft_snapshot_inspect.go Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> * Update command/operator_raft_snapshot_inspect.go * revert go.mod * update comment on temp file * update comment on closing writer * remove temporary file, and process state.bin in memory * return metadata like info * remove unnused function * remove ReadSnapshot func, and unnecessary goroutine * remove handler, and zero values * move defer, and return error instead of logging * add subcommand doc * remove -format flag * remove comments * change copy to copyN * remove formatters * remove formatters * remove duplicate check * fix error checks * remove unused consts --------- Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com>
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) HashiCorp, Inc.
 | |
| // SPDX-License-Identifier: BUSL-1.1
 | |
| 
 | |
| package command
 | |
| 
 | |
| import (
 | |
| 	"strings"
 | |
| 
 | |
| 	"github.com/mitchellh/cli"
 | |
| )
 | |
| 
 | |
| var _ cli.Command = (*OperatorRaftSnapshotCommand)(nil)
 | |
| 
 | |
| type OperatorRaftSnapshotCommand struct {
 | |
| 	*BaseCommand
 | |
| }
 | |
| 
 | |
| func (c *OperatorRaftSnapshotCommand) Synopsis() string {
 | |
| 	return "Restores and saves snapshots from the Raft cluster"
 | |
| }
 | |
| 
 | |
| func (c *OperatorRaftSnapshotCommand) Help() string {
 | |
| 	helpText := `
 | |
| Usage: vault operator raft snapshot <subcommand> [options] [args]
 | |
| 
 | |
|   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:
 | |
| 
 | |
|   Installs the provided snapshot, returning the cluster to the state defined in it:
 | |
| 
 | |
|       $ vault operator raft snapshot restore raft.snap
 | |
| 
 | |
|   Saves a snapshot of the current state of the Raft cluster into a file:
 | |
| 
 | |
|       $ vault operator raft snapshot save raft.snap
 | |
| 
 | |
|   Inspects a snapshot based on a file:
 | |
| 
 | |
|       $ vault operator raft snapshot inspect raft.snap
 | |
| 
 | |
|   Please see the individual subcommand help for detailed usage information.
 | |
| `
 | |
| 
 | |
| 	return strings.TrimSpace(helpText)
 | |
| }
 | |
| 
 | |
| func (c *OperatorRaftSnapshotCommand) Run(args []string) int {
 | |
| 	return cli.RunResultHelp
 | |
| }
 |