psadm

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

README

psadm

Go

psadm is a library and a command-line tool for AWS Systems Manager Parameter Store.

The command-line application provides the import and export features for SSM Parameter Store via the library.

Features

psadm provides the API client with the following additional feature to aws-sdk-go's one:

Use-case

  • use with Lambda functions
  • use with daemon on initializaton

Library

v2 version supports aws-sdk-go-v2.

go get github.com/nabeken/psadm/v2

If you want to use the library with aws-sdk-go, please use v0 version.

go get github.com/nabeken/psadm

Command-line installation

go get -u github.com/nabeken/psadm/v2/cmd/psadm
Usage

To export parameters in YAML to STDOUT:

psadm export [--key-prefix=PREFIX] > exported.yml

Note: All SecureString parameters are decrypted.

To import from exported parameters in YAML:

psadm import [--dryrun] [--skip-exist] [--overwrite] [--default-kms-key-id=KMS-KEY-ID] exported.yml

To get a parameter at give time in YAML:

psadm get [--at=TIME] KEY

Documentation

Overview

Package psadm is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedClient

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

CachedClient is a cache-aware psadmin client.

func (*CachedClient) GetParameter

func (c *CachedClient) GetParameter(ctx context.Context, key string) (string, error)

func (*CachedClient) GetParameterByTime

func (c *CachedClient) GetParameterByTime(ctx context.Context, key string, at time.Time) (*Parameter, error)

func (*CachedClient) GetParameterWithDescription

func (c *CachedClient) GetParameterWithDescription(ctx context.Context, key string) (*Parameter, error)

func (*CachedClient) GetParametersByPath

func (c *CachedClient) GetParametersByPath(ctx context.Context, pathPrefix string) ([]*Parameter, error)

func (*CachedClient) PutParameter

func (c *CachedClient) PutParameter(ctx context.Context, p *Parameter, overwrite bool) error

PutParameter forwards a call to the underlying client. It doesn't do any caching.

type Client

type Client struct {
	SSM ssmClient
}

Client wraps the SSM client for psadm.

func NewClient

func NewClient(cfg aws.Config) *Client

NewClient returns a psadm client.

func (*Client) CachedClient

func (c *Client) CachedClient(cache *cache.Cache) *CachedClient

CachedClient returns a client with caching.

func (*Client) GetParameter

func (c *Client) GetParameter(ctx context.Context, key string) (string, error)

GetParameter returns the decrypted parameter.

func (*Client) GetParameterByTime

func (c *Client) GetParameterByTime(ctx context.Context, key string, at time.Time) (*Parameter, error)

GetParameterByTime returns the latest parameter.

func (*Client) GetParameterWithDescription

func (c *Client) GetParameterWithDescription(ctx context.Context, key string) (*Parameter, error)

func (*Client) GetParametersByPath

func (c *Client) GetParametersByPath(ctx context.Context, pathPrefix string) ([]*Parameter, error)

GetParametersByPath gets all parameters having given path prefix.

func (*Client) PutParameter

func (c *Client) PutParameter(ctx context.Context, param *Parameter, overwrite bool) error

PutParameter puts param into Parameter Store.

func (*Client) SingleflightClientWithCache

func (c *Client) SingleflightClientWithCache(cache *cache.Cache) *SingleflightClient

SingleflightClient returns a client with single flight caching.

type Mockclient

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

Mockclient is a mock of client interface.

func NewMockclient

func NewMockclient(ctrl *gomock.Controller) *Mockclient

NewMockclient creates a new mock instance.

func (*Mockclient) EXPECT

func (m *Mockclient) EXPECT() *MockclientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*Mockclient) GetParameter

func (m *Mockclient) GetParameter(arg0 context.Context, arg1 string) (string, error)

GetParameter mocks base method.

func (*Mockclient) GetParameterByTime

func (m *Mockclient) GetParameterByTime(arg0 context.Context, arg1 string, arg2 time.Time) (*Parameter, error)

GetParameterByTime mocks base method.

func (*Mockclient) GetParameterWithDescription

func (m *Mockclient) GetParameterWithDescription(arg0 context.Context, arg1 string) (*Parameter, error)

GetParameterWithDescription mocks base method.

func (*Mockclient) GetParametersByPath

func (m *Mockclient) GetParametersByPath(arg0 context.Context, arg1 string) ([]*Parameter, error)

GetParametersByPath mocks base method.

func (*Mockclient) PutParameter

func (m *Mockclient) PutParameter(arg0 context.Context, arg1 *Parameter, arg2 bool) error

PutParameter mocks base method.

type MockclientMockRecorder

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

MockclientMockRecorder is the mock recorder for Mockclient.

func (*MockclientMockRecorder) GetParameter

func (mr *MockclientMockRecorder) GetParameter(arg0, arg1 any) *gomock.Call

GetParameter indicates an expected call of GetParameter.

func (*MockclientMockRecorder) GetParameterByTime

func (mr *MockclientMockRecorder) GetParameterByTime(arg0, arg1, arg2 any) *gomock.Call

GetParameterByTime indicates an expected call of GetParameterByTime.

func (*MockclientMockRecorder) GetParameterWithDescription

func (mr *MockclientMockRecorder) GetParameterWithDescription(arg0, arg1 any) *gomock.Call

GetParameterWithDescription indicates an expected call of GetParameterWithDescription.

func (*MockclientMockRecorder) GetParametersByPath

func (mr *MockclientMockRecorder) GetParametersByPath(arg0, arg1 any) *gomock.Call

GetParametersByPath indicates an expected call of GetParametersByPath.

func (*MockclientMockRecorder) PutParameter

func (mr *MockclientMockRecorder) PutParameter(arg0, arg1, arg2 any) *gomock.Call

PutParameter indicates an expected call of PutParameter.

type MockssmClient

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

MockssmClient is a mock of ssmClient interface.

func NewMockssmClient

func NewMockssmClient(ctrl *gomock.Controller) *MockssmClient

NewMockssmClient creates a new mock instance.

func (*MockssmClient) DescribeParameters

func (m *MockssmClient) DescribeParameters(arg0 context.Context, arg1 *ssm.DescribeParametersInput, arg2 ...func(*ssm.Options)) (*ssm.DescribeParametersOutput, error)

DescribeParameters mocks base method.

func (*MockssmClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockssmClient) GetParameter

func (m *MockssmClient) GetParameter(arg0 context.Context, arg1 *ssm.GetParameterInput, arg2 ...func(*ssm.Options)) (*ssm.GetParameterOutput, error)

GetParameter mocks base method.

func (*MockssmClient) GetParameterHistory

func (m *MockssmClient) GetParameterHistory(arg0 context.Context, arg1 *ssm.GetParameterHistoryInput, arg2 ...func(*ssm.Options)) (*ssm.GetParameterHistoryOutput, error)

GetParameterHistory mocks base method.

func (*MockssmClient) PutParameter

func (m *MockssmClient) PutParameter(arg0 context.Context, arg1 *ssm.PutParameterInput, arg2 ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)

PutParameter mocks base method.

type MockssmClientMockRecorder

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

MockssmClientMockRecorder is the mock recorder for MockssmClient.

func (*MockssmClientMockRecorder) DescribeParameters

func (mr *MockssmClientMockRecorder) DescribeParameters(arg0, arg1 any, arg2 ...any) *gomock.Call

DescribeParameters indicates an expected call of DescribeParameters.

func (*MockssmClientMockRecorder) GetParameter

func (mr *MockssmClientMockRecorder) GetParameter(arg0, arg1 any, arg2 ...any) *gomock.Call

GetParameter indicates an expected call of GetParameter.

func (*MockssmClientMockRecorder) GetParameterHistory

func (mr *MockssmClientMockRecorder) GetParameterHistory(arg0, arg1 any, arg2 ...any) *gomock.Call

GetParameterHistory indicates an expected call of GetParameterHistory.

func (*MockssmClientMockRecorder) PutParameter

func (mr *MockssmClientMockRecorder) PutParameter(arg0, arg1 any, arg2 ...any) *gomock.Call

PutParameter indicates an expected call of PutParameter.

type Parameter

type Parameter struct {
	Description string `yaml:"description"`
	KMSKeyID    string `yaml:"kmskeyid"`
	Name        string `yaml:"name"`
	Type        string `yaml:"type"`
	Value       string `yaml:"value"`
}

Parameter is the parameter exported by psadm. This should be sufficient for import and export.

type SingleflightClient

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

SingleflightClient is a duplicate function call suppression client.

func (*SingleflightClient) GetParameter

func (c *SingleflightClient) GetParameter(ctx context.Context, key string) (string, error)

func (*SingleflightClient) GetParameterByTime

func (c *SingleflightClient) GetParameterByTime(ctx context.Context, key string, at time.Time) (*Parameter, error)

func (*SingleflightClient) GetParameterWithDescription

func (c *SingleflightClient) GetParameterWithDescription(ctx context.Context, key string) (*Parameter, error)

func (*SingleflightClient) GetParametersByPath

func (c *SingleflightClient) GetParametersByPath(ctx context.Context, pathPrefix string) ([]*Parameter, error)

func (*SingleflightClient) PutParameter

func (c *SingleflightClient) PutParameter(ctx context.Context, p *Parameter, overwrite bool) error

PutParameter forwards a call to the underlying client. It doesn't do any deduplication.

Directories

Path Synopsis
cmd
psadm
psadm is a tool for EC2 System Manager Parameter Store.
psadm is a tool for EC2 System Manager Parameter Store.

Jump to

Keyboard shortcuts

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