Documentation
¶
Index ¶
- type BackupManager
- func (m *BackupManager) BackupExists(originalPath string) bool
- func (m *BackupManager) CreateBackup(filePath string) (string, error)
- func (m *BackupManager) GetBackupPath(originalPath string) string
- func (m *BackupManager) RemoveBackup(originalPath string) error
- func (m *BackupManager) RestoreBackup(originalPath string) error
- type BackupOptions
- type Reporter
- func (r *Reporter) AddResult(result *vault.RewrapResult)
- func (r *Reporter) AddResults(results []*vault.RewrapResult)
- func (r *Reporter) GetFailedFiles() []string
- func (r *Reporter) GetSkippedFiles() []string
- func (r *Reporter) GetStatistics() *Statistics
- func (r *Reporter) GetSuccessfulFiles() []string
- func (r *Reporter) WriteCSV(w io.Writer) error
- func (r *Reporter) WriteJSON(w io.Writer, includeResults bool) error
- func (r *Reporter) WriteText(w io.Writer, includeDetails bool) error
- type RewrapOptions
- type Rewrapper
- type ScanOptions
- type ScanResult
- type Scanner
- type Statistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupManager ¶
type BackupManager struct {
// contains filtered or unexported fields
}
BackupManager handles creation and restoration of key file backups.
func NewBackupManager ¶
func NewBackupManager(options BackupOptions) *BackupManager
NewBackupManager creates a new backup manager.
func (*BackupManager) BackupExists ¶
func (m *BackupManager) BackupExists(originalPath string) bool
BackupExists checks if a backup file exists for the given path.
func (*BackupManager) CreateBackup ¶
func (m *BackupManager) CreateBackup(filePath string) (string, error)
CreateBackup creates a backup copy of a file atomically. Returns the backup file path if successful.
func (*BackupManager) GetBackupPath ¶
func (m *BackupManager) GetBackupPath(originalPath string) string
GetBackupPath returns the backup path for a given file.
func (*BackupManager) RemoveBackup ¶
func (m *BackupManager) RemoveBackup(originalPath string) error
RemoveBackup deletes a backup file.
func (*BackupManager) RestoreBackup ¶
func (m *BackupManager) RestoreBackup(originalPath string) error
RestoreBackup restores a file from its backup.
type BackupOptions ¶
BackupOptions configures backup behavior.
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter generates statistics and reports from rewrap results.
func (*Reporter) AddResult ¶
func (r *Reporter) AddResult(result *vault.RewrapResult)
AddResult processes a rewrap result and updates statistics.
func (*Reporter) AddResults ¶
func (r *Reporter) AddResults(results []*vault.RewrapResult)
AddResults processes multiple results.
func (*Reporter) GetFailedFiles ¶
GetFailedFiles returns a list of files that failed to rewrap.
func (*Reporter) GetSkippedFiles ¶
GetSkippedFiles returns files that were skipped
func (*Reporter) GetStatistics ¶
func (r *Reporter) GetStatistics() *Statistics
GetStatistics returns the current statistics.
func (*Reporter) GetSuccessfulFiles ¶
GetSuccessfulFiles returns a list of files that were successfully rewrapped.
type RewrapOptions ¶
type RewrapOptions struct {
VaultClient *vault.Client // Vault client for rewrapping
MinVersion int // Minimum key version to require
DryRun bool // If true, don't modify files
CreateBackup bool // Whether to create backups
BackupSuffix string // Backup file suffix (default: ".bak")
Logger logger.Logger // Logger interface (not pointer)
}
RewrapOptions configures the rewrap operation.
type Rewrapper ¶
type Rewrapper struct {
// contains filtered or unexported fields
}
Rewrapper orchestrates the key re-wrapping process.
func NewRewrapper ¶
func NewRewrapper(options RewrapOptions) (*Rewrapper, error)
NewRewrapper creates a new key re-wrapper.
func (*Rewrapper) RewrapBatch ¶
func (r *Rewrapper) RewrapBatch(ctx context.Context, keyFiles []string) ([]*vault.RewrapResult, error)
RewrapBatch processes multiple key files.
func (*Rewrapper) RewrapFile ¶
func (r *Rewrapper) RewrapFile(ctx context.Context, keyFilePath string) (*vault.RewrapResult, error)
RewrapFile processes a single .key file.
type ScanOptions ¶
type ScanOptions struct {
Directory string // Root directory to scan
Recursive bool // Scan subdirectories recursively
}
ScanOptions configures the key file scanner.
type ScanResult ¶
type ScanResult struct {
Files []string // Discovered .key file paths
Count int // Number of files found
Error error // Error if scan failed
}
ScanResult represents the outcome of scanning a directory for key files.
func ScanSingleFile ¶
func ScanSingleFile(filePath string) (*ScanResult, error)
ScanSingleFile validates and returns a single .key file path. This is a convenience function for processing a single file.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner finds .key files in a directory structure.
func NewScanner ¶
func NewScanner(options ScanOptions) (*Scanner, error)
NewScanner creates a new key file scanner.
func (*Scanner) Scan ¶
func (s *Scanner) Scan() (*ScanResult, error)
Scan searches for .key files according to the configured options.
type Statistics ¶
type Statistics struct {
TotalFiles int `json:"total_files"`
Successful int `json:"successful"`
Failed int `json:"failed"`
Skipped int `json:"skipped"`
VersionCounts map[int]int `json:"version_counts"`
Results []*vault.RewrapResult `json:"results,omitempty"`
}
Statistics contains aggregated rewrap operation statistics.