func makeKmsHandle(region string, contextString string) (ops *kmsHandle, err error) { encryptionContext, err := parseEncryptionContext(contextString) if err != nil { return } if region == "" { region = awsmeta.GetRegion() if region == "" { err = errors.New("please specify region (--region or $AWS_DEFAULT_REGION)") return } } ops = &kmsHandle{ Client: kms.New(&aws.Config{Region: ®ion}), Context: encryptionContext, } return }
func makeKmsHandle(region string, context []string) (ops *kmsHandle, err error) { encryptionContext, err := parseEncryptionContext(context) if err != nil { return nil, fmt.Errorf("could not parse encryption context: %v", err) } if region == "" { region = awsmeta.GetRegion() if region == "" { err = errors.New("please specify region (--region or $AWS_DEFAULT_REGION)") return } } client := kms.New(session.New(), aws.NewConfig().WithRegion(region)) ops = &kmsHandle{ Client: client, Context: encryptionContext, } return }