Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "feature",
"description": "Allow tags member names in input/output structures to have \"map\" suffix variants.",
Comment thread
kstich marked this conversation as resolved.
Outdated
"pull_requests": [
"[#3129](https://github.com/smithy-lang/smithy/pull/3129)"
]
}
Comment thread
taylorlo-aws marked this conversation as resolved.
18 changes: 10 additions & 8 deletions docs/source-2.0/aws/aws-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1348,10 +1348,11 @@ tag associations on a resource:
* Must have exactly one input member that targets a string shape and has a
member name that matches ``^([R|r]esource)?([A|a]rn|ARN)$`` to accept
the resource ARN.
* Must have exactly one input member that targets a list shape, with list
member targeting a structure that consists of two members that target a
string shape representing the tag key or name and the tag value. This
member name must match: ``^[T|t]ag(s|[L|l]ist)$``
* Must have exactly one input member that targets either a list shape (with
list member targeting a structure of two string members representing the
tag key and tag value) or a map shape with string keys and values. This
member name must match: ``^[T|t]ag(s|s?[M|m]ap|[L|l]ist)$`` (e.g., ``tags``,
``TagList``, ``tagMap``, ``tagsMap``).

The following snippet is a valid definition of a tag resource operation and
its input:
Expand Down Expand Up @@ -1416,10 +1417,11 @@ resource.
* Must have exactly one input member that targets a string shape and has a
member name that matches: ``^([R|r]esource)?([A|a]rn|ARN)$`` to accept
the resource ARN.
* Must have exactly one output member that targets a list shape, with list
member targeting a structure that consists of two members that target a
string shape representing the tag key or name and the tag value. This
member name must match: ``^[T|t]ag(s|[L|l]ist)$``
* Must have exactly one output member that targets either a list shape (with
list member targeting a structure of two string members representing the
tag key and tag value) or a map shape with string keys and values. This
member name must match: ``^[T|t]ag(s|s?[M|m]ap|[L|l]ist)$`` (e.g., ``tags``,
``TagList``, ``tagMap``, ``tagsMap``).

The following snippet is an example of the list tags for resource operation and
its input:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class TaggingShapeUtils {
static final String LIST_TAGS_OPNAME = "ListTagsForResource";

private static final Pattern TAG_PROPERTY_REGEX = Pattern
.compile("^[T|t]ag(s|[L|l]ist)$");
.compile("^[T|t]ag(s|s?[M|m]ap|[L|l]ist)$");
private static final Pattern RESOURCE_ARN_REGEX = Pattern
.compile("^([R|r]esource)?([A|a]rn|ARN)?$");
private static final Pattern TAG_KEYS_REGEX = Pattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,39 @@ public static List<Arguments> arnMembers() {
public void isArnMemberDesiredName(String arnMember, boolean expected) {
assertEquals(expected, TaggingShapeUtils.isArnMemberDesiredName(arnMember));
}

public static List<Arguments> tagMembers() {
return ListUtils.of(
// accepted plural / list forms (existing)
Arguments.of("Tags", true),
Arguments.of("tags", true),
Arguments.of("TagList", true),
Arguments.of("tagList", true),
Arguments.of("Taglist", true),
Arguments.of("taglist", true),
// accepted map forms (new)
Arguments.of("TagMap", true),
Arguments.of("tagMap", true),
Arguments.of("Tagmap", true),
Arguments.of("tagmap", true),
Arguments.of("TagsMap", true),
Arguments.of("tagsMap", true),
Arguments.of("Tagsmap", true),
Arguments.of("tagsmap", true),
// rejected
Arguments.of("", false),
Arguments.of("Tag", false),
Arguments.of("tag", false),
Arguments.of("Tagger", false),
Arguments.of("tagging", false),
Arguments.of("mytags", false),
Arguments.of("Maptag", false),
Arguments.of("Maps", false));
}

@ParameterizedTest
@MethodSource("tagMembers")
public void isTagDesiredName(String memberName, boolean expected) {
assertEquals(expected, TaggingShapeUtils.isTagDesiredName(memberName));
}
}
Loading