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

New Resource: aws_transfer_tag #27131

Merged
merged 21 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
692ebdb
Add transfer tag resoure impl
Oct 6, 2022
1140652
Allow aws prefix tags for transfer tags
Oct 6, 2022
a99a5c2
Add a transfer tag resource doc
Oct 6, 2022
aedf770
Add a transfer tag resource test
Oct 6, 2022
21e8683
Add CHANGELOG entry.
ewbankkit Oct 7, 2022
213facf
Fix importlint 'Imports of different types are not allowed in the sam…
ewbankkit Oct 7, 2022
183d468
'TestAccTransferTag_aws' -> 'TestAccTransferTag_system'.
ewbankkit Oct 7, 2022
27e009b
Cosmetics.
ewbankkit Oct 7, 2022
85d11a2
Correct tagging code generation.
ewbankkit Oct 7, 2022
6044849
Merge branch 'main' into HEAD
ewbankkit Oct 7, 2022
7e1e067
Regenerate Transfer service tagging code.
ewbankkit Oct 7, 2022
4060035
generate/tags: Make output file name configurable.
ewbankkit Oct 7, 2022
5a416d0
generate/tags: Make UpdateTags function name configurable.
ewbankkit Oct 7, 2022
420c348
generate/tags: Make ListTags function name configurable.
ewbankkit Oct 7, 2022
547a1b5
generate/tags: Make GetTag function name configurable.
ewbankkit Oct 7, 2022
4818b4f
Transfer: Generate 'UpdateTagsNoIgnoreSystem'.
ewbankkit Oct 7, 2022
e95fff8
generate/tagresource: Make CreateTags, GetTag and UpdateTags function…
ewbankkit Oct 7, 2022
adb04df
r/aws_transfer_tag: Use 'UpdateTagsNoIgnoreSystem'.
ewbankkit Oct 7, 2022
1863fe7
ec2/generate/createtags: Make CreateTags function name configurable.
ewbankkit Oct 7, 2022
16f419a
ec2/generate/createtags: Use 'ec2iface' package.
ewbankkit Oct 7, 2022
8e62051
r/aws_transfer_tag: Call out usage to manager custom hostname system …
ewbankkit Oct 7, 2022
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/27131.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
aws_transfer_tag
```
16 changes: 13 additions & 3 deletions internal/generate/tagresource/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import (
)

var (
idAttribName = flag.String("IDAttribName", "resource_arn", "idAttribName")
createTagsFunc = flag.String("CreateTagsFunc", "CreateTags", "createTagsFunc")
getTagFunc = flag.String("GetTagFunc", "GetTag", "getTagFunc")
idAttribName = flag.String("IDAttribName", "resource_arn", "idAttribName")
updateTagsFunc = flag.String("UpdateTagsFunc", "UpdateTags", "updateTagsFunc")
)

func usage() {
Expand All @@ -32,7 +35,10 @@ type TemplateData struct {
AWSServiceUpper string
ServicePackage string

IDAttribName string
CreateTagsFunc string
GetTagFunc string
IDAttribName string
UpdateTagsFunc string
}

func main() {
Expand All @@ -57,7 +63,11 @@ func main() {
AWSService: awsService,
AWSServiceUpper: u,
ServicePackage: servicePackage,
IDAttribName: *idAttribName,

CreateTagsFunc: *createTagsFunc,
GetTagFunc: *getTagFunc,
IDAttribName: *idAttribName,
UpdateTagsFunc: *updateTagsFunc,
}

resourceFilename := "tag_gen.go"
Expand Down
10 changes: 5 additions & 5 deletions internal/generate/tagresource/resource.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func resourceTagCreate(ctx context.Context, d *schema.ResourceData, meta interfa
value := d.Get("value").(string)

{{ if eq .ServicePackage "ec2" }}
if err := CreateTagsWithContext(ctx, conn, identifier, map[string]string{key: value}); err != nil {
if err := {{ .CreateTagsFunc }}WithContext(ctx, conn, identifier, map[string]string{key: value}); err != nil {
{{- else }}
if err := UpdateTagsWithContext(ctx, conn, identifier, nil, map[string]string{key: value}); err != nil {
if err := {{ .UpdateTagsFunc }}WithContext(ctx, conn, identifier, nil, map[string]string{key: value}); err != nil {
{{- end }}
return diag.Errorf("creating %s resource (%s) tag (%s): %s", {{ .ServicePackage }}.ServiceID, identifier, key, err)
}
Expand All @@ -72,7 +72,7 @@ func resourceTagRead(ctx context.Context, d *schema.ResourceData, meta interface
return diag.FromErr(err)
}

value, err := GetTagWithContext(ctx, conn, identifier, key)
value, err := {{ .GetTagFunc }}WithContext(ctx, conn, identifier, key)

if !d.IsNewResource() && tfresource.NotFound(err) {
log.Printf("[WARN] %s resource (%s) tag (%s) not found, removing from state", {{ .ServicePackage }}.ServiceID, identifier, key)
Expand All @@ -99,7 +99,7 @@ func resourceTagUpdate(ctx context.Context, d *schema.ResourceData, meta interfa
return diag.FromErr(err)
}

if err := UpdateTagsWithContext(ctx, conn, identifier, nil, map[string]string{key: d.Get("value").(string)}); err != nil {
if err := {{ .UpdateTagsFunc }}WithContext(ctx, conn, identifier, nil, map[string]string{key: d.Get("value").(string)}); err != nil {
return diag.Errorf("updating %s resource (%s) tag (%s): %s", {{ .ServicePackage }}.ServiceID, identifier, key, err)
}

Expand All @@ -114,7 +114,7 @@ func resourceTagDelete(ctx context.Context, d *schema.ResourceData, meta interfa
return diag.FromErr(err)
}

if err := UpdateTagsWithContext(ctx, conn, identifier, map[string]string{key: d.Get("value").(string)}, nil); err != nil {
if err := {{ .UpdateTagsFunc }}WithContext(ctx, conn, identifier, map[string]string{key: d.Get("value").(string)}, nil); err != nil {
return diag.Errorf("deleting %s resource (%s) tag (%s): %s", {{ .ServicePackage }}.ServiceID, identifier, key, err)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/generate/tagresource/tests.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func testAccCheckTagDestroy(s *terraform.State) error {
return err
}

_, err = tf{{ .ServicePackage }}.GetTagWithContext(context.Background(), conn, identifier, key)
_, err = tf{{ .ServicePackage }}.{{ .GetTagFunc }}WithContext(context.Background(), conn, identifier, key)

if tfresource.NotFound(err) {
continue
Expand Down Expand Up @@ -65,7 +65,7 @@ func testAccCheckTagExists(resourceName string) resource.TestCheckFunc {

conn := acctest.Provider.Meta().(*conns.AWSClient).{{ .AWSServiceUpper }}Conn

_, err = tf{{ .ServicePackage }}.GetTagWithContext(context.Background(), conn, identifier, key)
_, err = tf{{ .ServicePackage }}.{{ .GetTagFunc }}WithContext(context.Background(), conn, identifier, key)

return err
}
Expand Down
36 changes: 24 additions & 12 deletions internal/generate/tags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
)

const (
filename = `tags_gen.go`

sdkV1 = 1
sdkV2 = 2
)
Expand All @@ -34,6 +32,8 @@ var (
untagInNeedTagType = flag.Bool("UntagInNeedTagType", false, "whether Untag input needs tag type")
updateTags = flag.Bool("UpdateTags", false, "whether to generate UpdateTags")

getTagFunc = flag.String("GetTagFunc", "GetTag", "getTagFunc")
listTagsFunc = flag.String("ListTagsFunc", "ListTags", "listTagsFunc")
listTagsInFiltIDName = flag.String("ListTagsInFiltIDName", "", "listTagsInFiltIDName")
listTagsInIDElem = flag.String("ListTagsInIDElem", "ResourceArn", "listTagsInIDElem")
listTagsInIDNeedSlice = flag.String("ListTagsInIDNeedSlice", "", "listTagsInIDNeedSlice")
Expand All @@ -49,14 +49,15 @@ var (
tagResTypeElem = flag.String("TagResTypeElem", "", "tagResTypeElem")
tagType = flag.String("TagType", "Tag", "tagType")
tagType2 = flag.String("TagType2", "", "tagType")
TagTypeAddBoolElem = flag.String("TagTypeAddBoolElem", "", "TagTypeAddBoolElem")
tagTypeAddBoolElem = flag.String("TagTypeAddBoolElem", "", "TagTypeAddBoolElem")
tagTypeIDElem = flag.String("TagTypeIDElem", "", "tagTypeIDElem")
tagTypeKeyElem = flag.String("TagTypeKeyElem", "Key", "tagTypeKeyElem")
tagTypeValElem = flag.String("TagTypeValElem", "Value", "tagTypeValElem")
untagInCustomVal = flag.String("UntagInCustomVal", "", "untagInCustomVal")
untagInNeedTagKeyType = flag.String("UntagInNeedTagKeyType", "", "untagInNeedTagKeyType")
untagInTagsElem = flag.String("UntagInTagsElem", "TagKeys", "untagInTagsElem")
untagOp = flag.String("UntagOp", "UntagResource", "untagOp")
updateTagsFunc = flag.String("UpdateTagsFunc", "UpdateTags", "updateTagsFunc")

parentNotFoundErrCode = flag.String("ParentNotFoundErrCode", "", "Parent 'NotFound' Error Code")
parentNotFoundErrMsg = flag.String("ParentNotFoundErrMsg", "", "Parent 'NotFound' Error Message")
Expand Down Expand Up @@ -123,6 +124,8 @@ type TemplateData struct {
ClientType string
ServicePackage string

GetTagFunc string
ListTagsFunc string
ListTagsInFiltIDName string
ListTagsInIDElem string
ListTagsInIDNeedSlice string
Expand Down Expand Up @@ -152,6 +155,7 @@ type TemplateData struct {
UntagInNeedTagType bool
UntagInTagsElem string
UntagOp string
UpdateTagsFunc string

// The following are specific to writing import paths in the `headerBody`;
// to include the package, set the corresponding field's value to true
Expand All @@ -168,6 +172,11 @@ func main() {
flag.Usage = usage
flag.Parse()

filename := `tags_gen.go`
if args := flag.Args(); len(args) > 0 {
filename = args[0]
}

if *sdkVersion != sdkV1 && *sdkVersion != sdkV2 {
log.Fatalf("AWS SDK Go Version %d not supported", *sdkVersion)
}
Expand Down Expand Up @@ -219,6 +228,8 @@ func main() {
StrConvPkg: awsPkg == "autoscaling",
TfResourcePkg: *getTag,

GetTagFunc: *getTagFunc,
ListTagsFunc: *listTagsFunc,
ListTagsInFiltIDName: *listTagsInFiltIDName,
ListTagsInIDElem: *listTagsInIDElem,
ListTagsInIDNeedSlice: *listTagsInIDNeedSlice,
Expand All @@ -237,8 +248,8 @@ func main() {
TagResTypeElem: *tagResTypeElem,
TagType: *tagType,
TagType2: *tagType2,
TagTypeAddBoolElem: *TagTypeAddBoolElem,
TagTypeAddBoolElemSnake: ToSnakeCase(*TagTypeAddBoolElem),
TagTypeAddBoolElem: *tagTypeAddBoolElem,
TagTypeAddBoolElemSnake: ToSnakeCase(*tagTypeAddBoolElem),
TagTypeIDElem: *tagTypeIDElem,
TagTypeKeyElem: *tagTypeKeyElem,
TagTypeValElem: *tagTypeValElem,
Expand All @@ -247,6 +258,7 @@ func main() {
UntagInNeedTagType: *untagInNeedTagType,
UntagInTagsElem: *untagInTagsElem,
UntagOp: *untagOp,
UpdateTagsFunc: *updateTagsFunc,
}

templateBody := NewTemplateBody(*sdkVersion, *kvtValues)
Expand All @@ -258,31 +270,31 @@ func main() {
templateData.AWSService = ""
templateData.TagPackage = ""
}
writeTemplate(templateBody.header, "header", templateData)
writeTemplate(filename, templateBody.header, "header", templateData)
}

if *getTag {
writeTemplate(templateBody.getTag, "gettag", templateData)
writeTemplate(filename, templateBody.getTag, "gettag", templateData)
}

if *listTags {
writeTemplate(templateBody.listTags, "listtags", templateData)
writeTemplate(filename, templateBody.listTags, "listtags", templateData)
}

if *serviceTagsMap {
writeTemplate(templateBody.serviceTagsMap, "servicetagsmap", templateData)
writeTemplate(filename, templateBody.serviceTagsMap, "servicetagsmap", templateData)
}

if *serviceTagsSlice {
writeTemplate(templateBody.serviceTagsSlice, "servicetagsslice", templateData)
writeTemplate(filename, templateBody.serviceTagsSlice, "servicetagsslice", templateData)
}

if *updateTags {
writeTemplate(templateBody.updateTags, "updatetags", templateData)
writeTemplate(filename, templateBody.updateTags, "updatetags", templateData)
}
}

func writeTemplate(body string, templateName string, td TemplateData) {
func writeTemplate(filename, body, templateName string, td TemplateData) {
// If the file doesn't exist, create it, or append to the file
f, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
Expand Down
16 changes: 8 additions & 8 deletions internal/generate/tags/templates/v1/get_tag_body.tmpl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// GetTag fetches an individual {{ .ServicePackage }} service tag for a resource.
// {{ .GetTagFunc }} fetches an individual {{ .ServicePackage }} service tag for a resource.
// Returns whether the key value and any errors. A NotFoundError is used to signal that no value was found.
// This function will optimise the handling over ListTags, if possible.
// This function will optimise the handling over {{ .ListTagsFunc }}, if possible.
// The identifier is typically the Amazon Resource Name (ARN), although
// it may also be a different identifier depending on the service.
{{- if or ( .TagTypeIDElem ) ( .TagTypeAddBoolElem ) }}
func GetTag(conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*tftags.TagData, error) {
func {{ .GetTagFunc }}(conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*tftags.TagData, error) {
{{- else }}
func GetTag(conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*string, error) {
func {{ .GetTagFunc }}(conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*string, error) {
{{- end }}
return GetTagWithContext(context.Background(), conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}, key)
return {{ .GetTagFunc }}WithContext(context.Background(), conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}, key)
}

{{- if or ( .TagTypeIDElem ) ( .TagTypeAddBoolElem ) }}
func GetTagWithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*tftags.TagData, error) {
func {{ .GetTagFunc }}WithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*tftags.TagData, error) {
{{- else }}
func GetTagWithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*string, error) {
func {{ .GetTagFunc }}WithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*string, error) {
{{- end }}
{{- if .ListTagsInFiltIDName }}
input := &{{ .TagPackage }}.{{ .ListTagsOp }}Input{
Expand All @@ -38,7 +38,7 @@ func GetTagWithContext(ctx context.Context, conn {{ .ClientType }}, identifier s

listTags := KeyValueTags(output.{{ .ListTagsOutTagsElem }}{{ if .TagTypeIDElem }}, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}{{ end }})
{{- else }}
listTags, err := ListTagsWithContext(ctx, conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})
listTags, err := {{ .ListTagsFunc }}WithContext(ctx, conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})

if err != nil {
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions internal/generate/tags/templates/v1/list_tags_body.tmpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// ListTags lists {{ .ServicePackage }} service tags.
// {{ .ListTagsFunc }} lists {{ .ServicePackage }} service tags.
// The identifier is typically the Amazon Resource Name (ARN), although
// it may also be a different identifier depending on the service.
func ListTags(conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}) (tftags.KeyValueTags, error) {
return ListTagsWithContext(context.Background(), conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})
func {{ .ListTagsFunc }}(conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}) (tftags.KeyValueTags, error) {
return {{ .ListTagsFunc }}WithContext(context.Background(), conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})
}

func ListTagsWithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}) (tftags.KeyValueTags, error) {
func {{ .ListTagsFunc }}WithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}) (tftags.KeyValueTags, error) {
input := &{{ .TagPackage }}.{{ .ListTagsOp }}Input{
{{- if .ListTagsInFiltIDName }}
Filters: []*{{ .TagPackage }}.Filter{
Expand Down
10 changes: 5 additions & 5 deletions internal/generate/tags/templates/v1/update_tags_body.tmpl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// UpdateTags updates {{ .ServicePackage }} service tags.
// {{ .UpdateTagsFunc }} updates {{ .ServicePackage }} service tags.
// The identifier is typically the Amazon Resource Name (ARN), although
// it may also be a different identifier depending on the service.
func UpdateTags(conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTags interface{}, newTags interface{}) error {
return UpdateTagsWithContext(context.Background(), conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}, oldTags, newTags)
func {{ .UpdateTagsFunc }}(conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTags interface{}, newTags interface{}) error {
return {{ .UpdateTagsFunc }}WithContext(context.Background(), conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}, oldTags, newTags)
}

{{- if .TagTypeAddBoolElem }}
func UpdateTagsWithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTagsSet interface{}, newTagsSet interface{}) error {
func {{ .UpdateTagsFunc }}WithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTagsSet interface{}, newTagsSet interface{}) error {
oldTags := KeyValueTags(oldTagsSet, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})
newTags := KeyValueTags(newTagsSet, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})
{{- else }}
func UpdateTagsWithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTagsMap interface{}, newTagsMap interface{}) error {
func {{ .UpdateTagsFunc }}WithContext(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTagsMap interface{}, newTagsMap interface{}) error {
oldTags := tftags.New(oldTagsMap)
newTags := tftags.New(newTagsMap)
{{- end }}
Expand Down
10 changes: 5 additions & 5 deletions internal/generate/tags/templates/v2/get_tag_body.tmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// GetTag fetches an individual {{ .ServicePackage }} service tag for a resource.
// {{ .GetTagFunc }} fetches an individual {{ .ServicePackage }} service tag for a resource.
// Returns whether the key value and any errors. A NotFoundError is used to signal that no value was found.
// This function will optimise the handling over ListTags, if possible.
// This function will optimise the handling over {{ .ListTagsFunc }}, if possible.
// The identifier is typically the Amazon Resource Name (ARN), although
// it may also be a different identifier depending on the service.
{{- if or ( .TagTypeIDElem ) ( .TagTypeAddBoolElem ) }}
func GetTag(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*tftags.TagData, error) {
func {{ .GetTagFunc }}(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*tftags.TagData, error) {
{{- else }}
func GetTag(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*string, error) {
func {{ .GetTagFunc }}(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, key string) (*string, error) {
{{- end }}
{{- if .ListTagsInFiltIDName }}
input := &{{ .AWSService }}.{{ .ListTagsOp }}Input{
Expand All @@ -30,7 +30,7 @@ func GetTag(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if

listTags := KeyValueTags(output.{{ .ListTagsOutTagsElem }}{{ if .TagTypeIDElem }}, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}{{ end }})
{{- else }}
listTags, err := ListTags(ctx, conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})
listTags, err := {{ .ListTagsFunc }}(ctx, conn, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})

if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions internal/generate/tags/templates/v2/list_tags_body.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ListTags lists {{ .ServicePackage }} service tags.
// {{ .ListTagsFunc }} lists {{ .ServicePackage }} service tags.
// The identifier is typically the Amazon Resource Name (ARN), although
// it may also be a different identifier depending on the service.
func ListTags(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}) (tftags.KeyValueTags, error) {
func {{ .ListTagsFunc }}(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}) (tftags.KeyValueTags, error) {
input := &{{ .TagPackage }}.{{ .ListTagsOp }}Input{
{{- if .ListTagsInFiltIDName }}
Filters: []*{{ .AWSService }}.Filter{
Expand Down
6 changes: 3 additions & 3 deletions internal/generate/tags/templates/v2/update_tags_body.tmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// UpdateTags updates {{ .ServicePackage }} service tags.
// {{ .UpdateTagsFunc }} updates {{ .ServicePackage }} service tags.
// The identifier is typically the Amazon Resource Name (ARN), although
// it may also be a different identifier depending on the service.
{{- if .TagTypeAddBoolElem }}
func UpdateTags(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTagsSet interface{}, newTagsSet interface{}) error {
func {{ .UpdateTagsFunc }}(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTagsSet interface{}, newTagsSet interface{}) error {
oldTags := KeyValueTags(oldTagsSet, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})
newTags := KeyValueTags(newTagsSet, identifier{{ if .TagResTypeElem }}, resourceType{{ end }})
{{- else }}
func UpdateTags(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTagsMap interface{}, newTagsMap interface{}) error {
func {{ .UpdateTagsFunc }}(ctx context.Context, conn {{ .ClientType }}, identifier string{{ if .TagResTypeElem }}, resourceType string{{ end }}, oldTagsMap interface{}, newTagsMap interface{}) error {
oldTags := tftags.New(oldTagsMap)
newTags := tftags.New(newTagsMap)
{{- end }}
Expand Down
Loading