gcloudversion

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gcloudversion provides version spec parsing for Google Cloud Secret Manager (name#VERSION~SHIFT).

Google Cloud secret versions are positive integers (1, 2, 3, ...) or the "latest" alias; there are NO staging labels. The grammar therefore mirrors the SSM Parameter Store grammar (an integer #VERSION plus ~SHIFT) rather than the Secrets Manager one, and a ":LABEL" specifier is rejected at parse time with a clear error so the mistake never reaches the provider.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidVersion is returned when # is not followed by a version number.
	ErrInvalidVersion = errors.New("# must be followed by a version number")
	// ErrLabelUnsupported is returned when a :LABEL specifier is used. Google
	// Cloud Secret Manager has no staging labels (versions are integers or
	// "latest"), so a colon specifier is always invalid.
	ErrLabelUnsupported = errors.New(
		": staging labels are not supported for Google Cloud Secret Manager " +
			"(versions are integers or \"latest\")",
	)
)

Google Cloud Secret Manager-specific errors.

Functions

func ParseDiffArgs

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

ParseDiffArgs parses diff command arguments for Google Cloud Secret Manager. This is a convenience wrapper around diffargs.ParseArgs with Google Cloud Secret Manager-specific settings.

Types

type AbsoluteSpec

type AbsoluteSpec struct {
	Version *int64 // Explicit version number (#VERSION)
}

AbsoluteSpec represents the absolute version specifier for Google Cloud Secret Manager.

type Spec

type Spec = version.Spec[AbsoluteSpec]

Spec represents a parsed Google Cloud Secret Manager version specification.

Grammar: <name>[#<N>]<shift>*

  • #<N> optional version number (0 or 1)
  • <shift> ~ or ~<N>, repeatable (0 or more, cumulative)

A ":LABEL" specifier is rejected: Google Cloud has no staging labels.

Examples: my-secret, my-secret#3, my-secret~1, my-secret#5~2, my-secret~~.

func Parse

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

Parse parses a Google Cloud Secret Manager version specification string.

Grammar: <name>[#<N>]<shift>*

Shift syntax (Git-like, repeatable):

  • ~ go back 1 version
  • ~N go back N versions (e.g., ~2)
  • ~~ 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