# README

aws-sdk-go-v2-wrapper | SSM

Quick Usage

import (
	"context"

	"github.com/evalphobia/aws-sdk-go-v2-wrapper/config"
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/ssm"
)

func main() {
	svc, err := ssm.New(config.Config{
		AccessKey: "<...>",
		SecretKey: "<...>",
	})
	if err != nil {
		panic(err)
	}
	ctx := context.Background()


	// plain values
	alreadyExists, err := svc.XPutParameter(ctx, "plain-text", "I love you!")
	if err != nil {
		panic(err)
	}
	_ = alreadyExists
	// if alreadyExists {
	// 	panic("'plain-text' should not set")
	// }

	value, notFound, err := svc.XGetParameterValue(ctx, "plain-text")
	if err != nil {
		panic(err)
	}
	if notFound {
		panic("'value' should have value")
	}
	if value != "I love you!" {
		panic("'value' should be 'I love you!'")
	}

	// encrypted values
	alreadyExists, err = svc.XPutParameterSecrure(ctx, "cipher-text", "I love you!")
	if err != nil {
		panic(err)
	}
	_ = alreadyExists
	// if alreadyExists {
	// 	panic("'cipher-text' should not set")
	// }

	value, notFound, err = svc.XGetParameterValueWithDecryption(ctx, "cipher-text")
	if err != nil {
		panic(err)
	}
	if notFound {
		panic("'value' should have value")
	}
	if value != "I love you!" {
		panic("'value' should be 'I love you!'")
	}
	// ...
}

X API

NameDescription
XGetParameterValuegets a value from SSM Parameter Store.
XGetParameterValueWithDecryptiongets a decrypted value from SSM Parameter Store.
XGetParameterValueListgets value list from SSM Parameter Store.
XGetParameterValueListWithDecryptiongets decrypted value list from SSM Parameter Store.
XPutParameterputs a value to SSM Parameter Store.
XPutParameterListputs values (StringList) to SSM Parameter Store.
XPutParameterSecrureputs a values (SecureString) to SSM Parameter Store with an encryption of default AWS KMS.
XPutParameterSecureCMKputs a values (SecureString) to SSM Parameter Store with an encryption of your own CMK.