Skip to content

Commit

Permalink
internal/keyvaluetags: Support Quicksight service (#12220)
Browse files Browse the repository at this point in the history
  • Loading branch information
leppikallio authored Mar 3, 2020
1 parent b793dfe commit 63b09d7
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 0 deletions.
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/listtags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ var serviceNames = []string{
"organizations",
"pinpoint",
"qldb",
"quicksight",
"rds",
"resourcegroups",
"route53",
Expand Down
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/servicetags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var sliceServiceNames = []string{
"mediastore",
"neptune",
"organizations",
"quicksight",
"ram",
"rds",
"redshift",
Expand Down
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/updatetags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ var serviceNames = []string{
"organizations",
"pinpoint",
"qldb",
"quicksight",
"ram",
"rds",
"redshift",
Expand Down
18 changes: 18 additions & 0 deletions aws/internal/keyvaluetags/list_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package keyvaluetags

import (
"fmt"
"github.com/aws/aws-sdk-go/service/quicksight"
"reflect"

"github.com/aws/aws-sdk-go/service/accessanalyzer"
Expand Down Expand Up @@ -266,6 +267,8 @@ func ServiceClientType(serviceName string) string {
funcType = reflect.TypeOf(pinpoint.New)
case "qldb":
funcType = reflect.TypeOf(qldb.New)
case "quicksight":
funcType = reflect.TypeOf(quicksight.New)
case "ram":
funcType = reflect.TypeOf(ram.New)
case "rds":
Expand Down
28 changes: 28 additions & 0 deletions aws/internal/keyvaluetags/service_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 99 additions & 0 deletions aws/internal/keyvaluetags/service_tags_gen_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keyvaluetags

import (
"github.com/aws/aws-sdk-go/service/quicksight"
"testing"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -481,3 +482,101 @@ func TestKeyValueTagsAppmeshTags(t *testing.T) {
})
}
}

func TestQuicksightKeyValueTags(t *testing.T) {
testCases := []struct {
name string
tags []*quicksight.Tag
want map[string]string
}{
{
name: "empty",
tags: []*quicksight.Tag{},
want: map[string]string{},
},
{
name: "non_empty",
tags: []*quicksight.Tag{
{
Key: aws.String("key1"),
Value: aws.String("value1"),
},
{
Key: aws.String("key2"),
Value: aws.String("value2"),
},
{
Key: aws.String("key3"),
Value: aws.String("value3"),
},
},
want: map[string]string{
"key1": "value1",
"key2": "value2",
"key3": "value3",
},
},
}

for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
got := QuicksightKeyValueTags(testCase.tags)

testKeyValueTagsVerifyMap(t, got.Map(), testCase.want)
})
}
}

func TestKeyValueTagsQuicksightTags(t *testing.T) {
testCases := []struct {
name string
tags KeyValueTags
want []*quicksight.Tag
}{
{
name: "empty",
tags: New(map[string]string{}),
want: []*quicksight.Tag{},
},
{
name: "non_empty",
tags: New(map[string]string{
"key1": "value1",
"key2": "value2",
"key3": "value3",
}),
want: []*quicksight.Tag{
{
Key: aws.String("key1"),
Value: aws.String("value1"),
},
{
Key: aws.String("key2"),
Value: aws.String("value2"),
},
{
Key: aws.String("key3"),
Value: aws.String("value3"),
},
},
},
}

for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
got := testCase.tags.QuicksightTags()

gotMap := make(map[string]string, len(got))
for _, tag := range got {
gotMap[aws.StringValue(tag.Key)] = aws.StringValue(tag.Value)
}

wantMap := make(map[string]string, len(testCase.want))
for _, tag := range testCase.want {
wantMap[aws.StringValue(tag.Key)] = aws.StringValue(tag.Value)
}

testKeyValueTagsVerifyMap(t, gotMap, wantMap)
})
}
}
37 changes: 37 additions & 0 deletions aws/internal/keyvaluetags/update_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 63b09d7

Please sign in to comment.