Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot Resource for lexv2 #33475

Merged
merged 10 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/33475.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
aws_lexv2models_bot
```
8 changes: 8 additions & 0 deletions internal/framework/flex/int.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,11 @@ func Int64FromFrameworkLegacy(_ context.Context, v types.Int64) *int64 {

return aws.Int64(i)
}

func Int32ToFramework(ctx context.Context, v *int32) types.Int64 {
var output types.Int64

panicOnError(Flatten(ctx, v, &output))

return output
}
36 changes: 36 additions & 0 deletions internal/framework/flex/int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,39 @@ func TestInt64ToFrameworkLegacy(t *testing.T) {
})
}
}

func TestInt32ToFramework(t *testing.T) {
nam054 marked this conversation as resolved.
Show resolved Hide resolved
t.Parallel()

type testCase struct {
input *int32
expected types.Int64
}
tests := map[string]testCase{
"valid int64": {
input: aws.Int32(42),
expected: types.Int64Value(42),
},
"zero int64": {
input: aws.Int32(0),
expected: types.Int64Value(0),
},
"nil int64": {
input: nil,
expected: types.Int64Null(),
},
}

for name, test := range tests {
name, test := name, test
t.Run(name, func(t *testing.T) {
t.Parallel()

got := flex.Int32ToFramework(context.Background(), test.input)

if diff := cmp.Diff(got, test.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}
Loading
Loading