ssm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package ssm retrieves and writes AWS Systems Manager Parameter Store values.

New wraps an application-owned AWS SDK v2 Client. Provider.Get retrieves one parameter, Provider.GetMultiple traverses a path, and Provider.Set writes a parameter. GetOptions and MultipleOptions select SDK request options and the shared Parameters cache/transform policy.

Defaults and isolation

Package-level helpers lazily initialize a default provider; use an explicit provider when controlling clients, endpoints or credentials. Effective decrypt and path request options isolate cached values, and matching single/batch reads can reuse entries. Provider.ClearCache invalidates local cached configuration. SDK errors retain their error chain through the Parameters error types.

For usage and compatibility details, see the user guide.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetParameter

func GetParameter(ctx context.Context, name string, options GetOptions) (any, error)

func GetParameters

func GetParameters(ctx context.Context, path string, options MultipleOptions) (map[string]any, error)

func GetParametersByName

func GetParametersByName(ctx context.Context, names map[string]GetOptions, options ByNameOptions) (map[string]any, error)

func SetParameter

func SetParameter(ctx context.Context, name, value string, options *sdk.PutParameterInput) (int64, error)

Types

type ByNameOptions

type ByNameOptions struct {
	parameters.Options
	Decrypt *bool
	// ThrowOnError defaults to true; false returns failed names under _errors.
	ThrowOnError *bool
}

type GetOptions

type GetOptions struct {
	parameters.Options
	Decrypt    *bool
	SDKOptions *sdk.GetParameterInput
}

type MultipleOptions

type MultipleOptions struct {
	parameters.Options
	Decrypt    *bool
	Recursive  *bool
	SDKOptions *sdk.GetParametersByPathInput
}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func New

func New(client Client) *Provider

func (*Provider) ClearCache

func (p *Provider) ClearCache()

func (*Provider) Get

func (p *Provider) Get(ctx context.Context, name string, options GetOptions) (any, error)
Example

This example requires AWS credentials and an existing Parameter Store value.

package main

import (
	"context"

	"github.com/aws/aws-sdk-go-v2/config"
	sdk "github.com/aws/aws-sdk-go-v2/service/ssm"
	"github.com/rambow-cloud/powertools-lambda-go/parameters/ssm"
)

func main() {
	ctx := context.Background()
	cfg, err := config.LoadDefaultConfig(ctx)
	if err != nil {
		panic(err)
	}
	provider := ssm.New(sdk.NewFromConfig(cfg))
	value, err := provider.Get(ctx, "/example/feature", ssm.GetOptions{})
	if err != nil {
		panic(err)
	}
	_ = value // Reuse the provider across invocations to retain cached values.
}

func (*Provider) GetMultiple

func (p *Provider) GetMultiple(ctx context.Context, path string, options MultipleOptions) (map[string]any, error)

func (*Provider) GetParametersByName

func (p *Provider) GetParametersByName(ctx context.Context, names map[string]GetOptions, options ByNameOptions) (map[string]any, error)

GetParametersByName supports per-name overrides, groups decryption requirements, and fetches at most ten names per batch. Input maps are never modified.

func (*Provider) Set

func (p *Provider) Set(ctx context.Context, name, value string, options *sdk.PutParameterInput) (int64, error)

Set passes native SDK write options through and supplies the reference defaults. Writes do not invalidate cached reads; call ClearCache or use ForceFetch afterward.

Jump to

Keyboard shortcuts

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