diff --git a/aws/internal/keyvaluetags/generators/listtags/main.go b/aws/internal/keyvaluetags/generators/listtags/main.go index a865a37f219..e193e2515fb 100644 --- a/aws/internal/keyvaluetags/generators/listtags/main.go +++ b/aws/internal/keyvaluetags/generators/listtags/main.go @@ -100,6 +100,7 @@ var serviceNames = []string{ "route53resolver", "sagemaker", "securityhub", + "servicediscovery", "sfn", "sns", "sqs", @@ -110,6 +111,7 @@ var serviceNames = []string{ "waf", "wafregional", "wafv2", + "worklink", "workspaces", } diff --git a/aws/internal/keyvaluetags/generators/servicetags/main.go b/aws/internal/keyvaluetags/generators/servicetags/main.go index 0717922fd87..2af089f6787 100644 --- a/aws/internal/keyvaluetags/generators/servicetags/main.go +++ b/aws/internal/keyvaluetags/generators/servicetags/main.go @@ -84,6 +84,7 @@ var sliceServiceNames = []string{ "secretsmanager", "serverlessapplicationrepository", "servicecatalog", + "servicediscovery", "sfn", "sns", "ssm", @@ -133,6 +134,7 @@ var mapServiceNames = []string{ "securityhub", "sqs", "synthetics", + "worklink", } type TemplateData struct { diff --git a/aws/internal/keyvaluetags/generators/updatetags/main.go b/aws/internal/keyvaluetags/generators/updatetags/main.go index 05caa30f048..b14f9c6ccd7 100644 --- a/aws/internal/keyvaluetags/generators/updatetags/main.go +++ b/aws/internal/keyvaluetags/generators/updatetags/main.go @@ -107,6 +107,7 @@ var serviceNames = []string{ "sagemaker", "secretsmanager", "securityhub", + "servicediscovery", "sfn", "sns", "sqs", @@ -118,6 +119,7 @@ var serviceNames = []string{ "waf", "wafregional", "wafv2", + "worklink", "workspaces", } diff --git a/aws/internal/keyvaluetags/list_tags_gen.go b/aws/internal/keyvaluetags/list_tags_gen.go index 5afc6631b3c..100c4080937 100644 --- a/aws/internal/keyvaluetags/list_tags_gen.go +++ b/aws/internal/keyvaluetags/list_tags_gen.go @@ -87,6 +87,7 @@ import ( "github.com/aws/aws-sdk-go/service/route53resolver" "github.com/aws/aws-sdk-go/service/sagemaker" "github.com/aws/aws-sdk-go/service/securityhub" + "github.com/aws/aws-sdk-go/service/servicediscovery" "github.com/aws/aws-sdk-go/service/sfn" "github.com/aws/aws-sdk-go/service/sns" "github.com/aws/aws-sdk-go/service/sqs" @@ -97,6 +98,7 @@ import ( "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" "github.com/aws/aws-sdk-go/service/wafv2" + "github.com/aws/aws-sdk-go/service/worklink" "github.com/aws/aws-sdk-go/service/workspaces" ) @@ -1512,6 +1514,23 @@ func SecurityhubListTags(conn *securityhub.SecurityHub, identifier string) (KeyV return SecurityhubKeyValueTags(output.Tags), nil } +// ServicediscoveryListTags lists servicediscovery service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func ServicediscoveryListTags(conn *servicediscovery.ServiceDiscovery, identifier string) (KeyValueTags, error) { + input := &servicediscovery.ListTagsForResourceInput{ + ResourceARN: aws.String(identifier), + } + + output, err := conn.ListTagsForResource(input) + + if err != nil { + return New(nil), err + } + + return ServicediscoveryKeyValueTags(output.Tags), nil +} + // SfnListTags lists sfn service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. @@ -1683,6 +1702,23 @@ func Wafv2ListTags(conn *wafv2.WAFV2, identifier string) (KeyValueTags, error) { return Wafv2KeyValueTags(output.TagInfoForResource.TagList), nil } +// WorklinkListTags lists worklink service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func WorklinkListTags(conn *worklink.WorkLink, identifier string) (KeyValueTags, error) { + input := &worklink.ListTagsForResourceInput{ + ResourceArn: aws.String(identifier), + } + + output, err := conn.ListTagsForResource(input) + + if err != nil { + return New(nil), err + } + + return WorklinkKeyValueTags(output.Tags), nil +} + // WorkspacesListTags lists workspaces service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. diff --git a/aws/internal/keyvaluetags/service_generation_customizations.go b/aws/internal/keyvaluetags/service_generation_customizations.go index cd798080c68..20786db583d 100644 --- a/aws/internal/keyvaluetags/service_generation_customizations.go +++ b/aws/internal/keyvaluetags/service_generation_customizations.go @@ -97,6 +97,7 @@ import ( "github.com/aws/aws-sdk-go/service/sagemaker" "github.com/aws/aws-sdk-go/service/secretsmanager" "github.com/aws/aws-sdk-go/service/securityhub" + "github.com/aws/aws-sdk-go/service/servicediscovery" "github.com/aws/aws-sdk-go/service/sfn" "github.com/aws/aws-sdk-go/service/sns" "github.com/aws/aws-sdk-go/service/sqs" @@ -108,6 +109,7 @@ import ( "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" "github.com/aws/aws-sdk-go/service/wafv2" + "github.com/aws/aws-sdk-go/service/worklink" "github.com/aws/aws-sdk-go/service/workspaces" ) @@ -300,6 +302,8 @@ func ServiceClientType(serviceName string) string { funcType = reflect.TypeOf(secretsmanager.New) case "securityhub": funcType = reflect.TypeOf(securityhub.New) + case "servicediscovery": + funcType = reflect.TypeOf(servicediscovery.New) case "sfn": funcType = reflect.TypeOf(sfn.New) case "sns": @@ -322,6 +326,8 @@ func ServiceClientType(serviceName string) string { funcType = reflect.TypeOf(wafregional.New) case "wafv2": funcType = reflect.TypeOf(wafv2.New) + case "worklink": + funcType = reflect.TypeOf(worklink.New) case "workspaces": funcType = reflect.TypeOf(workspaces.New) default: @@ -692,6 +698,8 @@ func ServiceTagInputIdentifierField(serviceName string) string { return "ResourceId" case "secretsmanager": return "SecretId" + case "servicediscovery": + return "ResourceARN" case "sqs": return "QueueUrl" case "ssm": diff --git a/aws/internal/keyvaluetags/service_tags_gen.go b/aws/internal/keyvaluetags/service_tags_gen.go index 627f72f21fc..8e7a0432a67 100644 --- a/aws/internal/keyvaluetags/service_tags_gen.go +++ b/aws/internal/keyvaluetags/service_tags_gen.go @@ -69,6 +69,7 @@ import ( "github.com/aws/aws-sdk-go/service/secretsmanager" "github.com/aws/aws-sdk-go/service/serverlessapplicationrepository" "github.com/aws/aws-sdk-go/service/servicecatalog" + "github.com/aws/aws-sdk-go/service/servicediscovery" "github.com/aws/aws-sdk-go/service/sfn" "github.com/aws/aws-sdk-go/service/sns" "github.com/aws/aws-sdk-go/service/ssm" @@ -442,6 +443,16 @@ func SyntheticsKeyValueTags(tags map[string]*string) KeyValueTags { return New(tags) } +// WorklinkTags returns worklink service tags. +func (tags KeyValueTags) WorklinkTags() map[string]*string { + return aws.StringMap(tags.Map()) +} + +// WorklinkKeyValueTags creates KeyValueTags from worklink service tags. +func WorklinkKeyValueTags(tags map[string]*string) KeyValueTags { + return New(tags) +} + // []*SERVICE.Tag handling // AcmTags returns acm service tags. @@ -2214,6 +2225,33 @@ func ServicecatalogKeyValueTags(tags []*servicecatalog.Tag) KeyValueTags { return New(m) } +// ServicediscoveryTags returns servicediscovery service tags. +func (tags KeyValueTags) ServicediscoveryTags() []*servicediscovery.Tag { + result := make([]*servicediscovery.Tag, 0, len(tags)) + + for k, v := range tags.Map() { + tag := &servicediscovery.Tag{ + Key: aws.String(k), + Value: aws.String(v), + } + + result = append(result, tag) + } + + return result +} + +// ServicediscoveryKeyValueTags creates KeyValueTags from servicediscovery service tags. +func ServicediscoveryKeyValueTags(tags []*servicediscovery.Tag) KeyValueTags { + m := make(map[string]*string, len(tags)) + + for _, tag := range tags { + m[aws.StringValue(tag.Key)] = tag.Value + } + + return New(m) +} + // SfnTags returns sfn service tags. func (tags KeyValueTags) SfnTags() []*sfn.Tag { result := make([]*sfn.Tag, 0, len(tags)) diff --git a/aws/internal/keyvaluetags/update_tags_gen.go b/aws/internal/keyvaluetags/update_tags_gen.go index e987e0ad9a2..76af8214597 100644 --- a/aws/internal/keyvaluetags/update_tags_gen.go +++ b/aws/internal/keyvaluetags/update_tags_gen.go @@ -96,6 +96,7 @@ import ( "github.com/aws/aws-sdk-go/service/sagemaker" "github.com/aws/aws-sdk-go/service/secretsmanager" "github.com/aws/aws-sdk-go/service/securityhub" + "github.com/aws/aws-sdk-go/service/servicediscovery" "github.com/aws/aws-sdk-go/service/sfn" "github.com/aws/aws-sdk-go/service/sns" "github.com/aws/aws-sdk-go/service/sqs" @@ -107,6 +108,7 @@ import ( "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" "github.com/aws/aws-sdk-go/service/wafv2" + "github.com/aws/aws-sdk-go/service/worklink" "github.com/aws/aws-sdk-go/service/workspaces" ) @@ -3353,6 +3355,42 @@ func SecurityhubUpdateTags(conn *securityhub.SecurityHub, identifier string, old return nil } +// ServicediscoveryUpdateTags updates servicediscovery service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func ServicediscoveryUpdateTags(conn *servicediscovery.ServiceDiscovery, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := New(oldTagsMap) + newTags := New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &servicediscovery.UntagResourceInput{ + ResourceARN: aws.String(identifier), + TagKeys: aws.StringSlice(removedTags.IgnoreAws().Keys()), + } + + _, err := conn.UntagResource(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %w", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &servicediscovery.TagResourceInput{ + ResourceARN: aws.String(identifier), + Tags: updatedTags.IgnoreAws().ServicediscoveryTags(), + } + + _, err := conn.TagResource(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %w", identifier, err) + } + } + + return nil +} + // SfnUpdateTags updates sfn service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. @@ -3751,6 +3789,42 @@ func Wafv2UpdateTags(conn *wafv2.WAFV2, identifier string, oldTagsMap interface{ return nil } +// WorklinkUpdateTags updates worklink service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func WorklinkUpdateTags(conn *worklink.WorkLink, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := New(oldTagsMap) + newTags := New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &worklink.UntagResourceInput{ + ResourceArn: aws.String(identifier), + TagKeys: aws.StringSlice(removedTags.IgnoreAws().Keys()), + } + + _, err := conn.UntagResource(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %w", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &worklink.TagResourceInput{ + ResourceArn: aws.String(identifier), + Tags: updatedTags.IgnoreAws().WorklinkTags(), + } + + _, err := conn.TagResource(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %w", identifier, err) + } + } + + return nil +} + // WorkspacesUpdateTags updates workspaces service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service.