From 8129b7785cb5beea91bf18fe0e31c6a16e01294e Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Tue, 10 Mar 2020 19:55:54 -0700 Subject: [PATCH 1/5] r/aws_lightsail_instance: Fix crash when encountering key-only tags. Creating tags with an empty string as a value appears to correctly create these key-only tags. --- aws/internal/keyvaluetags/service_tags_gen.go | 8 +++++++- aws/resource_aws_lightsail_instance_test.go | 6 ++++-- website/docs/r/lightsail_instance.html.markdown | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/aws/internal/keyvaluetags/service_tags_gen.go b/aws/internal/keyvaluetags/service_tags_gen.go index 474562c584f..1fd8f00f405 100644 --- a/aws/internal/keyvaluetags/service_tags_gen.go +++ b/aws/internal/keyvaluetags/service_tags_gen.go @@ -1782,7 +1782,13 @@ func LightsailKeyValueTags(tags []*lightsail.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) diff --git a/aws/resource_aws_lightsail_instance_test.go b/aws/resource_aws_lightsail_instance_test.go index 5c4b9b687eb..bd19c52a769 100644 --- a/aws/resource_aws_lightsail_instance_test.go +++ b/aws/resource_aws_lightsail_instance_test.go @@ -160,7 +160,7 @@ func TestAccAWSLightsailInstance_Tags(t *testing.T) { resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"), resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"), resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"), - resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "1"), + resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "2"), ), }, { @@ -171,7 +171,7 @@ func TestAccAWSLightsailInstance_Tags(t *testing.T) { resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"), resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"), resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"), - resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "2"), + resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "3"), ), }, }, @@ -320,6 +320,7 @@ resource "aws_lightsail_instance" "lightsail_instance_test" { bundle_id = "nano_1_0" tags = { Name = "tf-test" + KeyOnlyTag = "" } } `, lightsailName) @@ -338,6 +339,7 @@ resource "aws_lightsail_instance" "lightsail_instance_test" { bundle_id = "nano_1_0" tags = { Name = "tf-test", + KeyOnlyTag = "" ExtraName = "tf-test" } } diff --git a/website/docs/r/lightsail_instance.html.markdown b/website/docs/r/lightsail_instance.html.markdown index 771cafe7a8c..6532cef9133 100644 --- a/website/docs/r/lightsail_instance.html.markdown +++ b/website/docs/r/lightsail_instance.html.markdown @@ -43,7 +43,7 @@ instance (see list below) * `key_pair_name` - (Optional) The name of your key pair. Created in the Lightsail console (cannot use `aws_key_pair` at this time) * `user_data` - (Optional) launch script to configure server with additional user data -* `tags` - (Optional) A mapping of tags to assign to the resource. +* `tags` - (Optional) A mapping of tags to assign to the resource. To create key-only tags, use an empty string as a value. ## Availability Zones Lightsail currently supports the following Availability Zones (e.g. `us-east-1a`): From b4814ae98c6c55307f8ff9cb8620f9c240cebfa1 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Fri, 20 Mar 2020 20:09:19 -0700 Subject: [PATCH 2/5] Update generator. --- .../generators/servicetags/main.go | 8 +- aws/internal/keyvaluetags/service_tags_gen.go | 586 +++++++++++++++--- 2 files changed, 519 insertions(+), 75 deletions(-) diff --git a/aws/internal/keyvaluetags/generators/servicetags/main.go b/aws/internal/keyvaluetags/generators/servicetags/main.go index aa731b95cf2..cd853d2bddf 100644 --- a/aws/internal/keyvaluetags/generators/servicetags/main.go +++ b/aws/internal/keyvaluetags/generators/servicetags/main.go @@ -258,7 +258,13 @@ func {{ . | Title }}KeyValueTags(tags []*{{ . | TagPackage }}.{{ . | TagType }}) m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.{{ . | TagTypeKeyField }})] = tag.{{ . | TagTypeValueField }} + if tag.{{ . | TagTypeValueField }} == nil { + // {{ . | TagTypeKeyField }}-only tag + m[aws.StringValue(tag.{{ . | TagTypeKeyField }})] = aws.String("") + } else { + // {{ . | TagTypeKeyField }}-{{ . | TagTypeValueField }} tag + m[aws.StringValue(tag.{{ . | TagTypeKeyField }})] = tag.{{ . | TagTypeValueField }} + } } return New(m) diff --git a/aws/internal/keyvaluetags/service_tags_gen.go b/aws/internal/keyvaluetags/service_tags_gen.go index 1fd8f00f405..1a2fffd36dc 100644 --- a/aws/internal/keyvaluetags/service_tags_gen.go +++ b/aws/internal/keyvaluetags/service_tags_gen.go @@ -444,7 +444,13 @@ func AcmKeyValueTags(tags []*acm.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -471,7 +477,13 @@ func AcmpcaKeyValueTags(tags []*acmpca.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -498,7 +510,13 @@ func AppmeshKeyValueTags(tags []*appmesh.TagRef) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -525,7 +543,13 @@ func AthenaKeyValueTags(tags []*athena.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -552,7 +576,13 @@ func Cloud9KeyValueTags(tags []*cloud9.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -579,7 +609,13 @@ func CloudformationKeyValueTags(tags []*cloudformation.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -606,7 +642,13 @@ func CloudfrontKeyValueTags(tags []*cloudfront.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -633,7 +675,13 @@ func Cloudhsmv2KeyValueTags(tags []*cloudhsmv2.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -660,7 +708,13 @@ func CloudtrailKeyValueTags(tags []*cloudtrail.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -687,7 +741,13 @@ func CloudwatchKeyValueTags(tags []*cloudwatch.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -714,7 +774,13 @@ func CloudwatcheventsKeyValueTags(tags []*cloudwatchevents.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -741,7 +807,13 @@ func CodebuildKeyValueTags(tags []*codebuild.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -768,7 +840,13 @@ func CodedeployKeyValueTags(tags []*codedeploy.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -795,7 +873,13 @@ func CodepipelineKeyValueTags(tags []*codepipeline.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -822,7 +906,13 @@ func ConfigserviceKeyValueTags(tags []*configservice.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -849,7 +939,13 @@ func DatabasemigrationserviceKeyValueTags(tags []*databasemigrationservice.Tag) m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -876,7 +972,13 @@ func DatapipelineKeyValueTags(tags []*datapipeline.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -903,7 +1005,13 @@ func DatasyncKeyValueTags(tags []*datasync.TagListEntry) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -930,7 +1038,13 @@ func DaxKeyValueTags(tags []*dax.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -957,7 +1071,13 @@ func DevicefarmKeyValueTags(tags []*devicefarm.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -984,7 +1104,13 @@ func DirectconnectKeyValueTags(tags []*directconnect.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1011,7 +1137,13 @@ func DirectoryserviceKeyValueTags(tags []*directoryservice.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1038,7 +1170,13 @@ func DocdbKeyValueTags(tags []*docdb.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1065,7 +1203,13 @@ func DynamodbKeyValueTags(tags []*dynamodb.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1092,7 +1236,13 @@ func Ec2KeyValueTags(tags []*ec2.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1119,7 +1269,13 @@ func EcrKeyValueTags(tags []*ecr.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1146,7 +1302,13 @@ func EcsKeyValueTags(tags []*ecs.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1173,7 +1335,13 @@ func EfsKeyValueTags(tags []*efs.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1200,7 +1368,13 @@ func ElasticacheKeyValueTags(tags []*elasticache.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1227,7 +1401,13 @@ func ElasticbeanstalkKeyValueTags(tags []*elasticbeanstalk.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1254,7 +1434,13 @@ func ElasticsearchserviceKeyValueTags(tags []*elasticsearchservice.Tag) KeyValue m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1296,7 +1482,13 @@ func ElbKeyValueTags(tags []*elb.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1323,7 +1515,13 @@ func Elbv2KeyValueTags(tags []*elbv2.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1350,7 +1548,13 @@ func EmrKeyValueTags(tags []*emr.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1377,7 +1581,13 @@ func FirehoseKeyValueTags(tags []*firehose.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1404,7 +1614,13 @@ func FmsKeyValueTags(tags []*fms.ResourceTag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1431,7 +1647,13 @@ func FsxKeyValueTags(tags []*fsx.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1458,7 +1680,13 @@ func GameliftKeyValueTags(tags []*gamelift.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1485,7 +1713,13 @@ func GlobalacceleratorKeyValueTags(tags []*globalaccelerator.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1512,7 +1746,13 @@ func IamKeyValueTags(tags []*iam.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1539,7 +1779,13 @@ func InspectorKeyValueTags(tags []*inspector.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1566,7 +1812,13 @@ func IotKeyValueTags(tags []*iot.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1593,7 +1845,13 @@ func IotanalyticsKeyValueTags(tags []*iotanalytics.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1620,7 +1878,13 @@ func IoteventsKeyValueTags(tags []*iotevents.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1647,7 +1911,13 @@ func KinesisKeyValueTags(tags []*kinesis.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1674,7 +1944,13 @@ func KinesisanalyticsKeyValueTags(tags []*kinesisanalytics.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1701,7 +1977,13 @@ func Kinesisanalyticsv2KeyValueTags(tags []*kinesisanalyticsv2.Tag) KeyValueTags m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1728,7 +2010,13 @@ func KmsKeyValueTags(tags []*kms.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.TagKey)] = tag.TagValue + if tag.TagValue == nil { + // TagKey-only tag + m[aws.StringValue(tag.TagKey)] = aws.String("") + } else { + // TagKey-TagValue tag + m[aws.StringValue(tag.TagKey)] = tag.TagValue + } } return New(m) @@ -1755,7 +2043,13 @@ func LicensemanagerKeyValueTags(tags []*licensemanager.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1786,7 +2080,7 @@ func LightsailKeyValueTags(tags []*lightsail.Tag) KeyValueTags { // Key-only tag m[aws.StringValue(tag.Key)] = aws.String("") } else { - // Key-value tag + // Key-Value tag m[aws.StringValue(tag.Key)] = tag.Value } } @@ -1815,7 +2109,13 @@ func MediastoreKeyValueTags(tags []*mediastore.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1842,7 +2142,13 @@ func NeptuneKeyValueTags(tags []*neptune.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1869,7 +2175,13 @@ func OrganizationsKeyValueTags(tags []*organizations.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1896,7 +2208,13 @@ func QuicksightKeyValueTags(tags []*quicksight.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1923,7 +2241,13 @@ func RamKeyValueTags(tags []*ram.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1950,7 +2274,13 @@ func RdsKeyValueTags(tags []*rds.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -1977,7 +2307,13 @@ func RedshiftKeyValueTags(tags []*redshift.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2004,7 +2340,13 @@ func Route53KeyValueTags(tags []*route53.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2031,7 +2373,13 @@ func Route53resolverKeyValueTags(tags []*route53resolver.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2058,7 +2406,13 @@ func S3KeyValueTags(tags []*s3.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2085,7 +2439,13 @@ func SagemakerKeyValueTags(tags []*sagemaker.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2112,7 +2472,13 @@ func SecretsmanagerKeyValueTags(tags []*secretsmanager.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2139,7 +2505,13 @@ func ServerlessapplicationrepositoryKeyValueTags(tags []*serverlessapplicationre m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2166,7 +2538,13 @@ func ServicecatalogKeyValueTags(tags []*servicecatalog.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2193,7 +2571,13 @@ func SfnKeyValueTags(tags []*sfn.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2220,7 +2604,13 @@ func SnsKeyValueTags(tags []*sns.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2247,7 +2637,13 @@ func SsmKeyValueTags(tags []*ssm.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2274,7 +2670,13 @@ func StoragegatewayKeyValueTags(tags []*storagegateway.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2301,7 +2703,13 @@ func SwfKeyValueTags(tags []*swf.ResourceTag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2328,7 +2736,13 @@ func TransferKeyValueTags(tags []*transfer.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2355,7 +2769,13 @@ func WafKeyValueTags(tags []*waf.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2382,7 +2802,13 @@ func WafregionalKeyValueTags(tags []*waf.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2409,7 +2835,13 @@ func Wafv2KeyValueTags(tags []*wafv2.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) @@ -2436,7 +2868,13 @@ func WorkspacesKeyValueTags(tags []*workspaces.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + if tag.Value == nil { + // Key-only tag + m[aws.StringValue(tag.Key)] = aws.String("") + } else { + // Key-Value tag + m[aws.StringValue(tag.Key)] = tag.Value + } } return New(m) From bf4e3dfbf07704322efe4e1e335f970689871f25 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Fri, 20 Mar 2020 20:09:34 -0700 Subject: [PATCH 3/5] Update wording. --- website/docs/r/lightsail_instance.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/lightsail_instance.html.markdown b/website/docs/r/lightsail_instance.html.markdown index 6532cef9133..70ba73f7af8 100644 --- a/website/docs/r/lightsail_instance.html.markdown +++ b/website/docs/r/lightsail_instance.html.markdown @@ -43,7 +43,7 @@ instance (see list below) * `key_pair_name` - (Optional) The name of your key pair. Created in the Lightsail console (cannot use `aws_key_pair` at this time) * `user_data` - (Optional) launch script to configure server with additional user data -* `tags` - (Optional) A mapping of tags to assign to the resource. To create key-only tags, use an empty string as a value. +* `tags` - (Optional) A mapping of tags to assign to the resource. To create a key-only tag, use an empty string as the value. ## Availability Zones Lightsail currently supports the following Availability Zones (e.g. `us-east-1a`): From db148821565699dd24cfd5d983220854a4a5e0ab Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Wed, 24 Jun 2020 18:08:32 -0700 Subject: [PATCH 4/5] Revert "Update generator." This reverts commit b4814ae98c6c55307f8ff9cb8620f9c240cebfa1. --- .../generators/servicetags/main.go | 8 +- aws/internal/keyvaluetags/service_tags_gen.go | 586 +++--------------- 2 files changed, 75 insertions(+), 519 deletions(-) diff --git a/aws/internal/keyvaluetags/generators/servicetags/main.go b/aws/internal/keyvaluetags/generators/servicetags/main.go index cd853d2bddf..aa731b95cf2 100644 --- a/aws/internal/keyvaluetags/generators/servicetags/main.go +++ b/aws/internal/keyvaluetags/generators/servicetags/main.go @@ -258,13 +258,7 @@ func {{ . | Title }}KeyValueTags(tags []*{{ . | TagPackage }}.{{ . | TagType }}) m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.{{ . | TagTypeValueField }} == nil { - // {{ . | TagTypeKeyField }}-only tag - m[aws.StringValue(tag.{{ . | TagTypeKeyField }})] = aws.String("") - } else { - // {{ . | TagTypeKeyField }}-{{ . | TagTypeValueField }} tag - m[aws.StringValue(tag.{{ . | TagTypeKeyField }})] = tag.{{ . | TagTypeValueField }} - } + m[aws.StringValue(tag.{{ . | TagTypeKeyField }})] = tag.{{ . | TagTypeValueField }} } return New(m) diff --git a/aws/internal/keyvaluetags/service_tags_gen.go b/aws/internal/keyvaluetags/service_tags_gen.go index 1a2fffd36dc..1fd8f00f405 100644 --- a/aws/internal/keyvaluetags/service_tags_gen.go +++ b/aws/internal/keyvaluetags/service_tags_gen.go @@ -444,13 +444,7 @@ func AcmKeyValueTags(tags []*acm.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -477,13 +471,7 @@ func AcmpcaKeyValueTags(tags []*acmpca.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -510,13 +498,7 @@ func AppmeshKeyValueTags(tags []*appmesh.TagRef) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -543,13 +525,7 @@ func AthenaKeyValueTags(tags []*athena.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -576,13 +552,7 @@ func Cloud9KeyValueTags(tags []*cloud9.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -609,13 +579,7 @@ func CloudformationKeyValueTags(tags []*cloudformation.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -642,13 +606,7 @@ func CloudfrontKeyValueTags(tags []*cloudfront.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -675,13 +633,7 @@ func Cloudhsmv2KeyValueTags(tags []*cloudhsmv2.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -708,13 +660,7 @@ func CloudtrailKeyValueTags(tags []*cloudtrail.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -741,13 +687,7 @@ func CloudwatchKeyValueTags(tags []*cloudwatch.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -774,13 +714,7 @@ func CloudwatcheventsKeyValueTags(tags []*cloudwatchevents.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -807,13 +741,7 @@ func CodebuildKeyValueTags(tags []*codebuild.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -840,13 +768,7 @@ func CodedeployKeyValueTags(tags []*codedeploy.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -873,13 +795,7 @@ func CodepipelineKeyValueTags(tags []*codepipeline.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -906,13 +822,7 @@ func ConfigserviceKeyValueTags(tags []*configservice.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -939,13 +849,7 @@ func DatabasemigrationserviceKeyValueTags(tags []*databasemigrationservice.Tag) m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -972,13 +876,7 @@ func DatapipelineKeyValueTags(tags []*datapipeline.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1005,13 +903,7 @@ func DatasyncKeyValueTags(tags []*datasync.TagListEntry) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1038,13 +930,7 @@ func DaxKeyValueTags(tags []*dax.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1071,13 +957,7 @@ func DevicefarmKeyValueTags(tags []*devicefarm.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1104,13 +984,7 @@ func DirectconnectKeyValueTags(tags []*directconnect.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1137,13 +1011,7 @@ func DirectoryserviceKeyValueTags(tags []*directoryservice.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1170,13 +1038,7 @@ func DocdbKeyValueTags(tags []*docdb.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1203,13 +1065,7 @@ func DynamodbKeyValueTags(tags []*dynamodb.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1236,13 +1092,7 @@ func Ec2KeyValueTags(tags []*ec2.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1269,13 +1119,7 @@ func EcrKeyValueTags(tags []*ecr.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1302,13 +1146,7 @@ func EcsKeyValueTags(tags []*ecs.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1335,13 +1173,7 @@ func EfsKeyValueTags(tags []*efs.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1368,13 +1200,7 @@ func ElasticacheKeyValueTags(tags []*elasticache.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1401,13 +1227,7 @@ func ElasticbeanstalkKeyValueTags(tags []*elasticbeanstalk.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1434,13 +1254,7 @@ func ElasticsearchserviceKeyValueTags(tags []*elasticsearchservice.Tag) KeyValue m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1482,13 +1296,7 @@ func ElbKeyValueTags(tags []*elb.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1515,13 +1323,7 @@ func Elbv2KeyValueTags(tags []*elbv2.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1548,13 +1350,7 @@ func EmrKeyValueTags(tags []*emr.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1581,13 +1377,7 @@ func FirehoseKeyValueTags(tags []*firehose.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1614,13 +1404,7 @@ func FmsKeyValueTags(tags []*fms.ResourceTag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1647,13 +1431,7 @@ func FsxKeyValueTags(tags []*fsx.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1680,13 +1458,7 @@ func GameliftKeyValueTags(tags []*gamelift.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1713,13 +1485,7 @@ func GlobalacceleratorKeyValueTags(tags []*globalaccelerator.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1746,13 +1512,7 @@ func IamKeyValueTags(tags []*iam.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1779,13 +1539,7 @@ func InspectorKeyValueTags(tags []*inspector.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1812,13 +1566,7 @@ func IotKeyValueTags(tags []*iot.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1845,13 +1593,7 @@ func IotanalyticsKeyValueTags(tags []*iotanalytics.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1878,13 +1620,7 @@ func IoteventsKeyValueTags(tags []*iotevents.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1911,13 +1647,7 @@ func KinesisKeyValueTags(tags []*kinesis.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1944,13 +1674,7 @@ func KinesisanalyticsKeyValueTags(tags []*kinesisanalytics.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -1977,13 +1701,7 @@ func Kinesisanalyticsv2KeyValueTags(tags []*kinesisanalyticsv2.Tag) KeyValueTags m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2010,13 +1728,7 @@ func KmsKeyValueTags(tags []*kms.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.TagValue == nil { - // TagKey-only tag - m[aws.StringValue(tag.TagKey)] = aws.String("") - } else { - // TagKey-TagValue tag - m[aws.StringValue(tag.TagKey)] = tag.TagValue - } + m[aws.StringValue(tag.TagKey)] = tag.TagValue } return New(m) @@ -2043,13 +1755,7 @@ func LicensemanagerKeyValueTags(tags []*licensemanager.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2080,7 +1786,7 @@ func LightsailKeyValueTags(tags []*lightsail.Tag) KeyValueTags { // Key-only tag m[aws.StringValue(tag.Key)] = aws.String("") } else { - // Key-Value tag + // Key-value tag m[aws.StringValue(tag.Key)] = tag.Value } } @@ -2109,13 +1815,7 @@ func MediastoreKeyValueTags(tags []*mediastore.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2142,13 +1842,7 @@ func NeptuneKeyValueTags(tags []*neptune.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2175,13 +1869,7 @@ func OrganizationsKeyValueTags(tags []*organizations.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2208,13 +1896,7 @@ func QuicksightKeyValueTags(tags []*quicksight.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2241,13 +1923,7 @@ func RamKeyValueTags(tags []*ram.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2274,13 +1950,7 @@ func RdsKeyValueTags(tags []*rds.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2307,13 +1977,7 @@ func RedshiftKeyValueTags(tags []*redshift.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2340,13 +2004,7 @@ func Route53KeyValueTags(tags []*route53.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2373,13 +2031,7 @@ func Route53resolverKeyValueTags(tags []*route53resolver.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2406,13 +2058,7 @@ func S3KeyValueTags(tags []*s3.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2439,13 +2085,7 @@ func SagemakerKeyValueTags(tags []*sagemaker.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2472,13 +2112,7 @@ func SecretsmanagerKeyValueTags(tags []*secretsmanager.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2505,13 +2139,7 @@ func ServerlessapplicationrepositoryKeyValueTags(tags []*serverlessapplicationre m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2538,13 +2166,7 @@ func ServicecatalogKeyValueTags(tags []*servicecatalog.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2571,13 +2193,7 @@ func SfnKeyValueTags(tags []*sfn.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2604,13 +2220,7 @@ func SnsKeyValueTags(tags []*sns.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2637,13 +2247,7 @@ func SsmKeyValueTags(tags []*ssm.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2670,13 +2274,7 @@ func StoragegatewayKeyValueTags(tags []*storagegateway.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2703,13 +2301,7 @@ func SwfKeyValueTags(tags []*swf.ResourceTag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2736,13 +2328,7 @@ func TransferKeyValueTags(tags []*transfer.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2769,13 +2355,7 @@ func WafKeyValueTags(tags []*waf.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2802,13 +2382,7 @@ func WafregionalKeyValueTags(tags []*waf.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2835,13 +2409,7 @@ func Wafv2KeyValueTags(tags []*wafv2.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) @@ -2868,13 +2436,7 @@ func WorkspacesKeyValueTags(tags []*workspaces.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-Value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m) From 1ef536d0f51abdaebc1dc47fc9f231b4b15d6d15 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Wed, 24 Jun 2020 18:09:30 -0700 Subject: [PATCH 5/5] make gen --- aws/internal/keyvaluetags/service_tags_gen.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/aws/internal/keyvaluetags/service_tags_gen.go b/aws/internal/keyvaluetags/service_tags_gen.go index 1fd8f00f405..474562c584f 100644 --- a/aws/internal/keyvaluetags/service_tags_gen.go +++ b/aws/internal/keyvaluetags/service_tags_gen.go @@ -1782,13 +1782,7 @@ func LightsailKeyValueTags(tags []*lightsail.Tag) KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - if tag.Value == nil { - // Key-only tag - m[aws.StringValue(tag.Key)] = aws.String("") - } else { - // Key-value tag - m[aws.StringValue(tag.Key)] = tag.Value - } + m[aws.StringValue(tag.Key)] = tag.Value } return New(m)