awssmp

package
v0.0.0-...-7bfb7dc Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 6 Imported by: 0

README

awssmp

The awssmp package provides urfave/cli/v3 value sources backed by AWS Systems Manager (SSM) Parameter Store. It seamlessly handles standard, secure (automatically decrypted), and list parameters.

Usage

import (
    "github.com/aws-contrib/aws-cli/awssmp"
    "github.com/urfave/cli/v3"
)

// Fetch a single parameter
&cli.StringFlag{
    Name: "db-password",
    Sources: cli.NewValueSourceChain(
        awssmp.Parameter("/prod/db/password"),
    ),
}
Fallbacks (Multiple Parameters)

If you have multiple parameters you want to check as fallbacks, use the awssmp.Parameters helper:

&cli.StringFlag{
    Name: "db-password",
    Sources: awssmp.Parameters("/prod/db/password", "/fallback/db/password"),
}
Custom AWS Configuration

You can pass standard AWS SDK functional options to the constructors to configure the underlying AWS client (e.g., setting a specific region or custom endpoint).

import "github.com/aws/aws-sdk-go-v2/config"

awssmp.Parameter("/my/param", config.WithRegion("us-west-2"))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parameters

func Parameters(names ...string) cli.ValueSourceChain

Parameters is a helper function to encapsulate a number of ValueSource together as a ValueSourceChain.

Types

type ValueSource

type ValueSource struct {
	Name    string
	Options []func(*config.LoadOptions) error
}

ValueSource retrieves values from AWS Systems Manager (SSM) Parameter Store. It implements the cli.ValueSource interface.

func Parameter

func Parameter(name string, opts ...func(*config.LoadOptions) error) *ValueSource

Parameter creates a new ValueSource for the given parameter name. Optional AWS SDK configuration options can be provided.

func (*ValueSource) GoString

func (f *ValueSource) GoString() string

GoString returns a Go-syntax representation of the ValueSource.

func (*ValueSource) Lookup

func (f *ValueSource) Lookup() (string, bool)

Lookup retrieves the parameter value from the SSM Parameter Store. It returns the parameter value and a boolean indicating whether the retrieval was successful.

func (*ValueSource) String

func (f *ValueSource) String() string

String returns a string representation of the ValueSource.

Jump to

Keyboard shortcuts

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