summaryrefslogtreecommitdiff
path: root/aws
diff options
context:
space:
mode:
authorJanusz Bialy <janusz.bialy@qlik.com>2019-03-22 15:00:46 -0400
committerJanusz Bialy <janusz.bialy@qlik.com>2019-03-23 15:04:21 -0400
commit07f37d7f3c36ceee92c06b93111627d06e872664 (patch)
tree65b51674446fb5366f461ee92f69a8a8c7f9d0e2 /aws
parentb235bf53460a8d2d622e951928fd1bf5d3d29d2c (diff)
abstract KMS client so that it's easier to test
Diffstat (limited to 'aws')
-rw-r--r--aws/kms.go12
1 files changed, 9 insertions, 3 deletions
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{