From 07f37d7f3c36ceee92c06b93111627d06e872664 Mon Sep 17 00:00:00 2001 From: Janusz Bialy Date: Fri, 22 Mar 2019 15:00:46 -0400 Subject: abstract KMS client so that it's easier to test --- aws/kms.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'aws') diff --git a/aws/kms.go b/aws/kms.go index 2961351a..67a5b44b 100644 --- a/aws/kms.go +++ b/aws/kms.go @@ -6,12 +6,18 @@ import ( "github.com/aws/aws-sdk-go/service/kms" ) -// KMS - +// KMSAPI is a subset of kmsiface.KMSAPI +type KMSAPI interface { + Encrypt(input *kms.EncryptInput) (*kms.EncryptOutput, error) + Decrypt(input *kms.DecryptInput) (*kms.DecryptOutput, error) +} + +// KMS is an AWS KMS client type KMS struct { - Client *kms.KMS + Client KMSAPI } -// NewKMS - Create new KMS client +// NewKMS - Create new AWS KMS client using an SDKSession func NewKMS(option ClientOptions) *KMS { client := kms.New(SDKSession()) return &KMS{ -- cgit v1.2.3