secretversion

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package secretversion provides version resolution for AWS Secrets Manager.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID    = errors.New("# must be followed by a version ID")
	ErrInvalidLabel = errors.New(": must be followed by a label")
)

Secrets Manager-specific errors.

Functions

func GetSecretWithVersion

func GetSecretWithVersion(ctx context.Context, client Client, spec *Spec) (*secretapi.GetSecretValueOutput, error)

GetSecretWithVersion retrieves a secret with version/shift/label support.

func ParseDiffArgs

func ParseDiffArgs(args []string) (*Spec, *Spec, error)

ParseDiffArgs parses diff command arguments for Secrets Manager. This is a convenience wrapper around diff.ParseArgs with Secrets Manager-specific settings.

func TruncateVersionID

func TruncateVersionID(id string) string

TruncateVersionID truncates a version ID to 8 characters for display. Secrets Manager version IDs are UUIDs which are long; this provides a readable short form similar to git commit hashes.

Types

type AbsoluteSpec

type AbsoluteSpec struct {
	ID    *string // Version ID (#VERSION)
	Label *string // Staging label (:LABEL)
}

AbsoluteSpec represents the absolute version specifier for Secrets Manager.

type Client

Client is the interface for GetSecretWithVersion.

type Spec

type Spec = version.Spec[AbsoluteSpec]

Spec represents a parsed Secrets Manager secret version specification.

Grammar: <name>[#<id> | :<label>]<shift>*

  • #<id> optional version ID (0 or 1, mutually exclusive with :LABEL)
  • :<label> optional staging label (0 or 1, mutually exclusive with #VERSION)
  • <shift> ~ or ~<N>, repeatable (0 or more, cumulative)

Examples: my-secret, my-secret#abc123, my-secret:AWSCURRENT, my-secret~1

func Parse

func Parse(input string) (*Spec, error)

Parse parses a Secrets Manager version specification string.

Grammar: <name>[#<id> | :<label>]<shift>*

Shift syntax (Git-like, repeatable):

  • ~ go back 1 version
  • ~N go back N versions
  • ~~ go back 2 versions (same as ~1~1)
  • ~1~2 cumulative: go back 3 versions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL