forked from codahale/sneaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfake_kms_test.go
More file actions
29 lines (23 loc) · 849 Bytes
/
fake_kms_test.go
File metadata and controls
29 lines (23 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package sneaker
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/kms"
)
type FakeKMS struct {
GenerateInputs []kms.GenerateDataKeyInput
GenerateOutputs []kms.GenerateDataKeyOutput
DecryptInputs []kms.DecryptInput
DecryptOutputs []kms.DecryptOutput
}
func (f *FakeKMS) GenerateDataKey(context context.Context, req *kms.GenerateDataKeyInput, optFns ...func(*kms.Options)) (*kms.GenerateDataKeyOutput, error) {
f.GenerateInputs = append(f.GenerateInputs, *req)
resp := f.GenerateOutputs[0]
f.GenerateOutputs = f.GenerateOutputs[1:]
return &resp, nil
}
func (f *FakeKMS) Decrypt(context context.Context, req *kms.DecryptInput, optFns ...func(*kms.Options)) (*kms.DecryptOutput, error) {
f.DecryptInputs = append(f.DecryptInputs, *req)
resp := f.DecryptOutputs[0]
f.DecryptOutputs = f.DecryptOutputs[1:]
return &resp, nil
}