Light, fluffy, and always free - The AWS Local Emulator alternative
fix(iam): check a create's tags on its own and its tagging action (#6452)
Priamo Germosen64f4f9e48966
diff --git a/.github/workflows/iam-data-drift.yml b/.github/workflows/iam-data-drift.ymlindex a2ddee2647..52cc1c32b5 100644--- a/.github/workflows/iam-data-drift.yml+++ b/.github/workflows/iam-data-drift.yml@@ -1,9 +1,10 @@name: IAM Data Drift-# Checks the four vendored files that come from AWS's live service reference rather than from a+# Checks the five vendored files that come from AWS's live service reference rather than from a# pinned dependency: the IAM service namespace list, the map of which resource each IAM action is-# authorized against, the map of operations AWS authorizes as an action of another name, and the-# table of the operations that pass a role and the services they pass it to. That+# authorized against, the map of operations AWS authorizes as an action of another name, the+# table of the operations that pass a role and the services they pass it to, and the table of the+# tagging actions operations that tag what they create need. That# needs the live service reference index, so unlike every other check here it can# fail without anything in the repository having changed: an AWS outage, or a namespace AWS has# retired. It therefore runs on its own, never as part of a job that ordinary changes trigger.@@ -40,6 +41,9 @@ on:- 'src/main/resources/aws/iam-passed-roles.json'- 'tools/aws/regen_iam_passed_roles.py'- 'tools/aws/test_regen_iam_passed_roles.py'+ - 'src/main/resources/aws/iam-tag-on-create.json'+ - 'tools/aws/regen_iam_tag_on_create.py'+ - 'tools/aws/test_regen_iam_tag_on_create.py'- '.github/workflows/iam-data-drift.yml'schedule:# Mondays at 06:00 UTC, before the working week rather than during it.diff --git a/Makefile b/Makefileindex d3f5676475..edbac2a7f2 100644--- a/Makefile+++ b/Makefile@@ -65,7 +65,8 @@ PREFIX ?= $(HOME)/.localiam-action-resources-test iam-authorized-actions-sync iam-authorized-actions-check \cfn-property-types-sync cfn-property-types-check cfn-property-types-verify cfn-property-types-test \iam-authorized-actions-verify iam-authorized-actions-test iam-passed-roles-sync iam-passed-roles-check \- iam-passed-roles-verify iam-passed-roles-test iam-data-verify+ iam-passed-roles-verify iam-passed-roles-test iam-tag-on-create-sync iam-tag-on-create-check \+ iam-tag-on-create-verify iam-tag-on-create-test iam-data-verifyhelp: ## List the targets below@grep -hE '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-14s %s\n", $$1, $$2}'@@ -307,6 +308,7 @@ aws-data-check: ## CI gate: the vendored AWS data must match a fresh generationexit 1; \}@$(MAKE) --no-print-directory iam-passed-roles-check+ @$(MAKE) --no-print-directory iam-tag-on-create-checkaws-data-test: ## Run the AWS data generators' unit tests$(PYTHON) -m pytest tools/aws -q@@ -367,12 +369,14 @@ iam-data-verify: ## CI gate (online): every vendored IAM file must still match A@# Both halves run even when the first fails, so one file's drift cannot hide the other's@# state. Sequential steps in CI stop at the first failure, which once left the action@# resource gate unexercised while the namespace list was stale.- @namespaces=0; actions=0; authorized=0; passed=0; \+ @namespaces=0; actions=0; authorized=0; passed=0; tagged=0; \$(MAKE) --no-print-directory iam-namespaces-verify || namespaces=$$?; \$(MAKE) --no-print-directory iam-action-resources-verify || actions=$$?; \$(MAKE) --no-print-directory iam-authorized-actions-verify || authorized=$$?; \$(MAKE) --no-print-directory iam-passed-roles-verify || passed=$$?; \- if [ $$namespaces -ne 0 ] || [ $$actions -ne 0 ] || [ $$authorized -ne 0 ] || [ $$passed -ne 0 ]; then \+ $(MAKE) --no-print-directory iam-tag-on-create-verify || tagged=$$?; \+ if [ $$namespaces -ne 0 ] || [ $$actions -ne 0 ] || [ $$authorized -ne 0 ] || [ $$passed -ne 0 ] \+ || [ $$tagged -ne 0 ]; then \echo ""; \echo "error: vendored IAM data does not match upstream:"; \if [ $$namespaces -ne 0 ]; then \@@ -387,6 +391,9 @@ iam-data-verify: ## CI gate (online): every vendored IAM file must still match Aif [ $$passed -ne 0 ]; then \echo " the table of the roles operations pass, see its message above"; \fi; \+ if [ $$tagged -ne 0 ]; then \+ echo " the table of the tagging actions creates need, see its message above"; \+ fi; \exit 1; \fi@@ -448,6 +455,33 @@ iam-passed-roles-verify: ## CI gate (online): every vendored operation must stiliam-passed-roles-test: ## Run the IAM passed role generator's unit tests$(PYTHON) -m pytest tools/aws/test_regen_iam_passed_roles.py -q+iam-tag-on-create-sync: ## Regenerate src/main/resources/aws/iam-tag-on-create.json from AWS and botocore (commit the result)+ $(PYTHON) tools/aws/regen_iam_tag_on_create.py++iam-tag-on-create-check: ## CI gate (offline): every vendored tag member must be what the pinned botocore gives+ @$(PYTHON) tools/aws/regen_iam_tag_on_create.py --check || { \+ echo ""; \+ echo "error: src/main/resources/aws/iam-tag-on-create.json is malformed or out of date."; \+ echo " Run 'make iam-tag-on-create-sync' and commit the result."; \+ exit 1; \+ }++iam-tag-on-create-verify: ## CI gate (online): every vendored operation must still need its tagging action as AWS says+ @$(PYTHON) tools/aws/regen_iam_tag_on_create.py --verify; status=$$?; \+ if [ $$status -eq 2 ]; then \+ echo ""; \+ echo "error: could not reach AWS's service reference, so nothing was verified."; \+ exit 1; \+ elif [ $$status -ne 0 ]; then \+ echo ""; \+ echo "error: the vendored table checks a tagging action for an operation AWS does not check it for."; \+ echo " Run 'make iam-tag-on-create-sync' and commit the result."; \+ exit 1; \+ fi++iam-tag-on-create-test: ## Run the IAM tag-on-create generator's unit tests+ $(PYTHON) -m pytest tools/aws/test_regen_iam_tag_on_create.py -q+cfn-property-types-sync: ## Regenerate src/main/resources/aws/cfn-property-types.json from AWS's resource schemas (commit the result)$(PYTHON) tools/aws/regen_cfn_property_types.pydiff --git a/docs/services/iam.md b/docs/services/iam.mdindex 0314bbb473..c73fe05883 100644--- a/docs/services/iam.md+++ b/docs/services/iam.md@@ -1704,6 +1704,61 @@ when the caller may not pass the role.REST services whose routes no rule maps yet, and API Gateway, which is authorized by HTTP method,are not read either.+A request that tags the resource it creates also needs the service's tagging action. The SNS API+reference has "To be able to tag a topic on creation, you must have the sns:CreateTopic and+sns:TagResource permissions.", and the EC2 user guide "If tags are specified in the resource-creating+action, Amazon performs additional authorization on the ec2:CreateTags action to verify if users have+permissions to create tags." Every operation the Service Reference lists with an action that only+tags and adds tags (`TagResource`, `CreateTags`, `AddTags`, `AddTagsToResource`, SQS's `TagQueue`,+IAM's `TagRole`, STS's `TagSession` and the like), in the services Floci serves over the JSON and+Query protocols and Smithy RPC v2 CBOR and in the REST services whose routes are authorized as+operations, is checked from a second table generated the same way,+`src/main/resources/aws/iam-tag-on-create.json`.+When the request carries tags, the tagging action is checked for each resource's tags apart, with+each tag as `aws:RequestTag/<key>` and their keys as `aws:TagKeys`, so a policy that allows tagging+only with some tags or keys holds at creation too. A tag specification's tags are checked on the+resource of the type it names, its name not known yet, as AWS checks them on the resource being+tagged: an instance's on `arn:aws:ec2:<Region>:<account>:instance/*`, from the ARN the Service+Reference gives the type. Other tags are checked on the resources the operation itself is checked+on: Lambda's `CreateFunction` is checked on the function its body names, in the caller's account and+Region, as the Service Reference gives it the `function` resource, so a function's tags are checked+there too. Where the tagging action takes+its namespace's `CreateAction` key, as `ec2:CreateTags`, `ecs:TagResource`, CloudFormation's+`TagResource` and Elastic Load Balancing's `AddTags` do, the key is the operation's name:+`ec2:CreateAction` is `RunInstances` for an instance launched with tags. The operation's own action+is checked with the same `aws:RequestTag/<key>` and `aws:TagKeys`, once for each resource's tags,+wherever the Service Reference lists those keys for it or for a resource it acts on, which it does for 542 of the operations read, so+"allow `sqs:CreateQueue` only with `aws:RequestTag/team`" and "deny it when `aws:RequestTag/team` is+null" hold as on AWS; keys a service's own condition keys already give, as EC2's `RunInstances`+does, are kept. It is checked once for each reading of the tags and refused if any is denied: the+sets its handler reads, those under any other spelling (below), and none where its handler reads+none, so a deny on a tag holds whichever reading a handler applies, and a create that requires a tag+gets it only where its handler applies it. A request that carries no tags needs only its own action.+As with passed roles, an operation Floci does not serve is in the table too.+- The tags are read from a top-level request member named `Tags`, `TagList`, `TagSpecifications` or+ the like that holds a tag list or map, as the Floci handler that applies them reads it, so the check+ sees the tags the resource gets. A JSON or CBOR body's member is read under its own name, and an+ alarm's in CloudWatch's `PutMetricAlarm` and `PutCompositeAlarm` under `tags` too; a CodeDeploy+ tag's key and value as `Key` and `Value`, or `key` and `value`, as its handler takes either, each as+ text whatever it holds (a key `123` is the tag `123`). Query form+ parameters are read under the spelling the SDK sends, from 1 to the first number with no key, and+ under the further spellings the RDS, DocumentDB, Neptune, ElastiCache and Redshift handlers read.+ EC2's are read from every tag specification, under `TagSpecification` or `TagSpecifications`, as EC2+ applies either, to the first that names no resource type. SQS's are read from `Tag.N.Key` and+ `Tag.N.Value` over the Query protocol. The tagging action is also checked for tags under any other+ spelling a handler might read, a member or a tag's key and value in any case, every element of a+ tag list and an object's structures, a form's list under any spelling and every number, so none a+ handler applies goes unchecked. CodeDeploy's handler iterates its tags member whatever it holds,+ so an object's structures are its tags too.+- CloudWatch Logs `CreateLogGroup`, which takes either of two tagging actions, is checked as described+ under CloudWatch Logs groups below.+- Not read: an operation whose request carries no tags, which the Service Reference lists with a+ tagging action all the same (RDS `DeleteDBInstance` and DynamoDB `UpdateTable`, among others), and+ EC2's `RequestSpotFleet`, whose tags are deeper in its configuration. A session's tags also need+ `sts:TagSession` in the role's trust policy, which is not checked, and service-specific request tag+ keys such as `rds:req-tag/<key>` are not set. S3 checks `s3:PutObjectTagging` for an object it+ creates with tags itself, and the REST services whose routes no rule maps yet are not read.+A request that names its operation, in a Query `Action`, an `X-Amz-Target` header or a Smithy RPC v2path (`/service/<service>/operation/<operation>`), is authorized as the action AWS checks for thatoperation, which is usually the operation's own name. An RPC v2 call is checked as the service and@@ -2028,7 +2083,8 @@ floci populates:- `s3:prefix`, `s3:delimiter`, `s3:max-keys`: from the S3 request parameters.- `aws:RequestTag/<key>`: the tags named in the request itself, before they are applied, for`ec2:RunInstances` (`TagSpecification.N`), `ec2:CreateTags` (`Tag.N`) and- `s3:PutBucketTagging` (the `<Tagging>` body).+ `s3:PutBucketTagging` (the `<Tagging>` body), and for every create in the tag-on-create table+ whose action takes it, as described under the tag-on-create check above.- `aws:ResourceTag/<key>`: the target resource's current tags, for `ec2:CreateTags`,`ec2:DeleteTags`, `ec2:TerminateInstances` and `ec2:DescribeInstances` (the first`ResourceId.N` or `InstanceId.N`), and for `s3:GetBucketTagging`, `s3:DeleteBucket` and the@@ -2103,7 +2159,8 @@ floci populates:cannot match: an absent key has no equal or like value. That absence is the enforcement ratherthan a gap in it.- `aws:TagKeys`: the case-sensitive requested tag keys for EC2 `RunInstances` and- `CreateTags`, and S3 `PutBucketTagging`. `ForAllValues:StringEquals` can restrict the+ `CreateTags`, S3 `PutBucketTagging`, and every create in the tag-on-create table whose action+ takes it. `ForAllValues:StringEquals` can restrict thecomplete requested set without a `Null` guard; no tags still means absent context.- `dynamodb:LeadingKeys`, `dynamodb:Attributes`, `dynamodb:Select`: from the DynamoDB requestbody, for `GetItem`, `PutItem`, `UpdateItem`, `DeleteItem`, `Query`, `BatchGetItem` anddiff --git a/src/main/java/io/github/hectorvent/floci/core/common/IamEnforcementFilter.java b/src/main/java/io/github/hectorvent/floci/core/common/IamEnforcementFilter.javaindex 7d834c6cb9..28cc5193d2 100644--- a/src/main/java/io/github/hectorvent/floci/core/common/IamEnforcementFilter.java+++ b/src/main/java/io/github/hectorvent/floci/core/common/IamEnforcementFilter.java@@ -501,12 +501,16 @@ public class IamEnforcementFilter implements ContainerRequestFilter {conditionContext = conditionContext == null ? new HashMap<>() : new HashMap<>(conditionContext);callerArns.get().putPrincipalKeys(conditionContext);}- List<Map<String, List<String>>> targetContexts = new ArrayList<>();- targetContexts.add(conditionContext);+ // A create that carries tags is checked with them where its own action takes them, as the tagging+ // action it also needs is (see TagOnCreate); keys the service's own resolver gives are kept.+ Optional<TagOnCreate.Tagging> tagOnCreate = TagOnCreate.of(resolvedAuthorization.operation(), ctx);+ List<Map<String, List<String>>> requestTags = tagOnCreate.filter(TagOnCreate.Tagging::requestTags)+ .map(TagOnCreate::requestTagContexts).orElse(List.of());+ List<Map<String, List<String>>> targetContexts = withRequestTags(conditionContext, requestTags);for (Map<String, List<String>> target : remainingTargets) {Map<String, List<String>> targetContext = new HashMap<>(target);callerArns.ifPresent(arns -> arns.putPrincipalKeys(targetContext));- targetContexts.add(targetContext);+ targetContexts.addAll(withRequestTags(targetContext, requestTags));}RequestPrincipal principal = RequestPrincipal.caller(callerArns.orElse(null));@@ -534,6 +538,11 @@ public class IamEnforcementFilter implements ContainerRequestFilter {region, accountId, akid)) {return;}+ if (tagOnCreate.isPresent() && abortIfTagOnCreateDenied(ctx, caller, principal, callerArns.orElse(null),+ action, resolvedAuthorization.operation(), tagOnCreate.get(), credentialScope, resources, region,+ accountId, akid)) {+ return;+ }// Tagged group creation requires either tagging permission, using the same resolved// caller (including session, boundary and SCP ceilings) as the primary operation.@@ -733,7 +742,7 @@ public class IamEnforcementFilter implements ContainerRequestFilter {.map(descriptor -> iamServiceScope(descriptor, claimedScope)).orElseGet(() -> catalog.canonicalCredentialScope(service));return new ResolvedAuthorization(servingScope,- IamAuthorizedActions.actionFor(servingScope, queryAction));+ IamAuthorizedActions.actionFor(servingScope, queryAction), servingScope + ":" + queryAction);}// Read from the route rather than the claim: a path the claim filter takes for RPC v2 can@@ -745,7 +754,8 @@ public class IamEnforcementFilter implements ContainerRequestFilter {}String servingScope = iamServiceScope(rpcV2Route.service(), claimedScope);return new ResolvedAuthorization(servingScope,- actionRegistry.resolveOperation(servingScope, rpcV2Route.operation(), ctx));+ actionRegistry.resolveOperation(servingScope, rpcV2Route.operation(), ctx),+ servingScope + ":" + rpcV2Route.operation());}ResolvedAuthorization routeAuthorization = restRouteAuthorization(ctx);@@ -756,9 +766,13 @@ public class IamEnforcementFilter implements ContainerRequestFilter {// A REST request is authorized by its route alone, never by an X-Amz-Target it carries.boolean rest = claimValue instanceof ProtocolClaim claim && claim.protocol() == WireProtocol.REST;String servingScope = servingCredentialScope(claimedScope, ctx);- return new ResolvedAuthorization(servingScope, rest- ? actionRegistry.resolveRoute(servingScope, ctx)- : actionRegistry.resolve(servingScope, ctx));+ if (rest) {+ return new ResolvedAuthorization(servingScope, actionRegistry.resolveRoute(servingScope, ctx));+ }+ String targetOperation = IamActionRegistry.targetOperation(ctx);+ String action = actionRegistry.resolve(servingScope, ctx);+ return targetOperation == null ? new ResolvedAuthorization(servingScope, action)+ : new ResolvedAuthorization(servingScope, action, servingScope + ":" + targetOperation);}/**@@ -896,7 +910,15 @@ public class IamEnforcementFilter implements ContainerRequestFilter {.orElse(null);}- private record ResolvedAuthorization(String credentialScope, String action) {+ /**+ * The scope and action a request is authorized as, and the operation it calls as+ * {@code <namespace>:<Operation>}, which differs from the action for one AWS authorizes under another name.+ * A REST route maps straight to its action, which names the operation.+ */+ private record ResolvedAuthorization(String credentialScope, String action, String operation) {+ ResolvedAuthorization(String credentialScope, String action) {+ this(credentialScope, action, action);+ }}/** Floci's account-root principal, which is both the caller and the request's aws:PrincipalArn. */@@ -933,6 +955,52 @@ public class IamEnforcementFilter implements ContainerRequestFilter {return false;}+ /**+ * The context once for each set of tags the request carries, with that set's keys where the context has+ * none of its own, so each resource's tags are checked apart; the context alone when it carries none.+ */+ private static List<Map<String, List<String>>> withRequestTags(Map<String, List<String>> context,+ List<Map<String, List<String>>> requestTags) {+ List<Map<String, List<String>>> contexts = new ArrayList<>();+ if (requestTags.isEmpty()) {+ contexts.add(context);+ }+ for (Map<String, List<String>> tags : requestTags) {+ Map<String, List<String>> withTags = context == null ? new HashMap<>() : new HashMap<>(context);+ tags.forEach(withTags::putIfAbsent);+ contexts.add(withTags);+ }+ return contexts;+ }++ /**+ * A request that tags what it creates also needs the service's tagging action (see {@link TagOnCreate}),+ * checked as the caller for each set of tags, under any spelling a handler might read: on the resource a+ * tag specification names, else on the+ * resources the operation is checked on, with the set's tags as {@code aws:RequestTag/<key>} and+ * {@code aws:TagKeys}, the operation as the namespace's {@code CreateAction} key where the tagging action+ * takes one, and the keys that say who is calling. Returns true when the request was aborted.+ */+ private boolean abortIfTagOnCreateDenied(ContainerRequestContext ctx, CallerContext caller,+ RequestPrincipal principal, CallerArns callerArns, String action,+ String operation, TagOnCreate.Tagging tagging,+ String credentialScope, List<String> resources,+ String region, String accountId, String akid) {+ for (TagOnCreate.TagSet set : tagging.checked()) {+ Map<String, List<String>> context = TagOnCreate.conditionContext(tagging, set, operation);+ if (callerArns != null) {+ callerArns.putPrincipalKeys(context);+ }+ List<String> tagged = TagOnCreate.resources(operation, set, requestPartition(), region, accountId,+ resources);+ if (abortIfDenied(ctx, caller, principal, tagging.action(), action, credentialScope, tagged,+ List.of(context), region, accountId, akid)) {+ return true;+ }+ }+ return false;+ }+/** What {@link PassedRoles} looks up, in the request's account and Region. */private PassedRoles.Lookups lookupsFor(String accountId, String region) {return new PassedRoles.Lookups() {diff --git a/src/main/java/io/github/hectorvent/floci/core/common/PassedRoleMembers.java b/src/main/java/io/github/hectorvent/floci/core/common/PassedRoleMembers.javaindex 89666db8b9..6d873cfaa1 100644--- a/src/main/java/io/github/hectorvent/floci/core/common/PassedRoleMembers.java+++ b/src/main/java/io/github/hectorvent/floci/core/common/PassedRoleMembers.java@@ -112,20 +112,29 @@ final class PassedRoleMembers {private static Member member(String operation, JsonNode role) {String path = role.path("member").asText("");+ List<Step> steps = steps(path);+ if (steps == null) {+ throw new IllegalStateException(RESOURCE_NAME + " reads " + operation + " at " + path+ + ", which is no member path");+ }+ String passedTo = role.hasNonNull("passedTo") ? role.get("passedTo").asText() : null;+ return new Member(path, steps, queryKeys(steps), passedTo, role.path("byName").asBoolean(false));+ }++ /** The steps of a vendored member path; null when {@code path} is none. */+ static List<Step> steps(String path) {List<Step> steps = new ArrayList<>();for (String step : path.split("\\.", -1)) {Matcher matcher = STEP.matcher(step);if (!matcher.matches()) {- throw new IllegalStateException(RESOURCE_NAME + " reads " + operation + " at " + path- + ", which is no member path");+ return null;}Into into = matcher.group(2) != null ? Into.LIST : matcher.group(3) == null ? Into.NONE: matcher.group(3).isEmpty() ? Into.MAP : Into.KEY;String key = into == Into.LIST ? matcher.group(2) : into == Into.KEY ? matcher.group(3) : null;steps.add(new Step(matcher.group(1), into, key));}- String passedTo = role.hasNonNull("passedTo") ? role.get("passedTo").asText() : null;- return new Member(path, List.copyOf(steps), queryKeys(steps), passedTo, role.path("byName").asBoolean(false));+ return List.copyOf(steps);}/**diff --git a/src/main/java/io/github/hectorvent/floci/core/common/PassedRoles.java b/src/main/java/io/github/hectorvent/floci/core/common/PassedRoles.javaindex 8d3fd41da9..9b11769c4b 100644--- a/src/main/java/io/github/hectorvent/floci/core/common/PassedRoles.java+++ b/src/main/java/io/github/hectorvent/floci/core/common/PassedRoles.java@@ -888,7 +888,7 @@ final class PassedRoles {* A gzip-encoded body is decompressed first, as {@code AwsJsonCborController} decompresses it before* running the request.*/- private static JsonNode jsonBody(ContainerRequestContext ctx) {+ static JsonNode jsonBody(ContainerRequestContext ctx) {if (ctx.getProperty(IamConditionContextResolver.BUFFERED_JSON_BODY) instanceof JsonNode cached) {return cached;}diff --git a/src/main/java/io/github/hectorvent/floci/core/common/TagOnCreate.java b/src/main/java/io/github/hectorvent/floci/core/common/TagOnCreate.javanew file mode 100644index 0000000000..0438fa0c23--- /dev/null+++ b/src/main/java/io/github/hectorvent/floci/core/common/TagOnCreate.java@@ -0,0 +1,507 @@+package io.github.hectorvent.floci.core.common;++import com.fasterxml.jackson.databind.JsonNode;+import jakarta.ws.rs.container.ContainerRequestContext;++import java.util.ArrayList;+import java.util.Collections;+import java.util.HashMap;+import java.util.LinkedHashMap;+import java.util.LinkedHashSet;+import java.util.List;+import java.util.Locale;+import java.util.Map;+import java.util.Objects;+import java.util.Optional;+import java.util.Set;+import java.util.regex.Matcher;+import java.util.regex.Pattern;++/**+ * The tagging action a request that tags what it creates also needs, and the tags it attaches.+ *+ * <p>AWS checks the service's tagging action as well as the operation's own when the request carries+ * tags: the SNS API reference has "To be able to tag a topic on creation, you must have the+ * {@code sns:CreateTopic} and {@code sns:TagResource} permissions." Which action each operation needs and+ * where its request carries the tags come from {@link TagOnCreateMembers}, generated from AWS's Service+ * Reference and botocore. The operation's own action is checked with the tags too, where the Service+ * Reference lists {@code aws:RequestTag} or {@code aws:TagKeys} for it. The operations in {@link #BY_HAND}+ * need one of several tagging actions, and {@code IamEnforcementFilter} checks them itself.+ *+ * <p>The tags are read as the Floci handler that applies them reads them, so the check sees the tags the+ * resource gets: a form's tag list from 1 to the first number with no key, under the spellings the+ * handler reads, and a body's member under its own name. Each resource's tags are a set of their own,+ * checked apart: a member's, or a tag specification's for each type of resource it names.+ */+final class TagOnCreate {++ /** Operations the enforcement filter checks itself: CloudWatch Logs takes either of two tagging actions. */+ static final Set<String> BY_HAND = Set.of("logs:CreateLogGroup");++ /** CloudWatch's handler reads an alarm's tags from {@code tags} when the body has no {@code Tags}. */+ private static final Set<String> LOWER_CASE_TAGS = Set.of("cloudwatch:PutMetricAlarm", "cloudwatch:PutCompositeAlarm");++ /**+ * CodeDeploy's handler reads a tag as {@code Key} and {@code Value}, or as {@code key} and {@code value} when it+ * has no {@code Key}.+ */+ private static final Set<String> EITHER_CASE_TAGS = Set.of("codedeploy");++ /**+ * The tags one resource gets, and the type of that resource where a tag specification names it, else null.+ */+ record TagSet(String resourceType, Map<String, String> tags) {+ }++ /**+ * The tagging action a request needs, each set of tags it attaches as its handler reads them, the further+ * sets it carries under spellings another handler might read, whether the action takes the CreateAction key,+ * and whether the operation's own action takes the tags as well.+ */+ record Tagging(String action, List<TagSet> sets, List<TagSet> otherSpellings, boolean createAction,+ boolean requestTags) {++ /** Every set the tagging action is checked for, so no tag a handler might apply goes unchecked. */+ List<TagSet> checked() {+ List<TagSet> checked = new ArrayList<>(sets);+ checked.addAll(otherSpellings);+ return checked;+ }+ }++ /**+ * How a Floci Query handler numbers a tag list: from 1 to the first number with no key, every number there+ * is, or from 1 to the first number at which none of the prefixes has a key or a value.+ */+ private enum Numbering { TO_FIRST_GAP, EVERY, EITHER_AT_EACH }++ /** The prefixes a handler numbers a tag list under, in the order it reads them, and its tags' key and value. */+ private record Reading(List<String> prefixes, Numbering numbering, String key, String value) {+ }++ private TagOnCreate() {+ }++ /**+ * What a request for {@code operation}, as {@code <namespace>:<Operation>}, needs to tag what it creates:+ * empty when the table does not read the operation or the request carries no tags. A tag's key given+ * twice keeps its last value, as the services keep it.+ */+ static Optional<Tagging> of(String operation, ContainerRequestContext ctx) {+ TagOnCreateMembers.Entry entry = TagOnCreateMembers.of(operation);+ if (entry == null) {+ return Optional.empty();+ }+ Map<String, String> form = IamConditionContextResolver.formParameters(ctx);+ JsonNode body = form.isEmpty() ? PassedRoles.jsonBody(ctx) : null;+ Set<TagSet> sets = new LinkedHashSet<>();+ Set<TagSet> otherSpellings = new LinkedHashSet<>();+ for (TagOnCreateMembers.Member member : entry.members()) {+ if (!form.isEmpty()) {+ if (member.inForm()) {+ sets.addAll(fromForm(form, operation, member));+ }+ otherSpellings.addAll(anySpellingInForm(form, member));+ } else if (body != null && body.isObject()) {+ Map<String, Map<String, String>> byType = new LinkedHashMap<>();+ collect(topLevel(body, operation, member.steps().getFirst().name()), member,+ EITHER_CASE_TAGS.contains(operation.substring(0, operation.indexOf(':'))), 0, null, byType);+ byType.forEach((type, tags) -> add(sets, type, tags));+ otherSpellings.addAll(anySpellingInBody(body, member));+ }+ }+ // A set already in one the handler reads, of the same resource type, adds nothing to check.+ otherSpellings.removeIf(other -> sets.stream().anyMatch(set -> Objects.equals(set.resourceType(),+ other.resourceType()) && set.tags().entrySet().containsAll(other.tags().entrySet())));+ return sets.isEmpty() && otherSpellings.isEmpty() ? Optional.empty()+ : Optional.of(new Tagging(entry.tagging(), List.copyOf(sets), List.copyOf(otherSpellings),+ entry.createAction(), entry.requestTags()));+ }++ /**+ * The tags a form carries at the member under any spelling a handler might read: its names in any case and+ * a trailing {@code s} dropped, any one word between a list's name and its numbers, every number, and the+ * tag's key and value in any case. One set for each spelling, and for a tag specification each resource type.+ */+ private static List<TagSet> anySpellingInForm(Map<String, String> form, TagOnCreateMembers.Member member) {+ List<PassedRoleMembers.Step> steps = member.querySteps();+ if (!member.inForm()) {+ return List.of();+ }+ String key = member.key() == null ? "key" : member.key();+ String value = member.value() == null ? "value" : member.value();+ String list = "(?:\\.[A-Za-z]+)?\\.\\d+";+ Pattern name = Pattern.compile(steps.size() == 1+ ? "(?<tag>(?<spelling>" + anyCase(steps.getFirst().name()) + "(?:\\.[A-Za-z]+)?)\\.\\d+)\\.(?<field>(?i:"+ + Pattern.quote(key) + "|" + Pattern.quote(value) + "))"+ : "(?<tag>(?<specification>" + anyCase(steps.getFirst().name()) + list + ")\\.(?<spelling>"+ + anyCase(steps.get(1).name()) + "(?:\\.[A-Za-z]+)?)\\.\\d+)\\.(?<field>(?i:"+ + Pattern.quote(key) + "|" + Pattern.quote(value) + "))");+ Map<String, Map<String, String>> sets = new LinkedHashMap<>();+ Map<String, String[]> tags = new LinkedHashMap<>();+ Map<String, String> setOfTag = new HashMap<>();+ form.forEach((parameter, given) -> {+ Matcher matcher = name.matcher(parameter);+ if (!matcher.matches()) {+ return;+ }+ String set = matcher.group("spelling").toLowerCase(Locale.ROOT);+ if (steps.size() == 2) {+ String specification = matcher.group("specification");+ String type = member.resourceType() == null ? null : form.entrySet().stream()+ .filter(e -> e.getKey().equalsIgnoreCase(specification + "." + member.resourceType()))+ .map(Map.Entry::getValue).findFirst().orElse(null);+ set = specification.replaceAll("\\.\\d+$", "").toLowerCase(Locale.ROOT) + "|" + set + "|" + type;+ }+ String tag = matcher.group("tag").toLowerCase(Locale.ROOT);+ setOfTag.put(tag, set);+ tags.computeIfAbsent(tag, ignored -> new String[2])[matcher.group("field").equalsIgnoreCase(key) ? 0 : 1] = given;+ });+ tags.forEach((tag, pair) -> {+ if (pair[0] != null) {+ sets.computeIfAbsent(setOfTag.get(tag), ignored -> new LinkedHashMap<>())+ .put(pair[0], pair[1] == null ? "" : pair[1]);+ }+ });+ List<TagSet> found = new ArrayList<>();+ sets.forEach((set, read) -> {+ String type = steps.size() == 2 ? set.substring(set.lastIndexOf('|') + 1) : null;+ found.add(new TagSet("null".equals(type) ? null : type, Collections.unmodifiableMap(read)));+ });+ return found;+ }++ /** The name in any case, and without a trailing {@code s} too, as {@code Tag.N} stands for {@code Tags}. */+ private static String anyCase(String name) {+ String stem = name.endsWith("s") ? name.substring(0, name.length() - 1) : name;+ return "(?i:" + Pattern.quote(name) + (stem.equals(name) ? "" : "|" + Pattern.quote(stem)) + ")";+ }++ /**+ * The tags a body carries at the member under any spelling a handler might read: its names, and a tag's+ * key and value, in any case, and a list or a map whichever the member is. One set for each top-level+ * spelling, and for a tag specification each resource type.+ */+ private static List<TagSet> anySpellingInBody(JsonNode body, TagOnCreateMembers.Member member) {+ List<TagSet> found = new ArrayList<>();+ body.properties().forEach(top -> {+ if (!top.getKey().equalsIgnoreCase(member.steps().getFirst().name())) {+ return;+ }+ Map<String, Map<String, String>> byType = new LinkedHashMap<>();+ anySpelling(top.getValue(), member, 0, null, byType);+ byType.forEach((type, tags) -> {+ if (!tags.isEmpty()) {+ found.add(new TagSet(type, Collections.unmodifiableMap(tags)));+ }+ });+ });+ return found;+ }++ private static void anySpelling(JsonNode value, TagOnCreateMembers.Member member, int index, String type,+ Map<String, Map<String, String>> byType) {+ List<PassedRoleMembers.Step> steps = member.steps();+ if (value == null) {+ return;+ }+ if (index == steps.size() - 1) {+ Map<String, String> tags = byType.computeIfAbsent(type, ignored -> new LinkedHashMap<>());+ // Every element is a tag, its key as text whatever it holds and a missing one empty, as a handler that+ // reads it with asText takes it; an object's values that are structures are elements too, as a handler+ // iterating it reads them, and its members are a map's tags.+ for (JsonNode tag : value) {+ if (value.isObject() && !tag.isObject()) {+ continue;+ }+ JsonNode key = field(tag, member.key() == null ? "key" : member.key());+ tags.put(key == null || key.isNull() ? "" : key.asText(),+ text(field(tag, member.value() == null ? "value" : member.value())));+ }+ if (value.isObject()) {+ value.properties().forEach(tag -> tags.put(tag.getKey(), tag.getValue().isNull() ? ""+ : tag.getValue().asText()));+ }+ return;+ }+ String next = steps.get(index + 1).name();+ if (value.isArray()) {+ for (JsonNode element : value) {+ JsonNode kind = member.resourceType() == null ? null : field(element, member.resourceType());+ anySpelling(field(element, next), member, index + 1,+ kind != null && kind.isTextual() ? kind.asText() : type, byType);+ }+ } else if (value.isObject()) {+ anySpelling(field(step(value, steps.get(index)), next), member, index + 1, type, byType);+ }+ }++ /** A structure under a step that names a map's key, or the structure itself. */+ private static JsonNode step(JsonNode value, PassedRoleMembers.Step step) {+ return step.into() == PassedRoleMembers.Into.KEY ? field(value, step.key()) : value;+ }++ /** A tag's value as text, empty when it has none. */+ private static String text(JsonNode value) {+ return value == null || value.isNull() ? "" : value.asText();+ }++ /** The object's member {@code name} in any case; null for no such member, or no object. */+ private static JsonNode field(JsonNode node, String name) {+ if (node == null || !node.isObject()) {+ return null;+ }+ JsonNode exact = node.get(name);+ return exact != null ? exact : node.propertyStream().filter(member -> member.getKey().equalsIgnoreCase(name))+ .map(Map.Entry::getValue).findFirst().orElse(null);+ }++ private static void add(Set<TagSet> sets, String type, Map<String, String> tags) {+ if (!tags.isEmpty()) {+ sets.add(new TagSet(type, Collections.unmodifiableMap(tags)));+ }+ }++ /**+ * The sets of tags a form carries at the member, as each handler that may serve the operation reads it: a+ * tag list's tags, or each tag specification's, from 1 to the first without a resource type, by its type.+ */+ private static List<TagSet> fromForm(Map<String, String> form, String operation, TagOnCreateMembers.Member member) {+ boolean ec2 = operation.startsWith("ec2:");+ List<PassedRoleMembers.Step> steps = member.querySteps();+ Set<TagSet> sets = new LinkedHashSet<>();+ for (Reading reading : readings(operation, member, ec2)) {+ if (steps.size() == 1) {+ Map<String, String> tags = new LinkedHashMap<>();+ read(form, reading, tags);+ add(sets, null, tags);+ continue;+ }+ Map<String, Map<String, String>> byType = new LinkedHashMap<>();+ for (String specifications : reading.prefixes()) {+ for (int i = 1; ; i++) {+ String specification = specifications + "." + i;+ String type = member.resourceType() == null ? null+ : form.get(specification + "." + member.resourceType());+ if (member.resourceType() != null ? type == null : noneUnder(form, specification)) {+ break;+ }+ read(form, gap(member, specification + "." + sdkPrefix(steps.get(1), ec2)),+ byType.computeIfAbsent(type, ignored -> new LinkedHashMap<>()));+ }+ }+ byType.forEach((type, tags) -> add(sets, type, tags));+ }+ return List.copyOf(sets);+ }++ /**+ * How the Floci Query handler that serves the operation reads the member's tags. Most read the SDK's own+ * spelling, from 1 to the first number with no key; these read more, each as its handler does. Several+ * handlers serve the {@code rds} namespace and read its spellings in different orders, so each order is+ * read, and each set it gives is checked.+ */+ private static List<Reading> readings(String operation, TagOnCreateMembers.Member member, boolean ec2) {+ PassedRoleMembers.Step first = member.querySteps().getFirst();+ return switch (operation.substring(0, operation.indexOf(':') + 1) + first.name()) {+ // Ec2QueryHandler.parseTagsForResource+ case "ec2:TagSpecification", "ec2:TagSpecifications" ->+ List.of(gap(member, "TagSpecification", "TagSpecifications"));+ // SqsQueryHandler+ case "sqs:Tag" -> List.of(new Reading(List.of("Tag"), Numbering.TO_FIRST_GAP, "Key", "Value"));+ // RdsQueryHandler and DocDbQueryHandler, then NeptuneQueryHandler+ case "rds:Tags" -> List.of(gap(member, "Tags.member", "Tags.Tag", "Tag"),+ gap(member, "Tags.Tag", "Tags.member", "Tag"));+ // ElastiCacheServerlessQueryHandler, else ElastiCacheQueryHandler+ case "elasticache:Tags" -> "elasticache:CreateServerlessCache".equals(operation)+ ? List.of(new Reading(List.of("Tags.Tag", "Tags.member"), Numbering.EITHER_AT_EACH,+ member.key(), member.value()))+ : List.of(gap(member, "Tags.Tag", "Tags.member", "Tag"));+ // RedshiftQueryHandler+ case "redshift:Tags" -> List.of(gap(member, "Tags.member", "Tags.Tag"));+ case "redshift:TagList" -> List.of(new Reading(List.of("TagList.Tag"), Numbering.EVERY,+ member.key(), member.value()));+ default -> List.of(gap(member, sdkPrefix(first, ec2)));+ };+ }++ private static Reading gap(TagOnCreateMembers.Member member, String... prefixes) {+ return new Reading(List.of(prefixes), Numbering.TO_FIRST_GAP,+ member.key() == null ? "key" : member.key(), member.value() == null ? "value" : member.value());+ }++ /**+ * The prefix an SDK numbers a list or a map under: EC2 numbers a list under its name, the Query protocol+ * under the name its shape gives elements, or {@code member}, and a map's entries under {@code entry}.+ */+ private static String sdkPrefix(PassedRoleMembers.Step step, boolean ec2) {+ if (step.into() == PassedRoleMembers.Into.MAP) {+ return step.name() + ".entry";+ }+ return ec2 ? step.name() : step.name() + "." + (step.key().isEmpty() ? "member" : step.key());+ }++ private static boolean noneUnder(Map<String, String> form, String prefix) {+ return form.keySet().stream().noneMatch(name -> name.startsWith(prefix + "."));+ }++ /** The tags the form numbers under the reading's prefixes, a tag with no value taking an empty one. */+ private static void read(Map<String, String> form, Reading reading, Map<String, String> tags) {+ switch (reading.numbering()) {+ case TO_FIRST_GAP -> {+ for (String prefix : reading.prefixes()) {+ for (int i = 1; ; i++) {+ String key = form.get(prefix + "." + i + "." + reading.key());+ if (key == null) {+ break;+ }+ tags.put(key, form.getOrDefault(prefix + "." + i + "." + reading.value(), ""));+ }+ }+ }+ case EVERY -> {+ for (String prefix : reading.prefixes()) {+ Pattern name = Pattern.compile(Pattern.quote(prefix) + "\\.\\d+\\." + Pattern.quote(reading.key()));+ form.forEach((parameter, key) -> {+ if (name.matcher(parameter).matches() && key != null && !key.isBlank()) {+ String stem = parameter.substring(0, parameter.length() - reading.key().length());+ tags.put(key, form.getOrDefault(stem + reading.value(), ""));+ }+ });+ }+ }+ case EITHER_AT_EACH -> {+ for (int i = 1; ; i++) {+ String key = null;+ String value = null;+ for (String prefix : reading.prefixes()) {+ key = form.get(prefix + "." + i + "." + reading.key());+ value = form.get(prefix + "." + i + "." + reading.value());+ if (key != null || value != null) {+ break;+ }+ }+ if (key == null || key.isBlank()) {+ break;+ }+ tags.put(key, value == null ? "" : value);+ }+ }+ }+ }++ /**+ * The tags a body carries at the member, by the resource type of the tag specification they are in, null+ * outside one.+ */+ private static void collect(JsonNode value, TagOnCreateMembers.Member member, boolean eitherCase, int index,+ String type, Map<String, Map<String, String>> byType) {+ List<PassedRoleMembers.Step> steps = member.steps();+ PassedRoleMembers.Step step = steps.get(index);+ if (index == steps.size() - 1) {+ Map<String, String> tags = byType.computeIfAbsent(type, ignored -> new LinkedHashMap<>());+ // CodeDeployJsonHandler iterates the member whatever it holds, which for an object is its values.+ if (step.into() == PassedRoleMembers.Into.LIST && value != null+ && (value.isArray() || eitherCase && value.isObject())) {+ for (JsonNode tag : value) {+ if (eitherCase) {+ // As CodeDeployJsonHandler reads it: as text whatever it holds, a missing key an empty one.+ boolean lower = !tag.has(member.key());+ tags.put(tag.path(lower ? member.key().toLowerCase(Locale.ROOT) : member.key()).asText(),+ tag.path(lower ? member.value().toLowerCase(Locale.ROOT) : member.value()).asText());+ continue;+ }+ JsonNode key = tag.get(member.key());+ if (key != null && key.isValueNode() && !key.isNull()) {+ tags.put(key.asText(), text(tag.get(member.value())));+ }+ }+ } else if (step.into() == PassedRoleMembers.Into.MAP && value != null && value.isObject()) {+ value.properties().forEach(tag -> tags.put(tag.getKey(), tag.getValue().isNull() ? ""+ : tag.getValue().asText()));+ }+ return;+ }+ if (value == null || !value.isContainerNode()) {+ return;+ }+ String next = steps.get(index + 1).name();+ switch (step.into()) {+ case NONE -> collect(value.get(next), member, eitherCase, index + 1, type, byType);+ case KEY -> collect(value.path(step.key()).get(next), member, eitherCase, index + 1, type, byType);+ case LIST, MAP -> {+ if (step.into() == PassedRoleMembers.Into.LIST ? value.isArray() : value.isObject()) {+ for (JsonNode element : value) {+ JsonNode kind = member.resourceType() == null ? null : element.get(member.resourceType());+ collect(element.get(next), member, eitherCase, index + 1,+ kind != null && kind.isTextual() ? kind.asText() : type, byType);+ }+ }+ }+ }+ }++ /** The body's member {@code name}, or CloudWatch's {@code tags} where its handler reads an alarm's tags from it. */+ private static JsonNode topLevel(JsonNode body, String operation, String name) {+ if (!body.has(name) && "Tags".equals(name) && LOWER_CASE_TAGS.contains(operation)) {+ return body.get("tags");+ }+ return body.get(name);+ }++ /**+ * The condition keys a set of tags is checked with on the tagging action: each tag as+ * {@code aws:RequestTag/<key>}, their keys as {@code aws:TagKeys}, and, when the tagging action takes it,+ * the operation as its namespace's {@code CreateAction} key.+ */+ static Map<String, List<String>> conditionContext(Tagging tagging, TagSet set, String operation) {+ Map<String, List<String>> context = requestTagContext(set);+ if (tagging.createAction()) {+ String namespace = tagging.action().substring(0, tagging.action().indexOf(':'));+ context.put(namespace + ":CreateAction", List.of(operation.substring(operation.indexOf(':') + 1)));+ }+ return context;+ }++ /**+ * The request's tags as condition keys, once for each reading of them: each tag as {@code aws:RequestTag/<key>}+ * and their keys as {@code aws:TagKeys}. The operation's own action is checked with each when it takes them, as+ * {@link Tagging#requestTags()} says, and refused if any is denied: the sets its handler reads, the sets under+ * any other spelling, and no tags where its handler reads none. So a deny on a tag holds whichever reading a+ * handler applies, and a create that requires a tag gets it only where the handler applies it.+ */+ static List<Map<String, List<String>>> requestTagContexts(Tagging tagging) {+ List<Map<String, List<String>>> contexts = new ArrayList<>();+ if (tagging.sets().isEmpty() && !tagging.otherSpellings().isEmpty()) {+ // The handler applies none of the tags it reads, so a create that requires a tag does not get it.+ contexts.add(new HashMap<>());+ }+ for (TagSet set : tagging.checked()) {+ contexts.add(requestTagContext(set));+ }+ return contexts;+ }++ private static Map<String, List<String>> requestTagContext(TagSet set) {+ Map<String, List<String>> context = new HashMap<>();+ set.tags().forEach((key, value) -> context.put("aws:RequestTag/" + key, List.of(value)));+ context.put("aws:TagKeys", List.copyOf(set.tags().keySet()));+ return context;+ }++ /**+ * The resources a set of tags goes to: for a tag specification's, the ARN the table gives its type, in the+ * request's partition, Region and account, as AWS checks the tagging action on the resource being tagged;+ * otherwise {@code resources}, the ones the operation itself is checked on.+ */+ static List<String> resources(String operation, TagSet set, String partition, String region, String accountId,+ List<String> resources) {+ if (set.resourceType() == null) {+ return resources;+ }+ String arn = TagOnCreateMembers.table().resourceArns()+ .getOrDefault(operation.substring(0, operation.indexOf(':')), Map.of()).get(set.resourceType());+ return arn == null ? resources : List.of(arn.replace("${Partition}", partition)+ .replace("${Region}", region).replace("${Account}", accountId));+ }+}diff --git a/src/main/java/io/github/hectorvent/floci/core/common/TagOnCreateMembers.java b/src/main/java/io/github/hectorvent/floci/core/common/TagOnCreateMembers.javanew file mode 100644index 0000000000..8f3bd9a35c--- /dev/null+++ b/src/main/java/io/github/hectorvent/floci/core/common/TagOnCreateMembers.java@@ -0,0 +1,164 @@+package io.github.hectorvent.floci.core.common;++import com.fasterxml.jackson.databind.JsonNode;+import com.fasterxml.jackson.databind.ObjectMapper;++import java.io.IOException;+import java.io.InputStream;+import java.util.ArrayList;+import java.util.LinkedHashMap;+import java.util.LinkedHashSet;+import java.util.List;+import java.util.Map;+import java.util.Set;++/**+ * Which tagging action each operation that tags what it creates needs, and where its request carries the+ * tags, read once from the vendored {@code aws/iam-tag-on-create.json}.+ *+ * <p>The file is generated by {@code tools/aws/regen_iam_tag_on_create.py} from AWS's Service Reference,+ * which lists the tagging action among an operation's authorized actions, and from botocore's model of the+ * request, which gives the members that carry the tags. Every operation of the namespaces it reads is in it+ * once: with the members to read, as one Floci checks by hand, or as one whose request carries no tags it+ * can read. {@code make iam-tag-on-create-check} re-derives every member from botocore and+ * {@code make iam-tag-on-create-verify} checks every operation against AWS.+ *+ * <p>A missing or malformed resource is a build defect, so loading fails with+ * {@link IllegalStateException} rather than leaving every operation it reads unchecked.+ */+final class TagOnCreateMembers {++ static final String RESOURCE_NAME = "aws/iam-tag-on-create.json";++ private static final ObjectMapper MAPPER = new ObjectMapper();++ /**+ * A member of a request that carries tags: a list of tag structures, whose key and value members are+ * named {@code key} and {@code value}, or a map, for which both are null. {@code steps} lead to it in a+ * JSON or CBOR body, the last one into the list or the map, and {@code querySteps} in the Query protocol's+ * form parameters. A list of tag specifications names the member of each specification that gives the type+ * of the resource its tags go to as {@code resourceType}, null for any other member.+ */+ record Member(String path, List<PassedRoleMembers.Step> steps, List<PassedRoleMembers.Step> querySteps,+ String key, String value, String resourceType) {++ /** Whether a form can carry the member: a top-level tag list or map, or a list of tag specifications. */+ boolean inForm() {+ return querySteps.size() == 1+ || querySteps.size() == 2 && querySteps.getFirst().into() == PassedRoleMembers.Into.LIST;+ }+ }++ /**+ * What an operation needs: one tagging action, whether it takes the CreateAction key, whether the+ * operation's own action takes the request's tags as well, and its members.+ */+ record Entry(String tagging, boolean createAction, boolean requestTags, List<Member> members) {+ }++ /**+ * The file: the entries read from it, the operations checked by hand or not read, and, for each namespace+ * whose tag specifications name a resource type, the ARN of each type, still holding {@code ${Partition}},+ * {@code ${Region}} and {@code ${Account}}.+ */+ record Table(Map<String, Entry> entries, Set<String> byHand, Set<String> notRead,+ Set<String> namespaces, Set<String> notCovered, Set<String> otherNamespaces,+ Map<String, Map<String, String>> resourceArns) {+ }++ private static final class Holder {+ static final Table TABLE = VendoredResources.read(RESOURCE_NAME, "IAM tag-on-create table",+ TagOnCreateMembers::parse);+ }++ private TagOnCreateMembers() {+ }++ /** What a request for {@code operation}, as {@code <namespace>:<Operation>}, needs; null when this table does not read it. */+ static Entry of(String operation) {+ return Holder.TABLE.entries().get(operation);+ }++ static Table table() {+ return Holder.TABLE;+ }++ static Table parse(InputStream in) throws IOException {+ JsonNode document = MAPPER.readTree(in);+ JsonNode operations = document.path("operations");+ if (!operations.isObject() || operations.isEmpty()) {+ throw new IllegalStateException(RESOURCE_NAME + " carries no operations");+ }+ Map<String, Entry> entries = new LinkedHashMap<>();+ Set<String> byHand = new LinkedHashSet<>();+ Set<String> notRead = new LinkedHashSet<>();+ operations.properties().forEach(operation -> {+ JsonNode entry = operation.getValue();+ if (entry.has("byHand")) {+ byHand.add(operation.getKey());+ } else if (entry.has("notRead")) {+ notRead.add(operation.getKey());+ } else if (entry.path("tags").isArray() && !entry.path("tags").isEmpty()+ && entry.path("tagging").isArray() && entry.path("tagging").size() == 1) {+ List<Member> members = new ArrayList<>();+ for (JsonNode member : entry.path("tags")) {+ members.add(member(operation.getKey(), member));+ }+ entries.put(operation.getKey(), new Entry(entry.path("tagging").get(0).asText(),+ entry.path("createAction").asBoolean(false), entry.path("requestTags").asBoolean(false),+ List.copyOf(members)));+ } else {+ throw new IllegalStateException(RESOURCE_NAME + " says nothing usable for " + operation.getKey());+ }+ });+ Map<String, Map<String, String>> resourceArns = new LinkedHashMap<>();+ document.path("resourceArns").properties().forEach(namespace -> {+ Map<String, String> types = new LinkedHashMap<>();+ namespace.getValue().properties().forEach(type -> {+ if (!type.getValue().asText("").startsWith("arn:${Partition}:")) {+ throw new IllegalStateException(RESOURCE_NAME + " gives " + namespace.getKey() + "'s "+ + type.getKey() + " no ARN");+ }+ types.put(type.getKey(), type.getValue().asText());+ });+ resourceArns.put(namespace.getKey(), Map.copyOf(types));+ });+ entries.forEach((operation, entry) -> {+ if (entry.members().stream().anyMatch(member -> member.resourceType() != null)+ && !resourceArns.containsKey(operation.substring(0, operation.indexOf(':')))) {+ throw new IllegalStateException(RESOURCE_NAME + " names the resource types " + operation+ + " tags, but gives no ARN for them");+ }+ });+ return new Table(Map.copyOf(entries), Set.copyOf(byHand), Set.copyOf(notRead),+ Set.copyOf(document.path("namespaces").propertyStream().map(Map.Entry::getKey).toList()),+ Set.copyOf(document.path("notCovered").propertyStream().map(Map.Entry::getKey).toList()),+ Set.copyOf(document.path("otherNamespaces").valueStream().map(JsonNode::asText).toList()),+ Map.copyOf(resourceArns));+ }++ private static Member member(String operation, JsonNode member) {+ String path = member.path("member").asText("");+ List<PassedRoleMembers.Step> steps = PassedRoleMembers.steps(path);+ String key = member.hasNonNull("key") ? member.get("key").asText() : null;+ String value = member.hasNonNull("value") ? member.get("value").asText() : null;+ PassedRoleMembers.Into last = steps == null ? null : steps.getLast().into();+ if (last != PassedRoleMembers.Into.LIST && last != PassedRoleMembers.Into.MAP+ || (last == PassedRoleMembers.Into.LIST) != (key != null && value != null)) {+ throw new IllegalStateException(RESOURCE_NAME + " reads " + operation + " at " + path+ + ", which is no path to a tag list or map");+ }+ List<PassedRoleMembers.Step> querySteps = member.hasNonNull("query")+ ? PassedRoleMembers.steps(member.get("query").asText()) : steps;+ if (querySteps == null || querySteps.getLast().into() != last) {+ throw new IllegalStateException(RESOURCE_NAME + " reads " + operation + "'s tags at " + path+ + " from a form by no path to a tag list or map");+ }+ String resourceType = member.hasNonNull("resourceType") ? member.get("resourceType").asText() : null;+ if (resourceType != null && (steps.size() < 2 || steps.getFirst().into() != PassedRoleMembers.Into.LIST)) {+ throw new IllegalStateException(RESOURCE_NAME + " reads " + operation + "'s tags at " + path+ + " by resource type, though they are no list of tag specifications");+ }+ return new Member(path, steps, querySteps, key, value, resourceType);+ }+}diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/IamActionRegistry.java b/src/main/java/io/github/hectorvent/floci/services/iam/IamActionRegistry.javaindex 961d660d83..6dd4c07c85 100644--- a/src/main/java/io/github/hectorvent/floci/services/iam/IamActionRegistry.java+++ b/src/main/java/io/github/hectorvent/floci/services/iam/IamActionRegistry.java@@ -542,15 +542,20 @@ public class IamActionRegistry {}// JSON 1.1: X-Amz-Target → the action AWS checks for the operation it names- String target = ctx.getHeaderString("X-Amz-Target");- if (target != null && target.contains(".")) {- String operationName = target.substring(target.lastIndexOf('.') + 1);+ String operationName = targetOperation(ctx);+ if (operationName != null) {return resolveOperation(credentialScope, operationName, ctx);}return resolveRoute(credentialScope, ctx);}+ /** The operation a JSON request's {@code X-Amz-Target} names, the part after its last dot; null without one. */+ public static String targetOperation(ContainerRequestContext ctx) {+ String target = ctx.getHeaderString("X-Amz-Target");+ return target != null && target.contains(".") ? target.substring(target.lastIndexOf('.') + 1) : null;+ }+/** The action for a dispatched operation, including statement-dependent JSON and CBOR calls. */public String resolveOperation(String credentialScope, String operationName, ContainerRequestContext ctx) {if ("dynamodb".equals(credentialScope) && "ExecuteStatement".equals(operationName)) {diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java b/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.javaindex 3147223bf6..e214cf5691 100644--- a/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java+++ b/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java@@ -773,7 +773,9 @@ public class ResourceArnBuilder {}// path: /2015-03-31/functions/name or similarString name = extractSegmentAfter(path, "functions");- if (name == null) return "*";+ if (name == null) {+ return createdFunctionArn(path, ctx, region, accountId);+ }boolean qualifiedTarget = path.endsWith("/functions/" + name + "/invocations")|| path.endsWith("/functions/" + name + "/response-streaming-invocations")|| path.endsWith("/functions/" + name + "/provisioned-concurrency");@@ -801,6 +803,30 @@ public class ResourceArnBuilder {}}+ /**+ * The function {@code CreateFunction} makes, which its body names, in the caller's account and Region, as+ * every route but an invoke acts there: the Service Reference gives it the {@code function} resource, so+ * its own action, and the tagging action its tags need, are checked on that function. {@code *} for any+ * other route that names no function.+ */+ private String createdFunctionArn(String path, ContainerRequestContext ctx, String region, String accountId) {+ if (!"POST".equalsIgnoreCase(ctx.getMethod()) || !"/2015-03-31/functions".equals(path)) {+ return "*";+ }+ JsonNode body = readJsonBody(ctx);+ JsonNode name = body == null ? null : body.get("FunctionName");+ if (name == null || !name.isTextual() || name.asText().isEmpty()) {+ return "*";+ }+ try {+ return AwsArnUtils.Arn.of("lambda", region, accountId,+ "function:" + LambdaArnUtils.resolve(name.asText()).name()).toString();+ } catch (AwsException e) {+ // A name Lambda refuses, which its handler answers with a 400 before creating anything.+ return AwsArnUtils.Arn.of("lambda", region, accountId, "function:" + name.asText()).toString();+ }+ }+/*** The resource of a Lambda event source mapping, code signing config or layer route, as the Service* Reference gives it. A mapping is looked up by its UUID, a config by the id that ends its ARN and adiff --git a/src/main/resources/aws/iam-tag-on-create.json b/src/main/resources/aws/iam-tag-on-create.jsonnew file mode 100644index 0000000000..1c28613745--- /dev/null+++ b/src/main/resources/aws/iam-tag-on-create.json@@ -0,0 +1,590 @@+{+ "_source": {"generator": "tools/aws/regen_iam_tag_on_create.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.113 (installed package)", "retrieved": "2026-10-24", "note": "make iam-tag-on-create-check re-derives every member from botocore; make iam-tag-on-create-verify checks every operation against AWS."},+ "namespaces": {"acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "autoscaling": ["autoscaling"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudformation": ["cloudformation"], "cloudhsm": ["cloudhsmv2"], "cloudtrail": ["cloudtrail"], "cloudwatch": ["cloudwatch", "cloudwatchomni"], "codedeploy": ["codedeploy"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "comprehend": ["comprehend"], "config": ["config"], "cur": ["cur"], "datasync": ["datasync"], "dms": ["dms"], "dsql": ["dsql"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "ecs": ["ecs"], "eks": ["eks"], "elasticache": ["elasticache"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "glue": ["glue"], "iam": ["iam"], "kinesis": ["kinesis"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "kms": ["kms"], "lambda": ["lambda", "lambda-core", "lambda-microvms", "lambda-web"], "lightsail": ["lightsail"], "logs": ["logs"], "memorydb": ["memorydb"], "network-firewall": ["network-firewall"], "organizations": ["organizations"], "pipes": ["pipes"], "rds": ["docdb", "neptune", "rds"], "redshift": ["redshift"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-groups": ["resource-groups"], "route53resolver": ["route53resolver"], "sagemaker": ["sagemaker"], "scheduler": ["scheduler"], "secretsmanager": ["secretsmanager"], "servicediscovery": ["servicediscovery"], "ses": ["mailmanager", "pinpoint-email", "ses", "sesv2"], "sns": ["sns"], "sqs": ["sqs"], "ssm": ["ssm"], "sso": ["sso-admin"], "states": ["stepfunctions"], "sts": ["sts"], "swf": ["swf"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "transcribe": ["transcribe"], "transfer": ["transfer"], "translate": ["translate"], "wafv2": ["wafv2"]},+ "notCovered": {"access-analyzer": "REST routes no rule maps yet", "airflow": "REST routes no rule maps yet", "app-integrations": "REST routes no rule maps yet", "appconfig": "REST routes no rule maps yet", "appsync": "REST routes no rule maps yet", "aps": "REST routes no rule maps yet", "aws-marketplace": "REST routes no rule maps yet", "backup": "REST routes no rule maps yet", "batch": "REST routes no rule maps yet", "bedrock": "REST routes no rule maps yet", "bedrock-agentcore": "REST routes no rule maps yet", "cloudfront": "REST routes no rule maps yet", "codeguru-reviewer": "REST routes no rule maps yet", "connect": "REST routes no rule maps yet", "controltower": "REST routes no rule maps yet", "detective": "REST routes no rule maps yet", "dlm": "REST routes no rule maps yet", "elasticfilesystem": "REST routes no rule maps yet", "emr-serverless": "REST routes no rule maps yet", "es": "REST routes no rule maps yet", "fis": "REST routes no rule maps yet", "guardduty": "REST routes no rule maps yet", "inspector2": "REST routes no rule maps yet", "iot": "REST routes no rule maps yet", "kafka": "REST routes no rule maps yet", "macie2": "REST routes no rule maps yet", "mq": "REST routes no rule maps yet", "oam": "REST routes no rule maps yet", "ram": "REST routes no rule maps yet", "resource-explorer-2": "REST routes no rule maps yet", "rum": "REST routes no rule maps yet", "s3": "authorized by route; S3 checks s3:PutObjectTagging for an object it creates with tags itself", "s3tables": "REST routes no rule maps yet", "securityhub": "REST routes no rule maps yet", "servicecatalog": "its operations that tag are AppRegistry's, whose REST routes no rule maps yet"},+ "otherNamespaces": ["account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "appmesh", "apprunner", "appstream", "arc-region-switch", "artifact", "auditmanager", "b2bi", "backup-gateway", "backup-search", "bcm-dashboards", "billing", "billingconductor", "braket", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "connect-campaigns", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "directconnect", "docdb-elastic", "drs", "ds", "ebs", "ecr-public", "elemental-inference", "emr-containers", "entityresolution", "evs", "fms", "forecast", "frauddetector", "fsx", "gamelift", "gameliftstreams", "geo", "grafana", "greengrass", "groundstation", "health-agent", "healthlake", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotdeviceadvisor", "iotfleetwise", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "ivs", "ivschat", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "m2", "managedblockchain", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgn", "migrationhub-orchestrator", "mobiletargeting", "mpa", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "notifications", "notifications-contacts", "observabilityadmin", "odb", "omics", "opensearch", "osis", "outposts", "partnercentral", "payment-cryptography", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "profile", "proton", "qbusiness", "quicksight", "rbin", "refactor-spaces", "repostspace", "resiliencehub", "rolesanywhere", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3files", "sagemaker-geospatial", "savingsplans", "schemas", "scn", "security-ir", "securityagent", "securitylake", "shield", "signer", "sms-voice", "snow-device-management", "social-messaging", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "voiceid", "vpc-lattice", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workspaces", "workspaces-instances", "workspaces-web", "xray"],+ "resourceArns": {"ec2": {"application-status-check": "arn:${Partition}:ec2:${Region}:${Account}:application-status-check/*", "capacity-block": "arn:${Partition}:ec2:${Region}:${Account}:capacity-block/*", "capacity-manager-data-export": "arn:${Partition}:ec2:${Region}:${Account}:capacity-manager-data-export/*", "capacity-reservation": "arn:${Partition}:ec2:${Region}:${Account}:capacity-reservation/*", "capacity-reservation-cancellation-quote": "arn:${Partition}:ec2:${Region}:${Account}:capacity-reservation-cancellation-quote/*", "capacity-reservation-fleet": "arn:${Partition}:ec2:${Region}:${Account}:capacity-reservation-fleet/*", "carrier-gateway": "arn:${Partition}:ec2:${Region}:${Account}:carrier-gateway/*", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/*", "client-vpn-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:client-vpn-endpoint/*", "coip-pool": "arn:${Partition}:ec2:${Region}:${Account}:coip-pool/*", "customer-gateway": "arn:${Partition}:ec2:${Region}:${Account}:customer-gateway/*", "declarative-policies-report": "arn:${Partition}:ec2:${Region}:${Account}:declarative-policies-report/*", "dedicated-host": "arn:${Partition}:ec2:${Region}:${Account}:dedicated-host/*", "dhcp-options": "arn:${Partition}:ec2:${Region}:${Account}:dhcp-options/*", "egress-only-internet-gateway": "arn:${Partition}:ec2:${Region}:${Account}:egress-only-internet-gateway/*", "elastic-gpu": "arn:${Partition}:ec2:${Region}:${Account}:elastic-gpu/*", "elastic-inference": "arn:${Partition}:elastic-inference:${Region}:${Account}:elastic-inference-accelerator/*", "elastic-ip": "arn:${Partition}:ec2:${Region}:${Account}:elastic-ip/*", "export-image-task": "arn:${Partition}:ec2:${Region}:${Account}:export-image-task/*", "export-instance-task": "arn:${Partition}:ec2:${Region}:${Account}:export-instance-task/*", "fleet": "arn:${Partition}:ec2:${Region}:${Account}:fleet/*", "fpga-image": "arn:${Partition}:ec2:${Region}:${Account}:fpga-image/*", "group": "arn:${Partition}:resource-groups:${Region}:${Account}:group/*", "host-reservation": "arn:${Partition}:ec2:${Region}:${Account}:host-reservation/*", "image": "arn:${Partition}:ec2:${Region}::image/*", "image-usage-report": "arn:${Partition}:ec2:${Region}:${Account}:image-usage-report/*", "import-image-task": "arn:${Partition}:ec2:${Region}:${Account}:import-image-task/*", "import-snapshot-task": "arn:${Partition}:ec2:${Region}:${Account}:import-snapshot-task/*", "instance": "arn:${Partition}:ec2:${Region}:${Account}:instance/*", "instance-connect-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:instance-connect-endpoint/*", "instance-event-window": "arn:${Partition}:ec2:${Region}:${Account}:instance-event-window/*", "internet-gateway": "arn:${Partition}:ec2:${Region}:${Account}:internet-gateway/*", "ipam": "arn:${Partition}:ec2::${Account}:ipam/*", "ipam-external-resource-verification-token": "arn:${Partition}:ec2::${Account}:ipam-external-resource-verification-token/*", "ipam-internet-registry-association": "arn:${Partition}:ec2::${Account}:ipam-internet-registry-association/*", "ipam-policy": "arn:${Partition}:ec2::${Account}:ipam-policy/*", "ipam-pool": "arn:${Partition}:ec2::${Account}:ipam-pool/*", "ipam-pool-allocation": "arn:${Partition}:ec2:${Region}:${Account}:ipam-pool-allocation/*", "ipam-prefix-list-resolver": "arn:${Partition}:ec2::${Account}:ipam-prefix-list-resolver/*", "ipam-prefix-list-resolver-target": "arn:${Partition}:ec2::${Account}:ipam-prefix-list-resolver-target/*", "ipam-resource-discovery": "arn:${Partition}:ec2::${Account}:ipam-resource-discovery/*", "ipam-resource-discovery-association": "arn:${Partition}:ec2::${Account}:ipam-resource-discovery-association/*", "ipam-scope": "arn:${Partition}:ec2::${Account}:ipam-scope/*", "ipv4pool-ec2": "arn:${Partition}:ec2:${Region}:${Account}:ipv4pool-ec2/*", "ipv6pool-ec2": "arn:${Partition}:ec2:${Region}:${Account}:ipv6pool-ec2/*", "key-pair": "arn:${Partition}:ec2:${Region}:${Account}:key-pair/*", "launch-template": "arn:${Partition}:ec2:${Region}:${Account}:launch-template/*", "license-configuration": "arn:${Partition}:license-manager:${Region}:${Account}:license-configuration:*", "local-gateway": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway/*", "local-gateway-route-table": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-route-table/*", "local-gateway-route-table-virtual-interface-group-association": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-route-table-virtual-interface-group-association/*", "local-gateway-route-table-vpc-association": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-route-table-vpc-association/*", "local-gateway-virtual-interface": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-virtual-interface/*", "local-gateway-virtual-interface-group": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-virtual-interface-group/*", "mac-modification-task": "arn:${Partition}:ec2:${Region}:${Account}:mac-modification-task/*", "natgateway": "arn:${Partition}:ec2:${Region}:${Account}:natgateway/*", "network-acl": "arn:${Partition}:ec2:${Region}:${Account}:network-acl/*", "network-insights-access-scope": "arn:${Partition}:ec2:${Region}:${Account}:network-insights-access-scope/*", "network-insights-access-scope-analysis": "arn:${Partition}:ec2:${Region}:${Account}:network-insights-access-scope-analysis/*", "network-insights-analysis": "arn:${Partition}:ec2:${Region}:${Account}:network-insights-analysis/*", "network-insights-path": "arn:${Partition}:ec2:${Region}:${Account}:network-insights-path/*", "network-interface": "arn:${Partition}:ec2:${Region}:${Account}:network-interface/*", "outpost-lag": "arn:${Partition}:ec2:${Region}:${Account}:outpost-lag/*", "placement-group": "arn:${Partition}:ec2:${Region}:${Account}:placement-group/*", "prefix-list": "arn:${Partition}:ec2:${Region}:${Account}:prefix-list/*", "replace-root-volume-task": "arn:${Partition}:ec2:${Region}:${Account}:replace-root-volume-task/*", "reserved-instances": "arn:${Partition}:ec2:${Region}:${Account}:reserved-instances/*", "role": "arn:${Partition}:iam::${Account}:role/*", "route-server": "arn:${Partition}:ec2:${Region}:${Account}:route-server/*", "route-server-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:route-server-endpoint/*", "route-server-peer": "arn:${Partition}:ec2:${Region}:${Account}:route-server-peer/*", "route-table": "arn:${Partition}:ec2:${Region}:${Account}:route-table/*", "secondary-interface": "arn:${Partition}:ec2:${Region}:${Account}:secondary-interface/*", "secondary-network": "arn:${Partition}:ec2:${Region}:${Account}:secondary-network/*", "secondary-subnet": "arn:${Partition}:ec2:${Region}:${Account}:secondary-subnet/*", "security-group": "arn:${Partition}:ec2:${Region}:${Account}:security-group/*", "security-group-rule": "arn:${Partition}:ec2:${Region}:${Account}:security-group-rule/*", "snapshot": "arn:${Partition}:ec2:${Region}::snapshot/*", "spot-fleet-request": "arn:${Partition}:ec2:${Region}:${Account}:spot-fleet-request/*", "spot-instances-request": "arn:${Partition}:ec2:${Region}:${Account}:spot-instances-request/*", "subnet": "arn:${Partition}:ec2:${Region}:${Account}:subnet/*", "subnet-cidr-reservation": "arn:${Partition}:ec2:${Region}:${Account}:subnet-cidr-reservation/*", "traffic-mirror-filter": "arn:${Partition}:ec2:${Region}:${Account}:traffic-mirror-filter/*", "traffic-mirror-filter-rule": "arn:${Partition}:ec2:${Region}:${Account}:traffic-mirror-filter-rule/*", "traffic-mirror-session": "arn:${Partition}:ec2:${Region}:${Account}:traffic-mirror-session/*", "traffic-mirror-target": "arn:${Partition}:ec2:${Region}:${Account}:traffic-mirror-target/*", "transit-gateway": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway/*", "transit-gateway-attachment": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-attachment/*", "transit-gateway-connect-peer": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-connect-peer/*", "transit-gateway-metering-policy": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-metering-policy/*", "transit-gateway-multicast-domain": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-multicast-domain/*", "transit-gateway-policy-table": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-policy-table/*", "transit-gateway-route-table": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-route-table/*", "transit-gateway-route-table-announcement": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-route-table-announcement/*", "verified-access-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-endpoint/*", "verified-access-endpoint-target": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-endpoint-target/*", "verified-access-group": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-group/*", "verified-access-instance": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-instance/*", "verified-access-policy": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-policy/*", "verified-access-trust-provider": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-trust-provider/*", "volume": "arn:${Partition}:ec2:${Region}:${Account}:volume/*", "vpc": "arn:${Partition}:ec2:${Region}:${Account}:vpc/*", "vpc-block-public-access-exclusion": "arn:${Partition}:ec2:${Region}:${Account}:vpc-block-public-access-exclusion/*", "vpc-encryption-control": "arn:${Partition}:ec2:${Region}:${Account}:vpc-encryption-control/*", "vpc-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:vpc-endpoint/*", "vpc-endpoint-connection": "arn:${Partition}:ec2:${Region}:${Account}:vpc-endpoint-connection/*", "vpc-endpoint-service": "arn:${Partition}:ec2:${Region}:${Account}:vpc-endpoint-service/*", "vpc-endpoint-service-permission": "arn:${Partition}:ec2:${Region}:${Account}:vpc-endpoint-service-permission/*", "vpc-flow-log": "arn:${Partition}:ec2:${Region}:${Account}:vpc-flow-log/*", "vpc-peering-connection": "arn:${Partition}:ec2:${Region}:${Account}:vpc-peering-connection/*", "vpn-concentrator": "arn:${Partition}:ec2:${Region}:${Account}:vpn-concentrator/*", "vpn-connection": "arn:${Partition}:ec2:${Region}:${Account}:vpn-connection/*", "vpn-connection-device-type": "arn:${Partition}:ec2:${Region}:${Account}:vpn-connection-device-type/*", "vpn-gateway": "arn:${Partition}:ec2:${Region}:${Account}:vpn-gateway/*"}, "rds": {"auto-backup": "arn:${Partition}:rds:${Region}:${Account}:auto-backup:*", "cev": "arn:${Partition}:rds:${Region}:${Account}:cev:*/*/*", "cluster": "arn:${Partition}:rds:${Region}:${Account}:cluster:*", "cluster-auto-backup": "arn:${Partition}:rds:${Region}:${Account}:cluster-auto-backup:*", "cluster-endpoint": "arn:${Partition}:rds:${Region}:${Account}:cluster-endpoint:*", "cluster-pg": "arn:${Partition}:rds:${Region}:${Account}:cluster-pg:*", "cluster-snapshot": "arn:${Partition}:rds:${Region}:${Account}:cluster-snapshot:*", "db": "arn:${Partition}:rds:${Region}:${Account}:db:*", "db-capacity-reservation": "arn:${Partition}:rds:${Region}:${Account}:db-capacity-reservation:*", "deployment": "arn:${Partition}:rds:${Region}:${Account}:deployment:*", "es": "arn:${Partition}:rds:${Region}:${Account}:es:*", "global-cluster": "arn:${Partition}:rds::${Account}:global-cluster:*", "integration": "arn:${Partition}:rds:${Region}:${Account}:integration:*", "og": "arn:${Partition}:rds:${Region}:${Account}:og:*", "pg": "arn:${Partition}:rds:${Region}:${Account}:pg:*", "proxy": "arn:${Partition}:rds:${Region}:${Account}:db-proxy:*", "proxy-endpoint": "arn:${Partition}:rds:${Region}:${Account}:db-proxy-endpoint:*", "ri": "arn:${Partition}:rds:${Region}:${Account}:ri:*", "secgrp": "arn:${Partition}:rds:${Region}:${Account}:secgrp:*", "shardgrp": "arn:${Partition}:rds:${Region}:${Account}:shard-group:*", "snapshot": "arn:${Partition}:rds:${Region}:${Account}:snapshot:*", "snapshot-tenant-database": "arn:${Partition}:rds:${Region}:${Account}:snapshot-tenant-database:*:*", "subgrp": "arn:${Partition}:rds:${Region}:${Account}:subgrp:*", "target-group": "arn:${Partition}:rds:${Region}:${Account}:target-group:*", "tenant-database": "arn:${Partition}:rds:${Region}:${Account}:tenant-database:*"}},+ "operations": {+ "acm:ImportCertificate": {"tagging": ["acm:AddTagsToCertificate"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "acm:RequestCertificate": {"tagging": ["acm:AddTagsToCertificate"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "application-autoscaling:RegisterScalableTarget": {"tagging": ["application-autoscaling:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "athena:CreateCapacityReservation": {"tagging": ["athena:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "athena:CreateDataCatalog": {"tagging": ["athena:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "athena:CreateWorkGroup": {"tagging": ["athena:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "athena:StartSession": {"tagging": ["athena:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "autoscaling:CreateAutoScalingGroup": {"tagging": ["autoscaling:CreateOrUpdateTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "bcm-data-exports:CreateExport": {"tagging": ["bcm-data-exports:TagResource"], "requestTags": true, "tags": [{"member": "ResourceTags[]", "key": "Key", "value": "Value"}]},+ "bcm-pricing-calculator:CreateBillEstimate": {"tagging": ["bcm-pricing-calculator:TagResource"], "tags": [{"member": "tags{}"}]},+ "bcm-pricing-calculator:CreateBillScenario": {"tagging": ["bcm-pricing-calculator:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "bcm-pricing-calculator:CreateWorkloadEstimate": {"tagging": ["bcm-pricing-calculator:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "budgets:CreateBudget": {"tagging": ["budgets:TagResource"], "requestTags": true, "tags": [{"member": "ResourceTags[]", "key": "Key", "value": "Value"}]},+ "budgets:CreateBudgetAction": {"tagging": ["budgets:TagResource"], "requestTags": true, "tags": [{"member": "ResourceTags[]", "key": "Key", "value": "Value"}]},+ "ce:CreateAnomalyMonitor": {"tagging": ["ce:TagResource"], "requestTags": true, "tags": [{"member": "ResourceTags[]", "key": "Key", "value": "Value"}]},+ "ce:CreateAnomalySubscription": {"tagging": ["ce:TagResource"], "requestTags": true, "tags": [{"member": "ResourceTags[]", "key": "Key", "value": "Value"}]},+ "ce:CreateCostCategoryDefinition": {"tagging": ["ce:TagResource"], "requestTags": true, "tags": [{"member": "ResourceTags[]", "key": "Key", "value": "Value"}]},+ "cloudformation:CreateChangeSet": {"tagging": ["cloudformation:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudformation:CreateStack": {"tagging": ["cloudformation:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudformation:CreateStackSet": {"tagging": ["cloudformation:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudformation:ExecuteChangeSet": {"tagging": ["cloudformation:TagResource"], "createAction": true, "notRead": "no member of the request carries tags"},+ "cloudformation:UpdateStack": {"tagging": ["cloudformation:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudformation:UpdateStackSet": {"tagging": ["cloudformation:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudhsm:CopyBackupToRegion": {"tagging": ["cloudhsm:TagResource"], "requestTags": true, "tags": [{"member": "TagList[]", "key": "Key", "value": "Value"}]},+ "cloudhsm:CreateCluster": {"tagging": ["cloudhsm:TagResource"], "requestTags": true, "tags": [{"member": "TagList[]", "key": "Key", "value": "Value"}]},+ "cloudtrail:CreateChannel": {"tagging": ["cloudtrail:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudtrail:CreateDashboard": {"tagging": ["cloudtrail:AddTags"], "requestTags": true, "tags": [{"member": "TagsList[]", "key": "Key", "value": "Value"}]},+ "cloudtrail:CreateEventDataStore": {"tagging": ["cloudtrail:AddTags"], "requestTags": true, "tags": [{"member": "TagsList[]", "key": "Key", "value": "Value"}]},+ "cloudtrail:CreateTrail": {"tagging": ["cloudtrail:AddTags"], "requestTags": true, "tags": [{"member": "TagsList[]", "key": "Key", "value": "Value"}]},+ "cloudwatch:CreateAccessGrant": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:CreateAccessProfile": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:CreateDomain": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:CreateDomainAccessGrantForOrganization": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:CreateDomainForOrganization": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:CreateIntegration": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:CreateOmniDashboard": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:CreateSpace": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:CreateView": {"tagging": ["cloudwatch:TagResource"], "tags": [{"member": "tags{}"}]},+ "cloudwatch:PutAlarmMuteRule": {"tagging": ["cloudwatch:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudwatch:PutCompositeAlarm": {"tagging": ["cloudwatch:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudwatch:PutDashboard": {"tagging": ["cloudwatch:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudwatch:PutInsightRule": {"tagging": ["cloudwatch:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudwatch:PutLogAlarm": {"tagging": ["cloudwatch:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudwatch:PutMetricAlarm": {"tagging": ["cloudwatch:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cloudwatch:PutMetricStream": {"tagging": ["cloudwatch:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "codedeploy:CreateApplication": {"tagging": ["codedeploy:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "Key", "value": "Value"}]},+ "codedeploy:CreateDeploymentGroup": {"tagging": ["codedeploy:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "Key", "value": "Value"}]},+ "codepipeline:CreateCustomActionType": {"tagging": ["codepipeline:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "codepipeline:CreatePipeline": {"tagging": ["codepipeline:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "codepipeline:PutWebhook": {"tagging": ["codepipeline:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "cognito-identity:CreateIdentityPool": {"tagging": ["cognito-identity:TagResource"], "requestTags": true, "tags": [{"member": "IdentityPoolTags{}"}]},+ "cognito-identity:UpdateIdentityPool": {"tagging": ["cognito-identity:TagResource"], "tags": [{"member": "IdentityPoolTags{}"}]},+ "cognito-idp:CreateUserPool": {"tagging": ["cognito-idp:TagResource"], "requestTags": true, "tags": [{"member": "UserPoolTags{}"}]},+ "cognito-idp:UpdateUserPool": {"tagging": ["cognito-idp:TagResource"], "requestTags": true, "tags": [{"member": "UserPoolTags{}"}]},+ "comprehend:CreateDataset": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:CreateDocumentClassifier": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:CreateEndpoint": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:CreateEntityRecognizer": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:CreateFlywheel": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:ImportModel": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartDocumentClassificationJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartDominantLanguageDetectionJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartEntitiesDetectionJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartEventsDetectionJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartKeyPhrasesDetectionJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartPiiEntitiesDetectionJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartSentimentDetectionJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartTargetedSentimentDetectionJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "comprehend:StartTopicsDetectionJob": {"tagging": ["comprehend:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutAggregationAuthorization": {"tagging": ["config:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutConfigRule": {"tagging": ["config:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutConfigurationAggregator": {"tagging": ["config:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutConfigurationRecorder": {"tagging": ["config:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutConformancePack": {"tagging": ["config:TagResource"], "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutConnector": {"tagging": ["config:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutOrganizationConfigRule": {"tagging": ["config:TagResource"], "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutOrganizationConformancePack": {"tagging": ["config:TagResource"], "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "config:PutStoredQuery": {"tagging": ["config:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "cur:PutReportDefinition": {"tagging": ["cur:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateAgent": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationAzureBlob": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationEfs": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationFsxLustre": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationFsxOntap": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationFsxOpenZfs": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationFsxWindows": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationHdfs": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationNfs": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationObjectStorage": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationS3": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateLocationSmb": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:CreateTask": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "datasync:StartTaskExecution": {"tagging": ["datasync:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateDataMigration": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateDataProvider": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateEndpoint": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateEventSubscription": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateInstanceProfile": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateMigrationProject": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateReplicationConfig": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateReplicationInstance": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateReplicationSubnetGroup": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:CreateReplicationTask": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:ImportCertificate": {"tagging": ["dms:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dms:StartReplicationTaskAssessmentRun": {"tagging": ["dms:AddTagsToResource"], "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dsql:CreateCluster": {"tagging": ["dsql:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "dsql:CreateStream": {"tagging": ["dsql:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "dynamodb:CreateTable": {"tagging": ["dynamodb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "dynamodb:UpdateTable": {"tagging": ["dynamodb:TagResource"], "notRead": "no member of the request carries tags"},+ "ec2:AcceptAddressTransfer": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:AllocateAddress": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:AllocateHosts": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:AllocateIpamPoolCidr": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:AssociateIpamResourceDiscovery": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:AuthorizeSecurityGroupEgress": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:AuthorizeSecurityGroupIngress": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CopyImage": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CopySnapshot": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CopyVolumes": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateApplicationStatusCheck": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCapacityManagerDataExport": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCapacityReservation": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCapacityReservationBySplitting": {"tagging": ["ec2:CreateTags"], "createAction": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCapacityReservationCancellationQuote": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCapacityReservationDateChangeQuote": {"tagging": ["ec2:CreateTags"], "createAction": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCapacityReservationFleet": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCarrierGateway": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateClientVpnEndpoint": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCoipPool": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateCustomerGateway": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateDelegateMacVolumeOwnershipTask": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateDhcpOptions": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateEgressOnlyInternetGateway": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateFleet": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateFlowLogs": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateFpgaImage": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateImage": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateImageUsageReport": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateInstanceConnectEndpoint": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateInstanceEventWindow": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateInstanceExportTask": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateInternetGateway": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateInterruptibleCapacityReservationAllocation": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpam": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpamExternalResourceVerificationToken": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpamInternetRegistryAssociation": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpamPolicy": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpamPool": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpamPrefixListResolver": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpamPrefixListResolverTarget": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpamResourceDiscovery": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateIpamScope": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateKeyPair": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateLaunchTemplate": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateLocalGatewayRouteTable": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateLocalGatewayRouteTableVirtualInterfaceGroupAssociation": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateLocalGatewayRouteTableVpcAssociation": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateLocalGatewayVirtualInterface": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateLocalGatewayVirtualInterfaceGroup": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateMacSystemIntegrityProtectionModificationTask": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateManagedPrefixList": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateNatGateway": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateNetworkAcl": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateNetworkInsightsAccessScope": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateNetworkInsightsPath": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateNetworkInterface": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreatePlacementGroup": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreatePublicIpv4Pool": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateReplaceRootVolumeTask": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateRestoreImageTask": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateRouteServer": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateRouteServerEndpoint": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateRouteServerPeer": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateRouteTable": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateSecondaryNetwork": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateSecondarySubnet": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateSecurityGroup": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateSnapshot": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateSnapshots": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateSubnet": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateSubnetCidrReservation": {"tagging": ["ec2:CreateTags"], "createAction": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTrafficMirrorFilter": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTrafficMirrorFilterRule": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTrafficMirrorSession": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTrafficMirrorTarget": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGateway": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayConnect": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayConnectPeer": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayMeteringPolicy": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayMulticastDomain": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayPeeringAttachment": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayPolicyTable": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayRouteTable": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayRouteTableAnnouncement": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateTransitGatewayVpcAttachment": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVerifiedAccessEndpoint": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVerifiedAccessGroup": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVerifiedAccessInstance": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVerifiedAccessTrustProvider": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVolume": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpc": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpcBlockPublicAccessExclusion": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpcEncryptionControl": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpcEndpoint": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpcEndpointServiceConfiguration": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpcPeeringConnection": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpnConcentrator": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpnConnection": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:CreateVpnGateway": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:ExportImage": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:ImportImage": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:ImportKeyPair": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:ImportSnapshot": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:PurchaseCapacityBlock": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:PurchaseHostReservation": {"tagging": ["ec2:CreateTags"], "createAction": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:RegisterImage": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:RequestSpotFleet": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "notRead": "its tags are in spotFleetRequestConfig, deeper than the members this file reads"},+ "ec2:RequestSpotInstances": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:RunInstances": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:StartDeclarativePoliciesReport": {"tagging": ["ec2:CreateTags"], "createAction": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:StartNetworkInsightsAccessScopeAnalysis": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ec2:StartNetworkInsightsAnalysis": {"tagging": ["ec2:CreateTags"], "createAction": true, "requestTags": true, "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "ecr:BatchGetImage": {"tagging": ["ecr:TagResource"], "notRead": "no member of the request carries tags"},+ "ecr:CreateRepository": {"tagging": ["ecr:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "Key", "value": "Value"}]},+ "ecs:CreateCapacityProvider": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:CreateCluster": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:CreateDaemon": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:CreateExpressGatewayService": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:CreateGateway": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "notRead": "no member of the request carries tags"},+ "ecs:CreateService": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:CreateTaskSet": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:RegisterContainerInstance": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:RegisterDaemonTaskDefinition": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:RegisterTaskDefinition": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:RunTask": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "ecs:StartTask": {"tagging": ["ecs:TagResource"], "createAction": true, "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "eks:AssociateIdentityProviderConfig": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:CreateAccessEntry": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:CreateAddon": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:CreateCapability": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:CreateCluster": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:CreateEksAnywhereSubscription": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:CreateFargateProfile": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:CreateNodegroup": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:CreatePodIdentityAssociation": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "eks:RegisterCluster": {"tagging": ["eks:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "elasticache:CopyServerlessCacheSnapshot": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CopySnapshot": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateCacheCluster": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateCacheParameterGroup": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateCacheSecurityGroup": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateCacheSubnetGroup": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateGlobalReplicationGroup": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateReplicationGroup": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateServerlessCache": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateServerlessCacheSnapshot": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateSnapshot": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateUser": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:CreateUserGroup": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticache:PurchaseReservedCacheNodesOffering": {"tagging": ["elasticache:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "elasticloadbalancing:CreateListener": {"tagging": ["elasticloadbalancing:AddTags"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticloadbalancing:CreateLoadBalancer": {"tagging": ["elasticloadbalancing:AddTags"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticloadbalancing:CreateRule": {"tagging": ["elasticloadbalancing:AddTags"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticloadbalancing:CreateTargetGroup": {"tagging": ["elasticloadbalancing:AddTags"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticloadbalancing:CreateTrustStore": {"tagging": ["elasticloadbalancing:AddTags"], "createAction": true, "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticmapreduce:CreatePersistentAppUI": {"tagging": ["elasticmapreduce:AddTags"], "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticmapreduce:CreateStudio": {"tagging": ["elasticmapreduce:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticmapreduce:RunJobFlow": {"tagging": ["elasticmapreduce:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticmapreduce:StartNotebookExecution": {"tagging": ["elasticmapreduce:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "elasticmapreduce:StartSession": {"tagging": ["elasticmapreduce:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "events:CreateEventBus": {"tagging": ["events:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}, {"member": "Tags{}"}]},+ "events:CreateEventSource": {"tagging": ["events:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "events:CreateSubscriber": {"tagging": ["events:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "events:PutRule": {"tagging": ["events:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "firehose:CreateDeliveryStream": {"tagging": ["firehose:TagDeliveryStream"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "globalaccelerator:CreateAccelerator": {"tagging": ["globalaccelerator:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "globalaccelerator:CreateCrossAccountAttachment": {"tagging": ["globalaccelerator:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "globalaccelerator:CreateCustomRoutingAccelerator": {"tagging": ["globalaccelerator:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "glue:CreateBlueprint": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateCatalog": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateConnection": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateCrawler": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateCustomEntityType": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateDataQualityRuleset": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateDatabase": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateDevEndpoint": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateIntegration": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "key", "value": "value"}]},+ "glue:CreateIntegrationResourceProperty": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "key", "value": "value"}]},+ "glue:CreateJob": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateMLTransform": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateRegistry": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateSchema": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateSession": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateTrigger": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateUsageProfile": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:CreateWorkflow": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "glue:RegisterConnectionType": {"tagging": ["glue:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "iam:AcquireRole": {"tagging": ["iam:TagRole"], "requestTags": true, "notRead": "no member of the request carries tags"},+ "iam:CreateInstanceProfile": {"tagging": ["iam:TagInstanceProfile"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "iam:CreateOpenIDConnectProvider": {"tagging": ["iam:TagOpenIDConnectProvider"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "iam:CreatePolicy": {"tagging": ["iam:TagPolicy"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "iam:CreateRole": {"tagging": ["iam:TagRole"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "iam:CreateSAMLProvider": {"tagging": ["iam:TagSAMLProvider"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "iam:CreateUser": {"tagging": ["iam:TagUser"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "iam:CreateVirtualMFADevice": {"tagging": ["iam:TagMFADevice"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "iam:UploadServerCertificate": {"tagging": ["iam:TagServerCertificate"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "kinesis:CreateStream": {"tagging": ["kinesis:AddTagsToStream"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "kinesis:RegisterStreamConsumer": {"tagging": ["kinesis:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "kinesisanalytics:CreateApplication": {"tagging": ["kinesisanalytics:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "kms:CreateKey": {"tagging": ["kms:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "TagKey", "value": "TagValue"}]},+ "lambda:CreateCapacityProvider": {"tagging": ["lambda:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "lambda:CreateCodeSigningConfig": {"tagging": ["lambda:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "lambda:CreateEventSourceMapping": {"tagging": ["lambda:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "lambda:CreateFunction": {"tagging": ["lambda:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "lambda:CreateMicrovmImage": {"tagging": ["lambda:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "lambda:CreateNetworkConnector": {"tagging": ["lambda:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "lambda:CreateWebFunction": {"tagging": ["lambda:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "lightsail:CreateBucket": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateCertificate": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateContactMethod": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateContainerService": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateDisk": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateDiskFromSnapshot": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateDiskSnapshot": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateDistribution": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateDomain": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateInstanceSnapshot": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateInstances": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateInstancesFromSnapshot": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateKeyPair": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateLoadBalancer": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateRelationalDatabase": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateRelationalDatabaseFromSnapshot": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:CreateRelationalDatabaseSnapshot": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "lightsail:PutAlarm": {"tagging": ["lightsail:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "logs:CreateDelivery": {"tagging": ["logs:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "logs:CreateLogAnomalyDetector": {"tagging": ["logs:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "logs:CreateLogGroup": {"tagging": ["logs:TagLogGroup", "logs:TagResource"], "requestTags": true, "byHand": "either logs:TagResource on the log group's ARN or the older logs:TagLogGroup"},+ "logs:CreateLookupTable": {"tagging": ["logs:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "logs:CreateScheduledQuery": {"tagging": ["logs:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "logs:PutDeliveryDestination": {"tagging": ["logs:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "logs:PutDeliverySource": {"tagging": ["logs:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "logs:PutDestination": {"tagging": ["logs:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "memorydb:CopySnapshot": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "memorydb:CreateACL": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "memorydb:CreateCluster": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "memorydb:CreateMultiRegionCluster": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "memorydb:CreateParameterGroup": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "memorydb:CreateSnapshot": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "memorydb:CreateSubnetGroup": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "memorydb:CreateUser": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "memorydb:PurchaseReservedNodesOffering": {"tagging": ["memorydb:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateContainerAssociation": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateFirewall": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateFirewallPolicy": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateProxy": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateProxyConfiguration": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateProxyRuleGroup": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateRuleGroup": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateTLSInspectionConfiguration": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "network-firewall:CreateVpcEndpointAssociation": {"tagging": ["network-firewall:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "organizations:CreateAccount": {"tagging": ["organizations:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "organizations:CreateGovCloudAccount": {"tagging": ["organizations:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "organizations:CreateOrganizationalUnit": {"tagging": ["organizations:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "organizations:CreatePolicy": {"tagging": ["organizations:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "organizations:InviteAccountToOrganization": {"tagging": ["organizations:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "organizations:InviteOrganizationToTransferResponsibility": {"tagging": ["organizations:TagResource"], "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "organizations:PutResourcePolicy": {"tagging": ["organizations:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "pipes:CreatePipe": {"tagging": ["pipes:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "rds:CopyDBClusterParameterGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CopyDBClusterSnapshot": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CopyDBParameterGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CopyDBSnapshot": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CopyOptionGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateBlueGreenDeployment": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateCustomDBEngineVersion": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBCapacityReservation": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "notRead": "no member of the request carries tags"},+ "rds:CreateDBCluster": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBClusterEndpoint": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBClusterParameterGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBClusterSnapshot": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBInstance": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBInstanceReadReplica": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBParameterGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBProxy": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBProxyEndpoint": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBSecurityGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBShardGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBSnapshot": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateDBSubnetGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateEventSubscription": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateGlobalCluster": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateIntegration": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateOptionGroup": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:CreateTenantDatabase": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:DeleteDBCluster": {"tagging": ["rds:AddTagsToResource"], "notRead": "no member of the request carries tags"},+ "rds:DeleteDBInstance": {"tagging": ["rds:AddTagsToResource"], "notRead": "no member of the request carries tags"},+ "rds:DeleteTenantDatabase": {"tagging": ["rds:AddTagsToResource"], "notRead": "no member of the request carries tags"},+ "rds:ModifyDBInstance": {"tagging": ["rds:AddTagsToResource"], "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "rds:PromoteReadReplica": {"tagging": ["rds:AddTagsToResource"], "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]},+ "rds:PurchaseReservedDBInstancesOffering": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:RestoreDBClusterFromS3": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:RestoreDBClusterFromSnapshot": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:RestoreDBClusterToPointInTime": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:RestoreDBInstanceFromDBSnapshot": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:RestoreDBInstanceFromS3": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:RestoreDBInstanceToPointInTime": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "TagSpecifications[item].Tags[Tag]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}, {"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:StartDBInstanceAutomatedBackupsReplication": {"tagging": ["rds:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rds:StopDBInstance": {"tagging": ["rds:AddTagsToResource"], "notRead": "no member of the request carries tags"},+ "redshift-serverless:ConvertRecoveryPointToSnapshot": {"tagging": ["redshift-serverless:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "redshift-serverless:CreateNamespace": {"tagging": ["redshift-serverless:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "redshift-serverless:CreateSnapshot": {"tagging": ["redshift-serverless:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "redshift-serverless:CreateWorkgroup": {"tagging": ["redshift-serverless:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "redshift:CreateCluster": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateClusterParameterGroup": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateClusterSecurityGroup": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateClusterSnapshot": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateClusterSubnetGroup": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateEventSubscription": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateHsmClientCertificate": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateHsmConfiguration": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateIntegration": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "TagList[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateQev2IdcApplication": {"tagging": ["redshift:CreateTags"], "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateRedshiftIdcApplication": {"tagging": ["redshift:CreateTags"], "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateSnapshotCopyGrant": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateSnapshotSchedule": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "redshift:CreateUsageLimit": {"tagging": ["redshift:CreateTags"], "requestTags": true, "tags": [{"member": "Tags[Tag]", "key": "Key", "value": "Value"}]},+ "rekognition:CopyProjectVersion": {"tagging": ["rekognition:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "rekognition:CreateCollection": {"tagging": ["rekognition:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "rekognition:CreateDataset": {"tagging": ["rekognition:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "rekognition:CreateProject": {"tagging": ["rekognition:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "rekognition:CreateProjectVersion": {"tagging": ["rekognition:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "rekognition:CreateStreamProcessor": {"tagging": ["rekognition:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "resource-groups:CreateGroup": {"tagging": ["resource-groups:Tag"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "route53resolver:AssociateFirewallRuleGroup": {"tagging": ["route53resolver:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "route53resolver:CreateFirewallDomainList": {"tagging": ["route53resolver:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "route53resolver:CreateFirewallRuleGroup": {"tagging": ["route53resolver:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "route53resolver:CreateOutpostResolver": {"tagging": ["route53resolver:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "route53resolver:CreateResolverEndpoint": {"tagging": ["route53resolver:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "route53resolver:CreateResolverQueryLogConfig": {"tagging": ["route53resolver:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "route53resolver:CreateResolverRule": {"tagging": ["route53resolver:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateAIBenchmarkJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateAIRecommendationJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateAIWorkloadConfig": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateAction": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateAlgorithm": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateApp": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateAppImageConfig": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateArtifact": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateAutoMLJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateAutoMLJobV2": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateCluster": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateClusterSchedulerConfig": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateCodeRepository": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateCompilationJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateComputeQuota": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateContext": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateDataQualityJobDefinition": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateDomain": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateEndpoint": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateEndpointConfig": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateExperiment": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateFeatureGroup": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateFlowDefinition": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateHub": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateHubContentReference": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateHumanTaskUi": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateHyperParameterTuningJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateImage": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateInferenceComponent": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateInferenceExperiment": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateInferenceRecommendationsJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateLabelingJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateMlflowApp": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateMlflowTrackingServer": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateModel": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateModelBiasJobDefinition": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateModelCard": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateModelExplainabilityJobDefinition": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateModelPackage": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateModelPackageGroup": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateModelQualityJobDefinition": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateMonitoringSchedule": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateNotebookInstance": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateNotebookInstanceLifecycleConfig": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateOptimizationJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreatePartnerApp": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreatePipeline": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateProcessingJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateProject": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateSpace": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateStudioLifecycleConfig": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateTrainingJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateTrainingPlan": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateTrainingSession": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateTransformJob": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateTrial": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateTrialComponent": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateUserProfile": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateWorkforce": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:CreateWorkteam": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:ImportHubContent": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:UpdatePartnerApp": {"tagging": ["sagemaker:AddTags"], "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sagemaker:UpdateProject": {"tagging": ["sagemaker:AddTags"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "scheduler:CreateScheduleGroup": {"tagging": ["scheduler:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "secretsmanager:CreateSecret": {"tagging": ["secretsmanager:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "servicediscovery:CreateHttpNamespace": {"tagging": ["servicediscovery:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "servicediscovery:CreatePrivateDnsNamespace": {"tagging": ["servicediscovery:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "servicediscovery:CreatePublicDnsNamespace": {"tagging": ["servicediscovery:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "servicediscovery:CreateService": {"tagging": ["servicediscovery:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateAddonInstance": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateAddonSubscription": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateAddressList": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateArchive": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateConfigurationSet": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateContactList": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateCustomVerificationEmailTemplate": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateDedicatedIpPool": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateDeliverabilityTestReport": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateEmailIdentity": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateEmailTemplate": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateIngressPoint": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateMultiRegionEndpoint": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateRelay": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateRuleSet": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateTenant": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ses:CreateTrafficPolicy": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sns:CreateTopic": {"tagging": ["sns:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sqs:CreateQueue": {"tagging": ["sqs:TagQueue"], "requestTags": true, "tags": [{"member": "tags{}", "query": "Tag{}"}]},+ "ssm:CreateActivation": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:CreateAssociation": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:CreateCloudConnector": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:CreateDocument": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:CreateMaintenanceWindow": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:CreateOpsItem": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:CreateOpsMetadata": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:CreatePatchBaseline": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:PutParameter": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:StartAccessRequest": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "ssm:StartAutomationExecution": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sso:CreateApplication": {"tagging": ["sso:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sso:CreateInstance": {"tagging": ["sso:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sso:CreatePermissionSet": {"tagging": ["sso:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sso:CreateTrustedTokenIssuer": {"tagging": ["sso:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "states:CreateActivity": {"tagging": ["states:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "states:CreateStateMachine": {"tagging": ["states:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "sts:AssumeRole": {"tagging": ["sts:TagSession"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sts:GetFederationToken": {"tagging": ["sts:TagSession"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "sts:GetWebIdentityToken": {"tagging": ["sts:TagGetWebIdentityToken"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "swf:RegisterDomain": {"tagging": ["swf:TagResource"], "requestTags": true, "tags": [{"member": "tags[]", "key": "key", "value": "value"}]},+ "textract:CreateAdapter": {"tagging": ["textract:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "textract:CreateAdapterVersion": {"tagging": ["textract:TagResource"], "requestTags": true, "tags": [{"member": "Tags{}"}]},+ "timestream-influxdb:CreateDbBackup": {"tagging": ["timestream-influxdb:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "timestream-influxdb:CreateDbCluster": {"tagging": ["timestream-influxdb:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "timestream-influxdb:CreateDbInstance": {"tagging": ["timestream-influxdb:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "timestream-influxdb:CreateDbParameterGroup": {"tagging": ["timestream-influxdb:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]},+ "transcribe:CreateCallAnalyticsCategory": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transcribe:CreateLanguageModel": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transcribe:CreateMedicalVocabulary": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transcribe:CreateVocabulary": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transcribe:CreateVocabularyFilter": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transcribe:StartCallAnalyticsJob": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transcribe:StartMedicalScribeJob": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transcribe:StartMedicalTranscriptionJob": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transcribe:StartTranscriptionJob": {"tagging": ["transcribe:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:CreateAgreement": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:CreateConnector": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:CreateProfile": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:CreateServer": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:CreateUser": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:CreateWebApp": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:CreateWorkflow": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:ImportCertificate": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "transfer:ImportHostKey": {"tagging": ["transfer:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "translate:CreateParallelData": {"tagging": ["translate:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "translate:ImportTerminology": {"tagging": ["translate:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "wafv2:CreateIPSet": {"tagging": ["wafv2:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "wafv2:CreateRegexPatternSet": {"tagging": ["wafv2:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "wafv2:CreateRuleGroup": {"tagging": ["wafv2:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]},+ "wafv2:CreateWebACL": {"tagging": ["wafv2:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]}+ }+}diff --git a/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateMembersTest.java b/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateMembersTest.javanew file mode 100644index 0000000000..9d243a66de--- /dev/null+++ b/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateMembersTest.java@@ -0,0 +1,233 @@+package io.github.hectorvent.floci.core.common;++import com.fasterxml.jackson.databind.JsonNode;+import com.fasterxml.jackson.databind.ObjectMapper;+import com.fasterxml.jackson.databind.node.ObjectNode;+import io.github.hectorvent.floci.core.common.PassedRoleMembers.Into;+import io.github.hectorvent.floci.core.common.PassedRoleMembers.Step;+import io.github.hectorvent.floci.core.common.TagOnCreateMembers.Entry;+import io.github.hectorvent.floci.core.common.TagOnCreateMembers.Member;+import jakarta.ws.rs.container.ContainerRequestContext;+import jakarta.ws.rs.core.MediaType;+import org.junit.jupiter.api.DynamicTest;+import org.junit.jupiter.api.Test;+import org.junit.jupiter.api.TestFactory;++import java.io.ByteArrayInputStream;+import java.nio.charset.StandardCharsets;+import java.util.ArrayList;+import java.util.List;+import java.util.Map;+import java.util.Optional;+import java.util.stream.Stream;++import static org.junit.jupiter.api.Assertions.assertEquals;+import static org.junit.jupiter.api.Assertions.assertFalse;+import static org.junit.jupiter.api.Assertions.assertNull;+import static org.junit.jupiter.api.Assertions.assertThrows;+import static org.junit.jupiter.api.Assertions.assertTrue;+import static org.mockito.Mockito.mock;+import static org.mockito.Mockito.when;++/**+ * The vendored table of the tagging action each operation that tags what it creates needs, and that+ * {@link TagOnCreate} reads every member it gives, from a JSON body and from Query form parameters.+ */+class TagOnCreateMembersTest {++ private static final ObjectMapper MAPPER = new ObjectMapper();++ @Test+ void theTableReadsTheOperationsOfEveryNamespaceItCoversOnce() {+ TagOnCreateMembers.Table table = TagOnCreateMembers.table();+ assertFalse(table.entries().isEmpty());+ for (String operation : table.entries().keySet()) {+ assertFalse(table.byHand().contains(operation) || table.notRead().contains(operation), operation);+ assertTrue(table.namespaces().contains(operation.substring(0, operation.indexOf(':'))), operation);+ }+ assertFalse(table.byHand().stream().anyMatch(table.notRead()::contains));+ assertTrue(table.otherNamespaces().stream().noneMatch(table.namespaces()::contains));+ assertTrue(table.notCovered().stream().noneMatch(table.namespaces()::contains));+ }++ /** The operations the table says Floci checks by hand are the ones {@link TagOnCreate} leaves to the filter. */+ @Test+ void exactlyTheOperationsCheckedByHandAreLeftToTheFilter() {+ assertEquals(TagOnCreate.BY_HAND, TagOnCreateMembers.table().byHand());+ }++ @Test+ void aTagListIsReadAsItsStepsAndATagSpecificationListByItsResourceType() {+ Member list = member("{\"member\":\"TagSpecification[item].Tag[item]\",\"key\":\"Key\",\"value\":\"Value\","+ + "\"resourceType\":\"ResourceType\"}");+ assertEquals(List.of(new Step("TagSpecification", Into.LIST, "item"), new Step("Tag", Into.LIST, "item")),+ list.steps());+ assertEquals("ResourceType", list.resourceType());+ assertTrue(list.inForm());++ Member named = member("{\"member\":\"Tags[Tag]\",\"key\":\"Key\",\"value\":\"Value\"}");+ assertEquals(List.of(new Step("Tags", Into.LIST, "Tag")), named.querySteps());+ assertNull(named.resourceType());+ assertFalse(member("{\"member\":\"Settings{Tags}.Tags[]\",\"key\":\"Key\",\"value\":\"Value\"}").inForm());+ }++ @Test+ void aTagMapIsReadFromAFormUnderItsQueryName() {+ Member map = member("{\"member\":\"tags{}\",\"query\":\"Tag{}\"}");+ assertEquals(List.of(new Step("tags", Into.MAP, null)), map.steps());+ assertEquals(List.of(new Step("Tag", Into.MAP, null)), map.querySteps());+ assertNull(map.key());+ }++ /** A tag specification's tags are checked on the resource of its type, an ARN the table gives each type. */+ @Test+ void theTableGivesAnArnForEachResourceTypeATagSpecificationCanName() {+ Map<String, String> ec2 = TagOnCreateMembers.table().resourceArns().get("ec2");+ assertEquals("arn:${Partition}:ec2:${Region}:${Account}:instance/*", ec2.get("instance"));+ assertEquals("arn:${Partition}:ec2:${Region}::image/*", ec2.get("image"));+ for (Map.Entry<String, Entry> operation : TagOnCreateMembers.table().entries().entrySet()) {+ for (Member member : operation.getValue().members()) {+ assertTrue(member.resourceType() == null || TagOnCreateMembers.table().resourceArns()+ .containsKey(operation.getKey().substring(0, operation.getKey().indexOf(':'))), operation.getKey());+ }+ }+ }++ @Test+ void aMalformedTableFailsToLoad() {+ assertThrows(IllegalStateException.class, () -> parse("{\"operations\":{}}"));+ assertThrows(IllegalStateException.class, () -> parse("{\"operations\":{\"a:B\":{\"tagging\":[\"a:Tag\"]}}}"));+ // Several tagging actions are checked by hand, never read from the table.+ assertThrows(IllegalStateException.class, () -> parse("{\"operations\":{\"a:B\":{\"tagging\":[\"a:T\",\"a:U\"],"+ + "\"tags\":[{\"member\":\"Tags{}\"}]}}}"));+ assertThrows(IllegalStateException.class, () -> member("{\"member\":\"Tags\"}"));+ assertThrows(IllegalStateException.class, () -> member("{\"member\":\"Tags[]\"}"));+ assertThrows(IllegalStateException.class, () -> member("{\"member\":\"Tags{}\",\"key\":\"K\",\"value\":\"V\"}"));+ assertThrows(IllegalStateException.class, () -> member("{\"member\":\"Tags{}\",\"query\":\"Tag[]\"}"));+ // A resource type belongs to a list of tag specifications, and its namespace's types need ARNs.+ assertThrows(IllegalStateException.class, () -> member("{\"member\":\"Tags[]\",\"key\":\"K\",\"value\":\"V\","+ + "\"resourceType\":\"ResourceType\"}"));+ assertThrows(IllegalStateException.class, () -> parse("{\"operations\":{\"a:B\":{\"tagging\":[\"a:T\"],"+ + "\"tags\":[{\"member\":\"Specs[].Tags[]\",\"key\":\"K\",\"value\":\"V\",\"resourceType\":\"Type\"}]}}}"));+ assertThrows(IllegalStateException.class, () -> parse("{\"resourceArns\":{\"a\":{\"thing\":\"*\"}},"+ + "\"operations\":{\"a:B\":{\"tagging\":[\"a:T\"],\"tags\":[{\"member\":\"Tags{}\"}]}}}"));+ }++ @TestFactory+ Stream<DynamicTest> everyMemberOfTheTableIsReadFromAJsonBody() {+ return TagOnCreateMembers.table().entries().entrySet().stream()+ .flatMap(operation -> operation.getValue().members().stream().map(member -> DynamicTest.dynamicTest(+ operation.getKey() + " " + member.path(), () -> assertEquals(expected(operation.getValue(), member),+ TagOnCreate.of(operation.getKey(), json(body(member).toString()))))));+ }++ /** Each member a form can carry, as the SDK sends it. */+ @TestFactory+ Stream<DynamicTest> everyMemberOfTheTableAQueryRequestCanCarryIsReadFromItsForm() {+ return TagOnCreateMembers.table().entries().entrySet().stream()+ .flatMap(operation -> operation.getValue().members().stream()+ .filter(Member::inForm)+ .map(member -> DynamicTest.dynamicTest(operation.getKey() + " " + member.path(),+ () -> assertEquals(expected(operation.getValue(), member),+ TagOnCreate.of(operation.getKey(), form(formBody(operation.getKey(), member)))))));+ }++ @TestFactory+ Stream<DynamicTest> aRequestCarryingNoTagsNeedsNoTaggingAction() {+ return TagOnCreateMembers.table().entries().keySet().stream().map(operation -> DynamicTest.dynamicTest(+ operation, () -> assertEquals(Optional.empty(), TagOnCreate.of(operation, json("{\"Name\":\"n\"}")))));+ }++ private static Optional<TagOnCreate.Tagging> expected(Entry entry, Member member) {+ return Optional.of(new TagOnCreate.Tagging(entry.tagging(), List.of(new TagOnCreate.TagSet(+ member.resourceType() == null ? null : "thing", Map.of("team", "blue"))), List.of(), entry.createAction(),+ entry.requestTags()));+ }++ /**+ * A body carrying the tag {@code team=blue} at the member, as one element of each list on the way, a tag+ * specification naming the resource type {@code thing}.+ */+ private static JsonNode body(Member member) {+ List<Step> steps = member.steps();+ Step last = steps.getLast();+ JsonNode node = last.into() == Into.MAP+ ? MAPPER.createObjectNode().put("team", "blue")+ : MAPPER.createArrayNode().add(MAPPER.createObjectNode().put(member.key(), "team")+ .put(member.value(), "blue"));+ for (int i = steps.size() - 1; i >= 0; i--) {+ Step step = steps.get(i);+ if (i < steps.size() - 1 && step.into() == Into.LIST && member.resourceType() != null) {+ ((ObjectNode) node).put(member.resourceType(), "thing");+ }+ JsonNode inner = i == steps.size() - 1 || step.into() == Into.NONE ? node+ : step.into() == Into.LIST ? MAPPER.createArrayNode().add(node)+ : MAPPER.createObjectNode().set("any", node);+ ObjectNode outer = MAPPER.createObjectNode();+ outer.set(step.name(), inner);+ node = outer;+ }+ return node;+ }++ /**+ * The form parameters of the tag {@code team=blue} at the member as the SDK sends them: EC2 numbers a list+ * under its name, the Query protocol under the name its shape gives elements, or {@code member}, and a map's+ * entries under {@code entry}, but SQS, whose tags go by {@code Tag.N.Key} and {@code Tag.N.Value}. A tag+ * specification names the resource type {@code thing}.+ */+ private static String formBody(String operation, Member member) {+ boolean ec2 = operation.startsWith("ec2:");+ boolean sqs = operation.startsWith("sqs:");+ List<String> parts = new ArrayList<>();+ String specification = null;+ for (Step step : member.querySteps()) {+ parts.add(step.name());+ if (step.into() == Into.LIST && !ec2) {+ parts.add(step.key().isEmpty() ? "member" : step.key());+ } else if (step.into() == Into.MAP && !sqs) {+ parts.add("entry");+ }+ parts.add("1");+ if (specification == null && member.resourceType() != null) {+ specification = String.join(".", parts) + "." + member.resourceType() + "=thing&";+ }+ }+ String prefix = String.join(".", parts);+ String key = member.key() != null ? member.key() : sqs ? "Key" : "key";+ String value = member.value() != null ? member.value() : sqs ? "Value" : "value";+ return (specification == null ? "" : specification) + prefix + "." + key + "=team&" + prefix + "." + value + "=blue";+ }++ private static Member member(String member) {+ try {+ return parse("{\"resourceArns\":{\"a\":{\"thing\":\"arn:${Partition}:a:${Region}:${Account}:thing/*\"}},"+ + "\"operations\":{\"a:B\":{\"tagging\":[\"a:TagResource\"],\"tags\":[" + member + "]}}}")+ .entries().get("a:B").members().get(0);+ } catch (IllegalStateException e) {+ throw e;+ } catch (Exception e) {+ throw new AssertionError(e);+ }+ }++ private static TagOnCreateMembers.Table parse(String document) throws Exception {+ return TagOnCreateMembers.parse(new ByteArrayInputStream(document.getBytes(StandardCharsets.UTF_8)));+ }++ private static ContainerRequestContext json(String body) {+ return request("application/x-amz-json-1.1", body);+ }++ private static ContainerRequestContext form(String body) {+ return request("application/x-www-form-urlencoded", body);+ }++ private static ContainerRequestContext request(String mediaType, String body) {+ byte[] bytes = body.getBytes(StandardCharsets.UTF_8);+ ContainerRequestContext request = mock(ContainerRequestContext.class);+ when(request.getMediaType()).thenReturn(MediaType.valueOf(mediaType));+ when(request.getEntityStream()).thenAnswer(invocation -> new ByteArrayInputStream(bytes));+ return request;+ }+}diff --git a/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateNamespacesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateNamespacesIntegrationTest.javanew file mode 100644index 0000000000..a01d580363--- /dev/null+++ b/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateNamespacesIntegrationTest.java@@ -0,0 +1,35 @@+package io.github.hectorvent.floci.core.common;++import io.quarkus.test.junit.QuarkusTest;+import jakarta.inject.Inject;+import org.junit.jupiter.api.Test;++import java.util.Set;+import java.util.TreeSet;++import static org.junit.jupiter.api.Assertions.assertEquals;++/**+ * Every IAM namespace Floci serves whose operations the Service Reference lists with a tagging action is one+ * the vendored tag-on-create table reads, or one it names as not read yet, so a service Floci adds does not+ * tag what it creates unchecked.+ */+@QuarkusTest+class TagOnCreateNamespacesIntegrationTest {++ @Inject+ ResolvedServiceCatalog catalog;++ @Test+ void everyNamespaceFlociServesThatTagsOnCreationIsReadOrNamedAsNotReadYet() {+ Set<String> served = new TreeSet<>();+ for (ServiceDescriptor descriptor : catalog.all()) {+ for (String scope : descriptor.credentialScopes()) {+ served.add(catalog.canonicalCredentialScope(scope));+ }+ }+ Set<String> unread = new TreeSet<>(served);+ unread.retainAll(TagOnCreateMembers.table().otherNamespaces());+ assertEquals(Set.of(), unread, "add these to NAMESPACES or NOT_COVERED in tools/aws/regen_iam_tag_on_create.py");+ }+}diff --git a/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateTest.java b/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateTest.javanew file mode 100644index 0000000000..f07040d0a6--- /dev/null+++ b/src/test/java/io/github/hectorvent/floci/core/common/TagOnCreateTest.java@@ -0,0 +1,279 @@+package io.github.hectorvent.floci.core.common;++import com.fasterxml.jackson.databind.ObjectMapper;+import com.fasterxml.jackson.dataformat.cbor.CBORFactory;+import io.github.hectorvent.floci.core.common.TagOnCreate.TagSet;+import io.github.hectorvent.floci.core.common.TagOnCreate.Tagging;+import jakarta.ws.rs.container.ContainerRequestContext;+import jakarta.ws.rs.core.MediaType;+import org.junit.jupiter.api.Test;++import java.io.ByteArrayInputStream;+import java.nio.charset.StandardCharsets;+import java.util.List;+import java.util.Map;+import java.util.Optional;++import static org.junit.jupiter.api.Assertions.assertEquals;+import static org.junit.jupiter.api.Assertions.assertFalse;+import static org.mockito.Mockito.mock;+import static org.mockito.Mockito.when;++/** How {@link TagOnCreate} reads the tags a request carries and the condition keys it checks them with. */+class TagOnCreateTest {++ @Test+ void aFormsTagsAreReadFromOneToTheFirstNumberWithNoKey() {+ assertEquals(List.of(set(Map.of("a", "1", "b", "2"))), sets("sns:CreateTopic", form("Name=t"+ + "&Tags.member.2.Key=b&Tags.member.2.Value=2&Tags.member.1.Key=a&Tags.member.1.Value=1"+ + "&Tags.member.4.Key=d&Tags.member.4.Value=4")));+ assertEquals(List.of("a", "b"), sets("sns:CreateTopic", form("Name=t&Tags.member.1.Key=a&Tags.member.2.Key=b"))+ .getFirst().tags().keySet().stream().toList());+ // SNS's handler and SQS's stop where the number is missing, so a tag past the gap is not one the queue+ // gets, though the tagging action is still checked for it.+ assertEquals(List.of(), sets("sqs:CreateQueue", form("Action=CreateQueue&QueueName=q&Tag.2.Key=team&Tag.2.Value=blue")));+ assertEquals(List.of(set(Map.of("team", "blue"))), TagOnCreate.of("sqs:CreateQueue",+ form("Action=CreateQueue&QueueName=q&Tag.2.Key=team&Tag.2.Value=blue")).orElseThrow().otherSpellings());+ assertEquals(List.of(set(Map.of("team", ""))), TagOnCreate.of("sns:CreateTopic",+ form("Name=t&Tags.member.99999999999999999999.Key=team")).orElseThrow().checked());+ }++ /**+ * A handler reads the SDK's own spelling, so a tag under another is not one the resource gets; the tagging+ * action is still checked for it, as another handler might apply it.+ */+ @Test+ void aTagUnderASpellingTheHandlerDoesNotReadIsCheckedOnlyOnTheTaggingAction() {+ Tagging bare = TagOnCreate.of("sns:CreateTopic", form("Name=t&Tags.1.Key=team&Tags.1.Value=b")).orElseThrow();+ assertEquals(List.of(), bare.sets());+ assertEquals(List.of(set(Map.of("team", "b"))), bare.otherSpellings());+ // The own action is checked with no tags, as the handler applies none, and with the other spelling's.+ assertEquals(List.of(Map.of(), Map.of("aws:RequestTag/team", List.of("b"), "aws:TagKeys", List.of("team"))),+ TagOnCreate.requestTagContexts(bare));+ assertEquals(List.of(set(Map.of("team", "b"))), TagOnCreate.of("sns:CreateTopic",+ form("Name=t&TAGS.Tag.1.key=team&Tags.Tag.1.VALUE=b")).orElseThrow().otherSpellings());+ assertEquals(List.of(new TagSet("instance", Map.of("team", ""))), TagOnCreate.of("ec2:RunInstances",+ form("Action=RunInstances&TagSpecification.item.1.ResourceType=instance"+ + "&TagSpecification.item.1.Tag.1.Key=team")).orElseThrow().otherSpellings());+ }++ /**+ * CodeDeploy's handler reads a tag as {@code Key} and {@code Value}, or as {@code key} and {@code value}, so both+ * are the tags it applies; under any other case a tag is checked on the tagging action only.+ */+ @Test+ void aBodysTagsAreReadInTheCasesTheirHandlerReadsAndCheckedOnTheTaggingActionInAnyOther() {+ for (String tag : List.of("{\"key\":\"team\",\"value\":\"red\"}", "{\"Key\":\"team\",\"Value\":\"red\"}")) {+ Tagging tagging = TagOnCreate.of("codedeploy:CreateApplication", json(+ "{\"applicationName\":\"demo\",\"tags\":[" + tag + "]}")).orElseThrow();+ assertEquals(List.of(set(Map.of("team", "red"))), tagging.sets(), tag);+ assertEquals(List.of(), tagging.otherSpellings(), tag);+ }+ // Under any other case the handler reads neither, and keeps an empty tag; the tagging action is checked for both.+ Tagging upper = TagOnCreate.of("codedeploy:CreateApplication", json(+ "{\"applicationName\":\"demo\",\"tags\":[{\"KEY\":\"team\",\"VALUE\":\"red\"}]}")).orElseThrow();+ assertEquals(List.of(set(Map.of("", ""))), upper.sets());+ assertEquals(List.of(set(Map.of("", "")), set(Map.of("team", "red"))), upper.checked());+ // Only CodeDeploy's handler reads a lowercase key where the SDK sends Key.+ assertEquals(List.of(), sets("dynamodb:CreateTable", json(+ "{\"TableName\":\"t\",\"Tags\":[{\"key\":\"team\",\"value\":\"red\"}]}")));+ }++ /**+ * CodeDeploy's handler iterates its tags member whatever it holds, so an object's values are tags too; a deny on+ * one holds on the own action and the tagging action alike.+ */+ @Test+ void anObjectsValuesAreTagsWhereTheHandlerIteratesIt() {+ Tagging object = TagOnCreate.of("codedeploy:CreateApplication", json("{\"applicationName\":\"demo\","+ + "\"tags\":{\"0\":{\"key\":\"team\",\"value\":\"red\"}}}")).orElseThrow();+ assertEquals(List.of(set(Map.of("team", "red"))), object.sets());+ assertEquals(List.of("red"), TagOnCreate.requestTagContexts(object).getFirst().get("aws:RequestTag/team"));+ // Elsewhere it is checked on the tagging action and with the own action, beside no tags.+ Tagging elsewhere = TagOnCreate.of("dynamodb:CreateTable", json("{\"TableName\":\"t\","+ + "\"Tags\":{\"0\":{\"Key\":\"team\",\"Value\":\"red\"}}}")).orElseThrow();+ assertEquals(List.of(), elsewhere.sets());+ assertEquals("red", elsewhere.otherSpellings().getFirst().tags().get("team"));+ assertEquals(List.of(), TagOnCreate.requestTagContexts(elsewhere).getFirst().keySet().stream().toList());+ // A map's string values are its own, not elements.+ assertEquals(List.of(), TagOnCreate.of("sqs:CreateQueue", json("{\"QueueName\":\"q\",\"tags\":{\"team\":\"blue\"}}"))+ .orElseThrow().otherSpellings());+ }++ /**+ * CodeDeploy's handler reads a tag's key and value as text whatever they hold, a missing key as an empty one,+ * and so does the check; other handlers' keys are read as text when they are a number or a flag too.+ */+ @Test+ void aTagKeyThatIsNoStringIsReadAsText() {+ assertEquals(List.of(set(Map.of("123", "red"))), sets("codedeploy:CreateApplication", json(+ "{\"applicationName\":\"demo\",\"tags\":[{\"key\":123,\"value\":\"red\"}]}")));+ assertEquals(List.of(set(Map.of("", "red"))), sets("codedeploy:CreateApplication", json(+ "{\"applicationName\":\"demo\",\"tags\":[{\"value\":\"red\"}]}")));+ assertEquals(List.of(set(Map.of("true", "1"))), sets("dynamodb:CreateTable", json(+ "{\"TableName\":\"t\",\"Tags\":[{\"Key\":true,\"Value\":1}]}")));+ // Under any other spelling, every element of a tag list is checked on the tagging action.+ assertEquals(List.of(set(Map.of("", ""))), TagOnCreate.of("dynamodb:CreateTable", json(+ "{\"TableName\":\"t\",\"Tags\":[{\"Key\":{}}]}")).orElseThrow().checked());+ }++ @Test+ void aTagWithNoValueIsReadWithAnEmptyOneAndAKeyGivenTwiceKeepsItsLastValue() {+ assertEquals(List.of(set(Map.of("team", ""))), sets("sns:CreateTopic", form("Name=t&Tags.member.1.Key=team")));+ assertEquals(List.of(set(Map.of("team", "red", "env", ""))), sets("dynamodb:CreateTable", json(+ "{\"TableName\":\"t\",\"Tags\":[{\"Key\":\"team\",\"Value\":\"blue\"},{\"Key\":\"env\"},"+ + "{\"Key\":\"team\",\"Value\":\"red\"}]}")));+ // A value with no key tags nothing.+ assertEquals(Optional.empty(), TagOnCreate.of("sns:CreateTopic", form("Name=t&Tags.member.1.Value=v")));+ }++ @Test+ void sqsTagsAreReadAsTheJsonProtocolsMapAndTheQueryProtocolsTagParameters() {+ Tagging json = TagOnCreate.of("sqs:CreateQueue", json("{\"QueueName\":\"q\",\"tags\":{\"team\":\"blue\"}}"))+ .orElseThrow();+ assertEquals(new Tagging("sqs:TagQueue", List.of(set(Map.of("team", "blue"))), List.of(), false, true), json);+ assertEquals(json, TagOnCreate.of("sqs:CreateQueue",+ form("Action=CreateQueue&QueueName=q&Tag.1.Key=team&Tag.1.Value=blue")).orElseThrow());+ }++ /**+ * Each resource type an EC2 request names gets its own specifications' tags, as {@code Ec2QueryHandler}+ * applies them, so one type's tags cannot stand in for another's.+ */+ @Test+ void anEc2RequestsTagsAreReadByTheResourceTypeEachSpecificationNames() {+ Tagging tagging = TagOnCreate.of("ec2:RunInstances", form("Action=RunInstances&ImageId=ami-1"+ + "&TagSpecification.1.ResourceType=instance&TagSpecification.1.Tag.1.Key=team"+ + "&TagSpecification.1.Tag.1.Value=red&TagSpecification.2.ResourceType=volume"+ + "&TagSpecification.2.Tag.1.Key=team&TagSpecification.2.Tag.1.Value=blue"+ + "&TagSpecifications.1.ResourceType=instance&TagSpecifications.1.Tag.1.Key=env"+ + "&TagSpecifications.1.Tag.1.Value=dev")).orElseThrow();+ assertEquals(new Tagging("ec2:CreateTags", List.of(new TagSet("instance", Map.of("team", "red", "env", "dev")),+ new TagSet("volume", Map.of("team", "blue"))), List.of(), true, true), tagging);+ Map<String, List<String>> context = TagOnCreate.conditionContext(tagging, tagging.sets().getFirst(),+ "ec2:RunInstances");+ assertEquals(List.of("RunInstances"), context.get("ec2:CreateAction"));+ assertEquals(List.of("red"), context.get("aws:RequestTag/team"));+ assertEquals(List.of("team", "env"), context.get("aws:TagKeys"));+ }++ /** {@code Ec2QueryHandler} stops at the first tag specification that names no resource type. */+ @Test+ void anEc2RequestsSpecificationsAreReadToTheFirstWithNoResourceType() {+ assertEquals(List.of(new TagSet("instance", Map.of("a", "1"))), sets("ec2:RunInstances", form(+ "Action=RunInstances&TagSpecification.1.ResourceType=instance&TagSpecification.1.Tag.1.Key=a"+ + "&TagSpecification.1.Tag.1.Value=1&TagSpecification.2.Tag.1.Key=b"+ + "&TagSpecification.3.ResourceType=volume&TagSpecification.3.Tag.1.Key=c")));+ }++ /** A tag specification's tags are checked on the resource it names, its name not known yet. */+ @Test+ void aSpecificationsTagsGoToTheResourceOfItsTypeAndOtherTagsToTheOperationsResources() {+ List<String> checked = List.of("*");+ assertEquals(List.of("arn:aws:ec2:us-east-1:000000000000:instance/*"), TagOnCreate.resources("ec2:RunInstances",+ new TagSet("instance", Map.of()), "aws", "us-east-1", "000000000000", checked));+ assertEquals(List.of("arn:aws-cn:ec2:cn-north-1::image/*"), TagOnCreate.resources("ec2:CreateImage",+ new TagSet("image", Map.of()), "aws-cn", "cn-north-1", "000000000000", checked));+ assertEquals(checked, TagOnCreate.resources("ec2:RunInstances", new TagSet("no-such-type", Map.of()),+ "aws", "us-east-1", "000000000000", checked));+ assertEquals(checked, TagOnCreate.resources("sns:CreateTopic", new TagSet(null, Map.of()),+ "aws", "us-east-1", "000000000000", checked));+ }++ /**+ * RDS, DocumentDB and Neptune read three spellings, the first two in either order, so a key given under both+ * with two values may end up with either, and each is checked.+ */+ @Test+ void rdsTagsAreReadUnderEachSpellingItsHandlersRead() {+ assertEquals(List.of(set(Map.of("a", "1", "b", "2", "c", "3"))), sets("rds:CreateDBParameterGroup", form(+ "Tags.member.1.Key=a&Tags.member.1.Value=1&Tags.Tag.1.Key=b&Tags.Tag.1.Value=2&Tag.1.Key=c&Tag.1.Value=3")));+ assertEquals(List.of(set(Map.of("team", "blue")), set(Map.of("team", "red"))), sets("rds:CreateDBParameterGroup",+ form("Tags.member.1.Key=team&Tags.member.1.Value=red&Tags.Tag.1.Key=team&Tags.Tag.1.Value=blue")));+ }++ @Test+ void elastiCacheAndRedshiftTagsAreReadAsTheirHandlersNumberThem() {+ // ElastiCacheServerlessQueryHandler takes either spelling at each number.+ assertEquals(List.of(set(Map.of("a", "1", "b", "2"))), sets("elasticache:CreateServerlessCache",+ form("Tags.Tag.1.Key=a&Tags.Tag.1.Value=1&Tags.member.2.Key=b&Tags.member.2.Value=2")));+ // ElastiCacheQueryHandler reads each spelling from 1.+ assertEquals(List.of(set(Map.of("a", "1"))), sets("elasticache:CreateCacheCluster",+ form("Tags.Tag.1.Key=a&Tags.Tag.1.Value=1&Tags.member.2.Key=b&Tags.member.2.Value=2")));+ // RedshiftQueryHandler reads every number of an integration's tags, but a blank key.+ assertEquals(List.of(set(Map.of("a", "1", "b", "2"))), sets("redshift:CreateIntegration",+ form("TagList.Tag.3.Key=a&TagList.Tag.3.Value=1&TagList.Tag.7.Key=b&TagList.Tag.7.Value=2"+ + "&TagList.Tag.8.Key=%20")));+ }++ /** CloudWatch's handler reads an alarm's tags from {@code tags} too; other handlers read the member's name only. */+ @Test+ void aBodysMemberIsReadUnderItsOwnNameAndAnAlarmsUnderTagsToo() {+ assertEquals(List.of(set(Map.of("team", "blue"))), sets("cloudwatch:PutMetricAlarm", json(+ "{\"AlarmName\":\"a\",\"tags\":[{\"Key\":\"team\",\"Value\":\"blue\"}]}")));+ assertEquals(List.of(set(Map.of("team", "red"))), sets("cloudwatch:PutCompositeAlarm", json(+ "{\"AlarmName\":\"a\",\"Tags\":[{\"Key\":\"team\",\"Value\":\"red\"}],"+ + "\"tags\":[{\"Key\":\"team\",\"Value\":\"blue\"}]}")));+ Tagging lower = TagOnCreate.of("dynamodb:CreateTable", json(+ "{\"TableName\":\"t\",\"tags\":[{\"Key\":\"team\",\"Value\":\"blue\"}]}")).orElseThrow();+ assertEquals(List.of(), lower.sets());+ assertEquals(List.of(set(Map.of("team", "blue"))), lower.otherSpellings());+ }++ @Test+ void aCborBodysTagsAreRead() throws Exception {+ byte[] body = new ObjectMapper(new CBORFactory()).writeValueAsBytes(Map.of("AlarmName", "a",+ "Tags", List.of(Map.of("Key", "team", "Value", "blue"))));+ Tagging tagging = TagOnCreate.of("cloudwatch:PutMetricAlarm", request("application/cbor", body)).orElseThrow();+ assertEquals(new Tagging("cloudwatch:TagResource", List.of(set(Map.of("team", "blue"))), List.of(), false, true),+ tagging);+ assertFalse(TagOnCreate.conditionContext(tagging, tagging.sets().getFirst(), "cloudwatch:PutMetricAlarm")+ .keySet().stream().anyMatch(key -> key.endsWith(":CreateAction")));+ }++ @Test+ void theOperationsOwnActionTakesEachSetOfTagsOnlyWhereTheServiceReferenceSaysItDoes() {+ Tagging queue = TagOnCreate.of("sqs:CreateQueue", json("{\"QueueName\":\"q\",\"tags\":{\"team\":\"blue\"}}"))+ .orElseThrow();+ assertEquals(List.of(Map.of("aws:RequestTag/team", List.of("blue"), "aws:TagKeys", List.of("team"))),+ TagOnCreate.requestTagContexts(queue));+ // RDS lists aws:RequestTag for neither ModifyDBInstance nor its resources, only for the tagging action.+ assertFalse(TagOnCreate.of("rds:ModifyDBInstance", form("Action=ModifyDBInstance&DBInstanceIdentifier=d"+ + "&TagSpecifications.item.1.ResourceType=auto-backup&TagSpecifications.item.1.Tags.Tag.1.Key=team"+ + "&TagSpecifications.item.1.Tags.Tag.1.Value=blue")).orElseThrow().requestTags());+ }++ @Test+ void anOperationTheTableDoesNotReadOrChecksByHandNeedsNothingHere() {+ assertEquals(Optional.empty(), TagOnCreate.of("sqs:SendMessage", json("{\"tags\":{\"a\":\"b\"}}")));+ assertEquals(Optional.empty(), TagOnCreate.of("logs:CreateLogGroup", json(+ "{\"logGroupName\":\"g\",\"tags\":{\"a\":\"b\"}}")));+ assertEquals(Optional.empty(), TagOnCreate.of("dynamodb:CreateTable", json("{\"Tags\":[]}")));+ // A tags member of the other shape is none the handler reads, though the tagging action is checked for it.+ assertEquals(List.of(), sets("dynamodb:CreateTable", json("{\"Tags\":{\"a\":\"b\"}}")));+ }++ private static TagSet set(Map<String, String> tags) {+ return new TagSet(null, tags);+ }++ /** The sets of tags the request carries as its handler reads them. */+ private static List<TagSet> sets(String operation, ContainerRequestContext request) {+ return TagOnCreate.of(operation, request).orElseThrow().sets();+ }++ private static ContainerRequestContext json(String body) {+ return request("application/x-amz-json-1.1", body.getBytes(StandardCharsets.UTF_8));+ }++ private static ContainerRequestContext form(String body) {+ return request("application/x-www-form-urlencoded", body.getBytes(StandardCharsets.UTF_8));+ }++ private static ContainerRequestContext request(String mediaType, byte[] bytes) {+ ContainerRequestContext request = mock(ContainerRequestContext.class);+ when(request.getMediaType()).thenReturn(MediaType.valueOf(mediaType));+ when(request.getEntityStream()).thenAnswer(invocation -> new ByteArrayInputStream(bytes));+ return request;+ }+}diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamTagOnCreateEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamTagOnCreateEnforcementIntegrationTest.javanew file mode 100644index 0000000000..af6181936f--- /dev/null+++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamTagOnCreateEnforcementIntegrationTest.java@@ -0,0 +1,502 @@+package io.github.hectorvent.floci.services.iam;++import com.fasterxml.jackson.databind.JsonNode;+import com.fasterxml.jackson.databind.ObjectMapper;+import com.fasterxml.jackson.dataformat.cbor.CBORFactory;+import io.github.hectorvent.floci.testing.EnforcementFixtures;+import io.github.hectorvent.floci.testing.IamEnforcementProfile;+import io.github.hectorvent.floci.testing.PartitionCleanup;+import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;+import io.quarkus.test.common.http.TestHTTPResource;+import io.quarkus.test.junit.QuarkusTest;+import io.quarkus.test.junit.TestProfile;+import io.restassured.response.Response;+import io.restassured.response.ValidatableResponse;+import io.restassured.specification.RequestSpecification;+import org.junit.jupiter.api.BeforeAll;+import org.junit.jupiter.api.Test;+import org.junit.jupiter.api.extension.RegisterExtension;++import java.io.IOException;+import java.net.URI;+import java.util.List;+import java.util.Map;++import static io.github.hectorvent.floci.testing.EnforcementFixtures.auth;+import static io.restassured.RestAssured.given;+import static org.hamcrest.Matchers.containsString;+import static org.hamcrest.Matchers.not;+import static org.junit.jupiter.api.Assertions.assertTrue;++/**+ * A request that tags the resource it creates also needs the service's tagging action, as AWS checks it: the+ * SNS API reference has "To be able to tag a topic on creation, you must have the {@code sns:CreateTopic}+ * and {@code sns:TagResource} permissions." Without it a caller allowed to create but not to tag could set+ * the tags a tag-based policy trusts.+ */+@QuarkusTest+@TestProfile(IamEnforcementProfile.class)+class IamTagOnCreateEnforcementIntegrationTest {++ private static final String ADMIN = "test";+ private static final String ACCOUNT = "000000000000";+ private static final String IMAGE = "ami-0abcdef1234567890";+ private static final ObjectMapper CBOR_MAPPER = new ObjectMapper(new CBORFactory());++ @TestHTTPResource("/")+ static URI baseUri;++ @RegisterExtension+ final PartitionCleanup cleanup = new PartitionCleanup();++ @BeforeAll+ static void configureRestAssured() {+ RestAssuredJsonUtils.configureAwsContentTypes();+ }++ @Test+ void aQueueCreatedWithTagsNeedsTagQueueOverEitherProtocol() {+ User user = user("tag-queue");+ String queue = "tag-queue-" + suffix();++ // A queue created without tags needs only its own action.+ user.policy(allow("sqs:CreateQueue"));+ deleteQueueLater(user.query("sqs", "CreateQueue").formParam("QueueName", queue + "-plain").post("/"));+ refused(user.query("sqs", "CreateQueue").formParam("QueueName", queue)+ .formParam("Tag.1.Key", "team").formParam("Tag.1.Value", "blue").post("/").then(), "sqs:TagQueue");+ refusedJson(user.json("sqs", "AmazonSQS.CreateQueue", "1.0")+ .body("{\"QueueName\":\"" + queue + "\",\"tags\":{\"team\":\"blue\"}}").post("/").then(), "sqs:TagQueue");++ // Allowed to create but not to tag, the caller is refused the create, not the tagging.+ user.policy(allow("sqs:TagQueue"));+ refused(user.query("sqs", "CreateQueue").formParam("QueueName", queue)+ .formParam("Tag.1.Key", "team").formParam("Tag.1.Value", "blue").post("/").then(), "sqs:CreateQueue");++ user.policy(allow("sqs:CreateQueue") + "," + allow("sqs:TagQueue"));+ deleteQueueLater(user.query("sqs", "CreateQueue").formParam("QueueName", queue)+ .formParam("Tag.1.Key", "team").formParam("Tag.1.Value", "blue").post("/"));+ }++ /** The create's own action sees the tags too, as the Service Reference lists the keys for it. */+ @Test+ void theCreatesOwnActionIsCheckedWithTheTagsItCarries() {+ User user = user("tag-create-condition");+ String queue = "tag-condition-" + suffix();+ user.policy("{\"Effect\":\"Allow\",\"Action\":\"sqs:CreateQueue\",\"Resource\":\"*\","+ + "\"Condition\":{\"StringEquals\":{\"aws:RequestTag/team\":\"blue\"}}}," + allow("sqs:TagQueue"));+ refused(createQueue(user, queue, "red").then(), "sqs:CreateQueue");+ refused(user.query("sqs", "CreateQueue").formParam("QueueName", queue).post("/").then(), "sqs:CreateQueue");+ refusedJson(user.json("sqs", "AmazonSQS.CreateQueue", "1.0")+ .body("{\"QueueName\":\"" + queue + "\",\"tags\":{\"team\":\"red\"}}").post("/").then(), "sqs:CreateQueue");+ deleteQueueLater(createQueue(user, queue, "blue"));++ // The usual guard: no create without the tag. It must not refuse a create that carries it.+ user.policy(allow("sqs:CreateQueue") + "," + allow("sqs:TagQueue") + ",{\"Effect\":\"Deny\","+ + "\"Action\":\"sqs:CreateQueue\",\"Resource\":\"*\",\"Condition\":{\"Null\":{\"aws:RequestTag/team\":\"true\"}}}");+ refused(user.query("sqs", "CreateQueue").formParam("QueueName", queue + "-untagged").post("/").then(),+ "sqs:CreateQueue");+ deleteQueueLater(createQueue(user, queue + "-guarded", "blue"));+ }++ /**+ * Only an action the Service Reference gives the request's tags to sees them: Cognito's+ * {@code CreateIdentityPool} does, {@code UpdateIdentityPool} does not, though both carry them.+ */+ @Test+ void anActionTheServiceReferenceGivesNoRequestTagsIsCheckedWithout() {+ User user = user("tag-pool");+ String pool = "tag_pool_" + suffix();+ String created = admin("cognito-identity").header("X-Amz-Target", "AWSCognitoIdentityService.CreateIdentityPool")+ .contentType("application/x-amz-json-1.1")+ .body("{\"IdentityPoolName\":\"" + pool + "\",\"AllowUnauthenticatedIdentities\":false}")+ .post("/").then().statusCode(200).extract().path("IdentityPoolId");+ cleanup.register(() -> admin("cognito-identity").header("X-Amz-Target", "AWSCognitoIdentityService.DeleteIdentityPool")+ .contentType("application/x-amz-json-1.1").body("{\"IdentityPoolId\":\"" + created + "\"}").post("/"));+ user.policy(allow("cognito-identity:CreateIdentityPool") + "," + allow("cognito-identity:UpdateIdentityPool") + ","+ + allow("cognito-identity:TagResource") + ",{\"Effect\":\"Deny\",\"Action\":["+ + "\"cognito-identity:CreateIdentityPool\",\"cognito-identity:UpdateIdentityPool\"],\"Resource\":\"*\","+ + "\"Condition\":{\"ForAnyValue:StringEquals\":{\"aws:TagKeys\":[\"env\"]}}}");++ refusedJson(user.json("cognito-identity", "AWSCognitoIdentityService.CreateIdentityPool", "1.1")+ .body("{\"IdentityPoolName\":\"" + pool + "_new\",\"AllowUnauthenticatedIdentities\":false,"+ + "\"IdentityPoolTags\":{\"env\":\"dev\"}}").post("/").then(), "cognito-identity:CreateIdentityPool");+ user.json("cognito-identity", "AWSCognitoIdentityService.UpdateIdentityPool", "1.1")+ .body("{\"IdentityPoolId\":\"" + created + "\",\"IdentityPoolName\":\"" + pool + "\","+ + "\"AllowUnauthenticatedIdentities\":false,\"IdentityPoolTags\":{\"env\":\"dev\"}}")+ .post("/").then().statusCode(200);+ }++ @Test+ void theTaggingActionIsCheckedWithTheTagsTheRequestCarries() {+ User user = user("tag-topic");+ String topic = "tag-topic-" + suffix();+ user.policy(allow("sns:CreateTopic") + ",{\"Effect\":\"Allow\",\"Action\":\"sns:TagResource\",\"Resource\":\"*\","+ + "\"Condition\":{\"StringEquals\":{\"aws:RequestTag/team\":\"blue\"},"+ + "\"ForAllValues:StringEquals\":{\"aws:TagKeys\":[\"team\"]}}}");++ refused(createTopic(user, topic, Map.of("team", "red")), "sns:TagResource");+ refused(createTopic(user, topic, Map.of("team", "blue", "env", "dev")), "sns:TagResource");+ createTopic(user, topic, Map.of("team", "blue")).statusCode(200);+ cleanup.register(() -> admin("sns").formParam("Action", "DeleteTopic")+ .formParam("TopicArn", "arn:aws:sns:us-east-1:" + ACCOUNT + ":" + topic).post("/"));+ }++ @Test+ void aJsonRequestsTagsNeedTheTaggingAction() {+ User user = user("tag-json");+ String table = "tag-table-" + suffix();+ String createTable = """+ {"TableName":"%s","BillingMode":"PAY_PER_REQUEST",+ "AttributeDefinitions":[{"AttributeName":"id","AttributeType":"S"}],+ "KeySchema":[{"AttributeName":"id","KeyType":"HASH"}],+ "Tags":[{"Key":"team","Value":"blue"}]}""".formatted(table);+ String createKey = "{\"Tags\":[{\"TagKey\":\"team\",\"TagValue\":\"blue\"}]}";++ user.policy(allow("dynamodb:CreateTable") + "," + allow("kms:CreateKey"));+ refusedJson(user.json("dynamodb", "DynamoDB_20120810.CreateTable", "1.0").body(createTable).post("/").then(),+ "dynamodb:TagResource");+ refusedJson(user.json("kms", "TrentService.CreateKey", "1.1").body(createKey).post("/").then(),+ "kms:TagResource");++ user.policy(allow("dynamodb:CreateTable") + "," + allow("dynamodb:TagResource") + ","+ + allow("kms:CreateKey") + "," + allow("kms:TagResource"));+ user.json("dynamodb", "DynamoDB_20120810.CreateTable", "1.0").body(createTable).post("/").then().statusCode(200);+ cleanup.register(() -> admin("dynamodb").header("X-Amz-Target", "DynamoDB_20120810.DeleteTable")+ .contentType("application/x-amz-json-1.0").body("{\"TableName\":\"" + table + "\"}").post("/"));+ user.json("kms", "TrentService.CreateKey", "1.1").body(createKey).post("/").then().statusCode(200);+ }++ /**+ * The tagging action is found by the operation, not by the action it is authorized as: Budgets'+ * {@code CreateBudget} is authorized as {@code budgets:ModifyBudget}.+ */+ @Test+ void aBudgetCreatedWithTagsNeedsTagResourceThoughItIsAuthorizedAsModifyBudget() {+ User user = user("tag-budget");+ String budget = "tag-budget-" + suffix();+ String create = """+ {"AccountId":"%s","Budget":{"BudgetName":"%s","BudgetType":"COST","TimeUnit":"MONTHLY",+ "BudgetLimit":{"Amount":"100","Unit":"USD"}},"ResourceTags":[{"Key":"team","Value":"blue"}]}"""+ .formatted(ACCOUNT, budget);+ String modify = allow("budgets:ModifyBudget");++ user.policy(modify);+ refusedJson(user.json("budgets", "AWSBudgetServiceGateway.CreateBudget", "1.1").body(create).post("/").then(),+ "budgets:TagResource");++ user.policy(modify + "," + allow("budgets:TagResource"));+ user.json("budgets", "AWSBudgetServiceGateway.CreateBudget", "1.1").body(create).post("/").then()+ .statusCode(200);+ cleanup.register(() -> admin("budgets").header("X-Amz-Target", "AWSBudgetServiceGateway.DeleteBudget")+ .contentType("application/x-amz-json-1.1")+ .body("{\"AccountId\":\"" + ACCOUNT + "\",\"BudgetName\":\"" + budget + "\"}").post("/"));+ }++ @Test+ void anInstanceLaunchedWithTagsNeedsCreateTagsForRunInstances() {+ User user = user("tag-instance");+ // The tagging permission is scoped to the action that creates the resource, as EC2's examples scope it.+ user.policy(allow("ec2:RunInstances") + "," + createTagsFor("CreateVolume"));+ refused(runInstances(user).then(), "ec2:CreateTags");++ user.policy(allow("ec2:RunInstances") + "," + createTagsFor("RunInstances"));+ terminateLater(runInstances(user));+ }++ /**+ * EC2 checks {@code ec2:CreateTags} on each resource a tag specification names, as its examples scope the grant,+ * so one scoped to instances covers an instance's tags and not a volume's.+ */+ @Test+ void anInstancesTagsAreCheckedOnTheInstanceAndAVolumesOnTheVolume() {+ User user = user("tag-instance-scoped");+ user.policy(allow("ec2:RunInstances") + ",{\"Effect\":\"Allow\",\"Action\":\"ec2:CreateTags\","+ + "\"Resource\":\"arn:aws:ec2:us-east-1:" + ACCOUNT + ":instance/*\","+ + "\"Condition\":{\"StringEquals\":{\"ec2:CreateAction\":\"RunInstances\"}}}");+ terminateLater(runInstances(user, "instance", "blue"));+ refused(runInstances(user, "instance", "blue", "volume", "blue").then(), "ec2:CreateTags");+ }++ /** Each resource type's tags are checked apart, so a volume's cannot stand in for an instance's. */+ @Test+ void eachResourceTypesTagsAreCheckedApart() {+ User user = user("tag-instance-sets");+ user.policy(allow("ec2:RunInstances") + ",{\"Effect\":\"Allow\",\"Action\":\"ec2:CreateTags\","+ + "\"Resource\":\"*\",\"Condition\":{\"StringEquals\":{\"aws:RequestTag/team\":\"blue\"}}}");+ refused(runInstances(user, "instance", "red", "volume", "blue").then(), "ec2:CreateTags");+ terminateLater(runInstances(user, "instance", "blue", "volume", "blue"));+ }++ /** The create's own action is checked with each resource's tags apart too. */+ @Test+ void theCreatesOwnActionIsCheckedWithEachResourcesTagsApart() {+ User user = user("tag-vpc");+ user.policy("{\"Effect\":\"Allow\",\"Action\":\"ec2:CreateVpc\",\"Resource\":\"*\","+ + "\"Condition\":{\"StringEquals\":{\"aws:RequestTag/team\":\"blue\"}}}," + allow("ec2:CreateTags"));+ refused(createVpc(user, "vpc", "red", "vpc-flow-log", "blue").then(), "ec2:CreateVpc");+ String vpcId = createVpc(user, "vpc", "blue").then().statusCode(200).extract().path("CreateVpcResponse.vpc.vpcId");+ cleanup.register(() -> admin("ec2").formParam("Action", "DeleteVpc").formParam("VpcId", vpcId).post("/"));+ }++ /**+ * A tag the handler would not apply is not taken for one the resource gets: SQS's handler stops at the first+ * missing number, SNS's reads {@code Tags.member.N} only.+ */+ @Test+ void aTagTheHandlerWouldNotApplyDoesNotMeetAPolicyRequiringIt() {+ User user = user("tag-unread");+ String name = "tag-unread-" + suffix();+ user.policy("{\"Effect\":\"Allow\",\"Action\":[\"sqs:CreateQueue\",\"sns:CreateTopic\"],\"Resource\":\"*\","+ + "\"Condition\":{\"StringEquals\":{\"aws:RequestTag/team\":\"blue\"}}}," + allow("sqs:TagQueue") + ","+ + allow("sns:TagResource"));+ refused(user.query("sqs", "CreateQueue").formParam("QueueName", name)+ .formParam("Tag.2.Key", "team").formParam("Tag.2.Value", "blue").post("/").then(), "sqs:CreateQueue");+ refused(user.query("sns", "CreateTopic").formParam("Name", name)+ .formParam("Tags.1.Key", "team").formParam("Tags.1.Value", "blue").post("/").then(), "sns:CreateTopic");+ deleteQueueLater(createQueue(user, name, "blue"));+ }++ @Test+ void aRoleCreatedWithTagsNeedsTagRole() {+ User user = user("tag-role");+ String role = "tag-role-" + suffix();+ String trust = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\","+ + "\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}";++ user.policy(allow("iam:CreateRole"));+ refused(user.query("iam", "CreateRole").formParam("RoleName", role).formParam("AssumeRolePolicyDocument", trust)+ .formParam("Tags.member.1.Key", "team").formParam("Tags.member.1.Value", "blue").post("/").then(),+ "iam:TagRole");++ user.policy(allow("iam:CreateRole") + "," + allow("iam:TagRole"));+ user.query("iam", "CreateRole").formParam("RoleName", role).formParam("AssumeRolePolicyDocument", trust)+ .formParam("Tags.member.1.Key", "team").formParam("Tags.member.1.Value", "blue").post("/").then()+ .statusCode(200);+ cleanup.register(() -> admin("iam").formParam("Action", "DeleteRole").formParam("RoleName", role).post("/"));+ }++ @Test+ void aFunctionCreatedWithTagsNeedsTagResourceOverItsRestRoute() {+ String role = EnforcementFixtures.createRole(cleanup, baseUri.getPort(), ACCOUNT, "/", "tag-fn-" + suffix(),+ "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}]}");+ User user = user("tag-function");+ String name = "tag-fn-" + suffix();+ String body = """+ {"FunctionName":"%s","Runtime":"nodejs20.x","Handler":"index.handler","Role":"%s",+ "Tags":{"team":"blue"}}""".formatted(name, role);+ String passRole = "{\"Effect\":\"Allow\",\"Action\":\"iam:PassRole\",\"Resource\":\"" + role + "\"}";++ user.policy(allow("lambda:CreateFunction") + "," + passRole);+ refusedRest(user.rest("lambda").body(body).post("/2015-03-31/functions").then(), "lambda:TagResource");++ user.policy(allow("lambda:CreateFunction") + "," + passRole + "," + allow("lambda:TagResource"));+ user.rest("lambda").body(body).post("/2015-03-31/functions").then().statusCode(201);+ cleanup.register(() -> admin("lambda").contentType("application/json")+ .delete("/2015-03-31/functions/{name}", name));+ }++ /** A function's tags are checked on the function its body names, as its own action is. */+ @Test+ void aFunctionsTagsAreCheckedOnTheFunctionItCreates() {+ String role = EnforcementFixtures.createRole(cleanup, baseUri.getPort(), ACCOUNT, "/", "tag-fn-" + suffix(),+ "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}]}");+ User user = user("tag-function-scoped");+ String name = "tag-fn-" + suffix();+ String function = "arn:aws:lambda:us-east-1:" + ACCOUNT + ":function:" + name;+ user.policy(allow("lambda:CreateFunction") + ",{\"Effect\":\"Allow\",\"Action\":\"iam:PassRole\","+ + "\"Resource\":\"" + role + "\"},{\"Effect\":\"Allow\",\"Action\":\"lambda:TagResource\","+ + "\"Resource\":\"" + function + "\"},{\"Effect\":\"Deny\",\"Action\":\"lambda:CreateFunction\","+ + "\"Resource\":\"" + function + "-denied\"}");+ refusedRest(user.rest("lambda").body(function(name + "-other", role)).post("/2015-03-31/functions").then(),+ "lambda:TagResource");+ refusedRest(user.rest("lambda").body(function(name + "-denied", role)).post("/2015-03-31/functions").then(),+ "lambda:CreateFunction");+ user.rest("lambda").body(function(name, role)).post("/2015-03-31/functions").then().statusCode(201);+ cleanup.register(() -> admin("lambda").contentType("application/json")+ .delete("/2015-03-31/functions/{name}", name));+ }++ /**+ * CodeDeploy's handler reads a tag's key and value in either case, so the tagging action is checked for both,+ * and the create's own action sees them.+ */+ @Test+ void anApplicationsTagsInEitherCaseNeedTagResource() {+ User user = user("tag-application");+ String application = "tag-app-" + suffix();+ String create = "{\"applicationName\":\"" + application + "\",\"tags\":[{\"key\":\"team\",\"value\":\"red\"}]}";+ user.policy(allow("codedeploy:CreateApplication"));+ refusedJson(user.json("codedeploy", "CodeDeploy_20141006.CreateApplication", "1.1").body(create).post("/").then(),+ "codedeploy:TagResource");+ // The handler keeps a key that is a number as its text, so it needs the tagging action too.+ refusedJson(user.json("codedeploy", "CodeDeploy_20141006.CreateApplication", "1.1")+ .body("{\"applicationName\":\"" + application + "\",\"tags\":[{\"key\":123,\"value\":\"red\"}]}")+ .post("/").then(), "codedeploy:TagResource");++ user.policy("{\"Effect\":\"Allow\",\"Action\":\"codedeploy:CreateApplication\",\"Resource\":\"*\","+ + "\"Condition\":{\"StringEquals\":{\"aws:RequestTag/team\":\"red\"}}}," + allow("codedeploy:TagResource"));+ user.json("codedeploy", "CodeDeploy_20141006.CreateApplication", "1.1").body(create).post("/").then()+ .statusCode(200);+ cleanup.register(() -> admin("codedeploy").header("X-Amz-Target", "CodeDeploy_20141006.DeleteApplication")+ .contentType("application/x-amz-json-1.1").body("{\"applicationName\":\"" + application + "\"}").post("/"));++ // The handler iterates an object's values as tags, so a deny on one holds however they are shaped.+ user.policy(allow("codedeploy:CreateApplication") + "," + allow("codedeploy:TagResource")+ + ",{\"Effect\":\"Deny\",\"Action\":\"codedeploy:CreateApplication\",\"Resource\":\"*\","+ + "\"Condition\":{\"StringEquals\":{\"aws:RequestTag/team\":\"red\"}}}");+ refusedJson(user.json("codedeploy", "CodeDeploy_20141006.CreateApplication", "1.1")+ .body("{\"applicationName\":\"" + application + "-object\",\"tags\":{\"0\":{\"key\":\"team\",\"value\":\"red\"}}}")+ .post("/").then(), "codedeploy:CreateApplication");+ }++ @Test+ void anAlarmPutWithTagsOverCborNeedsTagResource() throws IOException {+ User user = user("tag-alarm");+ String alarm = "tag-alarm-" + suffix();+ byte[] body = CBOR_MAPPER.writeValueAsBytes(Map.of("AlarmName", alarm, "MetricName", "Errors",+ "Namespace", "Tag/OnCreate", "Statistic", "Sum", "Period", 60, "EvaluationPeriods", 1,+ "Threshold", 1.0, "ComparisonOperator", "GreaterThanThreshold",+ "Tags", List.of(Map.of("Key", "team", "Value", "blue"))));++ user.policy(allow("cloudwatch:PutMetricAlarm"));+ Response denied = user.cbor("monitoring").body(body)+ .post("/service/GraniteServiceVersion20100801/operation/PutMetricAlarm");+ JsonNode error = CBOR_MAPPER.readTree(denied.then().statusCode(403).extract().asByteArray());+ assertTrue(error.path("message").asText().contains("cloudwatch:TagResource"), error.toString());++ user.policy(allow("cloudwatch:PutMetricAlarm") + "," + allow("cloudwatch:TagResource"));+ user.cbor("monitoring").body(body).post("/service/GraniteServiceVersion20100801/operation/PutMetricAlarm")+ .then().statusCode(200);+ cleanup.register(() -> admin("monitoring").formParam("Action", "DeleteAlarms")+ .formParam("AlarmNames.member.1", alarm).post("/"));+ }++ private static String function(String name, String role) {+ return """+ {"FunctionName":"%s","Runtime":"nodejs20.x","Handler":"index.handler","Role":"%s",+ "Tags":{"team":"blue"}}""".formatted(name, role);+ }++ private static ValidatableResponse createTopic(User user, String name, Map<String, String> tags) {+ RequestSpecification request = user.query("sns", "CreateTopic").formParam("Name", name);+ int index = 1;+ for (Map.Entry<String, String> tag : tags.entrySet()) {+ request = request.formParam("Tags.member." + index + ".Key", tag.getKey())+ .formParam("Tags.member." + index + ".Value", tag.getValue());+ index++;+ }+ return request.post("/").then();+ }++ private static Response createQueue(User user, String name, String team) {+ return user.query("sqs", "CreateQueue").formParam("QueueName", name)+ .formParam("Tag.1.Key", "team").formParam("Tag.1.Value", team).post("/");+ }++ private static Response runInstances(User user) {+ return runInstances(user, "instance", "blue");+ }++ /** An instance launched with a tag specification for each resource type given, each tagging its team. */+ private static Response runInstances(User user, String... typesAndTeams) {+ return tagSpecifications(user.query("ec2", "RunInstances").formParam("ImageId", IMAGE)+ .formParam("InstanceType", "t3.micro").formParam("MinCount", "1").formParam("MaxCount", "1"),+ typesAndTeams).post("/");+ }++ private static Response createVpc(User user, String... typesAndTeams) {+ return tagSpecifications(user.query("ec2", "CreateVpc").formParam("CidrBlock", "10.20.0.0/16"), typesAndTeams)+ .post("/");+ }++ private static RequestSpecification tagSpecifications(RequestSpecification request, String... typesAndTeams) {+ for (int i = 0; i < typesAndTeams.length; i += 2) {+ String specification = "TagSpecification." + (i / 2 + 1);+ request = request.formParam(specification + ".ResourceType", typesAndTeams[i])+ .formParam(specification + ".Tag.1.Key", "team")+ .formParam(specification + ".Tag.1.Value", typesAndTeams[i + 1]);+ }+ return request;+ }++ private void terminateLater(Response launched) {+ String instanceId = launched.then().statusCode(200).extract().xmlPath()+ .getString("RunInstancesResponse.instancesSet.item.instanceId");+ cleanup.register(() -> admin("ec2").formParam("Action", "TerminateInstances")+ .formParam("InstanceId.1", instanceId).post("/"));+ }++ private void deleteQueueLater(Response created) {+ String url = created.then().statusCode(200).extract().xmlPath()+ .getString("CreateQueueResponse.CreateQueueResult.QueueUrl");+ cleanup.register(() -> admin("sqs").formParam("Action", "DeleteQueue").formParam("QueueUrl", url).post("/"));+ }++ private static String createTagsFor(String createAction) {+ return "{\"Effect\":\"Allow\",\"Action\":\"ec2:CreateTags\",\"Resource\":\"*\","+ + "\"Condition\":{\"StringEquals\":{\"ec2:CreateAction\":\"" + createAction + "\"}}}";+ }++ /** A Query service refuses with {@code AccessDenied}, a 403, naming the permission that is missing. */+ private static void refused(ValidatableResponse response, String action) {+ response.statusCode(403).body(containsString("not authorized to perform: " + action));+ }++ /** A JSON-protocol service refuses with {@code AccessDeniedException}, which those protocols send as a 400. */+ private static void refusedJson(ValidatableResponse response, String action) {+ response.statusCode(400).body(containsString("AccessDeniedException"))+ .body(containsString("not authorized to perform: " + action));+ }++ private static void refusedRest(ValidatableResponse response, String action) {+ response.statusCode(403).body(containsString("not authorized to perform: " + action))+ .body(not(containsString("iam:PassRole")));+ }++ private static String allow(String action) {+ return "{\"Effect\":\"Allow\",\"Action\":\"" + action + "\",\"Resource\":\"*\"}";+ }++ private User user(String name) {+ String userName = name + "-" + suffix();+ return new User(userName, EnforcementFixtures.createUser(cleanup, baseUri.getPort(), auth(ADMIN, "iam"),+ userName).accessKeyId());+ }++ private static RequestSpecification admin(String service) {+ return given().header("Authorization", auth(ADMIN, service));+ }++ private static String suffix() {+ return Long.toString(System.nanoTime(), 36);+ }++ /** An IAM user whose one inline policy each test replaces. */+ private record User(String name, String accessKeyId) {++ void policy(String statements) {+ admin("iam").formParam("Action", "PutUserPolicy").formParam("UserName", name)+ .formParam("PolicyName", "p")+ .formParam("PolicyDocument", "{\"Version\":\"2012-10-17\",\"Statement\":[" + statements + "]}")+ .post("/").then().statusCode(200);+ }++ RequestSpecification query(String service, String action) {+ return given().header("Authorization", auth(accessKeyId, service)).formParam("Action", action);+ }++ RequestSpecification json(String service, String target, String version) {+ return given().header("Authorization", auth(accessKeyId, service)).header("X-Amz-Target", target)+ .contentType("application/x-amz-json-" + version);+ }++ RequestSpecification rest(String service) {+ return given().header("Authorization", auth(accessKeyId, service)).contentType("application/json");+ }++ RequestSpecification cbor(String service) {+ return given().header("Authorization", auth(accessKeyId, service)).header("smithy-protocol", "rpc-v2-cbor")+ .contentType("application/cbor").accept("application/cbor");+ }+ }+}diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilderTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilderTest.javaindex acef1ad46e..a17de0bbc4 100644--- a/src/test/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilderTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilderTest.java@@ -1237,6 +1237,24 @@ class ResourceArnBuilderTest {assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function", arn);}+ /** CreateFunction is checked on the function its body names, in the caller's account and Region. */+ @Test+ void lambdaCreateFunctionIsCheckedOnTheFunctionItsBodyNames() {+ when(uriInfo.getPath()).thenReturn("/2015-03-31/functions");+ when(ctx.getMethod()).thenReturn("POST");+ setJsonBody("{\"FunctionName\":\"my-function\",\"Runtime\":\"nodejs20.x\"}");+ assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",+ builder.build("lambda", ctx, "us-east-1", "000000000000"));+ setJsonBody("{\"FunctionName\":\"arn:aws:lambda:us-east-1:111122223333:function:my-function\"}");+ assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",+ builder.build("lambda", ctx, "us-east-1", "000000000000"));+ setJsonBody("{\"Runtime\":\"nodejs20.x\"}");+ assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));+ when(ctx.getMethod()).thenReturn("GET");+ setJsonBody("{\"FunctionName\":\"my-function\"}");+ assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));+ }+@Testvoid lambdaFunctionArnKeepsTheAccountItNames() {when(uriInfo.getPath()).thenReturn(diff --git a/tools/aws/regen_iam_tag_on_create.py b/tools/aws/regen_iam_tag_on_create.pynew file mode 100644index 0000000000..d6e2cf47af--- /dev/null+++ b/tools/aws/regen_iam_tag_on_create.py@@ -0,0 +1,678 @@+#!/usr/bin/env python3+"""Regenerate src/main/resources/aws/iam-tag-on-create.json from AWS's Service Reference and botocore.++A request that tags the resource it creates also needs the service's tagging action. The SNS API+reference, for one: "To be able to tag a topic on creation, you must have the sns:CreateTopic and+sns:TagResource permissions." `TagOnCreate` finds the tags a request carries, and this file tells it+which tagging action each operation needs and where its request carries the tags. It comes from two+sources, each answering what the other cannot:++- AWS's Service Reference, which lists the tagging action among an operation's `AuthorizedActions`,+ and marks an action as one that only tags (`IsTaggingOnly`), but does not say which request member+ carries the tags:++ https://servicereference.us-east-1.amazonaws.com/ (the index of services)+ https://servicereference.us-east-1.amazonaws.com/v1/<svc>/<svc>.json++- botocore's model of each SDK client the reference lists the operation for (Apache-2.0,+ https://github.com/boto/botocore, the pinned release), which gives the request's members but+ not which of them AWS checks.++An operation is read when it is not a tagging action itself and the reference lists, beside its+own, an action that only tags and adds tags: one whose name starts with Tag, Add, Create, Put, Set or+Replicate. That leaves out the untagging actions an update lists, which remove tags rather than+attach them. A member of the operation's request carries the tags when it is a top-level member named+`Tags`, `TagList`, `TagsList`, `TagSpecification` or `TagSpecifications`, or ending in `Tags`+(`ResourceTags`, `UserPoolTags`), and it holds a map of strings, a list of structures with a key and a+value, or a list of structures holding one of those, as EC2's tag specifications do. A member nested+deeper tags something else: the tasks a pipe starts, a workflow step's files. What the rule gets wrong+for an operation is corrected here, each with its reason: a member it sees that carries no tags the+operation attaches (`EXCLUDED_MEMBERS`), and the name a member goes by in the Query protocol where the+model no longer gives it (`QUERY_MEMBERS`).++Only the namespaces in `NAMESPACES` are read, and in them every operation the reference lists with a+tagging action, whether Floci serves it or not, so an operation Floci adds is checked from the start.+Each of those operations ends up in exactly one of three places, and generation fails on an operation+that would end up in none:++- `tags`: the members it reads.+- `byHand`: operations Floci checks itself, because they need one of several tagging actions.+ `TagOnCreateMembersTest` holds the two lists to each other.+- `notRead`: operations whose request carries no tags this table can read, each with its reason.++An operation whose tagging action takes the namespace's `CreateAction` condition key, as EC2's+`ec2:CreateTags` does, is marked `createAction`, and Floci gives that key the operation's name. One+whose own action takes `aws:RequestTag/${TagKey}` or `aws:TagKeys`, for the action or for a resource+it acts on, is marked `requestTags`, and Floci checks that action with the request's tags too, as it+checks the tagging action. Its own action is the one of the operation's name, in any case+(MemoryDB's `CreateACL` is `memorydb:CreateAcl`), or else the other actions of its namespace that+the reference lists for it (Budgets' `CreateBudget` is `budgets:ModifyBudget`).++A tag specification names the type of the resource its tags go to, as EC2's `ResourceType` does, so+its member says which of the specification's members that is (`resourceType`), and `resourceArns`+gives, for each namespace with such a member, every resource type the reference lists as the ARN of+one whose name is not known yet: its first ARN format, with every variable but the partition, Region+and account as `*` (`arn:${Partition}:ec2:${Region}:${Account}:instance/*`). Floci checks the tagging+action for a specification's tags on that ARN, as AWS checks it on the resource being tagged.++The Service Reference is live rather than a pinned dependency, so a fresh generation is not+byte-identical. The two gates split along the sources:++- `--check` is offline and needs the pinned botocore. The file must be well-formed, and every+ operation's members must be exactly what the rule and the corrections give from botocore for the+ models the file names, so a hand-edited member fails.+- `--verify` is online and stdlib-only. Every operation the file carries must still list the same+ tagging actions, with the same `createAction` and `requestTags`, for the same SDK clients, and+ every resource type in `resourceArns` must still have its ARN. An operation AWS has added+ is reported without failing: until the next sync it tags on creation unchecked, which is where it+ was before this file existed.++Run from anywhere in the repo:+ python3 tools/aws/regen_iam_tag_on_create.py # rewrite the vendored file in place+ python3 tools/aws/regen_iam_tag_on_create.py --check # offline: members match botocore+ python3 tools/aws/regen_iam_tag_on_create.py --verify # online: operations match AWS+ python3 tools/aws/regen_iam_tag_on_create.py --source-dir <dir> # read saved <svc>.json files+"""+from __future__ import annotations++import argparse+import json+import re+import sys+from datetime import datetime, timezone+from pathlib import Path++from regen_iam_authorized_actions import fetch_references+from regen_iam_passed_roles import (BODY_LOCATIONS, MEMBER_PATH_RE, NAMESPACE_RE, OPERATION_RE, _shown, load_models,+ namespace_of)+from regen_partitions import resolve_botocore_data++REPO_ROOT = Path(__file__).resolve().parents[2]+OUTPUT = REPO_ROOT / "src/main/resources/aws/iam-tag-on-create.json"++# The IAM namespaces whose operations this file reads: those Floci serves over the JSON and Query+# protocols and Smithy RPC v2 CBOR, and the REST ones whose routes Floci authorizes by operation.+NAMESPACES = (+ "acm", "application-autoscaling", "athena", "autoscaling", "bcm-data-exports", "bcm-pricing-calculator",+ "budgets", "ce", "cloudformation", "cloudhsm", "cloudtrail", "cloudwatch", "codedeploy", "codepipeline",+ "cognito-identity", "cognito-idp", "comprehend", "config", "cur", "datasync", "dms", "dsql", "dynamodb",+ "ec2", "ecr", "ecs", "eks", "elasticache", "elasticloadbalancing", "elasticmapreduce", "events",+ "firehose", "globalaccelerator", "glue", "iam", "kinesis", "kinesisanalytics", "kms", "lambda",+ "lightsail", "logs", "memorydb", "network-firewall", "organizations", "pipes", "rds", "redshift",+ "redshift-serverless", "rekognition", "resource-groups", "route53resolver", "sagemaker", "scheduler",+ "secretsmanager", "servicediscovery", "ses", "sns", "sqs", "ssm", "sso", "states", "sts", "swf", "textract",+ "timestream-influxdb", "transcribe", "transfer", "translate", "wafv2",+)++_NO_ROUTES = "REST routes no rule maps yet"+# Namespaces Floci serves whose operations list a tagging action but are not read here yet, each with+# why. `TagOnCreateNamespacesIntegrationTest` fails for a namespace Floci serves that is in neither list.+NOT_COVERED = {+ "access-analyzer": _NO_ROUTES, "airflow": _NO_ROUTES, "app-integrations": _NO_ROUTES, "appconfig": _NO_ROUTES,+ "appsync": _NO_ROUTES, "aps": _NO_ROUTES, "aws-marketplace": _NO_ROUTES, "backup": _NO_ROUTES,+ "batch": _NO_ROUTES, "bedrock": _NO_ROUTES, "bedrock-agentcore": _NO_ROUTES,+ "cloudfront": _NO_ROUTES, "codeguru-reviewer": _NO_ROUTES, "connect": _NO_ROUTES,+ "controltower": _NO_ROUTES, "detective": _NO_ROUTES, "dlm": _NO_ROUTES,+ "elasticfilesystem": _NO_ROUTES, "emr-serverless": _NO_ROUTES, "es": _NO_ROUTES, "fis": _NO_ROUTES,+ "guardduty": _NO_ROUTES, "inspector2": _NO_ROUTES, "iot": _NO_ROUTES, "kafka": _NO_ROUTES,+ "macie2": _NO_ROUTES, "mq": _NO_ROUTES, "oam": _NO_ROUTES, "ram": _NO_ROUTES,+ "resource-explorer-2": _NO_ROUTES, "rum": _NO_ROUTES, "s3tables": _NO_ROUTES, "securityhub": _NO_ROUTES,+ "s3": "authorized by route; S3 checks s3:PutObjectTagging for an object it creates with tags itself",+ "servicecatalog": "its operations that tag are AppRegistry's, whose REST routes no rule maps yet",+}++# An action that adds tags, among those the reference marks as only tagging.+ADDING_ACTION_RE = re.compile(r"^(Tag|Add|Create|Put|Set|Replicate)")+# A request member that carries the tags the operation attaches.+TAG_MEMBER_RE = re.compile(r"^(\w*tags|tags?list|tagspecifications?)$", re.IGNORECASE)+# The members of a tag structure that hold its key and its value.+KEY_NAMES = {"key", "tagkey"}+VALUE_NAMES = {"value", "tagvalue"}+CREATE_ACTION = "CreateAction"+# The condition keys that give an action the tags a request carries.+REQUEST_TAG_KEYS = {"aws:RequestTag/${TagKey}", "aws:TagKeys"}+# The protocols whose requests TagOnCreate reads: form parameters, EC2's among them, or a JSON or CBOR body.+READ_PROTOCOLS = {"json", "query", "ec2", "rest-json", "smithy-rpc-v2-cbor"}+# The member of a tag specification that names the type of the resource its tags go to.+RESOURCE_TYPE = "resourcetype"+# The variables of an ARN format a resource's ARN is built with before its name is known; the rest become `*`.+ARN_VARIABLE_RE = re.compile(r"\$\{(\w+)}")+KNOWN_ARN_VARIABLES = {"Partition", "Region", "Account"}++# Operations Floci checks itself, and why.+BY_HAND = {+ "logs:CreateLogGroup": "either logs:TagResource on the log group's ARN or the older logs:TagLogGroup",+}++NO_TAGS = "no member of the request carries tags"+# Operations the reference lists with a tagging action whose request carries no tags this file reads.+NOT_READ = {+ "cloudformation:ExecuteChangeSet": NO_TAGS,+ "dynamodb:UpdateTable": NO_TAGS,+ "ec2:RequestSpotFleet": "its tags are in spotFleetRequestConfig, deeper than the members this file reads",+ "ecr:BatchGetImage": NO_TAGS,+ "ecs:CreateGateway": NO_TAGS,+ "iam:AcquireRole": NO_TAGS,+ "rds:CreateDBCapacityReservation": NO_TAGS,+ "rds:DeleteDBCluster": NO_TAGS,+ "rds:DeleteDBInstance": NO_TAGS,+ "rds:DeleteTenantDatabase": NO_TAGS,+ "rds:StopDBInstance": NO_TAGS,+}++# Members the rule reads that carry no tags the operation attaches, each with why.+EXCLUDED_MEMBERS = {+ "ec2:CreateIpamPool": {"AllocationResourceTag[item]": "the tags a resource needs to allocate from the pool, "+ "\"Tags that are required for resources that use CIDRs from "+ "this IPAM pool\""},+}++# The name a member goes by in the Query protocol, which Floci serves the namespace in as well, where+# the model, now JSON only, no longer gives it.+QUERY_MEMBERS = {+ "sqs:CreateQueue": {"tags{}": ("Tag{}", "Floci's SQS Query handler reads the tags as Tag.N.Key and Tag.N.Value")},+}+++# --------------------------------------------------------------------------- #+# The Service Reference: which operations need a tagging action+# --------------------------------------------------------------------------- #+def _actions(documents: list[dict]) -> dict[str, dict]:+ """Every action of every namespace, by `<namespace>:<action>`."""+ actions: dict[str, dict] = {}+ for document in documents:+ namespace = document.get("Name")+ if not isinstance(namespace, str) or not NAMESPACE_RE.match(namespace):+ raise ValueError(f"{namespace!r} is not usable as an IAM namespace")+ for action in document.get("Actions", []):+ if isinstance(action, dict) and isinstance(action.get("Name"), str):+ actions[f"{namespace}:{action['Name']}"] = action+ return actions+++def _tagging_only(action: dict | None) -> bool:+ properties = ((action or {}).get("Annotations") or {}).get("Properties") or {}+ return properties.get("IsTaggingOnly") is True+++def _resource_keys(documents: list[dict]) -> dict[str, list[str]]:+ """The condition keys of every resource type of every namespace, by `<namespace>:<resource>`."""+ keys: dict[str, list[str]] = {}+ for document in documents:+ for resource in document.get("Resources") or []:+ if isinstance(resource, dict) and isinstance(resource.get("Name"), str):+ keys[f"{document['Name']}:{resource['Name']}"] = resource.get("ConditionKeys") or []+ return keys+++def _condition_keys(namespace: str, action: dict, resource_keys: dict[str, list[str]]) -> set[str]:+ """The condition keys an action takes, for itself and for each resource it acts on: the resource's own+ when the action names them, as EC2's do, else the ones its namespace gives the resource type."""+ keys = set(action.get("ActionConditionKeys") or [])+ for resource in action.get("Resources") or []:+ if isinstance(resource, dict):+ keys |= set(resource["ConditionKeys"] if "ConditionKeys" in resource+ else resource_keys.get(f"{namespace}:{resource.get('Name')}", []))+ return keys+++def _takes_request_tags(namespace: str, name: str, authorized: list[dict], actions: dict[str, dict],+ lowered: dict[str, dict], resource_keys: dict[str, list[str]]) -> bool:+ """Whether the operation's own action takes the request's tags: the action of its name in any case, or+ else the other actions of its namespace the reference lists for it, none of them only tagging."""+ own = [lowered[f"{namespace}:{name}".lower()]] if f"{namespace}:{name}".lower() in lowered else []+ if not own:+ own = [actions[key] for key in (f"{entry.get('Service')}:{entry.get('Name')}" for entry in authorized)+ if namespace_of(key) == namespace and key in actions and not _tagging_only(actions[key])]+ return any(REQUEST_TAG_KEYS & _condition_keys(namespace, action, resource_keys) for action in own)+++def tag_on_create_operations(documents: list[dict]) -> dict[str, dict]:+ """Every operation of every namespace that lists an action adding tags beside its own, with those+ actions, whether one takes its namespace's CreateAction key, whether the operation's own action takes+ the request's tags, and the SDK clients it is listed for."""+ actions = _actions(documents)+ lowered = {key.lower(): action for key, action in actions.items()}+ resource_keys = _resource_keys(documents)+ found: dict[str, dict] = {}+ for document in documents:+ namespace = document["Name"]+ for operation in document.get("Operations", []):+ name = operation.get("Name") if isinstance(operation, dict) else None+ if not isinstance(name, str):+ raise ValueError(f"{namespace}: operation entry without a usable 'Name': {operation!r}")+ if _tagging_only(actions.get(f"{namespace}:{name}")):+ continue+ authorized = operation.get("AuthorizedActions") or []+ if not isinstance(authorized, list) or not all(isinstance(entry, dict) for entry in authorized):+ raise ValueError(f"{namespace}:{name}: 'AuthorizedActions' is not a list of objects")+ tagging = sorted({f"{entry.get('Service')}:{entry.get('Name')}" for entry in authorized+ if isinstance(entry.get("Name"), str) and ADDING_ACTION_RE.match(entry["Name"])+ and _tagging_only(actions.get(f"{entry.get('Service')}:{entry.get('Name')}"))})+ if not tagging:+ continue+ create_action = any(f"{namespace_of(action)}:{CREATE_ACTION}"+ in actions[action].get("ActionConditionKeys", []) for action in tagging)+ clients = {sdk["Name"] for sdk in operation.get("SDK") or []+ if isinstance(sdk, dict) and sdk.get("Package") == "Boto3" and isinstance(sdk.get("Name"), str)}+ key = f"{namespace}:{name}"+ entry = found.setdefault(key, {"tagging": set(), "createAction": False, "requestTags": False,+ "clients": set()})+ entry["tagging"] |= set(tagging)+ entry["createAction"] = entry["createAction"] or create_action+ entry["requestTags"] = (entry["requestTags"]+ or _takes_request_tags(namespace, name, authorized, actions, lowered,+ resource_keys))+ entry["clients"] |= clients+ return {key: {"tagging": sorted(value["tagging"]), "createAction": value["createAction"],+ "requestTags": value["requestTags"], "clients": sorted(value["clients"])}+ for key, value in sorted(found.items())}+++# --------------------------------------------------------------------------- #+# botocore: which members of the request carry the tags+# --------------------------------------------------------------------------- #+def _protocols(model: dict) -> set[str]:+ metadata = model["metadata"]+ return set(metadata.get("protocols") or [metadata.get("protocol")])+++def readable(model: dict) -> bool:+ """Whether the model's requests come as form parameters or a JSON or CBOR body."""+ return bool(READ_PROTOCOLS & _protocols(model))+++def _serialized(name: str, member: dict, model: dict) -> str:+ """The name the member goes by on the wire: EC2's Query names are capitalized, and give way to a+ `queryName`; everything else goes by its `locationName`."""+ if "ec2" in _protocols(model):+ if "queryName" in member:+ return member["queryName"]+ location = member.get("locationName", name)+ return location[:1].upper() + location[1:]+ return member.get("locationName", name)+++def _pair(model: dict, shape: dict) -> tuple[str, str] | None:+ """The wire names of a tag structure's key and value members; None for any other structure."""+ if shape["type"] != "structure":+ return None+ members = shape.get("members", {})+ key = [name for name in members if name.lower() in KEY_NAMES]+ value = [name for name in members if name.lower() in VALUE_NAMES]+ if len(key) != 1 or len(value) != 1:+ return None+ return _serialized(key[0], members[key[0]], model), _serialized(value[0], members[value[0]], model)+++def _collection(model: dict, shape_name: str) -> dict | None:+ """How a shape holds tags, as the vendored path's last step and a tag structure's key and value+ names: a map of strings, or a list of tag structures. None for any other shape."""+ shape = model["shapes"][shape_name]+ if shape["type"] == "map":+ key = model["shapes"][shape["key"]["shape"]]+ value = model["shapes"][shape["value"]["shape"]]+ return {"step": "{}"} if key["type"] == "string" and value["type"] == "string" else None+ if shape["type"] == "list":+ pair = _pair(model, model["shapes"][shape["member"]["shape"]])+ if pair is not None:+ return {"step": "[" + shape["member"].get("locationName", "") + "]", "key": pair[0], "value": pair[1]}+ return None+++def tag_members(model: dict, operation: str) -> list[dict]:+ """The members of the operation's request the rule reads, as vendored entries."""+ spec = model["operations"].get(operation)+ if spec is None or "input" not in spec or not readable(model):+ return []+ root = model["shapes"][spec["input"]["shape"]]+ if root.get("payload") is not None:+ return []+ found = []+ for name, member in root.get("members", {}).items():+ if member.get("location") not in BODY_LOCATIONS or not TAG_MEMBER_RE.match(name):+ continue+ serialized = _serialized(name, member, model)+ collection = _collection(model, member["shape"])+ if collection is not None:+ found.append({"member": serialized + collection.pop("step"), **collection})+ continue+ shape = model["shapes"][member["shape"]]+ if shape["type"] != "list":+ continue+ element = model["shapes"][shape["member"]["shape"]]+ for inner_name, inner in (element.get("members", {}).items() if element["type"] == "structure" else []):+ inner_collection = _collection(model, inner["shape"]) if TAG_MEMBER_RE.match(inner_name) else None+ if inner_collection is not None:+ path = (serialized + "[" + shape["member"].get("locationName", "") + "]."+ + _serialized(inner_name, inner, model) + inner_collection.pop("step"))+ kinds = [name for name in element["members"] if name.lower() == RESOURCE_TYPE]+ if len(kinds) == 1:+ inner_collection["resourceType"] = _serialized(kinds[0], element["members"][kinds[0]], model)+ found.append({"member": path, **inner_collection})+ return found+++def resource_arns(documents: list[dict], namespaces: set[str]) -> dict[str, dict[str, str]]:+ """Every resource type of each namespace given, as the ARN of one whose name is not known yet: its first+ ARN format, with every variable but the partition, Region and account as `*`."""+ arns = {}+ for document in documents:+ if document["Name"] not in namespaces:+ continue+ arns[document["Name"]] = dict(sorted(+ (resource["Name"], ARN_VARIABLE_RE.sub(+ lambda m: m.group(0) if m.group(1) in KNOWN_ARN_VARIABLES else "*", resource["ARNFormats"][0]))+ for resource in document.get("Resources", []) if resource.get("ARNFormats")))+ return dict(sorted(arns.items()))+++# --------------------------------------------------------------------------- #+# The vendored document+# --------------------------------------------------------------------------- #+def entry_for(operation: str, upstream: dict, models: dict[str, dict]) -> dict:+ """What the file says for one operation, from its tagging actions and the models of its namespace."""+ head = {"tagging": upstream["tagging"]}+ if upstream["createAction"]:+ head["createAction"] = True+ if upstream["requestTags"]:+ head["requestTags"] = True+ if operation in BY_HAND:+ return {**head, "byHand": BY_HAND[operation]}+ if operation in NOT_READ:+ return {**head, "notRead": NOT_READ[operation]}+ if len(upstream["tagging"]) != 1:+ raise ValueError(f"{operation}: needs one of {upstream['tagging']}; check it by hand (BY_HAND)")+ name = operation.split(":", 1)[1]+ members: dict[str, dict] = {}+ for model in models.values():+ for member in tag_members(model, name):+ members.setdefault(member["member"], member)+ for path in EXCLUDED_MEMBERS.get(operation, {}):+ members.pop(path, None)+ for path, (query, _reason) in QUERY_MEMBERS.get(operation, {}).items():+ if path not in members:+ raise ValueError(f"{operation}: QUERY_MEMBERS names {path}, which its request does not have")+ members[path] = {**members[path], "query": query}+ if not members:+ raise ValueError(f"{operation}: no request member carries tags; say why it is not read (NOT_READ) "+ f"or check it by hand (BY_HAND)")+ return {**head, "tags": [members[path] for path in sorted(members)]}+++def build(documents: list[dict], provenance: str, data: Path, botocore: str) -> dict:+ upstream = tag_on_create_operations(documents)+ covered = {operation: value for operation, value in upstream.items() if namespace_of(operation) in NAMESPACES}+ _check_overrides(covered)+ namespaces: dict[str, list[str]] = {}+ for namespace in sorted(NAMESPACES):+ namespaces[namespace] = sorted({client for operation, value in covered.items()+ if namespace_of(operation) == namespace for client in value["clients"]})+ operations = {}+ unread = []+ for operation, value in covered.items():+ models = load_models(data, set(namespaces[namespace_of(operation)]))+ try:+ operations[operation] = entry_for(operation, value, models)+ except ValueError as e:+ unread.append(str(e))+ unread += _unmatched_exclusions(covered, namespaces, data)+ if unread:+ raise ValueError("\n".join(unread))+ elsewhere = sorted({namespace_of(operation) for operation in upstream} - set(NAMESPACES))+ typed = {namespace_of(operation) for operation, entry in operations.items()+ for member in entry.get("tags", []) if "resourceType" in member}+ return {+ "_source": {+ "generator": "tools/aws/regen_iam_tag_on_create.py",+ "reference": provenance,+ "botocore": botocore,+ "retrieved": datetime.now(timezone.utc).strftime("%Y-%m-%d"),+ "note": "make iam-tag-on-create-check re-derives every member from botocore; "+ "make iam-tag-on-create-verify checks every operation against AWS.",+ },+ "namespaces": namespaces,+ "notCovered": dict(sorted(NOT_COVERED.items())),+ "otherNamespaces": [namespace for namespace in elsewhere if namespace not in NOT_COVERED],+ "resourceArns": resource_arns(documents, typed),+ "operations": operations,+ }+++def _unmatched_exclusions(covered: dict[str, dict], namespaces: dict[str, list[str]], data: Path) -> list[str]:+ """An exclusion that its operation's request does not have, so none outlives its member."""+ problems = []+ for operation, paths in EXCLUDED_MEMBERS.items():+ if operation not in covered:+ continue+ name = operation.split(":", 1)[1]+ found = {member["member"] for model in load_models(data, set(namespaces[namespace_of(operation)])).values()+ for member in tag_members(model, name)}+ problems += [f"EXCLUDED_MEMBERS names {path} for {operation}, which its request does not have"+ for path in paths if path not in found]+ return problems+++def _check_overrides(covered: dict[str, dict]) -> None:+ """Every correction names an operation the reference lists with a tagging action, so none outlives it."""+ stale = []+ for table_name, table in (("BY_HAND", BY_HAND), ("NOT_READ", NOT_READ),+ ("EXCLUDED_MEMBERS", EXCLUDED_MEMBERS), ("QUERY_MEMBERS", QUERY_MEMBERS)):+ stale += [f"{table_name} names {key}, which the reference does not list with a tagging action"+ for key in table if key not in covered]+ stale += [f"{operation} is both checked by hand and not read" for operation in sorted(set(BY_HAND) & set(NOT_READ))]+ if stale:+ raise ValueError("; ".join(stale))+++def render(document: dict) -> str:+ """The document with one operation to a line."""+ lines = ["{"]+ for key in ("_source", "namespaces", "notCovered", "otherNamespaces", "resourceArns"):+ lines.append(f' "{key}": {json.dumps(document[key])},')+ lines.append(' "operations": {')+ operations = list(document["operations"].items())+ for index, (operation, entry) in enumerate(operations):+ tail = "," if index < len(operations) - 1 else ""+ lines.append(f" {json.dumps(operation)}: {json.dumps(entry)}{tail}")+ lines += [" }", "}"]+ return "\n".join(lines) + "\n"+++# --------------------------------------------------------------------------- #+# Gates+# --------------------------------------------------------------------------- #+def validate(document: dict) -> list[str]:+ """Problems that make the vendored file unusable, rather than out of date."""+ problems: list[str] = []+ namespaces = document.get("namespaces")+ operations = document.get("operations")+ if not isinstance(namespaces, dict) or not namespaces:+ return ["namespaces is missing or empty"]+ if not isinstance(operations, dict) or not operations:+ return ["operations is missing or empty"]+ if list(namespaces) != sorted(namespaces):+ problems.append("namespaces is not sorted")+ if list(operations) != sorted(operations):+ problems.append("operations is not sorted")+ arns = document.get("resourceArns", {})+ if not isinstance(arns, dict) or not all(+ namespace in namespaces and isinstance(types, dict) and types and all(+ isinstance(name, str) and name and isinstance(arn, str) and arn.startswith("arn:${Partition}:")+ for name, arn in types.items())+ for namespace, types in arns.items()):+ problems.append("resourceArns is not an ARN for each resource type of namespaces the file reads")+ arns = {}+ for operation, entry in operations.items():+ if not OPERATION_RE.match(operation) or namespace_of(operation) not in namespaces:+ problems.append(f"{operation!r} is not an operation of a namespace the file reads")+ continue+ kinds = [kind for kind in ("tags", "byHand", "notRead") if kind in entry]+ if len(kinds) != 1:+ problems.append(f"{operation} is not exactly one of tags, byHand and notRead")+ continue+ tagging = entry.get("tagging")+ if not isinstance(tagging, list) or not tagging or not all(+ isinstance(action, str) and OPERATION_RE.match(action) for action in tagging):+ problems.append(f"{operation} has no usable tagging")+ continue+ if (set(entry) - {"tagging", "createAction", "requestTags", kinds[0]}+ or entry.get("createAction", True) is not True or entry.get("requestTags", True) is not True):+ problems.append(f"{operation} carries an unknown field")+ continue+ if kinds[0] != "tags":+ if not isinstance(entry[kinds[0]], str) or not entry[kinds[0]]:+ problems.append(f"{operation} gives no reason for {kinds[0]}")+ continue+ if len(tagging) != 1:+ problems.append(f"{operation} reads its tags for {tagging}, not one tagging action")+ members = entry["tags"]+ if not isinstance(members, list) or not members:+ problems.append(f"{operation} reads no tags")+ continue+ for member in members:+ problems += _member_problems(operation, member)+ if isinstance(member, dict) and "resourceType" in member and namespace_of(operation) not in arns:+ problems.append(f"{operation}: resourceArns has no resource types of {namespace_of(operation)}")+ return problems+++def _member_problems(operation: str, member: object) -> list[str]:+ path = member.get("member") if isinstance(member, dict) else None+ if not isinstance(path, str) or not MEMBER_PATH_RE.match(path) or not re.search(r"(\[\w*]|\{})$", path):+ return [f"{operation} reads {member!r}, which is no path to a tag list or map"]+ problems = []+ query = member.get("query")+ if query is not None and (not isinstance(query, str) or not MEMBER_PATH_RE.match(query)+ or query.endswith("}") != path.endswith("}")):+ problems.append(f"{operation}: the tags at {path} go by {query!r} in the Query protocol, which is no path")+ pair = [member.get("key"), member.get("value")]+ if path.endswith("]") and not all(isinstance(name, str) and name for name in pair):+ problems.append(f"{operation}: the tag list at {path} names no key and value")+ if path.endswith("}") and pair != [None, None]:+ problems.append(f"{operation}: the tag map at {path} names a key and value")+ kind = member.get("resourceType")+ if kind is not None and (not isinstance(kind, str) or not kind or "]." not in path):+ problems.append(f"{operation}: the tags at {path} name {kind!r} as their resource type, "+ f"though they are no list of tag specifications")+ if set(member) - {"member", "key", "value", "query", "resourceType"}:+ problems.append(f"{operation}: the tags at {path} carry an unknown field")+ return problems+++def derive(document: dict, data: Path) -> list[str]:+ """Where the members the file gives differ from what botocore gives for the models it names."""+ problems: list[str] = []+ for operation, entry in document["operations"].items():+ models = load_models(data, set(document["namespaces"][namespace_of(operation)]))+ upstream = {"tagging": entry["tagging"], "createAction": entry.get("createAction", False),+ "requestTags": entry.get("requestTags", False)}+ try:+ expected = entry_for(operation, upstream, models)+ except ValueError as e:+ problems.append(str(e))+ continue+ if expected != entry:+ problems.append(f"{operation}: the file has {json.dumps(entry)}, botocore gives {json.dumps(expected)}")+ return problems+++def verify_against(vendored: dict, upstream: dict[str, dict],+ arns: dict[str, dict[str, str]] | None = None) -> tuple[list[str], list[str]]:+ """What the file claims and AWS does not, and the operations AWS has added since. `arns` are the resource+ ARNs AWS gives the namespaces the file has them for."""+ untrue: list[str] = []+ for namespace, types in vendored.get("resourceArns", {}).items():+ changed = [] if arns is None else sorted(name for name, arn in types.items()+ if arns.get(namespace, {}).get(name) != arn)+ if changed:+ untrue.append(f"AWS no longer gives {namespace}'s {', '.join(changed)} the ARN the file does")+ for operation, entry in vendored["operations"].items():+ actual = upstream.get(operation)+ if actual is None:+ untrue.append(f"AWS no longer lists a tagging action for {operation}")+ elif actual["tagging"] != entry["tagging"]:+ untrue.append(f"AWS lists {actual['tagging']} for {operation}, not {entry['tagging']}")+ elif actual["createAction"] != entry.get("createAction", False):+ untrue.append(f"AWS's tagging action for {operation} {'takes' if actual['createAction'] else 'no longer takes'} "+ f"the CreateAction key")+ elif actual["requestTags"] != entry.get("requestTags", False):+ untrue.append(f"AWS's own action for {operation} {'takes' if actual['requestTags'] else 'no longer takes'} "+ f"the request's tags")+ elif not set(actual["clients"]) <= set(vendored["namespaces"][namespace_of(operation)]):+ untrue.append(f"AWS lists {operation} for {actual['clients']}, which the file does not read")+ added = sorted(operation for operation in upstream+ if namespace_of(operation) in vendored["namespaces"] and operation not in vendored["operations"])+ return untrue, added+++def main(argv: list[str] | None = None) -> int:+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ parser.add_argument("--check", action="store_true", help="offline: members match the pinned botocore")+ parser.add_argument("--verify", action="store_true", help="online: operations match AWS")+ parser.add_argument("--source-dir", type=Path, default=None,+ help="read saved <service>.json reference files instead of fetching them")+ parser.add_argument("--botocore-data", type=Path, default=None, help="botocore data directory")+ parser.add_argument("--output", type=Path, default=OUTPUT, help=argparse.SUPPRESS)+ args = parser.parse_args(argv)++ if args.check or args.verify:+ if not args.output.exists():+ print(f"error: {args.output} does not exist", file=sys.stderr)+ return 1+ document = json.loads(args.output.read_text(encoding="utf-8"))+ problems = validate(document)+ if not problems and args.check:+ data, _ = resolve_botocore_data(args.botocore_data)+ problems = derive(document, data)+ for problem in problems:+ print(f"error: {problem}", file=sys.stderr)+ if problems:+ return 1+ entries = len(document["operations"])+ if args.check:+ print(f"{_shown(args.output)} matches botocore ({entries} operations over "+ f"{len(document['namespaces'])} namespaces)")+ return 0+ try:+ documents, provenance = fetch_references(args.source_dir)+ upstream = tag_on_create_operations(documents)+ arns = resource_arns(documents, set(document.get("resourceArns", {})))+ except (OSError, ValueError) as e:+ print(f"error: could not read the Service Reference ({e})", file=sys.stderr)+ return 2+ untrue, added = verify_against(document, upstream, arns)+ for claim in untrue:+ print(f"error: {claim}", file=sys.stderr)+ if untrue:+ print(f"error: {len(untrue)} vendored operation(s) do not hold upstream.", file=sys.stderr)+ return 1+ if added:+ print(f"{_shown(args.output)}: all {entries} operations verified. AWS has since added "+ f"{len(added)}, so the file is incomplete but not wrong (run without --verify to refresh): "+ f"{', '.join(added[:10])}{'...' if len(added) > 10 else ''}")+ else:+ print(f"{_shown(args.output)}: all {entries} operations verified against {provenance}, "+ f"nothing added upstream.")+ return 0++ data, botocore = resolve_botocore_data(args.botocore_data)+ try:+ documents, provenance = fetch_references(args.source_dir)+ document = build(documents, provenance, data, botocore)+ except (OSError, ValueError) as e:+ print(f"error: {e}", file=sys.stderr)+ return 2+ problems = validate(document)+ for problem in problems:+ print(f"error: {problem}", file=sys.stderr)+ if problems:+ return 1+ args.output.write_text(render(document), encoding="utf-8")+ print(f"wrote {_shown(args.output)} ({len(document['operations'])} operations over "+ f"{len(document['namespaces'])} namespaces, from {provenance})")+ return 0+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/tools/aws/test_regen_iam_tag_on_create.py b/tools/aws/test_regen_iam_tag_on_create.pynew file mode 100644index 0000000000..df4f097f81--- /dev/null+++ b/tools/aws/test_regen_iam_tag_on_create.py@@ -0,0 +1,397 @@+"""Tests for regen_iam_tag_on_create.++Run with: pytest tools/aws -q (or: make iam-tag-on-create-test)+"""+from __future__ import annotations++import json++import pytest++import regen_iam_tag_on_create as r+++def reference(namespace: str, operations: dict[str, list[str]], clients: dict[str, list[str]] | None = None,+ tagging: dict[str, list[str]] | None = None, keys: dict[str, list[str]] | None = None) -> dict:+ """A Service Reference document. Each operation maps to the actions it lists beside its own; `tagging`+ names the namespace's actions that only tag, each with its condition keys, `keys` an operation's own+ action's condition keys, and `clients` an operation's SDK clients, the namespace by default."""+ tagging = {"TagResource": [], "UntagResource": []} if tagging is None else tagging+ actions = [{"Name": name, "ActionConditionKeys": keys,+ "Annotations": {"Properties": {"IsTaggingOnly": True}}} for name, keys in tagging.items()]+ actions += [{"Name": name, "ActionConditionKeys": (keys or {}).get(name, []),+ "Annotations": {"Properties": {"IsTaggingOnly": False}}}+ for name in operations if name not in tagging]+ entries = []+ for name, beside in operations.items():+ authorized = [{"Service": namespace, "Name": name}]+ authorized += [{"Service": action.split(":")[0], "Name": action.split(":")[1]} for action in beside]+ sdk = [{"Name": c, "Method": name, "Package": "Boto3"} for c in (clients or {}).get(name, [namespace])]+ entries.append({"Name": name, "AuthorizedActions": authorized, "SDK": sdk})+ return {"Name": namespace, "Actions": actions, "Operations": entries}+++def model(operations: dict[str, dict], shapes: dict[str, dict], protocol: str = "json") -> dict:+ """A botocore model whose operations take the input shape each names."""+ return {"metadata": {"protocol": protocol},+ "operations": {name: {"input": {"shape": shape}} for name, shape in operations.items()},+ "shapes": {"String": {"type": "string"}, **shapes}}+++def structure(**members) -> dict:+ return {"type": "structure", "members": {name: ({"shape": spec} if isinstance(spec, str) else spec)+ for name, spec in members.items()}}+++TAG_SHAPES = {+ "TagList": {"type": "list", "member": {"shape": "Tag"}},+ "Tag": structure(Key="String", Value="String"),+ "TagMap": {"type": "map", "key": {"shape": "String"}, "value": {"shape": "String"}},+}+++def corrections(monkeypatch):+ """No corrections at all, so a test sees the rule alone and sets what it needs."""+ for name in ("BY_HAND", "NOT_READ", "EXCLUDED_MEMBERS", "QUERY_MEMBERS"):+ monkeypatch.setattr(r, name, {})+ monkeypatch.setattr(r, "NAMESPACES", ("svc",))+ return monkeypatch+++# --------------------------------------------------------------------------- #+# The Service Reference+# --------------------------------------------------------------------------- #+def test_only_operations_listing_an_action_that_adds_tags_are_kept_with_their_clients():+ found = r.tag_on_create_operations([reference(+ "svc", {"CreateThing": ["svc:TagResource"], "UpdateThing": ["svc:UntagResource"], "GetThing": [],+ "TagResource": []},+ {"CreateThing": ["svc", "svcv2"]})])+ assert found == {"svc:CreateThing": {"tagging": ["svc:TagResource"], "createAction": False,+ "requestTags": False, "clients": ["svc", "svcv2"]}}+++def test_an_action_the_reference_does_not_mark_as_only_tagging_is_no_tagging_action():+ document = reference("svc", {"CreateThing": ["svc:TagSession"]})+ assert r.tag_on_create_operations([document]) == {}+++def test_a_tagging_action_of_another_namespace_counts():+ found = r.tag_on_create_operations([reference("svc", {"CreateThing": ["other:TagResource"]}, tagging={}),+ reference("other", {}, tagging={"TagResource": []})])+ assert found["svc:CreateThing"]["tagging"] == ["other:TagResource"]+++def test_a_tagging_action_taking_its_namespace_s_create_action_key_marks_the_operation():+ document = reference("svc", {"RunThing": ["svc:CreateTags"]},+ tagging={"CreateTags": ["svc:CreateAction", "svc:Region"]})+ assert r.tag_on_create_operations([document])["svc:RunThing"]["createAction"] is True+++def test_an_own_action_taking_the_request_s_tags_marks_the_operation():+ document = reference("svc", {"CreateThing": ["svc:TagResource"], "CreateOther": ["svc:TagResource"]},+ keys={"CreateThing": ["aws:RequestTag/${TagKey}", "aws:TagKeys"]})+ found = r.tag_on_create_operations([document])+ assert found["svc:CreateThing"]["requestTags"] is True+ assert found["svc:CreateOther"]["requestTags"] is False+++def test_a_resource_s_keys_count_whether_the_action_names_them_or_its_namespace_does():+ document = reference("svc", {"CreateThing": ["svc:TagResource"], "CreateOther": ["svc:TagResource"]})+ document["Actions"][-2]["Resources"] = [{"Name": "thing", "ConditionKeys": ["aws:TagKeys"]}]+ document["Actions"][-1]["Resources"] = [{"Name": "other"}]+ document["Resources"] = [{"Name": "other", "ConditionKeys": ["aws:RequestTag/${TagKey}"]}]+ found = r.tag_on_create_operations([document])+ assert found["svc:CreateThing"]["requestTags"] is True+ assert found["svc:CreateOther"]["requestTags"] is True+++def test_an_operation_with_no_action_of_its_name_goes_by_the_other_actions_of_its_namespace():+ document = reference("svc", {"CreateBudget": ["svc:ModifyBudget", "svc:TagResource"]},+ keys={"ModifyBudget": ["aws:TagKeys"]})+ document["Actions"] = [action for action in document["Actions"] if action["Name"] != "CreateBudget"]+ document["Actions"].append({"Name": "ModifyBudget", "ActionConditionKeys": ["aws:TagKeys"],+ "Annotations": {"Properties": {"IsTaggingOnly": False}}})+ assert r.tag_on_create_operations([document])["svc:CreateBudget"]["requestTags"] is True+ # The action of its name is found in any case.+ document = reference("svc", {"CreateACL": ["svc:TagResource"]})+ document["Actions"].append({"Name": "CreateAcl", "ActionConditionKeys": ["aws:RequestTag/${TagKey}"],+ "Annotations": {"Properties": {"IsTaggingOnly": False}}})+ document["Actions"] = [action for action in document["Actions"] if action["Name"] != "CreateACL"]+ assert r.tag_on_create_operations([document])["svc:CreateACL"]["requestTags"] is True+++def test_an_unusable_namespace_is_rejected():+ with pytest.raises(ValueError, match="not usable"):+ r.tag_on_create_operations([{"Name": "Not A Namespace", "Operations": []}])+++# --------------------------------------------------------------------------- #+# botocore: the members that carry the tags+# --------------------------------------------------------------------------- #+def test_a_tag_list_and_a_tag_map_are_read_with_their_key_and_value_names():+ m = model({"Op": "In"}, {+ "In": structure(Tags="TagList", ResourceTags="KmsTags", UserPoolTags="TagMap", Name="String"),+ "KmsTags": {"type": "list", "member": {"shape": "KmsTag"}},+ "KmsTag": structure(TagKey="String", TagValue="String"),+ **TAG_SHAPES,+ })+ assert r.tag_members(m, "Op") == [+ {"member": "Tags[]", "key": "Key", "value": "Value"},+ {"member": "ResourceTags[]", "key": "TagKey", "value": "TagValue"},+ {"member": "UserPoolTags{}"},+ ]+++def test_tag_specifications_are_read_through_their_list():+ m = model({"Op": "In"}, {+ "In": structure(TagSpecifications={"shape": "Specs", "locationName": "TagSpecification"}),+ "Specs": {"type": "list", "member": {"shape": "Spec", "locationName": "item"}},+ "Spec": structure(ResourceType="String", Tags={"shape": "Ec2Tags", "locationName": "Tag"}),+ "Ec2Tags": {"type": "list", "member": {"shape": "Ec2Tag", "locationName": "item"}},+ "Ec2Tag": structure(Key={"shape": "String", "locationName": "key"},+ Value={"shape": "String", "locationName": "value"}),+ }, protocol="ec2")+ assert r.tag_members(m, "Op") == [+ {"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value", "resourceType": "ResourceType"}]+++def test_a_specification_naming_no_resource_type_gives_none():+ m = model({"Op": "In"}, {"In": structure(TagSpecifications="Specs"), "Specs": {"type": "list", "member": {"shape": "Spec"}},+ "Spec": structure(Tags="TagList"), **TAG_SHAPES})+ assert r.tag_members(m, "Op") == [{"member": "TagSpecifications[].Tags[]", "key": "Key", "value": "Value"}]+++def test_each_resource_type_s_arn_keeps_the_partition_region_and_account_and_leaves_the_rest_open():+ document = {"Name": "svc", "Resources": [+ {"Name": "thing", "ARNFormats": ["arn:${Partition}:svc:${Region}:${Account}:thing/${ThingId}"]},+ {"Name": "image", "ARNFormats": ["arn:${Partition}:svc:${Region}::image/${ImageId}"]},+ {"Name": "pair", "ARNFormats": ["arn:${Partition}:svc:${Region}:${Account}:a/${A}/b/${B}", "arn:other"]},+ {"Name": "nameless"}]}+ assert r.resource_arns([document, {"Name": "other", "Resources": []}], {"svc"}) == {"svc": {+ "image": "arn:${Partition}:svc:${Region}::image/*",+ "pair": "arn:${Partition}:svc:${Region}:${Account}:a/*/b/*",+ "thing": "arn:${Partition}:svc:${Region}:${Account}:thing/*"}}+++def test_an_ec2_query_name_wins_over_its_location_name():+ m = model({"Op": "In"}, {"In": structure(Tags={"shape": "TagList", "locationName": "tags", "queryName": "Tag"}),+ **TAG_SHAPES}, protocol="ec2")+ assert r.tag_members(m, "Op") == [{"member": "Tag[]", "key": "Key", "value": "Value"}]+++def test_members_named_otherwise_nested_deeper_or_holding_no_tags_are_not_read():+ m = model({"Op": "In"}, {+ "In": structure(TagFilters="TagList", Config="Config", Tag="TagList", Tags="String",+ TagKeys="Keys"),+ "Config": structure(Tags="TagList"),+ "Keys": {"type": "list", "member": {"shape": "String"}},+ **TAG_SHAPES,+ })+ assert r.tag_members(m, "Op") == []+++def test_a_member_bound_to_the_uri_a_header_or_the_query_string_is_not_read():+ m = model({"Op": "In"}, {"In": structure(Tags={"shape": "TagMap", "location": "header"},+ tags="TagMap"), **TAG_SHAPES}, protocol="rest-json")+ assert r.tag_members(m, "Op") == [{"member": "tags{}"}]++[email protected]("protocol", ["rest-xml"])+def test_a_model_whose_requests_are_not_read_has_no_members(protocol):+ m = model({"Op": "In"}, {"In": structure(Tags="TagList"), **TAG_SHAPES}, protocol=protocol)+ assert r.tag_members(m, "Op") == []+++# --------------------------------------------------------------------------- #+# One operation's entry+# --------------------------------------------------------------------------- #+SIMPLE = {"svc": model({"CreateThing": "In"}, {"In": structure(Tags="TagList"), **TAG_SHAPES})}+++def upstream(*tagging: str, create_action: bool = False, request_tags: bool = False) -> dict:+ return {"tagging": list(tagging), "createAction": create_action, "requestTags": request_tags, "clients": ["svc"]}+++def test_an_operation_reads_its_members_for_its_one_tagging_action(corrections):+ assert r.entry_for("svc:CreateThing", upstream("svc:TagResource", create_action=True, request_tags=True),+ SIMPLE) == {"tagging": ["svc:TagResource"], "createAction": True, "requestTags": True,+ "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]}+++def test_several_tagging_actions_must_be_checked_by_hand(corrections):+ with pytest.raises(ValueError, match="BY_HAND"):+ r.entry_for("svc:CreateThing", upstream("svc:TagResource", "svc:TagThing"), SIMPLE)+ corrections.setattr(r, "BY_HAND", {"svc:CreateThing": "either action"})+ assert r.entry_for("svc:CreateThing", upstream("svc:TagResource", "svc:TagThing"), SIMPLE) == {+ "tagging": ["svc:TagResource", "svc:TagThing"], "byHand": "either action"}+++def test_an_operation_carrying_no_tags_must_say_why(corrections):+ models = {"svc": model({"CreateThing": "In"}, {"In": structure(Name="String")})}+ with pytest.raises(ValueError, match="NOT_READ"):+ r.entry_for("svc:CreateThing", upstream("svc:TagResource"), models)+ corrections.setattr(r, "NOT_READ", {"svc:CreateThing": "no member of the request carries tags"})+ assert r.entry_for("svc:CreateThing", upstream("svc:TagResource"), models) == {+ "tagging": ["svc:TagResource"], "notRead": "no member of the request carries tags"}+++def test_an_exclusion_drops_a_member_and_a_query_name_is_added(corrections):+ models = {"svc": model({"CreateThing": "In"}, {"In": structure(Tags="TagList", tags="TagMap"), **TAG_SHAPES})}+ corrections.setattr(r, "EXCLUDED_MEMBERS", {"svc:CreateThing": {"Tags[]": "the tags of something else"}})+ corrections.setattr(r, "QUERY_MEMBERS", {"svc:CreateThing": {"tags{}": ("Tag{}", "the Query example")}})+ assert r.entry_for("svc:CreateThing", upstream("svc:TagResource"), models)["tags"] == [+ {"member": "tags{}", "query": "Tag{}"}]+++def test_a_query_name_for_a_member_the_request_does_not_have_fails(corrections):+ corrections.setattr(r, "QUERY_MEMBERS", {"svc:CreateThing": {"tags{}": ("Tag{}", "the Query example")}})+ with pytest.raises(ValueError, match="QUERY_MEMBERS"):+ r.entry_for("svc:CreateThing", upstream("svc:TagResource"), SIMPLE)+++# --------------------------------------------------------------------------- #+# The whole document+# --------------------------------------------------------------------------- #+def write_models(root, models: dict[str, dict]):+ for name, value in models.items():+ directory = root / name / "2020-01-01"+ directory.mkdir(parents=True)+ (directory / "service-2.json").write_text(json.dumps(value), encoding="utf-8")+++def test_a_built_document_validates_and_matches_botocore(corrections, tmp_path):+ write_models(tmp_path, SIMPLE)+ document = r.build([reference("svc", {"CreateThing": ["svc:TagResource"]}),+ reference("elsewhere", {"Op": ["elsewhere:TagResource"]})], "test", tmp_path, "botocore test")+ assert r.validate(document) == []+ assert r.derive(document, tmp_path) == []+ assert document["namespaces"] == {"svc": ["svc"]}+ assert document["otherNamespaces"] == ["elsewhere"]+ assert json.loads(r.render(document)) == document+++def test_a_hand_edited_member_does_not_match_botocore(corrections, tmp_path):+ write_models(tmp_path, SIMPLE)+ document = r.build([reference("svc", {"CreateThing": ["svc:TagResource"]})], "test", tmp_path, "botocore test")+ document["operations"]["svc:CreateThing"]["tags"].append({"member": "Other{}"})+ assert r.validate(document) == []+ assert len(r.derive(document, tmp_path)) == 1+++def test_a_correction_naming_an_operation_the_reference_does_not_list_fails(corrections, tmp_path):+ write_models(tmp_path, SIMPLE)+ corrections.setattr(r, "NOT_READ", {"svc:Gone": "no member of the request carries tags"})+ with pytest.raises(ValueError, match="svc:Gone"):+ r.build([reference("svc", {"CreateThing": ["svc:TagResource"]})], "test", tmp_path, "botocore test")+++def test_an_exclusion_its_operation_does_not_have_fails(corrections, tmp_path):+ write_models(tmp_path, SIMPLE)+ corrections.setattr(r, "EXCLUDED_MEMBERS", {"svc:CreateThing": {"Missing[]": "no longer there"}})+ with pytest.raises(ValueError, match="does not have"):+ r.build([reference("svc", {"CreateThing": ["svc:TagResource"]})], "test", tmp_path, "botocore test")+++def good_document() -> dict:+ return {"namespaces": {"svc": ["svc"]}, "operations": {+ "svc:A": {"tagging": ["svc:CreateTags"], "createAction": True, "requestTags": True,+ "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key", "value": "Value"}]},+ "svc:B": {"tagging": ["svc:TagResource", "svc:TagThing"], "byHand": "either action"},+ "svc:C": {"tagging": ["svc:TagResource"], "notRead": "no member of the request carries tags"},+ "svc:D": {"tagging": ["svc:TagResource"], "tags": [{"member": "tags{}", "query": "Tag{}"}]}}}+++def test_a_well_formed_document_validates():+ assert r.validate(good_document()) == []+ document = good_document()+ document["resourceArns"] = {"svc": {"thing": "arn:${Partition}:svc:${Region}:${Account}:thing/*"}}+ document["operations"]["svc:A"]["tags"][0]["resourceType"] = "ResourceType"+ assert r.validate(document) == []+++def typed(document: dict) -> dict:+ document["operations"]["svc:A"]["tags"][0]["resourceType"] = "ResourceType"+ document["resourceArns"] = {"svc": {"thing": "arn:${Partition}:svc:${Region}:${Account}:thing/*"}}+ return document++[email protected]("change, problem", [+ (lambda d: d["operations"]["svc:A"].update(byHand="x"), "exactly one"),+ (lambda d: d["operations"]["svc:A"]["tags"][0].update(member="TagSpecification..Tag[]"), "no path"),+ (lambda d: d["operations"]["svc:A"]["tags"][0].update(member="TagSpecification[item].Key"), "no path"),+ (lambda d: d["operations"]["svc:A"]["tags"][0].pop("value"), "names no key and value"),+ (lambda d: d["operations"]["svc:D"]["tags"][0].update(key="Key", value="Value"), "names a key and value"),+ (lambda d: d["operations"]["svc:D"]["tags"][0].update(query="Tag[]"), "Query protocol"),+ (lambda d: d["operations"]["svc:A"].update(createAction=False), "unknown field"),+ (lambda d: d["operations"]["svc:A"].update(requestTags=False), "unknown field"),+ (lambda d: d["operations"]["svc:A"].update(tagging=["svc:CreateTags", "svc:TagResource"]), "not one tagging"),+ (lambda d: d["operations"]["svc:C"].update(tagging=[]), "no usable tagging"),+ (lambda d: d["operations"].update({"other:E": {"tagging": ["other:TagResource"], "notRead": "x"}}),+ "namespace the file reads"),+ (lambda d: d["operations"]["svc:D"]["tags"][0].update(resourceType="ResourceType"), "no list of tag specifications"),+ (lambda d: typed(d).pop("resourceArns"), "resourceArns has no resource types of svc"),+ (lambda d: typed(d)["resourceArns"]["svc"].update(thing="*"), "resourceArns is not an ARN"),+ (lambda d: typed(d)["resourceArns"].update(other={"thing": "arn:${Partition}:other:::thing/*"}),+ "resourceArns is not an ARN"),+])+def test_a_malformed_document_is_rejected(change, problem):+ document = good_document()+ change(document)+ assert any(problem in p for p in r.validate(document)), r.validate(document)+++def test_verify_fails_on_a_claim_aws_does_not_make_and_reports_an_added_operation():+ def found(tagging, create_action=False, request_tags=False, clients=("svc",)):+ return {"tagging": tagging, "createAction": create_action, "requestTags": request_tags,+ "clients": list(clients)}++ upstream_operations = {+ "svc:A": found(["svc:CreateTags"], create_action=True),+ "svc:B": found(["svc:TagResource"]),+ "svc:D": found(["svc:TagResource"], create_action=True),+ "svc:F": found(["svc:TagResource"]),+ "elsewhere:E": found(["elsewhere:TagResource"], clients=("elsewhere",))}+ untrue, added = r.verify_against(good_document(), upstream_operations)+ assert len(untrue) == 4 and any("svc:B" in u for u in untrue) and any("svc:C" in u for u in untrue)+ assert any("svc:D" in u and "CreateAction" in u for u in untrue)+ assert any("svc:A" in u and "request's tags" in u for u in untrue)+ assert added == ["svc:F"]+++def test_verify_fails_when_aws_gives_a_resource_type_another_arn():+ document = typed(good_document())+ upstream_operations = {operation: {"tagging": entry["tagging"], "createAction": entry.get("createAction", False),+ "requestTags": entry.get("requestTags", False), "clients": ["svc"]}+ for operation, entry in document["operations"].items()}+ assert r.verify_against(document, upstream_operations, {"svc": dict(document["resourceArns"]["svc"])}) == ([], [])+ untrue, _ = r.verify_against(document, upstream_operations,+ {"svc": {"thing": "arn:${Partition}:svc:${Region}:${Account}:thing:*"}})+ assert untrue == ["AWS no longer gives svc's thing the ARN the file does"]+++def test_verify_fails_when_aws_lists_an_operation_for_a_client_the_file_does_not_read():+ document = good_document()+ untrue, _ = r.verify_against(document, {+ "svc:A": {"tagging": ["svc:CreateTags"], "createAction": True, "requestTags": True, "clients": ["svc", "svcv2"]},+ "svc:B": {"tagging": ["svc:TagResource", "svc:TagThing"], "createAction": False, "requestTags": False,+ "clients": ["svc"]},+ "svc:C": {"tagging": ["svc:TagResource"], "createAction": False, "requestTags": False, "clients": ["svc"]},+ "svc:D": {"tagging": ["svc:TagResource"], "createAction": False, "requestTags": False, "clients": ["svc"]}})+ assert untrue == ["AWS lists svc:A for ['svc', 'svcv2'], which the file does not read"]+++def test_the_vendored_file_is_well_formed():+ document = json.loads(r.OUTPUT.read_text(encoding="utf-8"))+ assert r.validate(document) == []+ operations = document["operations"]+ assert operations["sqs:CreateQueue"] == {"tagging": ["sqs:TagQueue"], "requestTags": True,+ "tags": [{"member": "tags{}", "query": "Tag{}"}]}+ assert operations["kms:CreateKey"]["tags"] == [{"member": "Tags[]", "key": "TagKey", "value": "TagValue"}]+ assert operations["ec2:RunInstances"] == {"tagging": ["ec2:CreateTags"], "createAction": True, "requestTags": True,+ "tags": [{"member": "TagSpecification[item].Tag[item]", "key": "Key",+ "value": "Value", "resourceType": "ResourceType"}]}+ assert document["resourceArns"]["ec2"]["instance"] == "arn:${Partition}:ec2:${Region}:${Account}:instance/*"+ assert document["resourceArns"]["ec2"]["image"] == "arn:${Partition}:ec2:${Region}::image/*"+ assert operations["budgets:CreateBudget"]["requestTags"] is True+ assert operations["logs:CreateLogGroup"].get("byHand")