Skip to content

Commit

Permalink
feat(kms): Go release v0.0.1 (#1199)
Browse files Browse the repository at this point in the history
Co-authored-by: Shubham Chaturvedi <scchatur@amazon.com>
  • Loading branch information
ShubhamChaturvedi7 and Shubham Chaturvedi authored Jan 13, 2025
1 parent 95e54bf commit 9c80544
Show file tree
Hide file tree
Showing 17 changed files with 36,412 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ComAmazonawsKms/runtimes/go/ImplementationFromDafny-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ module github.com/aws/aws-cryptographic-material-providers-library/releases/go/k

go 1.23.0

require github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.0
require github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.1

require (
github.com/aws/aws-sdk-go-v2/config v1.27.36
github.com/aws/aws-sdk-go-v2/service/kms v1.36.0
github.com/aws/smithy-go v1.21.0
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2
)

require (
Expand Down
4 changes: 2 additions & 2 deletions ComAmazonawsKms/runtimes/go/ImplementationFromDafny-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.31.0 h1:GNVxIHBTi2EgwCxpNiozhNasMOK+
github.com/aws/aws-sdk-go-v2/service/sts v1.31.0/go.mod h1:yMWe0F+XG0DkRZK5ODZhG7BEFYhLXi2dqGsv6tX0cgI=
github.com/aws/smithy-go v1.21.0 h1:H7L8dtDRk0P1Qm6y0ji7MCYMQObJ5R9CRpyPhRUkLYA=
github.com/aws/smithy-go v1.21.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1 h1:dOgaw3i0I9nWKPjfXYzEfgWsVRJykL6FA18DErvQiJQ=
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1/go.mod h1:l2Tm4N2DKuq3ljONC2vOATeM9PUpXbIc8SgXdwwqEto=
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2 h1:g/xAj4F7Zt9wXJ6QjfbfocVi/ZYlAFpNddHCFyfzRDg=
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2/go.mod h1:l2Tm4N2DKuq3ljONC2vOATeM9PUpXbIc8SgXdwwqEto=
4 changes: 2 additions & 2 deletions ComAmazonawsKms/runtimes/go/TestsFromDafny-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ go 1.23.0

replace github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms v0.0.0 => ../ImplementationFromDafny-go

require github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.0
require github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.1

require (
github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms v0.0.0
github.com/aws/aws-sdk-go-v2/service/kms v1.36.0
github.com/aws/smithy-go v1.21.0
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2
)

require (
Expand Down
4 changes: 2 additions & 2 deletions ComAmazonawsKms/runtimes/go/TestsFromDafny-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.31.0 h1:GNVxIHBTi2EgwCxpNiozhNasMOK+
github.com/aws/aws-sdk-go-v2/service/sts v1.31.0/go.mod h1:yMWe0F+XG0DkRZK5ODZhG7BEFYhLXi2dqGsv6tX0cgI=
github.com/aws/smithy-go v1.21.0 h1:H7L8dtDRk0P1Qm6y0ji7MCYMQObJ5R9CRpyPhRUkLYA=
github.com/aws/smithy-go v1.21.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1 h1:dOgaw3i0I9nWKPjfXYzEfgWsVRJykL6FA18DErvQiJQ=
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1/go.mod h1:l2Tm4N2DKuq3ljONC2vOATeM9PUpXbIc8SgXdwwqEto=
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2 h1:g/xAj4F7Zt9wXJ6QjfbfocVi/ZYlAFpNddHCFyfzRDg=
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2/go.mod h1:l2Tm4N2DKuq3ljONC2vOATeM9PUpXbIc8SgXdwwqEto=
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms v0.0.0
github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl v0.0.0
github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives v0.0.0
github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.0
github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.1
github.com/aws/aws-sdk-go-v2/service/kms v1.36.0
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms v0.0.0
github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl v0.0.0
github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives v0.0.0
github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.0
github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.1
github.com/aws/aws-cryptographic-material-providers-library/testvectors v0.0.0
github.com/aws/aws-sdk-go-v2/service/kms v1.36.0
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2
Expand Down
5 changes: 5 additions & 0 deletions releases/go/kms/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

# [0.0.1] (2025-01-13)

Initial release for Go based on MPL [1.8.0](../../../CHANGELOG.md)
20,043 changes: 20,043 additions & 0 deletions releases/go/kms/ComAmazonawsKmsTypes/ComAmazonawsKmsTypes.go

Large diffs are not rendered by default.

319 changes: 319 additions & 0 deletions releases/go/kms/Com_Amazonaws_Kms/Com_Amazonaws_Kms.go

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions releases/go/kms/Com_Amazonaws_Kms/externs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package Com_Amazonaws_Kms

import (
"context"

ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes"
"github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/KMSwrapped"
"github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/kms"
_dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny"
)

func (_static *CompanionStruct_Default___) KMSClientForRegion(regionInput _dafny.Sequence) Wrappers.Result {
region := *toString(regionInput)
cfg, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
return Wrappers.Companion_Result_.Create_Failure_(ComAmazonawsKmsTypes.Companion_Error_.Create_KMSInternalException_(Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOfChars([]_dafny.Char(err.Error())...))))
}
return Wrappers.Companion_Result_.Create_Success_(&KMSwrapped.Shim{Client: kms.NewFromConfig(cfg, func(o *kms.Options) {
o.Region = region
})})
}

func (_static *CompanionStruct_Default___) KMSClient() Wrappers.Result {
cfg, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
return Wrappers.Companion_Result_.Create_Failure_(ComAmazonawsKmsTypes.Companion_Error_.Create_KMSInternalException_(Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOfChars([]_dafny.Char(err.Error())...))))
}
return Wrappers.Companion_Result_.Create_Success_(&KMSwrapped.Shim{Client: kms.NewFromConfig(cfg)})
}

func (_static *CompanionStruct_Default___) RegionMatch(ikmsClient ComAmazonawsKmsTypes.IKMSClient, regionInput _dafny.Sequence) Wrappers.Option {
region := toString(regionInput)
var kmsShim = ikmsClient.(*KMSwrapped.Shim).Client
return Wrappers.Companion_Option_.Create_Some_(kmsShim.Options().Region == *region)
}

func toString(input _dafny.Sequence) *string {
var s string
for i := _dafny.Iterate(input); ; {
val, ok := i()
if !ok {
return &[]string{s}[0]
} else {
s = s + string(val.(_dafny.Char))
}
}
}
Loading

0 comments on commit 9c80544

Please sign in to comment.