Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

fix(iam): check ARNs inside structures and EventBridge's resources (#6561)

Priamo Germosenc5e873ff847c
diff --git a/docs/services/iam.md b/docs/services/iam.md
index 9ff9e60cc0..d4b5805c66 100644
--- a/docs/services/iam.md
+++ b/docs/services/iam.md
@@ -1424,11 +1424,14 @@ the status, not just the request's content type.
A request is checked against the resources it names. Floci builds their ARNs itself for S3, Lambda,
SQS, SNS, DynamoDB, Kinesis, SSM, KMS, IAM, Resource Groups, EventBridge Scheduler, EventBridge
Pipes, Aurora DSQL, EKS, CloudWatch Logs, Secrets Manager and STS. For Elastic Load Balancing, ECR,
-Step Functions and Amazon Cognito user pools they come from a table generated from AWS's Service
+Step Functions, EventBridge and Amazon Cognito user pools they come from a table generated from AWS's Service
Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
operation's action, the resource types that action acts on with their ARN formats, and the request
members that name them: a member holding a resource's ARN, which counts when it matches the format
-of a type the action acts on, or members filling the variables of a type's format. A variable the
+of a type the action acts on, or members filling the variables of a type's format. A member holding
+an ARN may be one inside a structure or inside each of a list's structures: `SetRulePriorities` is
+checked on the rules its `RulePriorities` name, and `CreateStateMachineAlias` on the state machine
+its routing configuration's versions are of. A variable the
request does not fill is `*`, as the service mints a new resource's id, so `CreateTargetGroup` is
checked on `targetgroup/<Name>/*`; a v2 `CreateLoadBalancer` is checked on the load balancer of its
`Type`, `loadbalancer/app/<Name>/*` when it gives none, and one of a `Type` outside `application`,
@@ -1443,7 +1446,16 @@ selects the registry its handler acts in, so `repository/<name>` is checked in t
`registryId` that is no account id names no repository, while a null one is the caller's, as ECR
reads it. `StartExecution` and
`StartSyncExecution` take Step Functions Local's `<stateMachineArn>#<test case>` and run the
-machine before the `#`, so that machine is the one checked. A state machine's version or alias
+machine before the `#`, so that machine is the one checked. An EventBridge rule is on the event bus
+its request's `EventBusName` names, by name or by ARN, and on the default bus when it names none
+or gives a null, whose rules are `rule/<name>`, with no bus; a bus ARN of another account, the
+default bus's included, names that account's rule, checked as given and as the caller's own, which
+Floci acts on, and one leaving its account and Region empty names the caller's. `DescribeEventBus`
+naming no bus is checked on `event-bus/default`. A connection or an API destination, whose ARN
+EventBridge follows with an id it mints after the name, `connection/<name>/<id>`, is checked on
+the ARN it is stored under when the request names it, and on `connection/<name>/*` when there is
+none yet, as for its create. EventBridge V2's API, which Floci does not serve, is not read. A
+state machine's version or alias
(`stateMachine:<name>:<qualifier>`) is checked on the state machine's ARN, as Step Functions
authorizes it, so a grant or a deny on `stateMachine:<name>` covers its versions and aliases, and
an execution started through one is the state machine's. An ARN naming another account or
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/RequestResourceMembers.java b/src/main/java/io/github/hectorvent/floci/core/common/RequestResourceMembers.java
index 5912fdc67f..46422a0f1f 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/RequestResourceMembers.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/RequestResourceMembers.java
@@ -32,23 +32,40 @@ final class RequestResourceMembers {
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final Pattern VARIABLE = Pattern.compile("\\$\\{(\\w+)}");
private static final Pattern MEMBER = Pattern.compile("[A-Za-z][A-Za-z0-9_]*(\\[])?");
+ /** A member holding an ARN may also be one level inside a structure or each of a list's structures. */
+ private static final Pattern ARN_MEMBER = Pattern.compile("[A-Za-z][A-Za-z0-9_]*(\\[])?(\\.[A-Za-z][A-Za-z0-9_]*(\\[])?)?");
/** An ARN format's leading resource type word, and the rest of its resource. */
private static final Pattern RESOURCE_PART = Pattern.compile(
"^arn:\\$\\{Partition}:[^:]*:[^:]*:[^:]*:([A-Za-z][A-Za-z0-9-]*)(.*)$");
+ /** A format's resource that is a literal and one variable. */
+ private static final Pattern ONE_VARIABLE = Pattern.compile("[^$]*\\$\\{\\w+}");
/** The one id a child type's format appends to its parent's. */
private static final Pattern APPENDED_ID = Pattern.compile("[/:]\\$\\{\\w+}");
- /** A top-level request member that holds a string, or a list of them when {@code list}. */
- record Member(String name, boolean list) {
+ /**
+ * A top-level request member that holds a string, or a list of them when {@code list}, or, with a
+ * {@code field}, a structure or a list of them, of which that field is read.
+ */
+ record Member(String name, boolean list, Member field) {
+
+ Member(String name, boolean list) {
+ this(name, list, null);
+ }
}
/**
* A resource type's ARN format, with {@code ${Partition}}, {@code ${Region}}, {@code ${Account}} and the
* variables a request fills, and the pattern an ARN of the type matches; {@code unqualified} when its service
* checks an ARN of it given with a qualifier, one more {@code :<name>} past the format, without that qualifier
- * (Step Functions checks a version or an alias on its state machine's ARN).
+ * (Step Functions checks a version or an alias on its state machine's ARN); {@code minted} when its service
+ * follows the one variable the format ends in with an id it mints, {@code /<id>}, which the format leaves out
+ * (EventBridge's {@code connection/<name>/<id>}).
*/
- record ArnFormat(String format, Pattern pattern, boolean unqualified) {
+ record ArnFormat(String format, Pattern pattern, boolean unqualified, boolean minted) {
+
+ ArnFormat(String format, Pattern pattern, boolean unqualified) {
+ this(format, pattern, unqualified, false);
+ }
/** The ARN as its service checks it: an unqualified type's without the qualifier it may carry. */
String checked(String arn) {
@@ -65,16 +82,27 @@ final class RequestResourceMembers {
}
return arn.substring(0, at);
}
+
+ /** The one variable of a format whose resource ends in it ({@code event-bus/${EventBusName}}), from an ARN of it. */
+ String variable(String arn) {
+ String resource = format.split(":", 6)[5];
+ return AwsArnUtils.parse(arn).resource().substring(resource.indexOf("${"));
+ }
}
/**
* A resource a request names: by a member holding its ARN, which names a resource of one of {@code types} when
* it matches the type's format, or by members filling the variables of one type's format, the others open,
- * only {@code when} each member named has one of its values, an empty one for the member absent, in the
- * account an {@code account} member gives (ECR's {@code registryId}), or else the request's. An ARN member's
- * value is read up to the character {@code before}, when there is one, as its handler drops the rest.
+ * only {@code when} each member named has one of its values and {@code unless} it has one of those, an empty
+ * one for the member absent, in the account an {@code account} member gives (ECR's {@code registryId}), or else
+ * the request's. A member {@code absent} from the request, or given a JSON null, is read as the value given for
+ * it (an EventBridge request naming no event bus names {@code default}), and one in {@code arnOf} may give an
+ * ARN of the type named for it instead of its name, read as that type's one variable, the resource then in the
+ * ARN's account and Region, or the caller's and the request's where the ARN leaves them empty. An ARN
+ * member's value is read up to the character {@code before}, when there is one, as its handler drops the rest.
*/
record Resource(List<String> types, Member arn, Map<String, Member> fill, Map<String, List<String>> when,
+ Map<String, List<String>> unless, Map<String, String> absent, Map<String, String> arnOf,
Member account, String before) {
}
@@ -118,6 +146,7 @@ final class RequestResourceMembers {
Map<String, Map<String, ArnFormat>> formats = new LinkedHashMap<>();
document.path("arnFormats").properties().forEach(namespace -> {
Set<String> unqualified = names(document.path("unqualified").path(namespace.getKey()));
+ Set<String> minted = names(document.path("mintedIds").path(namespace.getKey()));
Map<String, ArnFormat> types = new LinkedHashMap<>();
namespace.getValue().properties().forEach(type -> {
String format = type.getValue().asText("");
@@ -125,7 +154,8 @@ final class RequestResourceMembers {
throw new IllegalStateException(RESOURCE_NAME + " gives " + namespace.getKey() + "'s "
+ type.getKey() + " no ARN format");
}
- types.put(type.getKey(), new ArnFormat(format, pattern(format), unqualified.contains(type.getKey())));
+ types.put(type.getKey(), new ArnFormat(format, pattern(format), unqualified.contains(type.getKey()),
+ minted.contains(type.getKey())));
});
formats.put(namespace.getKey(), Map.copyOf(types));
});
@@ -136,6 +166,14 @@ final class RequestResourceMembers {
+ namespace.getValue() + " without a qualifier, no types with an ARN format");
}
});
+ document.path("mintedIds").properties().forEach(namespace -> {
+ Map<String, ArnFormat> types = formats.getOrDefault(namespace.getKey(), Map.of());
+ if (!namespace.getValue().isArray() || !names(namespace.getValue()).stream().allMatch(type ->
+ types.containsKey(type) && ONE_VARIABLE.matcher(types.get(type).format().split(":", 6)[5]).matches())) {
+ throw new IllegalStateException(RESOURCE_NAME + " gives " + namespace.getKey() + "'s "
+ + namespace.getValue() + " a minted id, no types whose format ends in its one variable");
+ }
+ });
Map<String, List<Resource>> entries = new LinkedHashMap<>();
Map<String, List<Created>> creates = new LinkedHashMap<>();
operations.properties().forEach(operation -> {
@@ -179,8 +217,8 @@ final class RequestResourceMembers {
throw new IllegalStateException(RESOURCE_NAME + " reads an ARN for " + operation
+ " before " + before + ", no one character");
}
- return new Resource(types, member(operation, resource.path("arn").asText("")), Map.of(), Map.of(), null,
- before);
+ return new Resource(types, arnMember(operation, resource.path("arn").asText("")), Map.of(), Map.of(),
+ Map.of(), Map.of(), Map.of(), null, before);
}
String type = resource.path("type").asText("");
ArnFormat format = formats.get(type);
@@ -201,21 +239,48 @@ final class RequestResourceMembers {
throw new IllegalStateException(RESOURCE_NAME + " fills " + type + " for " + operation
+ " from more than one list");
}
- Map<String, List<String>> when = new LinkedHashMap<>();
- resource.path("when").properties().forEach(member -> {
- if (member(operation, member.getKey()).list() || !member.getValue().isArray() || member.getValue().isEmpty()) {
- throw new IllegalStateException(RESOURCE_NAME + " names a " + type + " for " + operation
- + " when " + member.getKey() + " has no values");
+ Map<String, List<String>> when = values(operation, type, resource.path("when"));
+ Map<String, List<String>> unless = values(operation, type, resource.path("unless"));
+ Map<String, String> absent = new LinkedHashMap<>();
+ resource.path("absent").properties().forEach(member -> {
+ if (member(operation, member.getKey()).list() || !member.getValue().isTextual()
+ || member.getValue().asText().isEmpty()) {
+ throw new IllegalStateException(RESOURCE_NAME + " reads " + member.getKey() + " for " + operation
+ + " when absent as no value");
}
- when.put(member.getKey(), member.getValue().valueStream().map(value -> value.isNull() ? "" : value.asText())
- .toList());
+ absent.put(member.getKey(), member.getValue().asText());
+ });
+ Map<String, String> arnOf = new LinkedHashMap<>();
+ resource.path("arnOf").properties().forEach(member -> {
+ ArnFormat named = formats.get(member.getValue().asText(""));
+ if (member(operation, member.getKey()).list() || named == null
+ || !ONE_VARIABLE.matcher(named.format().split(":", 6)[5]).matches()) {
+ throw new IllegalStateException(RESOURCE_NAME + " reads " + member.getKey() + " for " + operation
+ + " as an ARN of " + member.getValue() + ", no type named by one variable");
+ }
+ arnOf.put(member.getKey(), member.getValue().asText());
});
Member account = resource.has("account") ? member(operation, resource.path("account").asText("")) : null;
if (account != null && (account.list() || !format.format().contains("${Account}"))) {
throw new IllegalStateException(RESOURCE_NAME + " takes " + type + "'s account for " + operation
+ " from " + account.name() + ", no member of one account or a type of none");
}
- return new Resource(List.of(type), null, Map.copyOf(fill), Map.copyOf(when), account, null);
+ return new Resource(List.of(type), null, Map.copyOf(fill), when, unless, Map.copyOf(absent), Map.copyOf(arnOf),
+ account, null);
+ }
+
+ /** The values each member named in {@code when} or {@code unless} may have, an empty one for the member absent. */
+ private static Map<String, List<String>> values(String operation, String type, JsonNode members) {
+ Map<String, List<String>> values = new LinkedHashMap<>();
+ members.properties().forEach(member -> {
+ if (member(operation, member.getKey()).list() || !member.getValue().isArray() || member.getValue().isEmpty()) {
+ throw new IllegalStateException(RESOURCE_NAME + " names a " + type + " for " + operation
+ + " when or unless " + member.getKey() + " has no values");
+ }
+ values.put(member.getKey(), member.getValue().valueStream().map(value -> value.isNull() ? "" : value.asText())
+ .toList());
+ });
+ return Map.copyOf(values);
}
private static Created created(String operation, JsonNode created, Map<String, ArnFormat> formats) {
@@ -241,6 +306,19 @@ final class RequestResourceMembers {
return path.endsWith("[]") ? new Member(path.substring(0, path.length() - 2), true) : new Member(path, false);
}
+ /** A member holding an ARN: {@code Name}, {@code Name[]}, or a field of it, {@code Name.Field} or {@code Name[].Field}. */
+ private static Member arnMember(String operation, String path) {
+ if (!ARN_MEMBER.matcher(path).matches()) {
+ throw new IllegalStateException(RESOURCE_NAME + " reads " + operation + " at " + path + ", which is no member");
+ }
+ int dot = path.indexOf('.');
+ if (dot < 0) {
+ return member(operation, path);
+ }
+ Member outer = member(operation, path.substring(0, dot));
+ return new Member(outer.name(), outer.list(), member(operation, path.substring(dot + 1)));
+ }
+
/**
* What an ARN of the format matches: its literal parts, a partition, any Region and account, and anything for
* each other variable but nothing.
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/RequestResources.java b/src/main/java/io/github/hectorvent/floci/core/common/RequestResources.java
index dd88a43ef6..595f3ef8b0 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/RequestResources.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/RequestResources.java
@@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -19,7 +20,9 @@ import java.util.regex.Pattern;
*
* <p>A request names a resource by a member holding its ARN, which counts when it matches the ARN format of a
* resource type the action acts on, or by members filling the variables of a type's format, the others open as
- * {@code *} (a resource a request creates has the id its service mints). An ARN with a qualifier its service drops
+ * {@code *} (a resource a request creates has the id its service mints). A type whose service follows the name a
+ * request gives with an id it mints ({@code connection/<name>/<id>}) is the resource its service stores under that
+ * name, or else has that id open. An ARN with a qualifier its service drops
* to check it is checked without one (a state machine's version or alias, on the state machine). An ARN naming
* another account or Region than the request's is checked as given and as each resource of that name a handler may
* act on instead, in the ARN's account or the caller's and in the ARN's Region or the request's, and the request is
@@ -42,6 +45,16 @@ public final class RequestResources {
*/
public static List<String> of(String operation, ContainerRequestContext ctx, String partition, String region,
String accountId) {
+ return of(operation, ctx, partition, region, accountId, null);
+ }
+
+ /**
+ * As {@link #of(String, ContainerRequestContext, String, String, String)}, a resource of a type whose service
+ * mints an id after its name being the one {@code stored} finds for the caller under the name the request gives,
+ * or else its ARN with that id open, as it is with no {@code stored}.
+ */
+ public static List<String> of(String operation, ContainerRequestContext ctx, String partition, String region,
+ String accountId, StoredResourceArns stored) {
RequestResourceMembers.Table table = RequestResourceMembers.table();
List<RequestResourceMembers.Resource> resources = operation == null ? null : table.operations().get(operation);
if (resources == null || resources.isEmpty()) {
@@ -52,7 +65,7 @@ public final class RequestResources {
Map<String, RequestResourceMembers.ArnFormat> formats = formats(table, operation);
Set<String> arns = new LinkedHashSet<>();
for (RequestResourceMembers.Resource resource : resources) {
- if (!applies(resource, form, body)) {
+ if (!applies(resource, form, body, formats)) {
continue;
}
if (resource.arn() != null) {
@@ -63,7 +76,7 @@ public final class RequestResources {
accountId));
}
} else {
- fill(arns, resource, formats.get(resource.types().getFirst()), form, body, partition, region, accountId);
+ fill(arns, resource, formats, form, body, partition, region, accountId, stored);
}
}
return List.copyOf(arns);
@@ -112,17 +125,73 @@ public final class RequestResources {
return at < 0 ? value : value.substring(0, at);
}
- /** Whether each member the resource is named {@code when} has one of its values, an empty one for absent. */
- private static boolean applies(RequestResourceMembers.Resource resource, Map<String, String> form, JsonNode body) {
+ /**
+ * Whether each member the resource is named {@code when} has one of its values and no member it is named
+ * {@code unless} has one of those, an empty one for absent.
+ */
+ private static boolean applies(RequestResourceMembers.Resource resource, Map<String, String> form, JsonNode body,
+ Map<String, RequestResourceMembers.ArnFormat> formats) {
for (Map.Entry<String, List<String>> member : resource.when().entrySet()) {
- List<String> values = values(form, body, new RequestResourceMembers.Member(member.getKey(), false));
- if (!member.getValue().contains(values.isEmpty() ? "" : values.getFirst())) {
+ if (!member.getValue().contains(first(resource, form, body, member.getKey(), formats))) {
+ return false;
+ }
+ }
+ for (Map.Entry<String, List<String>> member : resource.unless().entrySet()) {
+ if (member.getValue().contains(first(resource, form, body, member.getKey(), formats))) {
return false;
}
}
return true;
}
+ private static String first(RequestResourceMembers.Resource resource, Map<String, String> form, JsonNode body,
+ String member, Map<String, RequestResourceMembers.ArnFormat> formats) {
+ List<String> given = given(resource, form, body, new RequestResourceMembers.Member(member, false), formats);
+ return given.isEmpty() ? "" : given.getFirst();
+ }
+
+ /**
+ * The values a request gives a member as the resource reads them: the one it reads for the member absent or
+ * given a JSON null, as a handler reading it with {@code asText(null)} does (EventBridge's {@code EventBusName}),
+ * and, for a member that may give an ARN of a type instead of its name, that type's one variable of such an ARN.
+ */
+ private static List<String> given(RequestResourceMembers.Resource resource, Map<String, String> form,
+ JsonNode body, RequestResourceMembers.Member member,
+ Map<String, RequestResourceMembers.ArnFormat> formats) {
+ String absent = resource.absent().get(member.name());
+ List<String> values = absent != null && isNull(body, member) ? List.of() : values(form, body, member);
+ if (values.isEmpty() && absent != null) {
+ return List.of(absent);
+ }
+ RequestResourceMembers.ArnFormat named = arnOf(resource, member.name(), formats);
+ return named == null ? values : values.stream()
+ .map(value -> named.pattern().matcher(value).matches() ? named.variable(value) : value).toList();
+ }
+
+ /** The format of the type whose ARN a member of the resource may give instead of its name; null for none. */
+ private static RequestResourceMembers.ArnFormat arnOf(RequestResourceMembers.Resource resource, String member,
+ Map<String, RequestResourceMembers.ArnFormat> formats) {
+ String type = resource.arnOf().get(member);
+ return type == null ? null : formats.get(type);
+ }
+
+ /**
+ * The ARN a request gives for a name in a member of the resource that may give one, which puts the resource in
+ * that ARN's account and Region (a rule on the event bus it names, the default one included); null for none.
+ */
+ private static AwsArnUtils.Arn arnGiven(RequestResourceMembers.Resource resource, Map<String, String> form,
+ JsonNode body, Map<String, RequestResourceMembers.ArnFormat> formats) {
+ for (String member : resource.arnOf().keySet()) {
+ RequestResourceMembers.ArnFormat named = arnOf(resource, member, formats);
+ for (String value : values(form, body, new RequestResourceMembers.Member(member, false))) {
+ if (named.pattern().matcher(value).matches()) {
+ return AwsArnUtils.parse(value);
+ }
+ }
+ }
+ return null;
+ }
+
/** The ARN formats of the operation's namespace, the part of {@code <namespace>:<Operation>} before its colon. */
private static Map<String, RequestResourceMembers.ArnFormat> formats(RequestResourceMembers.Table table,
String operation) {
@@ -133,11 +202,17 @@ public final class RequestResources {
* The ARNs of a type the request names through the variables it fills: one for each value of a list member,
* none when it gives none of them. A value that is itself an ARN of the type names that resource. They are in
* the account the resource's account member gives, which its handler acts in, and none when that member holds
- * no account id; in the request's without one, or with a JSON null for it.
+ * no account id; in the request's without one, or with a JSON null for it. An ARN given for a name puts the
+ * resource in that ARN's account and Region, the caller's and the request's where it leaves them empty, as its
+ * handler then acts on the caller's resource of that name, and it is named as an ARN the request gives is. A type
+ * whose service mints an id after its name is the caller's resource {@code stored} finds under that name, or
+ * else has that id open.
*/
private static void fill(Set<String> arns, RequestResourceMembers.Resource resource,
- RequestResourceMembers.ArnFormat format, Map<String, String> form, JsonNode body,
- String partition, String region, String accountId) {
+ Map<String, RequestResourceMembers.ArnFormat> formats, Map<String, String> form,
+ JsonNode body, String partition, String region, String accountId,
+ StoredResourceArns stored) {
+ RequestResourceMembers.ArnFormat format = formats.get(resource.types().getFirst());
String account = accountId;
if (resource.account() != null) {
List<String> given = isNull(body, resource.account()) ? List.of() : values(form, body, resource.account());
@@ -146,13 +221,15 @@ public final class RequestResources {
}
account = given.isEmpty() ? accountId : given.getFirst();
}
+ AwsArnUtils.Arn from = arnGiven(resource, form, body, formats);
List<Map<String, String>> fillings = new ArrayList<>(List.of(Map.of()));
for (Map.Entry<String, RequestResourceMembers.Member> variable : resource.fill().entrySet()) {
- List<String> values = values(form, body, variable.getValue());
+ List<String> values = given(resource, form, body, variable.getValue(), formats);
if (values.isEmpty()) {
continue;
}
- if (resource.fill().size() == 1 && values.stream().allMatch(value -> format.pattern().matcher(value).matches())) {
+ if (resource.fill().size() == 1 && from == null
+ && values.stream().allMatch(value -> format.pattern().matcher(value).matches())) {
values.forEach(value -> addNamed(arns, format.checked(value), partition, region, accountId));
return;
}
@@ -170,13 +247,40 @@ public final class RequestResources {
return;
}
for (Map<String, String> filling : fillings) {
- arns.add(render(format.format(), filling, partition, region, account));
+ if (from == null) {
+ arns.add(withId(render(format.format(), filling, partition, region, account), format,
+ resource.types().getFirst(), filling, account.equals(accountId) ? stored : null, region));
+ } else {
+ addNamed(arns, withId(render(format.format(), filling, from.partition(),
+ from.region().isEmpty() ? region : from.region(),
+ from.accountId().isEmpty() ? accountId : from.accountId()), format,
+ resource.types().getFirst(), filling, null, region), partition, region, accountId);
+ }
}
}
/**
- * Whether a body gives the member a JSON null, which a handler reading an account with {@code asText(null)} reads
- * as none (ECR's {@code registryId}, its caller's registry then).
+ * The ARN of a resource of a type whose service follows its name with an id it mints: the one {@code stored}
+ * finds the caller's resource of that name under in the Region, or else the ARN with that id open; any other
+ * type's as rendered.
+ */
+ private static String withId(String arn, RequestResourceMembers.ArnFormat format, String type,
+ Map<String, String> filling, StoredResourceArns stored, String region) {
+ if (!format.minted()) {
+ return arn;
+ }
+ if (stored != null && filling.size() == 1) {
+ Optional<String> found = stored.find(type, filling.values().iterator().next(), region);
+ if (found.isPresent()) {
+ return found.get();
+ }
+ }
+ return arn + "/*";
+ }
+
+ /**
+ * Whether a body gives the member a JSON null, which a handler reading it with {@code asText(null)} reads as
+ * none (ECR's {@code registryId}, its caller's registry then; EventBridge's {@code EventBusName}, the default bus).
*/
private static boolean isNull(JsonNode body, RequestResourceMembers.Member member) {
return body != null && body.isObject() && body.path(member.name()).isNull();
@@ -222,32 +326,72 @@ public final class RequestResources {
/**
* The non-empty strings a request gives a member, read as its handler reads them: a form's parameter, or its
* list numbered under {@code member} from 1 to the first missing, or a body's value, as text whether a string,
- * a number, a boolean or a null, and a list member's only from a list, a single value giving none.
+ * a number, a boolean or a null, and a list member's only from a list, a single value giving none. A member
+ * with a field gives that field of its structure, or of each of its list's structures.
*/
private static List<String> values(Map<String, String> form, JsonNode body, RequestResourceMembers.Member member) {
List<String> values = new ArrayList<>();
if (!form.isEmpty()) {
- if (!member.list()) {
- add(values, form.get(member.name()));
- return values;
+ addFormValues(values, form, "", member);
+ } else if (body != null && body.isObject()) {
+ addBodyValues(values, body, member);
+ }
+ return values;
+ }
+
+ /**
+ * A form's values of a member under {@code prefix}: each element of a list from 1 to the first that does not
+ * give the member, or its field, as a handler loops over them.
+ */
+ private static void addFormValues(List<String> values, Map<String, String> form, String prefix,
+ RequestResourceMembers.Member member) {
+ String key = prefix + member.name();
+ if (!member.list()) {
+ if (member.field() == null) {
+ add(values, form.get(key));
+ } else {
+ addFormValues(values, form, key + ".", member.field());
}
- for (int i = 1; form.containsKey(member.name() + ".member." + i); i++) {
- add(values, form.get(member.name() + ".member." + i));
+ return;
+ }
+ for (int i = 1; given(form, key + ".member." + i, member.field()); i++) {
+ if (member.field() == null) {
+ add(values, form.get(key + ".member." + i));
+ } else {
+ addFormValues(values, form, key + ".member." + i + ".", member.field());
}
- return values;
}
- JsonNode value = body == null || !body.isObject() ? null : body.get(member.name());
+ }
+
+ /** Whether a form gives a list's element, or the field of it that is read. */
+ private static boolean given(Map<String, String> form, String element, RequestResourceMembers.Member field) {
+ if (field == null) {
+ return form.containsKey(element);
+ }
+ return form.containsKey(element + "." + field.name() + (field.list() ? ".member.1" : ""));
+ }
+
+ /** A body's values of a member, and of its field in its structure or in each of its list's structures. */
+ private static void addBodyValues(List<String> values, JsonNode node, RequestResourceMembers.Member member) {
+ JsonNode value = node.get(member.name());
if (value == null) {
- return values;
+ return;
}
if (!member.list()) {
- addValue(values, value);
+ addElement(values, value, member.field());
} else if (value.isArray()) {
for (JsonNode element : value) {
- addValue(values, element);
+ addElement(values, element, member.field());
}
}
- return values;
+ }
+
+ private static void addElement(List<String> values, JsonNode element, RequestResourceMembers.Member field) {
+ if (field == null) {
+ addValue(values, element);
+ } else if (element.isObject()) {
+ addBodyValues(values, element, field);
+ }
}
/**
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/StoredResourceArns.java b/src/main/java/io/github/hectorvent/floci/core/common/StoredResourceArns.java
new file mode 100644
index 0000000000..36519fc05c
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/core/common/StoredResourceArns.java
@@ -0,0 +1,23 @@
+package io.github.hectorvent.floci.core.common;
+
+import java.util.Optional;
+
+/**
+ * Finds the ARN a service stores a resource under, for a type of the request-resources table whose service follows
+ * the name a request gives with an id it mints ({@code connection/<name>/<id>}), which only the service knows.
+ *
+ * <p>Implemented by the service that owns such resources (EventBridge, for its connections and API destinations);
+ * looked up lazily by {@code ResourceArnBuilder} through {@code Instance<StoredResourceArns>} for the namespace a
+ * request is of, so IAM never depends on that service directly.</p>
+ */
+public interface StoredResourceArns {
+
+ /** The namespace of the resource types it finds, as the table names it ({@code events}). */
+ String namespace();
+
+ /**
+ * The ARN the caller's resource of the type, named {@code name} in the Region, is stored under; empty when there
+ * is none, or the type is not one it mints an id for.
+ */
+ Optional<String> find(String type, String name, String region);
+}
diff --git a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
index dec3a90d0d..d1c751c264 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
@@ -19,6 +19,7 @@ import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.Pagination;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
+import io.github.hectorvent.floci.core.common.StoredResourceArns;
import io.github.hectorvent.floci.core.resource.ExplorerResource;
import io.github.hectorvent.floci.core.resource.ResourceProvider;
import io.github.hectorvent.floci.core.resource.SupportedResourceType;
@@ -60,7 +61,7 @@ import java.util.UUID;
import java.util.regex.Pattern;
@ApplicationScoped
-public class EventBridgeService implements ResourceProvider {
+public class EventBridgeService implements ResourceProvider, StoredResourceArns {
private static final Logger LOG = Logger.getLogger(EventBridgeService.class);
private static final int MAX_LIST_LIMIT = 100;
@@ -1582,6 +1583,24 @@ public class EventBridgeService implements ResourceProvider {
return connection;
}
+ @Override
+ public String namespace() {
+ return "events";
+ }
+
+ /**
+ * The ARN of the caller's connection or API destination of the name in the Region, which follows the name with
+ * the id it was minted with, as its handlers look it up.
+ */
+ @Override
+ public Optional<String> find(String type, String name, String region) {
+ return switch (type) {
+ case "connection" -> connectionStore.get(connectionKey(region, name)).map(Connection::getConnectionArn);
+ case "api-destination" -> apiDestinationStore.get(apiDestinationKey(region, name)).map(ApiDestination::getArn);
+ default -> Optional.empty();
+ };
+ }
+
public Connection describeConnection(String name, String region) {
return connectionStore.get(connectionKey(region, name))
.orElseThrow(() -> new AwsException("ResourceNotFoundException",
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.java
index ae13a18a55..7d91d7b204 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
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.core.common.AwsRegions;
import io.github.hectorvent.floci.core.common.RequestResources;
import io.github.hectorvent.floci.core.common.ServicePrincipals;
import io.github.hectorvent.floci.core.common.SigV4CredentialScope;
+import io.github.hectorvent.floci.core.common.StoredResourceArns;
import io.github.hectorvent.floci.services.cloudwatch.logs.LogGroupTagTarget;
import io.github.hectorvent.floci.services.eks.EksService;
import io.github.hectorvent.floci.services.kms.KmsService;
@@ -75,19 +76,34 @@ public class ResourceArnBuilder {
private final Instance<EksService> eksService;
/** Looked up lazily for the same reason, to resolve a key named by an id, an alias or an ARN to its stored ARN. */
private final Instance<KmsService> kmsService;
+ /**
+ * Looked up lazily for the same reason, to read the ARN a resource the request-resources table names by a name
+ * its service follows with a minted id is stored under.
+ */
+ private final Instance<StoredResourceArns> storedResourceArns;
@Inject
public ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService,
Instance<SecretsManagerService> secretsManagerService,
Instance<LambdaMicrovmsService> microvmsService,
Instance<EksService> eksService,
- Instance<KmsService> kmsService) {
+ Instance<KmsService> kmsService,
+ Instance<StoredResourceArns> storedResourceArns) {
this.objectMapper = objectMapper;
this.iamService = iamService;
this.secretsManagerService = secretsManagerService;
this.microvmsService = microvmsService;
this.eksService = eksService;
this.kmsService = kmsService;
+ this.storedResourceArns = storedResourceArns;
+ }
+
+ public ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService,
+ Instance<SecretsManagerService> secretsManagerService,
+ Instance<LambdaMicrovmsService> microvmsService,
+ Instance<EksService> eksService,
+ Instance<KmsService> kmsService) {
+ this(objectMapper, iamService, secretsManagerService, microvmsService, eksService, kmsService, null);
}
public ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService,
@@ -173,15 +189,29 @@ public class ResourceArnBuilder {
/**
* The resources a request of a namespace this builder has no branch for names, from the vendored table of
* request resources (see {@link RequestResources}); {@code *} when it names none, or the operation is not one
- * of the namespace.
+ * of the namespace. A resource whose service mints an id after its name is the one the namespace's
+ * {@link StoredResourceArns} finds under that name.
*/
- private static List<String> namedResources(String credentialScope, String operation, ContainerRequestContext ctx,
- String region, String accountId, String partition) {
+ private List<String> namedResources(String credentialScope, String operation, ContainerRequestContext ctx,
+ String region, String accountId, String partition) {
List<String> named = operation == null || !operation.startsWith(credentialScope + ":") ? List.of()
- : RequestResources.of(operation, ctx, partition, region, accountId);
+ : RequestResources.of(operation, ctx, partition, region, accountId, storedResourceArns(credentialScope));
return named.isEmpty() ? List.of("*") : named;
}
+ /** The registered finder of the namespace's stored ARNs; null when there is none. */
+ private StoredResourceArns storedResourceArns(String namespace) {
+ if (storedResourceArns == null || storedResourceArns.isUnsatisfied()) {
+ return null;
+ }
+ for (StoredResourceArns stored : storedResourceArns) {
+ if (stored.namespace().equals(namespace)) {
+ return stored;
+ }
+ }
+ return null;
+ }
+
private String buildResourceGroupArn(ContainerRequestContext ctx, String region, String accountId) {
JsonNode body = readJsonBody(ctx);
if (body == null) {
diff --git a/src/main/resources/aws/iam-request-resources.json b/src/main/resources/aws/iam-request-resources.json
index 94d30d3998..56b99329f8 100644
--- a/src/main/resources/aws/iam-request-resources.json
+++ b/src/main/resources/aws/iam-request-resources.json
@@ -1,11 +1,13 @@
{
"_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.113 (installed package)", "retrieved": "2026-10-25", "note": "make iam-request-resources-check re-derives every operation's resources from botocore; make iam-request-resources-verify checks every action, type and format against AWS."},
- "namespaces": {"cognito-idp": ["cognito-idp"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "states": ["stepfunctions"]},
+ "namespaces": {"cognito-idp": ["cognito-idp"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "events": ["events"], "states": ["stepfunctions"]},
+ "clientsNotRead": {"eventbridgev2": "EventBridge V2, the AWSEventsV2 target over Smithy RPC v2 CBOR on the eventsv2 endpoint, which Floci does not serve; its operations share EventBridge's names and name their resources by other members"},
"handBuilt": ["dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "ssm", "sts"],
- "notCovered": {"access-analyzer": "REST: its requests name their resources in the path, which RequestResources does not read yet", "account": "REST: its requests name their resources in the path, which RequestResources does not read yet", "acm": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "airflow": "REST: its requests name their resources in the path, which RequestResources does not read yet", "apigateway": "REST: its requests name their resources in the path, which RequestResources does not read yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources does not read yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources does not read yet", "application-autoscaling": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "appsync": "REST: its requests name their resources in the path, which RequestResources does not read yet", "aps": "REST: its requests name their resources in the path, which RequestResources does not read yet", "athena": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "autoscaling": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources does not read yet", "batch": "REST: its requests name their resources in the path, which RequestResources does not read yet", "bcm-data-exports": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "bcm-pricing-calculator": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "bedrock": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources does not read yet", "budgets": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ce": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudfront": "REST: its requests name their resources in the path, which RequestResources does not read yet", "cloudhsm": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudtrail": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudwatch": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeartifact": "REST: its requests name their resources in the path, which RequestResources does not read yet", "codebuild": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codedeploy": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources does not read yet", "codepipeline": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cognito-identity": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources does not read yet", "controlcatalog": "REST: its requests name their resources in the path, which RequestResources does not read yet", "controltower": "REST: its requests name their resources in the path, which RequestResources does not read yet", "cur": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "datasync": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "detective": "REST: its requests name their resources in the path, which RequestResources does not read yet", "dlm": "REST: its requests name their resources in the path, which RequestResources does not read yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ecs": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticache": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticbeanstalk": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources does not read yet", "elasticmapreduce": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "emr-serverless": "REST: its requests name their resources in the path, which RequestResources does not read yet", "es": "REST: its requests name their resources in the path, which RequestResources does not read yet", "events": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "execute-api": "REST: its requests name their resources in the path, which RequestResources does not read yet", "firehose": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "fis": "REST: its requests name their resources in the path, which RequestResources does not read yet", "globalaccelerator": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "glue": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "guardduty": "REST: its requests name their resources in the path, which RequestResources does not read yet", "identitystore": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "inspector2": "REST: its requests name their resources in the path, which RequestResources does not read yet", "iot": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "kafka": "REST: its requests name their resources in the path, which RequestResources does not read yet", "kinesisanalytics": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "lightsail": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "macie2": "REST: its requests name their resources in the path, which RequestResources does not read yet", "memorydb": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "mq": "REST: its requests name their resources in the path, which RequestResources does not read yet", "network-firewall": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "oam": "REST: its requests name their resources in the path, which RequestResources does not read yet", "organizations": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ram": "REST: its requests name their resources in the path, which RequestResources does not read yet", "rds": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rds-data": "REST: its requests name their resources in the path, which RequestResources does not read yet", "redshift": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "redshift-data": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "redshift-serverless": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rekognition": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "resource-explorer-2": "REST: its requests name their resources in the path, which RequestResources does not read yet", "route53": "REST: its requests name their resources in the path, which RequestResources does not read yet", "route53resolver": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rum": "REST: its requests name their resources in the path, which RequestResources does not read yet", "s3tables": "REST: its requests name their resources in the path, which RequestResources does not read yet", "s3vectors": "REST: its requests name their resources in the path, which RequestResources does not read yet", "sagemaker": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "securityhub": "REST: its requests name their resources in the path, which RequestResources does not read yet", "servicecatalog": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "servicediscovery": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "servicequotas": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ses": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "signin": "REST: its requests name their resources in the path, which RequestResources does not read yet", "sso": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "sso-oauth": "REST: its requests name their resources in the path, which RequestResources does not read yet", "swf": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "textract": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "timestream-influxdb": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "transcribe": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "transfer": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "translate": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "verifiedpermissions": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "wafv2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint"},
+ "notCovered": {"access-analyzer": "REST: its requests name their resources in the path, which RequestResources does not read yet", "account": "REST: its requests name their resources in the path, which RequestResources does not read yet", "acm": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "airflow": "REST: its requests name their resources in the path, which RequestResources does not read yet", "apigateway": "REST: its requests name their resources in the path, which RequestResources does not read yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources does not read yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources does not read yet", "application-autoscaling": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "appsync": "REST: its requests name their resources in the path, which RequestResources does not read yet", "aps": "REST: its requests name their resources in the path, which RequestResources does not read yet", "athena": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "autoscaling": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources does not read yet", "batch": "REST: its requests name their resources in the path, which RequestResources does not read yet", "bcm-data-exports": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "bcm-pricing-calculator": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "bedrock": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources does not read yet", "budgets": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ce": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudfront": "REST: its requests name their resources in the path, which RequestResources does not read yet", "cloudhsm": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudtrail": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudwatch": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeartifact": "REST: its requests name their resources in the path, which RequestResources does not read yet", "codebuild": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codedeploy": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources does not read yet", "codepipeline": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cognito-identity": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources does not read yet", "controlcatalog": "REST: its requests name their resources in the path, which RequestResources does not read yet", "controltower": "REST: its requests name their resources in the path, which RequestResources does not read yet", "cur": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "datasync": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "detective": "REST: its requests name their resources in the path, which RequestResources does not read yet", "dlm": "REST: its requests name their resources in the path, which RequestResources does not read yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ecs": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticache": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticbeanstalk": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources does not read yet", "elasticmapreduce": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "emr-serverless": "REST: its requests name their resources in the path, which RequestResources does not read yet", "es": "REST: its requests name their resources in the path, which RequestResources does not read yet", "execute-api": "REST: its requests name their resources in the path, which RequestResources does not read yet", "firehose": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "fis": "REST: its requests name their resources in the path, which RequestResources does not read yet", "globalaccelerator": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "glue": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "guardduty": "REST: its requests name their resources in the path, which RequestResources does not read yet", "identitystore": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "inspector2": "REST: its requests name their resources in the path, which RequestResources does not read yet", "iot": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "kafka": "REST: its requests name their resources in the path, which RequestResources does not read yet", "kinesisanalytics": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "lightsail": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "macie2": "REST: its requests name their resources in the path, which RequestResources does not read yet", "memorydb": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "mq": "REST: its requests name their resources in the path, which RequestResources does not read yet", "network-firewall": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "oam": "REST: its requests name their resources in the path, which RequestResources does not read yet", "organizations": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ram": "REST: its requests name their resources in the path, which RequestResources does not read yet", "rds": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rds-data": "REST: its requests name their resources in the path, which RequestResources does not read yet", "redshift": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "redshift-data": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "redshift-serverless": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rekognition": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "resource-explorer-2": "REST: its requests name their resources in the path, which RequestResources does not read yet", "route53": "REST: its requests name their resources in the path, which RequestResources does not read yet", "route53resolver": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rum": "REST: its requests name their resources in the path, which RequestResources does not read yet", "s3tables": "REST: its requests name their resources in the path, which RequestResources does not read yet", "s3vectors": "REST: its requests name their resources in the path, which RequestResources does not read yet", "sagemaker": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "securityhub": "REST: its requests name their resources in the path, which RequestResources does not read yet", "servicecatalog": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "servicediscovery": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "servicequotas": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ses": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "signin": "REST: its requests name their resources in the path, which RequestResources does not read yet", "sso": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "sso-oauth": "REST: its requests name their resources in the path, which RequestResources does not read yet", "swf": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "textract": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "timestream-influxdb": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "transcribe": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "transfer": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "translate": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "verifiedpermissions": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "wafv2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint"},
"otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudfront-keyvaluestore", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ec2-instance-connect", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "emr-containers", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "outposts", "panorama", "partnercentral", "payment-cryptography", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "quicksight", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "signer", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web", "xray"],
- "arnFormats": {"cognito-idp": {"userpool": "arn:${Partition}:cognito-idp:${Region}:${Account}:userpool/${UserPoolId}", "webacl": "arn:${Partition}:wafv2:${Region}:${Account}:${Scope}/webacl/${Name}/${Id}"}, "ecr": {"repository": "arn:${Partition}:ecr:${Region}:${Account}:repository/${RepositoryName}"}, "elasticloadbalancing": {"listener-rule/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener-rule/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/gwy": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/gwy/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "loadbalancer": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/${LoadBalancerName}", "loadbalancer/app/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/app/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/gwy/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/gwy/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/net/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/net/${LoadBalancerName}/${LoadBalancerId}", "targetgroup": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:targetgroup/${TargetGroupName}/${TargetGroupId}", "truststore": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:truststore/${TrustStoreName}/${TrustStoreId}"}, "states": {"activity": "arn:${Partition}:states:${Region}:${Account}:activity:${ActivityName}", "execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}:${ExecutionId}", "express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}:${ExecutionId}:${ExpressId}", "labelled execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}/${MapRunLabel}:${ExecutionId}", "labelled express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}/${MapRunLabel}:${ExecutionId}:${ExpressId}", "maprun": "arn:${Partition}:states:${Region}:${Account}:mapRun:${StateMachineName}/${MapRunLabel}:${MapRunId}", "statemachine": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}", "statemachinealias": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineAliasName}", "statemachineversion": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineVersionId}"}},
+ "arnFormats": {"cognito-idp": {"userpool": "arn:${Partition}:cognito-idp:${Region}:${Account}:userpool/${UserPoolId}", "webacl": "arn:${Partition}:wafv2:${Region}:${Account}:${Scope}/webacl/${Name}/${Id}"}, "ecr": {"repository": "arn:${Partition}:ecr:${Region}:${Account}:repository/${RepositoryName}"}, "elasticloadbalancing": {"listener-rule/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener-rule/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/gwy": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/gwy/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "loadbalancer": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/${LoadBalancerName}", "loadbalancer/app/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/app/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/gwy/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/gwy/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/net/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/net/${LoadBalancerName}/${LoadBalancerId}", "targetgroup": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:targetgroup/${TargetGroupName}/${TargetGroupId}", "truststore": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:truststore/${TrustStoreName}/${TrustStoreId}"}, "events": {"alias": "arn:${Partition}:kms:${Region}:${Account}:alias/${Alias}", "api-destination": "arn:${Partition}:events:${Region}:${Account}:api-destination/${ApiDestinationName}", "archive": "arn:${Partition}:events:${Region}:${Account}:archive/${ArchiveName}", "connection": "arn:${Partition}:events:${Region}:${Account}:connection/${ConnectionName}", "create-snapshot": "arn:${Partition}:events:${Region}:${Account}:target/create-snapshot", "endpoint": "arn:${Partition}:events:${Region}:${Account}:endpoint/${EndpointName}", "event-bus": "arn:${Partition}:events:${Region}:${Account}:event-bus/${EventBusName}", "event-busv2": "arn:${Partition}:events:${Region}:${Account}:event-busv2/${EventBusName}/${OpaqueId}", "event-source": "arn:${Partition}:events:${Region}::event-source/${EventSourceName}", "event-sourcev2": "arn:${Partition}:events:${Region}:${Account}:event-sourcev2/${SourceType}/${EventSourceName}/${OpaqueId}", "key": "arn:${Partition}:kms:${Region}:${Account}:key/${KeyId}", "reboot-instance": "arn:${Partition}:events:${Region}:${Account}:target/reboot-instance", "replay": "arn:${Partition}:events:${Region}:${Account}:replay/${ReplayName}", "rule-on-custom-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${EventBusName}/${RuleName}", "rule-on-default-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${RuleName}", "stop-instance": "arn:${Partition}:events:${Region}:${Account}:target/stop-instance", "subscriber": "arn:${Partition}:events:${Region}:${Account}:subscriber/${SubscriberName}/${OpaqueId}", "terminate-instance": "arn:${Partition}:events:${Region}:${Account}:target/terminate-instance"}, "states": {"activity": "arn:${Partition}:states:${Region}:${Account}:activity:${ActivityName}", "execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}:${ExecutionId}", "express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}:${ExecutionId}:${ExpressId}", "labelled execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}/${MapRunLabel}:${ExecutionId}", "labelled express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}/${MapRunLabel}:${ExecutionId}:${ExpressId}", "maprun": "arn:${Partition}:states:${Region}:${Account}:mapRun:${StateMachineName}/${MapRunLabel}:${MapRunId}", "statemachine": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}", "statemachinealias": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineAliasName}", "statemachineversion": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineVersionId}"}},
"unqualified": {"states": ["statemachine"]},
+ "mintedIds": {"events": ["api-destination", "connection"]},
"operations": {
"cognito-idp:AddCustomAttributes": {"action": "cognito-idp:AddCustomAttributes", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:AddUserPoolClientSecret": {"action": "cognito-idp:AddUserPoolClientSecret", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
@@ -50,8 +52,8 @@
"cognito-idp:CreateTerms": {"action": "cognito-idp:CreateTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:CreateUserImportJob": {"action": "cognito-idp:CreateUserImportJob", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "CloudWatchLogsRoleArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:CreateUserPool": {"action": "cognito-idp:CreateUserPool", "types": [], "resources": []},
- "cognito-idp:CreateUserPoolClient": {"action": "cognito-idp:CreateUserPoolClient", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
- "cognito-idp:CreateUserPoolDomain": {"action": "cognito-idp:CreateUserPoolDomain", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
+ "cognito-idp:CreateUserPoolClient": {"action": "cognito-idp:CreateUserPoolClient", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "AnalyticsConfiguration.ApplicationArn"}, {"types": ["userpool"], "arn": "AnalyticsConfiguration.RoleArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
+ "cognito-idp:CreateUserPoolDomain": {"action": "cognito-idp:CreateUserPoolDomain", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "CustomDomainConfig.CertificateArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:CreateUserPoolReplica": {"action": "cognito-idp:CreateUserPoolReplica", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:DeleteGroup": {"action": "cognito-idp:DeleteGroup", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:DeleteIdentityProvider": {"action": "cognito-idp:DeleteIdentityProvider", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
@@ -133,9 +135,9 @@
"cognito-idp:UpdateResourceServer": {"action": "cognito-idp:UpdateResourceServer", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:UpdateTerms": {"action": "cognito-idp:UpdateTerms", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:UpdateUserAttributes": {"action": "cognito-idp:UpdateUserAttributes", "types": [], "resources": []},
- "cognito-idp:UpdateUserPool": {"action": "cognito-idp:UpdateUserPool", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
- "cognito-idp:UpdateUserPoolClient": {"action": "cognito-idp:UpdateUserPoolClient", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
- "cognito-idp:UpdateUserPoolDomain": {"action": "cognito-idp:UpdateUserPoolDomain", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
+ "cognito-idp:UpdateUserPool": {"action": "cognito-idp:UpdateUserPool", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "EmailConfiguration.SourceArn"}, {"types": ["userpool"], "arn": "KeyConfiguration.KmsKeyArn"}, {"types": ["userpool"], "arn": "SmsConfiguration.SnsCallerArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
+ "cognito-idp:UpdateUserPoolClient": {"action": "cognito-idp:UpdateUserPoolClient", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "AnalyticsConfiguration.ApplicationArn"}, {"types": ["userpool"], "arn": "AnalyticsConfiguration.RoleArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
+ "cognito-idp:UpdateUserPoolDomain": {"action": "cognito-idp:UpdateUserPoolDomain", "types": ["userpool"], "resources": [{"types": ["userpool"], "arn": "CustomDomainConfig.CertificateArn"}, {"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:UpdateUserPoolReplica": {"action": "cognito-idp:UpdateUserPoolReplica", "types": ["userpool"], "resources": [{"type": "userpool", "fill": {"UserPoolId": "UserPoolId"}}]},
"cognito-idp:VerifySoftwareToken": {"action": "cognito-idp:VerifySoftwareToken", "types": [], "resources": []},
"cognito-idp:VerifyUserAttribute": {"action": "cognito-idp:VerifyUserAttribute", "types": [], "resources": []},
@@ -197,7 +199,7 @@
"ecr:UpdateRepositoryCreationTemplate": {"action": "ecr:UpdateRepositoryCreationTemplate", "types": [], "resources": []},
"ecr:UploadLayerPart": {"action": "ecr:UploadLayerPart", "types": ["repository"], "resources": [{"type": "repository", "fill": {"RepositoryName": "repositoryName"}, "account": "registryId"}]},
"ecr:ValidatePullThroughCacheRule": {"action": "ecr:ValidatePullThroughCacheRule", "types": [], "resources": []},
- "elasticloadbalancing:AddListenerCertificates": {"action": "elasticloadbalancing:AddListenerCertificates", "types": ["listener/app", "listener/net"], "resources": [{"types": ["listener/app", "listener/net"], "arn": "ListenerArn"}]},
+ "elasticloadbalancing:AddListenerCertificates": {"action": "elasticloadbalancing:AddListenerCertificates", "types": ["listener/app", "listener/net"], "resources": [{"types": ["listener/app", "listener/net"], "arn": "Certificates[].CertificateArn"}, {"types": ["listener/app", "listener/net"], "arn": "ListenerArn"}]},
"elasticloadbalancing:AddTags": {"action": "elasticloadbalancing:AddTags", "types": ["listener-rule/app", "listener-rule/net", "listener/app", "listener/gwy", "listener/net", "loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/", "targetgroup", "truststore"], "resources": [{"types": ["listener-rule/app", "listener-rule/net", "listener/app", "listener/gwy", "listener/net", "loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/", "targetgroup", "truststore"], "arn": "ResourceArns[]"}, {"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerNames[]"}}]},
"elasticloadbalancing:AddTrustStoreRevocations": {"action": "elasticloadbalancing:AddTrustStoreRevocations", "types": ["truststore"], "resources": [{"types": ["truststore"], "arn": "TrustStoreArn"}]},
"elasticloadbalancing:ApplySecurityGroupsToLoadBalancer": {"action": "elasticloadbalancing:ApplySecurityGroupsToLoadBalancer", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
@@ -205,11 +207,11 @@
"elasticloadbalancing:ConfigureHealthCheck": {"action": "elasticloadbalancing:ConfigureHealthCheck", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
"elasticloadbalancing:CreateAppCookieStickinessPolicy": {"action": "elasticloadbalancing:CreateAppCookieStickinessPolicy", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
"elasticloadbalancing:CreateLBCookieStickinessPolicy": {"action": "elasticloadbalancing:CreateLBCookieStickinessPolicy", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
- "elasticloadbalancing:CreateListener": {"action": "elasticloadbalancing:CreateListener", "types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "resources": [{"types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "LoadBalancerArn"}], "creates": [{"type": "listener/app", "parent": "loadbalancer/app/", "arn": "LoadBalancerArn"}, {"type": "listener/gwy", "parent": "loadbalancer/gwy/", "arn": "LoadBalancerArn"}, {"type": "listener/net", "parent": "loadbalancer/net/", "arn": "LoadBalancerArn"}]},
+ "elasticloadbalancing:CreateListener": {"action": "elasticloadbalancing:CreateListener", "types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "resources": [{"types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "Certificates[].CertificateArn"}, {"types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "DefaultActions[].TargetGroupArn"}, {"types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "LoadBalancerArn"}, {"types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "MutualAuthentication.TrustStoreArn"}], "creates": [{"type": "listener/app", "parent": "loadbalancer/app/", "arn": "LoadBalancerArn"}, {"type": "listener/gwy", "parent": "loadbalancer/gwy/", "arn": "LoadBalancerArn"}, {"type": "listener/net", "parent": "loadbalancer/net/", "arn": "LoadBalancerArn"}]},
"elasticloadbalancing:CreateLoadBalancer": {"action": "elasticloadbalancing:CreateLoadBalancer", "types": ["loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}, {"type": "loadbalancer/app/", "fill": {"LoadBalancerName": "Name"}, "when": {"Type": ["application", null]}}, {"type": "loadbalancer/gwy/", "fill": {"LoadBalancerName": "Name"}, "when": {"Type": ["gateway"]}}, {"type": "loadbalancer/net/", "fill": {"LoadBalancerName": "Name"}, "when": {"Type": ["network"]}}]},
"elasticloadbalancing:CreateLoadBalancerListeners": {"action": "elasticloadbalancing:CreateLoadBalancerListeners", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
"elasticloadbalancing:CreateLoadBalancerPolicy": {"action": "elasticloadbalancing:CreateLoadBalancerPolicy", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
- "elasticloadbalancing:CreateRule": {"action": "elasticloadbalancing:CreateRule", "types": ["listener/app", "listener/net"], "resources": [{"types": ["listener/app", "listener/net"], "arn": "ListenerArn"}], "creates": [{"type": "listener-rule/app", "parent": "listener/app", "arn": "ListenerArn"}, {"type": "listener-rule/net", "parent": "listener/net", "arn": "ListenerArn"}]},
+ "elasticloadbalancing:CreateRule": {"action": "elasticloadbalancing:CreateRule", "types": ["listener/app", "listener/net"], "resources": [{"types": ["listener/app", "listener/net"], "arn": "Actions[].TargetGroupArn"}, {"types": ["listener/app", "listener/net"], "arn": "ListenerArn"}], "creates": [{"type": "listener-rule/app", "parent": "listener/app", "arn": "ListenerArn"}, {"type": "listener-rule/net", "parent": "listener/net", "arn": "ListenerArn"}]},
"elasticloadbalancing:CreateTargetGroup": {"action": "elasticloadbalancing:CreateTargetGroup", "types": ["targetgroup"], "resources": [{"type": "targetgroup", "fill": {"TargetGroupName": "Name"}}]},
"elasticloadbalancing:CreateTrustStore": {"action": "elasticloadbalancing:CreateTrustStore", "types": ["truststore"], "resources": [{"type": "truststore", "fill": {"TrustStoreName": "Name"}}]},
"elasticloadbalancing:DeleteListener": {"action": "elasticloadbalancing:DeleteListener", "types": ["listener/app", "listener/gwy", "listener/net"], "resources": [{"types": ["listener/app", "listener/gwy", "listener/net"], "arn": "ListenerArn"}]},
@@ -249,28 +251,99 @@
"elasticloadbalancing:GetTrustStoreRevocationContent": {"action": "elasticloadbalancing:GetTrustStoreRevocationContent", "types": ["truststore"], "resources": [{"types": ["truststore"], "arn": "TrustStoreArn"}]},
"elasticloadbalancing:ModifyCapacityReservation": {"action": "elasticloadbalancing:ModifyCapacityReservation", "types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "resources": [{"types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "LoadBalancerArn"}]},
"elasticloadbalancing:ModifyIpPools": {"action": "elasticloadbalancing:ModifyIpPools", "types": ["loadbalancer/app/"], "resources": [{"types": ["loadbalancer/app/"], "arn": "LoadBalancerArn"}]},
- "elasticloadbalancing:ModifyListener": {"action": "elasticloadbalancing:ModifyListener", "types": ["listener/app", "listener/gwy", "listener/net"], "resources": [{"types": ["listener/app", "listener/gwy", "listener/net"], "arn": "ListenerArn"}]},
+ "elasticloadbalancing:ModifyListener": {"action": "elasticloadbalancing:ModifyListener", "types": ["listener/app", "listener/gwy", "listener/net"], "resources": [{"types": ["listener/app", "listener/gwy", "listener/net"], "arn": "Certificates[].CertificateArn"}, {"types": ["listener/app", "listener/gwy", "listener/net"], "arn": "DefaultActions[].TargetGroupArn"}, {"types": ["listener/app", "listener/gwy", "listener/net"], "arn": "ListenerArn"}, {"types": ["listener/app", "listener/gwy", "listener/net"], "arn": "MutualAuthentication.TrustStoreArn"}]},
"elasticloadbalancing:ModifyListenerAttributes": {"action": "elasticloadbalancing:ModifyListenerAttributes", "types": ["listener/app", "listener/gwy", "listener/net"], "resources": [{"types": ["listener/app", "listener/gwy", "listener/net"], "arn": "ListenerArn"}]},
"elasticloadbalancing:ModifyLoadBalancerAttributes": {"action": "elasticloadbalancing:ModifyLoadBalancerAttributes", "types": ["loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "resources": [{"types": ["loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "LoadBalancerArn"}, {"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
- "elasticloadbalancing:ModifyRule": {"action": "elasticloadbalancing:ModifyRule", "types": ["listener-rule/app", "listener-rule/net"], "resources": [{"types": ["listener-rule/app", "listener-rule/net"], "arn": "RuleArn"}]},
+ "elasticloadbalancing:ModifyRule": {"action": "elasticloadbalancing:ModifyRule", "types": ["listener-rule/app", "listener-rule/net"], "resources": [{"types": ["listener-rule/app", "listener-rule/net"], "arn": "Actions[].TargetGroupArn"}, {"types": ["listener-rule/app", "listener-rule/net"], "arn": "RuleArn"}]},
"elasticloadbalancing:ModifyTargetGroup": {"action": "elasticloadbalancing:ModifyTargetGroup", "types": ["targetgroup"], "resources": [{"types": ["targetgroup"], "arn": "TargetGroupArn"}]},
"elasticloadbalancing:ModifyTargetGroupAttributes": {"action": "elasticloadbalancing:ModifyTargetGroupAttributes", "types": ["targetgroup"], "resources": [{"types": ["targetgroup"], "arn": "TargetGroupArn"}]},
"elasticloadbalancing:ModifyTrustStore": {"action": "elasticloadbalancing:ModifyTrustStore", "types": ["truststore"], "resources": [{"types": ["truststore"], "arn": "TrustStoreArn"}]},
"elasticloadbalancing:RegisterInstancesWithLoadBalancer": {"action": "elasticloadbalancing:RegisterInstancesWithLoadBalancer", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
"elasticloadbalancing:RegisterTargets": {"action": "elasticloadbalancing:RegisterTargets", "types": ["targetgroup"], "resources": [{"types": ["targetgroup"], "arn": "TargetGroupArn"}]},
- "elasticloadbalancing:RemoveListenerCertificates": {"action": "elasticloadbalancing:RemoveListenerCertificates", "types": ["listener/app", "listener/net"], "resources": [{"types": ["listener/app", "listener/net"], "arn": "ListenerArn"}]},
+ "elasticloadbalancing:RemoveListenerCertificates": {"action": "elasticloadbalancing:RemoveListenerCertificates", "types": ["listener/app", "listener/net"], "resources": [{"types": ["listener/app", "listener/net"], "arn": "Certificates[].CertificateArn"}, {"types": ["listener/app", "listener/net"], "arn": "ListenerArn"}]},
"elasticloadbalancing:RemoveTags": {"action": "elasticloadbalancing:RemoveTags", "types": ["listener-rule/app", "listener-rule/net", "listener/app", "listener/gwy", "listener/net", "loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/", "targetgroup", "truststore"], "resources": [{"types": ["listener-rule/app", "listener-rule/net", "listener/app", "listener/gwy", "listener/net", "loadbalancer", "loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/", "targetgroup", "truststore"], "arn": "ResourceArns[]"}, {"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerNames[]"}}]},
"elasticloadbalancing:RemoveTrustStoreRevocations": {"action": "elasticloadbalancing:RemoveTrustStoreRevocations", "types": ["truststore"], "resources": [{"types": ["truststore"], "arn": "TrustStoreArn"}]},
"elasticloadbalancing:SetIpAddressType": {"action": "elasticloadbalancing:SetIpAddressType", "types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "resources": [{"types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "LoadBalancerArn"}]},
"elasticloadbalancing:SetLoadBalancerListenerSSLCertificate": {"action": "elasticloadbalancing:SetLoadBalancerListenerSSLCertificate", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
"elasticloadbalancing:SetLoadBalancerPoliciesForBackendServer": {"action": "elasticloadbalancing:SetLoadBalancerPoliciesForBackendServer", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
"elasticloadbalancing:SetLoadBalancerPoliciesOfListener": {"action": "elasticloadbalancing:SetLoadBalancerPoliciesOfListener", "types": ["loadbalancer"], "resources": [{"type": "loadbalancer", "fill": {"LoadBalancerName": "LoadBalancerName"}}]},
- "elasticloadbalancing:SetRulePriorities": {"action": "elasticloadbalancing:SetRulePriorities", "types": ["listener-rule/app", "listener-rule/net"], "resources": []},
+ "elasticloadbalancing:SetRulePriorities": {"action": "elasticloadbalancing:SetRulePriorities", "types": ["listener-rule/app", "listener-rule/net"], "resources": [{"types": ["listener-rule/app", "listener-rule/net"], "arn": "RulePriorities[].RuleArn"}]},
"elasticloadbalancing:SetSecurityGroups": {"action": "elasticloadbalancing:SetSecurityGroups", "types": ["loadbalancer/app/", "loadbalancer/net/"], "resources": [{"types": ["loadbalancer/app/", "loadbalancer/net/"], "arn": "LoadBalancerArn"}]},
"elasticloadbalancing:SetSubnets": {"action": "elasticloadbalancing:SetSubnets", "types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "resources": [{"types": ["loadbalancer/app/", "loadbalancer/gwy/", "loadbalancer/net/"], "arn": "LoadBalancerArn"}]},
+ "events:ActivateEventSource": {"action": "events:ActivateEventSource", "types": ["event-source"], "resources": [{"type": "event-source", "fill": {"EventSourceName": "Name"}}]},
+ "events:CancelReplay": {"action": "events:CancelReplay", "types": ["replay"], "resources": [{"type": "replay", "fill": {"ReplayName": "ReplayName"}}]},
+ "events:CreateApiDestination": {"action": "events:CreateApiDestination", "types": ["api-destination", "connection"], "resources": [{"types": ["api-destination", "connection"], "arn": "ConnectionArn"}, {"type": "api-destination", "fill": {"ApiDestinationName": "Name"}}]},
+ "events:CreateArchive": {"action": "events:CreateArchive", "types": ["alias", "archive", "event-bus", "key"], "resources": [{"types": ["alias", "archive", "event-bus", "key"], "arn": "EventSourceArn"}, {"type": "archive", "fill": {"ArchiveName": "ArchiveName"}}]},
+ "events:CreateConnection": {"action": "events:CreateConnection", "types": ["connection"], "resources": [{"type": "connection", "fill": {"ConnectionName": "Name"}}]},
+ "events:CreateEndpoint": {"action": "events:CreateEndpoint", "types": ["endpoint"], "resources": [{"types": ["endpoint"], "arn": "EventBuses[].EventBusArn"}, {"types": ["endpoint"], "arn": "RoleArn"}, {"type": "endpoint", "fill": {"EndpointName": "Name"}}]},
+ "events:CreateEventBus": {"action": "events:CreateEventBus", "types": ["event-bus", "event-busv2"], "resources": [{"types": ["event-bus", "event-busv2"], "arn": "DeadLetterConfig.Arn"}, {"type": "event-bus", "fill": {"EventBusName": "Name"}}]},
+ "events:CreateEventSource": {"action": "events:CreateEventSource", "types": ["event-busv2", "event-sourcev2"], "resources": []},
+ "events:CreatePartnerEventSource": {"action": "events:CreatePartnerEventSource", "types": ["event-source"], "resources": [{"type": "event-source", "fill": {"EventSourceName": "Name"}}]},
+ "events:CreateSubscriber": {"action": "events:CreateSubscriber", "types": ["event-busv2", "subscriber"], "resources": [{"type": "subscriber", "fill": {}}]},
+ "events:DeactivateEventSource": {"action": "events:DeactivateEventSource", "types": ["event-source"], "resources": [{"type": "event-source", "fill": {"EventSourceName": "Name"}}]},
+ "events:DeauthorizeConnection": {"action": "events:DeauthorizeConnection", "types": ["connection"], "resources": [{"type": "connection", "fill": {"ConnectionName": "Name"}}]},
+ "events:DeleteApiDestination": {"action": "events:DeleteApiDestination", "types": ["api-destination"], "resources": [{"type": "api-destination", "fill": {"ApiDestinationName": "Name"}}]},
+ "events:DeleteArchive": {"action": "events:DeleteArchive", "types": ["archive"], "resources": [{"type": "archive", "fill": {"ArchiveName": "ArchiveName"}}]},
+ "events:DeleteConnection": {"action": "events:DeleteConnection", "types": ["connection"], "resources": [{"type": "connection", "fill": {"ConnectionName": "Name"}}]},
+ "events:DeleteEndpoint": {"action": "events:DeleteEndpoint", "types": ["endpoint"], "resources": [{"type": "endpoint", "fill": {"EndpointName": "Name"}}]},
+ "events:DeleteEventBus": {"action": "events:DeleteEventBus", "types": ["event-bus", "event-busv2"], "resources": [{"type": "event-bus", "fill": {"EventBusName": "Name"}}]},
+ "events:DeleteEventSource": {"action": "events:DeleteEventSource", "types": ["event-sourcev2"], "resources": []},
+ "events:DeletePartnerEventSource": {"action": "events:DeletePartnerEventSource", "types": ["event-source"], "resources": [{"type": "event-source", "fill": {"EventSourceName": "Name"}}]},
+ "events:DeleteResourcePolicy": {"action": "events:DeleteResourcePolicy", "types": ["event-busv2"], "resources": []},
+ "events:DeleteRule": {"action": "events:DeleteRule", "types": ["rule-on-custom-event-bus", "rule-on-default-event-bus"], "resources": [{"type": "rule-on-default-event-bus", "fill": {"RuleName": "Name"}, "when": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}, {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Name"}, "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]},
+ "events:DeleteSubscriber": {"action": "events:DeleteSubscriber", "types": ["subscriber"], "resources": []},
+ "events:DescribeApiDestination": {"action": "events:DescribeApiDestination", "types": ["api-destination", "connection"], "resources": [{"type": "api-destination", "fill": {"ApiDestinationName": "Name"}}]},
+ "events:DescribeArchive": {"action": "events:DescribeArchive", "types": ["archive"], "resources": [{"type": "archive", "fill": {"ArchiveName": "ArchiveName"}}]},
+ "events:DescribeConnection": {"action": "events:DescribeConnection", "types": ["connection"], "resources": [{"type": "connection", "fill": {"ConnectionName": "Name"}}]},
+ "events:DescribeEndpoint": {"action": "events:DescribeEndpoint", "types": ["endpoint"], "resources": [{"type": "endpoint", "fill": {"EndpointName": "Name"}}]},
+ "events:DescribeEventBus": {"action": "events:DescribeEventBus", "types": ["event-bus", "event-busv2"], "resources": [{"type": "event-bus", "fill": {"EventBusName": "Name"}, "absent": {"Name": "default"}, "arnOf": {"Name": "event-bus"}}]},
+ "events:DescribeEventSource": {"action": "events:DescribeEventSource", "types": ["event-source", "event-sourcev2"], "resources": [{"type": "event-source", "fill": {"EventSourceName": "Name"}}]},
+ "events:DescribePartnerEventSource": {"action": "events:DescribePartnerEventSource", "types": ["event-source"], "resources": [{"type": "event-source", "fill": {"EventSourceName": "Name"}}]},
+ "events:DescribeReplay": {"action": "events:DescribeReplay", "types": ["replay"], "resources": [{"type": "replay", "fill": {"ReplayName": "ReplayName"}}]},
+ "events:DescribeRule": {"action": "events:DescribeRule", "types": ["rule-on-custom-event-bus", "rule-on-default-event-bus"], "resources": [{"type": "rule-on-default-event-bus", "fill": {"RuleName": "Name"}, "when": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}, {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Name"}, "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]},
+ "events:DescribeSubscriber": {"action": "events:DescribeSubscriber", "types": ["subscriber"], "resources": []},
+ "events:DisableRule": {"action": "events:DisableRule", "types": ["rule-on-custom-event-bus", "rule-on-default-event-bus"], "resources": [{"type": "rule-on-default-event-bus", "fill": {"RuleName": "Name"}, "when": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}, {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Name"}, "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]},
+ "events:EnableRule": {"action": "events:EnableRule", "types": ["rule-on-custom-event-bus", "rule-on-default-event-bus"], "resources": [{"type": "rule-on-default-event-bus", "fill": {"RuleName": "Name"}, "when": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}, {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Name"}, "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]},
+ "events:GetResourcePolicy": {"action": "events:GetResourcePolicy", "types": ["event-busv2"], "resources": []},
+ "events:ListApiDestinations": {"action": "events:ListApiDestinations", "types": [], "resources": []},
+ "events:ListArchives": {"action": "events:ListArchives", "types": [], "resources": []},
+ "events:ListConnections": {"action": "events:ListConnections", "types": [], "resources": []},
+ "events:ListEndpoints": {"action": "events:ListEndpoints", "types": [], "resources": []},
+ "events:ListEventBuses": {"action": "events:ListEventBuses", "types": [], "resources": []},
+ "events:ListEventSources": {"action": "events:ListEventSources", "types": [], "resources": []},
+ "events:ListPartnerEventSourceAccounts": {"action": "events:ListPartnerEventSourceAccounts", "types": ["event-source"], "resources": [{"type": "event-source", "fill": {"EventSourceName": "EventSourceName"}}]},
+ "events:ListPartnerEventSources": {"action": "events:ListPartnerEventSources", "types": [], "resources": []},
+ "events:ListReplays": {"action": "events:ListReplays", "types": [], "resources": []},
+ "events:ListResourcePolicies": {"action": "events:ListResourcePolicies", "types": ["event-busv2"], "resources": []},
+ "events:ListRuleNamesByTarget": {"action": "events:ListRuleNamesByTarget", "types": [], "resources": []},
+ "events:ListRules": {"action": "events:ListRules", "types": [], "resources": []},
+ "events:ListSubscribers": {"action": "events:ListSubscribers", "types": [], "resources": []},
+ "events:ListTagsForResource": {"action": "events:ListTagsForResource", "types": ["event-bus", "event-busv2", "event-sourcev2", "rule-on-custom-event-bus", "rule-on-default-event-bus", "subscriber"], "resources": [{"types": ["event-bus", "event-busv2", "event-sourcev2", "rule-on-custom-event-bus", "rule-on-default-event-bus", "subscriber"], "arn": "ResourceARN"}]},
+ "events:ListTargetsByRule": {"action": "events:ListTargetsByRule", "types": ["rule-on-custom-event-bus", "rule-on-default-event-bus"], "resources": [{"type": "rule-on-default-event-bus", "fill": {"RuleName": "Rule"}, "when": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}, {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Rule"}, "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]},
+ "events:PutEvents": {"action": "events:PutEvents", "types": ["event-bus", "event-busv2"], "resources": []},
+ "events:PutPartnerEvents": {"action": "events:PutPartnerEvents", "types": [], "resources": []},
+ "events:PutPermission": {"action": "events:PutPermission", "types": [], "resources": []},
+ "events:PutRawEvents": {"action": "events:PutRawEvents", "types": ["event-busv2"], "resources": []},
+ "events:PutResourcePolicy": {"action": "events:PutResourcePolicy", "types": ["event-busv2"], "resources": []},
+ "events:PutRule": {"action": "events:PutRule", "types": ["rule-on-custom-event-bus", "rule-on-default-event-bus"], "resources": [{"type": "rule-on-default-event-bus", "fill": {"RuleName": "Name"}, "when": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}, {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Name"}, "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]},
+ "events:PutTargets": {"action": "events:PutTargets", "types": ["rule-on-custom-event-bus", "rule-on-default-event-bus"], "resources": [{"type": "rule-on-default-event-bus", "fill": {"RuleName": "Rule"}, "when": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}, {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Rule"}, "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]},
+ "events:RemovePermission": {"action": "events:RemovePermission", "types": [], "resources": []},
+ "events:RemoveTargets": {"action": "events:RemoveTargets", "types": ["rule-on-custom-event-bus", "rule-on-default-event-bus"], "resources": [{"type": "rule-on-default-event-bus", "fill": {"RuleName": "Rule"}, "when": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}, {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Rule"}, "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]},
+ "events:RevokeResource": {"action": "events:RevokeResource", "types": ["event-busv2"], "resources": []},
+ "events:StartReplay": {"action": "events:StartReplay", "types": ["archive", "event-bus", "replay"], "resources": [{"types": ["archive", "event-bus", "replay"], "arn": "Destination.Arn"}, {"types": ["archive", "event-bus", "replay"], "arn": "Destination.FilterArns[]"}, {"types": ["archive", "event-bus", "replay"], "arn": "EventSourceArn"}, {"type": "replay", "fill": {"ReplayName": "ReplayName"}}]},
+ "events:TagResource": {"action": "events:TagResource", "types": ["event-bus", "event-busv2", "event-sourcev2", "rule-on-custom-event-bus", "rule-on-default-event-bus", "subscriber"], "resources": [{"types": ["event-bus", "event-busv2", "event-sourcev2", "rule-on-custom-event-bus", "rule-on-default-event-bus", "subscriber"], "arn": "ResourceARN"}]},
+ "events:TestEventPattern": {"action": "events:TestEventPattern", "types": [], "resources": []},
+ "events:UntagResource": {"action": "events:UntagResource", "types": ["event-bus", "event-busv2", "event-sourcev2", "rule-on-custom-event-bus", "rule-on-default-event-bus", "subscriber"], "resources": [{"types": ["event-bus", "event-busv2", "event-sourcev2", "rule-on-custom-event-bus", "rule-on-default-event-bus", "subscriber"], "arn": "ResourceARN"}]},
+ "events:UpdateApiDestination": {"action": "events:UpdateApiDestination", "types": ["api-destination"], "resources": [{"types": ["api-destination"], "arn": "ConnectionArn"}, {"type": "api-destination", "fill": {"ApiDestinationName": "Name"}}]},
+ "events:UpdateArchive": {"action": "events:UpdateArchive", "types": ["alias", "archive", "key"], "resources": [{"type": "archive", "fill": {"ArchiveName": "ArchiveName"}}]},
+ "events:UpdateConnection": {"action": "events:UpdateConnection", "types": ["connection"], "resources": [{"type": "connection", "fill": {"ConnectionName": "Name"}}]},
+ "events:UpdateEndpoint": {"action": "events:UpdateEndpoint", "types": ["endpoint"], "resources": [{"types": ["endpoint"], "arn": "EventBuses[].EventBusArn"}, {"types": ["endpoint"], "arn": "RoleArn"}, {"type": "endpoint", "fill": {"EndpointName": "Name"}}]},
+ "events:UpdateEventBus": {"action": "events:UpdateEventBus", "types": ["event-bus", "event-busv2"], "resources": [{"types": ["event-bus", "event-busv2"], "arn": "DeadLetterConfig.Arn"}, {"type": "event-bus", "fill": {"EventBusName": "Name"}}]},
+ "events:UpdateEventSource": {"action": "events:UpdateEventSource", "types": ["event-busv2", "event-sourcev2"], "resources": []},
+ "events:UpdateSubscriber": {"action": "events:UpdateSubscriber", "types": ["event-busv2", "subscriber"], "resources": []},
"states:CreateActivity": {"action": "states:CreateActivity", "types": ["activity"], "resources": [{"type": "activity", "fill": {"ActivityName": "name"}}]},
"states:CreateStateMachine": {"action": "states:CreateStateMachine", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "roleArn"}, {"type": "statemachine", "fill": {"StateMachineName": "name"}}]},
- "states:CreateStateMachineAlias": {"action": "states:CreateStateMachineAlias", "types": ["statemachine"], "resources": []},
+ "states:CreateStateMachineAlias": {"action": "states:CreateStateMachineAlias", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "routingConfiguration[].stateMachineVersionArn"}]},
"states:DeleteActivity": {"action": "states:DeleteActivity", "types": ["activity"], "resources": [{"types": ["activity"], "arn": "activityArn"}]},
"states:DeleteStateMachine": {"action": "states:DeleteStateMachine", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "stateMachineArn"}]},
"states:DeleteStateMachineAlias": {"action": "states:DeleteStateMachineAlias", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "stateMachineAliasArn"}]},
@@ -303,7 +376,7 @@
"states:UntagResource": {"action": "states:UntagResource", "types": ["activity", "statemachine"], "resources": [{"types": ["activity", "statemachine"], "arn": "resourceArn"}]},
"states:UpdateMapRun": {"action": "states:UpdateMapRun", "types": ["maprun"], "resources": [{"types": ["maprun"], "arn": "mapRunArn"}]},
"states:UpdateStateMachine": {"action": "states:UpdateStateMachine", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "roleArn"}, {"types": ["statemachine"], "arn": "stateMachineArn"}]},
- "states:UpdateStateMachineAlias": {"action": "states:UpdateStateMachineAlias", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "stateMachineAliasArn"}]},
+ "states:UpdateStateMachineAlias": {"action": "states:UpdateStateMachineAlias", "types": ["statemachine"], "resources": [{"types": ["statemachine"], "arn": "routingConfiguration[].stateMachineVersionArn"}, {"types": ["statemachine"], "arn": "stateMachineAliasArn"}]},
"states:ValidateStateMachineDefinition": {"action": "states:ValidateStateMachineDefinition", "types": [], "resources": []}
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/RequestResourceMembersTest.java b/src/test/java/io/github/hectorvent/floci/core/common/RequestResourceMembersTest.java
index ec81a143ca..9d694e369d 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/RequestResourceMembersTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/RequestResourceMembersTest.java
@@ -71,6 +71,14 @@ class RequestResourceMembersTest {
assertFalse(RequestResourceMembers.table().formats().get("states").get("execution").unqualified());
}
+ @Test
+ void connectionsAndApiDestinationsAreOfTypesWhoseServiceMintsAnIdAfterTheirName() {
+ Map<String, ArnFormat> events = RequestResourceMembers.table().formats().get("events");
+ assertTrue(events.get("connection").minted());
+ assertTrue(events.get("api-destination").minted());
+ assertFalse(events.get("event-bus").minted());
+ }
+
@Test
void aMalformedTableFailsToLoad() {
assertThrows(IllegalStateException.class, () -> parse("{\"operations\":{}}"));
@@ -81,7 +89,7 @@ class RequestResourceMembersTest {
String formats = "\"arnFormats\":{\"a\":{\"thing\":\"arn:${Partition}:a:${Region}:${Account}:thing/${ThingName}\"}}";
assertThrows(IllegalStateException.class, () -> parse(document(formats, "{\"types\":[\"other\"],\"arn\":\"Arn\"}")));
assertThrows(IllegalStateException.class, () -> parse(document(formats, "{\"type\":\"thing\",\"fill\":{\"Other\":\"Name\"}}")));
- assertThrows(IllegalStateException.class, () -> parse(document(formats, "{\"types\":[\"thing\"],\"arn\":\"a.b\"}")));
+ assertThrows(IllegalStateException.class, () -> parse(document(formats, "{\"types\":[\"thing\"],\"arn\":\"a.b.c\"}")));
assertThrows(IllegalStateException.class, () -> parse(
"{\"namespaces\":{\"a\":[]},\"arnFormats\":{\"a\":{\"thing\":\"*\"}},\"operations\":{\"a:Op\":{\"resources\":[]}}}"));
// A type made under a parent whose format it does not extend by one id.
@@ -92,6 +100,13 @@ class RequestResourceMembersTest {
+ "{\"resources\":[],\"creates\":[{\"type\":\"part\",\"parent\":\"thing\",\"arn\":\"ThingArn\"}]}}}"),
part);
}
+ // A member past one structure, or a structure's member filling a variable.
+ assertThrows(IllegalStateException.class, () -> parse(document(formats, "{\"types\":[\"thing\"],\"arn\":\"A[].B.ThingArn\"}")));
+ assertThrows(IllegalStateException.class, () -> parse(document(formats,
+ "{\"type\":\"thing\",\"fill\":{\"ThingName\":\"A[].Name\"}}")));
+ assertEquals(List.of(new Resource(List.of("thing"), new Member("A", true, new Member("ThingArns", true)), Map.of(),
+ Map.of(), Map.of(), Map.of(), Map.of(), null, null)), parseUnchecked(document(formats, "{\"types\":[\"thing\"],\"arn\":\"A[].ThingArns[]\"}"))
+ .operations().get("a:Op"));
// An ARN read before more than one character.
assertThrows(IllegalStateException.class, () -> parse(document(formats,
"{\"types\":[\"thing\"],\"arn\":\"ThingArn\",\"before\":\"##\"}")));
@@ -106,8 +121,30 @@ class RequestResourceMembersTest {
+ ",\"unqualified\":{\"a\":[\"other\"]},\"operations\":{\"a:Op\":{\"resources\":[]}}}"));
assertThrows(IllegalStateException.class, () -> parse("{\"namespaces\":{\"a\":[]}," + formats
+ ",\"unqualified\":{\"a\":\"thing\"},\"operations\":{\"a:Op\":{\"resources\":[]}}}"));
+ // A type given a minted id that has no format, whose format does not end in its one variable, or not a list.
+ String parts = "\"arnFormats\":{\"a\":{\"thing\":\"arn:${Partition}:a:${Region}:${Account}:thing/${ThingName}\","
+ + "\"part\":\"arn:${Partition}:a:${Region}:${Account}:part/${ThingName}/${PartId}\"}}";
+ for (String bad : List.of("{\"a\":[\"other\"]}", "{\"a\":[\"part\"]}", "{\"a\":\"thing\"}")) {
+ assertThrows(IllegalStateException.class, () -> parse("{\"namespaces\":{\"a\":[]}," + parts
+ + ",\"mintedIds\":" + bad + ",\"operations\":{\"a:Op\":{\"resources\":[]}}}"), bad);
+ }
+ assertTrue(parseUnchecked("{\"namespaces\":{\"a\":[]}," + parts + ",\"mintedIds\":{\"a\":[\"thing\"]},"
+ + "\"operations\":{\"a:Op\":{\"resources\":[]}}}").formats().get("a").get("thing").minted());
+ // A member read when absent as no value, or as an ARN of a type with no format or of more than one variable.
+ for (String bad : List.of("\"absent\":{\"Bus\":\"\"}", "\"absent\":{\"Bus[]\":\"default\"}",
+ "\"arnOf\":{\"Bus\":\"other\"}", "\"arnOf\":{\"Bus\":\"part\"}", "\"unless\":{\"Bus\":[]}")) {
+ assertThrows(IllegalStateException.class, () -> parse(document("\"arnFormats\":{\"a\":{"
+ + "\"thing\":\"arn:${Partition}:a:${Region}:${Account}:thing/${ThingName}\","
+ + "\"part\":\"arn:${Partition}:a:${Region}:${Account}:part/${ThingName}/${PartId}\"}}",
+ "{\"type\":\"thing\",\"fill\":{\"ThingName\":\"Name\"}," + bad + "}")), bad);
+ }
+ assertEquals(List.of(new Resource(List.of("thing"), null, Map.of("ThingName", new Member("Name", false)),
+ Map.of(), Map.of("Bus", List.of("default")), Map.of("Bus", "default"), Map.of("Bus", "thing"), null, null)),
+ parseUnchecked(document(formats, "{\"type\":\"thing\",\"fill\":{\"ThingName\":\"Name\"},"
+ + "\"unless\":{\"Bus\":[\"default\"]},\"absent\":{\"Bus\":\"default\"},"
+ + "\"arnOf\":{\"Bus\":\"thing\"}}")).operations().get("a:Op"));
assertEquals(List.of(new Resource(List.of("thing"), null, Map.of("ThingName", new Member("Names", true)), Map.of(),
- new Member("registryId", false), null)),
+ Map.of(), Map.of(), Map.of(), new Member("registryId", false), null)),
parseUnchecked(document(formats, "{\"type\":\"thing\",\"fill\":{\"ThingName\":\"Names[]\"},"
+ "\"account\":\"registryId\"}")).operations().get("a:Op"));
}
@@ -126,7 +163,8 @@ class RequestResourceMembersTest {
ArnFormat format = table.formats().get(namespace).get(resource.types().getFirst());
String arn = example(format.format());
String account = resource.account() != null ? "111122223333" : "000000000000";
- String expected = resource.arn() != null ? arn : expected(format.format(), resource, account);
+ String expected = resource.arn() != null ? arn
+ : expected(format.format(), resource, account) + (format.minted() ? "/*" : "");
ObjectNode body = MAPPER.createObjectNode();
StringBuilder form = new StringBuilder("Action=" + name);
Map<Member, String> values = resource.arn() != null ? Map.of(resource.arn(), arn)
@@ -141,13 +179,8 @@ class RequestResourceMembersTest {
}
});
given.forEach((member, value) -> {
- if (member.list()) {
- body.putArray(member.name()).add(value);
- form.append('&').append(member.name()).append(".member.1=").append(encoded(value));
- } else {
- body.put(member.name(), value);
- form.append('&').append(member.name()).append('=').append(encoded(value));
- }
+ put(body, member, value);
+ form.append('&').append(parameter(member)).append('=').append(encoded(value));
});
assertEquals(List.of(expected), RequestResources.of(operation.getKey(), json(body.toString()),
"aws", "us-east-1", "000000000000"), body.toString());
@@ -182,6 +215,25 @@ class RequestResourceMembersTest {
})));
}
+ /** The value at the member's path in a body: in its list's first element, and in its field's structure. */
+ private static void put(ObjectNode body, Member member, String value) {
+ if (member.field() == null) {
+ if (member.list()) {
+ body.putArray(member.name()).add(value);
+ } else {
+ body.put(member.name(), value);
+ }
+ } else {
+ put(member.list() ? body.putArray(member.name()).addObject() : body.putObject(member.name()), member.field(), value);
+ }
+ }
+
+ /** The form parameter of the member's path, its lists' first elements. */
+ private static String parameter(Member member) {
+ String name = member.name() + (member.list() ? ".member.1" : "");
+ return member.field() == null ? name : name + "." + parameter(member.field());
+ }
+
/** An ARN of the format in the test's partition, Region and account, each other variable {@code x}. */
private static String example(String format) {
return format.replace("${Partition}", "aws").replace("${Region}", "us-east-1")
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/RequestResourcesTest.java b/src/test/java/io/github/hectorvent/floci/core/common/RequestResourcesTest.java
index eacbb963bb..d93e27d8a9 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/RequestResourcesTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/RequestResourcesTest.java
@@ -7,6 +7,7 @@ import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
+import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
@@ -215,6 +216,114 @@ class RequestResourcesTest {
assertEquals(List.of(execution), of("states:DescribeExecution", json("{\"executionArn\":\"" + execution + "\"}")));
}
+ /**
+ * An ARN inside a structure, or inside each of a list's structures, names its resource as a top-level one does:
+ * {@code SetRulePriorities} acts on the rules its priorities name, read to the first element without one, as
+ * its handler loops, and an alias acts on the state machine its versions are of.
+ */
+ @Test
+ void anArnInsideAStructureNamesItsResource() {
+ String prefix = "arn:aws:elasticloadbalancing:us-east-1:000000000000:listener-rule/app/web/abc/def/";
+ assertEquals(List.of(prefix + "1", prefix + "2"), of("elasticloadbalancing:SetRulePriorities", form(
+ "Action=SetRulePriorities&RulePriorities.member.1.RuleArn=" + prefix + "1&RulePriorities.member.1.Priority=5"
+ + "&RulePriorities.member.2.RuleArn=" + prefix + "2&RulePriorities.member.2.Priority=6"
+ + "&RulePriorities.member.3.Priority=7&RulePriorities.member.4.RuleArn=" + prefix + "4")));
+ assertEquals(List.of(prefix + "1"), of("elasticloadbalancing:SetRulePriorities",
+ json("{\"RulePriorities\":[{\"RuleArn\":\"" + prefix + "1\"},\"" + prefix + "2\",{\"Priority\":1}]}")));
+ assertEquals(List.of(MACHINE), of("states:CreateStateMachineAlias", json("{\"name\":\"PROD\","
+ + "\"routingConfiguration\":[{\"stateMachineVersionArn\":\"" + MACHINE + ":1\",\"weight\":90},"
+ + "{\"stateMachineVersionArn\":\"" + MACHINE + ":2\",\"weight\":10}]}")));
+ assertEquals(List.of(MACHINE), of("states:UpdateStateMachineAlias", json("{\"stateMachineAliasArn\":\""
+ + MACHINE + ":PROD\",\"routingConfiguration\":[{\"stateMachineVersionArn\":\"" + MACHINE + ":2\"}]}")));
+ // An ARN there of a type the action does not act on is not checked: a rule's target group.
+ String listener = "arn:aws:elasticloadbalancing:us-east-1:000000000000:listener/app/web/abc/def";
+ assertEquals(List.of(listener), of("elasticloadbalancing:CreateRule", form("Action=CreateRule&ListenerArn="
+ + listener + "&Actions.member.1.Type=forward&Actions.member.1.TargetGroupArn="
+ + "arn:aws:elasticloadbalancing:us-east-1:000000000000:targetgroup/web/1")));
+ }
+
+ /**
+ * An EventBridge rule is on the event bus its request names, by name or ARN, or on the default one when it names
+ * none, whose rules have no bus in their ARN; a bus of another account names that account's rule, as given and
+ * as the caller's own, which Floci acts on.
+ */
+ @Test
+ void aRuleIsOnTheEventBusItsRequestNames() {
+ String events = "arn:aws:events:us-east-1:000000000000:";
+ assertEquals(List.of(events + "rule/r"), of("events:DescribeRule", json("{\"Name\":\"r\"}")));
+ assertEquals(List.of(events + "rule/r"), of("events:DescribeRule",
+ json("{\"Name\":\"r\",\"EventBusName\":\"default\"}")));
+ assertEquals(List.of(events + "rule/orders/r"), of("events:DescribeRule",
+ json("{\"Name\":\"r\",\"EventBusName\":\"orders\"}")));
+ assertEquals(List.of(events + "rule/orders/r"), of("events:DescribeRule",
+ json("{\"Name\":\"r\",\"EventBusName\":\"" + events + "event-bus/orders\"}")));
+ assertEquals(List.of(events + "rule/r"), of("events:DescribeRule",
+ json("{\"Name\":\"r\",\"EventBusName\":\"" + events + "event-bus/default\"}")));
+ assertEquals(List.of("arn:aws:events:eu-west-1:111122223333:rule/orders/r",
+ "arn:aws:events:us-east-1:111122223333:rule/orders/r", "arn:aws:events:eu-west-1:000000000000:rule/orders/r",
+ events + "rule/orders/r"), of("events:DescribeRule", json("{\"Name\":\"r\",\"EventBusName\":"
+ + "\"arn:aws:events:eu-west-1:111122223333:event-bus/orders\"}")));
+ // A target's rule is named by Rule.
+ assertEquals(List.of(events + "rule/orders/r"), of("events:PutTargets", json("{\"Rule\":\"r\","
+ + "\"EventBusName\":\"orders\",\"Targets\":[{\"Id\":\"1\",\"Arn\":\"arn:aws:sqs:us-east-1:000000000000:q\"}]}")));
+ // A request naming no event bus describes the default one.
+ assertEquals(List.of(events + "event-bus/default"), of("events:DescribeEventBus", json("{}")));
+ assertEquals(List.of(events + "event-bus/orders"), of("events:DescribeEventBus", json("{\"Name\":\"orders\"}")));
+ assertEquals(List.of(events + "event-bus/orders"), of("events:DescribeEventBus",
+ json("{\"Name\":\"" + events + "event-bus/orders\"}")));
+ }
+
+ /**
+ * A rule on another account's default event bus is that account's, checked as the caller's too, and a bus ARN
+ * leaving its account and Region empty, or a null bus, names the caller's, which the handler acts on.
+ */
+ @Test
+ void aRuleIsOnTheEventBusItsHandlerActsOn() {
+ String events = "arn:aws:events:us-east-1:000000000000:";
+ assertEquals(List.of("arn:aws:events:us-east-1:111122223333:rule/r", events + "rule/r"),
+ of("events:DescribeRule", json("{\"Name\":\"r\",\"EventBusName\":"
+ + "\"arn:aws:events:us-east-1:111122223333:event-bus/default\"}")));
+ assertEquals(List.of(events + "rule/orders/r"), of("events:DescribeRule",
+ json("{\"Name\":\"r\",\"EventBusName\":\"arn:aws:events:::event-bus/orders\"}")));
+ assertEquals(List.of(events + "rule/r"), of("events:DescribeRule",
+ json("{\"Name\":\"r\",\"EventBusName\":null}")));
+ assertEquals(List.of(events + "event-bus/orders"), of("events:DescribeEventBus",
+ json("{\"Name\":\"arn:aws:events:::event-bus/orders\"}")));
+ assertEquals(List.of(events + "event-bus/default"), of("events:DescribeEventBus", json("{\"Name\":null}")));
+ }
+
+ /**
+ * A connection or an API destination, whose ARN EventBridge follows with an id it mints after the name, is the
+ * one stored under the name the request gives, and has that id open when none is or nothing looks it up.
+ */
+ @Test
+ void aResourceWhoseIdItsServiceMintsIsTheOneStoredUnderItsName() {
+ String events = "arn:aws:events:us-east-1:000000000000:";
+ StoredResourceArns stored = new StoredResourceArns() {
+ @Override
+ public String namespace() {
+ return "events";
+ }
+
+ @Override
+ public Optional<String> find(String type, String name, String region) {
+ return "web".equals(name) && "us-east-1".equals(region) ? Optional.of(events + type + "/web/1234")
+ : Optional.empty();
+ }
+ };
+ assertEquals(List.of(events + "connection/web/1234"), RequestResources.of("events:DescribeConnection",
+ json("{\"Name\":\"web\"}"), "aws", "us-east-1", "000000000000", stored));
+ assertEquals(List.of(events + "api-destination/web/1234"), RequestResources.of(
+ "events:DescribeApiDestination", json("{\"Name\":\"web\"}"), "aws", "us-east-1", "000000000000", stored));
+ assertEquals(List.of(events + "connection/other/*"), RequestResources.of("events:DescribeConnection",
+ json("{\"Name\":\"other\"}"), "aws", "us-east-1", "000000000000", stored));
+ assertEquals(List.of(events + "connection/web/*"), of("events:DescribeConnection", json("{\"Name\":\"web\"}")));
+ // A create names the connection it uses by its ARN, the id given, and has its own id open.
+ assertEquals(List.of(events + "connection/web/1234", events + "api-destination/new/*"), RequestResources.of(
+ "events:CreateApiDestination", json("{\"Name\":\"new\",\"ConnectionArn\":\"" + events
+ + "connection/web/1234\"}"), "aws", "us-east-1", "000000000000", stored));
+ }
+
/** A request value is a name, so a {@code ${...}} in it is kept, not read as a variable of the format. */
@Test
void aValueIsTakenLiterally() {
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamRequestResourceEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamRequestResourceEnforcementIntegrationTest.java
index 61a1a9b473..2efd9a6e67 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/IamRequestResourceEnforcementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamRequestResourceEnforcementIntegrationTest.java
@@ -40,6 +40,7 @@ class IamRequestResourceEnforcementIntegrationTest {
private static final String ACCOUNT = "000000000000";
private static final String REGION = "us-east-1";
private static final String ELB = "arn:aws:elasticloadbalancing:" + REGION + ":" + ACCOUNT + ":";
+ private static final String EVENTS = "arn:aws:events:" + REGION + ":" + ACCOUNT + ":";
/** The AWS Load Balancer Controller's create, tag-on-create and listener statements (its policy v2.14.0). */
private static final String CONTROLLER_CREATE = "{\"Effect\":\"Allow\",\"Action\":[\"elasticloadbalancing:CreateLoadBalancer\","
+ "\"elasticloadbalancing:CreateTargetGroup\"],\"Resource\":\"*\","
@@ -225,13 +226,9 @@ class IamRequestResourceEnforcementIntegrationTest {
@Test
void aVersionOrAnAliasIsCheckedOnItsStateMachine() {
String arn = createStateMachine("res-alias-" + suffix());
- String version = admin("states").header("X-Amz-Target", "AWSStepFunctions.PublishStateMachineVersion")
- .contentType("application/x-amz-json-1.0").body("{\"stateMachineArn\":\"" + arn + "\"}")
- .post("/").then().statusCode(200).extract().path("stateMachineVersionArn");
- String alias = admin("states").header("X-Amz-Target", "AWSStepFunctions.CreateStateMachineAlias")
- .contentType("application/x-amz-json-1.0").body("{\"name\":\"PROD\",\"routingConfiguration\":"
- + "[{\"stateMachineVersionArn\":\"" + version + "\",\"weight\":100}]}")
- .post("/").then().statusCode(200).extract().path("stateMachineAliasArn");
+ String version = publishVersion(arn);
+ String alias = createAlias(ADMIN, version).statusCode(200)
+ .extract().path("stateMachineAliasArn");
assertEquals(arn + ":PROD", alias);
User user = user("res-alias");
@@ -247,6 +244,136 @@ class IamRequestResourceEnforcementIntegrationTest {
refusedJson(startExecution(user, version), "states:StartExecution");
}
+ /**
+ * An alias is created on the state machine its routing configuration's versions are of, so a grant on that
+ * machine allows it and one on another does not.
+ */
+ @Test
+ void anAliasIsCreatedOnTheStateMachineItsVersionsAreOf() {
+ String arn = createStateMachine("res-new-alias-" + suffix());
+ String version = publishVersion(arn);
+ User user = user("res-new-alias");
+ user.policy(allowOn("states:CreateStateMachineAlias", arn + "-other"));
+ refusedJson(createAlias(user.accessKeyId(), version), "states:CreateStateMachineAlias");
+ user.policy(allowOn("states:CreateStateMachineAlias", arn));
+ createAlias(user.accessKeyId(), version).statusCode(200);
+ }
+
+ /** {@code SetRulePriorities} is checked on the rules its priorities name. */
+ @Test
+ void rulePrioritiesAreCheckedOnTheRulesTheyName() {
+ String rule = ELB + "listener-rule/app/res-none/0123456789abcdef/0123456789abcdef/0123456789abcdef";
+ User user = user("res-priorities");
+ user.policy(allowOn("elasticloadbalancing:SetRulePriorities", rule));
+ setRulePriority(user, rule).statusCode(400).body(containsString("RuleNotFound"));
+ refused(setRulePriority(user, rule.replace("0123456789abcdef/0123456789abcdef/0123456789abcdef",
+ "0123456789abcdef/0123456789abcdef/fedcba9876543210")), "elasticloadbalancing:SetRulePriorities");
+ }
+
+ /**
+ * An EventBridge rule is checked on the rule its request names, on the event bus it names by name or ARN, or on
+ * the default one when it names none, whose rules have no bus in their ARN, as EventBridge mints them.
+ */
+ @Test
+ void aRuleIsCheckedOnTheEventBusItsRequestNames() {
+ String bus = "res-bus-" + suffix();
+ String name = "res-rule-" + suffix();
+ admin("events").header("X-Amz-Target", "AWSEvents.CreateEventBus").contentType("application/x-amz-json-1.1")
+ .body("{\"Name\":\"" + bus + "\"}").post("/").then().statusCode(200);
+ cleanup.register(() -> admin("events").header("X-Amz-Target", "AWSEvents.DeleteEventBus")
+ .contentType("application/x-amz-json-1.1").body("{\"Name\":\"" + bus + "\"}").post("/"));
+ String custom = putRule(name, ",\"EventBusName\":\"" + bus + "\"");
+ String onDefault = putRule(name, "");
+ assertEquals(EVENTS + "rule/" + bus + "/" + name, custom);
+ assertEquals(EVENTS + "rule/" + name, onDefault);
+
+ User user = user("res-rule");
+ user.policy(allowOn("events:DescribeRule", custom));
+ describeRule(user, name, ",\"EventBusName\":\"" + bus + "\"").statusCode(200);
+ describeRule(user, name, ",\"EventBusName\":\"" + EVENTS + "event-bus/" + bus + "\"").statusCode(200);
+ refusedJson(describeRule(user, name, ""), "events:DescribeRule");
+
+ user.policy(allowOn("events:DescribeRule", onDefault));
+ describeRule(user, name, "").statusCode(200);
+ describeRule(user, name, ",\"EventBusName\":\"default\"").statusCode(200);
+ refusedJson(describeRule(user, name, ",\"EventBusName\":\"" + bus + "\""), "events:DescribeRule");
+ }
+
+ /**
+ * A bus ARN leaving its account and Region empty names the caller's bus, and a null bus the default one, as the
+ * handler reads them, so a deny on the caller's rules holds.
+ */
+ @Test
+ void aDenyHoldsOnTheRuleOfTheBusTheHandlerActsOn() {
+ String bus = "res-bus-" + suffix();
+ String name = "res-rule-" + suffix();
+ admin("events").header("X-Amz-Target", "AWSEvents.CreateEventBus").contentType("application/x-amz-json-1.1")
+ .body("{\"Name\":\"" + bus + "\"}").post("/").then().statusCode(200);
+ cleanup.register(() -> admin("events").header("X-Amz-Target", "AWSEvents.DeleteEventBus")
+ .contentType("application/x-amz-json-1.1").body("{\"Name\":\"" + bus + "\"}").post("/"));
+ String custom = putRule(name, ",\"EventBusName\":\"" + bus + "\"");
+ String onDefault = putRule(name, "");
+ String noAccount = ",\"EventBusName\":\"arn:aws:events:::event-bus/" + bus + "\"";
+
+ User user = user("res-rule-deny");
+ user.policy(allowOn("events:DescribeRule", "*") + ",{\"Effect\":\"Deny\",\"Action\":\"events:DescribeRule\","
+ + "\"Resource\":[\"" + custom + "\",\"" + onDefault + "\"]}");
+ refusedJson(describeRule(user, name, noAccount), "events:DescribeRule");
+ refusedJson(describeRule(user, name, ",\"EventBusName\":null"), "events:DescribeRule");
+ describeRule(user, name + "-other", noAccount).statusCode(400)
+ .body(containsString("ResourceNotFoundException"));
+ describeRule(user, name + "-other", ",\"EventBusName\":null").statusCode(400)
+ .body(containsString("ResourceNotFoundException"));
+ }
+
+ /**
+ * A connection or an API destination named by its name is checked on the ARN EventBridge stored it under, which
+ * follows the name with the id it minted, so a grant on that ARN or on {@code <name>/*} allows it, one on the
+ * name alone does not, and a deny on that ARN holds.
+ */
+ @Test
+ void aConnectionNamedByItsNameIsCheckedOnTheArnItWasMintedUnder() {
+ String name = "res-conn-" + suffix();
+ String connection = admin("events").header("X-Amz-Target", "AWSEvents.CreateConnection")
+ .contentType("application/x-amz-json-1.1").body("{\"Name\":\"" + name + "\",\"AuthorizationType\":\"API_KEY\","
+ + "\"AuthParameters\":{\"ApiKeyAuthParameters\":{\"ApiKeyName\":\"k\",\"ApiKeyValue\":\"v\"}}}")
+ .post("/").then().statusCode(200).extract().path("ConnectionArn");
+ cleanup.register(() -> admin("events").header("X-Amz-Target", "AWSEvents.DeleteConnection")
+ .contentType("application/x-amz-json-1.1").body("{\"Name\":\"" + name + "\"}").post("/"));
+ String destination = admin("events").header("X-Amz-Target", "AWSEvents.CreateApiDestination")
+ .contentType("application/x-amz-json-1.1").body("{\"Name\":\"" + name + "\",\"ConnectionArn\":\""
+ + connection + "\",\"InvocationEndpoint\":\"https://example.com/hook\",\"HttpMethod\":\"POST\"}")
+ .post("/").then().statusCode(200).extract().path("ApiDestinationArn");
+ cleanup.register(() -> admin("events").header("X-Amz-Target", "AWSEvents.DeleteApiDestination")
+ .contentType("application/x-amz-json-1.1").body("{\"Name\":\"" + name + "\"}").post("/"));
+ assertTrue(connection.startsWith(EVENTS + "connection/" + name + "/"), connection);
+ assertTrue(destination.startsWith(EVENTS + "api-destination/" + name + "/"), destination);
+
+ User user = user("res-conn");
+ user.policy(allowOn("events:DescribeConnection", connection));
+ describeByName(user, "DescribeConnection", name).statusCode(200);
+ user.policy(allowOn("events:DescribeConnection", EVENTS + "connection/" + name + "/*"));
+ describeByName(user, "DescribeConnection", name).statusCode(200);
+ user.policy(allowOn("events:DescribeConnection", EVENTS + "connection/" + name));
+ refusedJson(describeByName(user, "DescribeConnection", name), "events:DescribeConnection");
+ user.policy(allowOn("events:DescribeConnection", "*") + ",{\"Effect\":\"Deny\",\"Action\":"
+ + "\"events:DescribeConnection\",\"Resource\":\"" + connection + "\"}");
+ refusedJson(describeByName(user, "DescribeConnection", name), "events:DescribeConnection");
+ user.policy(allowOn("events:DescribeApiDestination", destination));
+ describeByName(user, "DescribeApiDestination", name).statusCode(200);
+ refusedJson(describeByName(user, "DescribeApiDestination", name + "-other"), "events:DescribeApiDestination");
+ }
+
+ /** A request naming no event bus describes the default one, so it is checked on that bus. */
+ @Test
+ void anEventBusRequestNamingNoneIsCheckedOnTheDefaultOne() {
+ User user = user("res-default-bus");
+ user.policy(allowOn("events:DescribeEventBus", EVENTS + "event-bus/default"));
+ user.json("events", "AWSEvents.DescribeEventBus", "1.1").body("{}").post("/").then().statusCode(200);
+ refusedJson(user.json("events", "AWSEvents.DescribeEventBus", "1.1").body("{\"Name\":\"res-other\"}").post("/")
+ .then(), "events:DescribeEventBus");
+ }
+
@Test
void aUserPoolIsCheckedOnTheArnItsIdNames() {
String id = admin("cognito-idp").header("X-Amz-Target", "AWSCognitoIdentityProviderService.CreateUserPool")
@@ -376,6 +503,45 @@ class IamRequestResourceEnforcementIntegrationTest {
return arn;
}
+ /** Puts a rule of the name on the bus {@code bus} names, a JSON member or none, and gives its ARN. */
+ private String putRule(String name, String bus) {
+ String arn = admin("events").header("X-Amz-Target", "AWSEvents.PutRule").contentType("application/x-amz-json-1.1")
+ .body("{\"Name\":\"" + name + "\",\"ScheduleExpression\":\"rate(1 hour)\"" + bus + "}")
+ .post("/").then().statusCode(200).extract().path("RuleArn");
+ cleanup.register(() -> admin("events").header("X-Amz-Target", "AWSEvents.DeleteRule")
+ .contentType("application/x-amz-json-1.1").body("{\"Name\":\"" + name + "\"" + bus + "}").post("/"));
+ return arn;
+ }
+
+ private static ValidatableResponse describeByName(User user, String operation, String name) {
+ return user.json("events", "AWSEvents." + operation, "1.1").body("{\"Name\":\"" + name + "\"}").post("/").then();
+ }
+
+ private static ValidatableResponse describeRule(User user, String name, String bus) {
+ return user.json("events", "AWSEvents.DescribeRule", "1.1").body("{\"Name\":\"" + name + "\"" + bus + "}")
+ .post("/").then();
+ }
+
+ private static String publishVersion(String arn) {
+ return admin("states").header("X-Amz-Target", "AWSStepFunctions.PublishStateMachineVersion")
+ .contentType("application/x-amz-json-1.0").body("{\"stateMachineArn\":\"" + arn + "\"}")
+ .post("/").then().statusCode(200).extract().path("stateMachineVersionArn");
+ }
+
+ /** An alias {@code PROD} routing every execution to the version. */
+ private static ValidatableResponse createAlias(String accessKeyId, String version) {
+ return given().header("Authorization", auth(accessKeyId, "states"))
+ .header("X-Amz-Target", "AWSStepFunctions.CreateStateMachineAlias")
+ .contentType("application/x-amz-json-1.0").body("{\"name\":\"PROD\",\"routingConfiguration\":"
+ + "[{\"stateMachineVersionArn\":\"" + version + "\",\"weight\":100}]}").post("/").then();
+ }
+
+ private static ValidatableResponse setRulePriority(User user, String rule) {
+ return user.query("elasticloadbalancing", "SetRulePriorities").formParam("Version", "2015-12-01")
+ .formParam("RulePriorities.member.1.RuleArn", rule).formParam("RulePriorities.member.1.Priority", "5")
+ .post("/").then();
+ }
+
private static ValidatableResponse describeStateMachine(User user, String arn) {
return user.json("states", "AWSStepFunctions.DescribeStateMachine", "1.0")
.body("{\"stateMachineArn\":\"" + arn + "\"}").post("/").then();
diff --git a/tools/aws/regen_iam_request_resources.py b/tools/aws/regen_iam_request_resources.py
index cd959fc3b6..40e5a7a7f0 100644
--- a/tools/aws/regen_iam_request_resources.py
+++ b/tools/aws/regen_iam_request_resources.py
@@ -19,7 +19,8 @@ builds their ARNs from the request. It comes from two sources, each answering wh
An operation is checked as its own action, or as the action of another name the reference gives it
(`regen_iam_authorized_actions.py` vendors that mapping). For each resource type that action acts
on, the request names a resource when one of its top-level members holds a string or a list of
-strings and:
+strings, or, for an ARN, a member of a structure or of each element of a list of structures does
+(`SetRulePriorities`' `RulePriorities[].RuleArn`), and:
- holds the resource's ARN: its name ends in `Arn` or `Arns`. Any of the action's types may be the
one it holds (`ResourceArn` holds whatever the action acts on, `RuleArn` a `listener-rule/app`),
@@ -39,7 +40,9 @@ strings and:
A member whose botocore shape is an account id (a string of pattern `[0-9]{12}`) gives the account of
the types the request names by their variables: ECR's `registryId` selects the registry its handler
-acts in, so `repository/<name>` is that account's.
+acts in, so `repository/<name>` is that account's. A member whose shape's pattern takes an ARN before
+the name (`(arn:...:event-bus/)?<name>`) may give the ARN of the type of that name instead, whose one
+variable it is then read as, in the ARN's account and Region: EventBridge's `EventBusName`.
An operation that creates a type its action does not act on names the new resource from the ARN of the
parent it acts on, when the child's ARN format is the parent's with its resource type word replaced and
@@ -57,11 +60,17 @@ or not. `HAND_BUILT` are the namespaces `ResourceArnBuilder` builds resources fo
`RequestResourceNamespacesIntegrationTest` fails for a served namespace in none of the three.
`CORRECTIONS` gives an operation's resources where the rule gets them wrong, each with its reason; a
resource there may apply only `when` a member has one of some values (`Type` picks the load balancer
-v2 `CreateLoadBalancer` creates), and an ARN member's value may be read only up to a character
-`before` which its handler drops the rest (`StartExecution`'s `<stateMachineArn>#<test case>`).
+v2 `CreateLoadBalancer` creates), or `unless` it has, read as a value when it is `absent` (an
+EventBridge request naming no event bus names the default one), and an ARN member's value may be read
+only up to a character `before` which its handler drops the rest (`StartExecution`'s
+`<stateMachineArn>#<test case>`). `CLIENTS_NOT_READ` are SDK clients the reference lists for a
+namespace's operations whose requests Floci does not serve, each with its reason.
`UNQUALIFIED` are the resource types whose ARN a request may give with a qualifier, one more `:<name>`
past its format, and whose service checks it without one: Step Functions checks a version or an alias
-on its state machine's ARN.
+on its state machine's ARN. `MINTED_IDS` are the resource types whose service follows the name their
+format ends in with an id it mints, `/<id>`, which the format leaves out and a request naming one by
+its name does not give: EventBridge's connections and API destinations, whose stored ARN the reader
+asks the service for, or else checks with that id open.
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:
@@ -98,7 +107,15 @@ OUTPUT = REPO_ROOT / "src/main/resources/aws/iam-request-resources.json"
# The namespaces read, in batches: each moves here from NOT_COVERED with the tests that show its ARNs
# are the ones its handlers mint.
-NAMESPACES = ("cognito-idp", "ecr", "elasticloadbalancing", "states")
+NAMESPACES = ("cognito-idp", "ecr", "elasticloadbalancing", "events", "states")
+
+# SDK clients the reference lists for a namespace's operations whose requests Floci does not serve, and why: their
+# members are not read.
+CLIENTS_NOT_READ: dict[str, str] = {
+ "eventbridgev2": "EventBridge V2, the AWSEventsV2 target over Smithy RPC v2 CBOR on the eventsv2 endpoint, which "
+ "Floci does not serve; its operations share EventBridge's names and name their resources by "
+ "other members",
+}
# The namespaces whose resources ResourceArnBuilder builds itself.
HAND_BUILT = ("dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups",
@@ -159,7 +176,6 @@ NOT_COVERED: dict[str, str] = {
"elasticmapreduce": _LATER,
"emr-serverless": _REST,
"es": _REST,
- "events": _LATER,
"execute-api": _REST,
"firehose": _LATER,
"fis": _REST,
@@ -220,6 +236,20 @@ CORRECTIONS: dict[str, tuple[list[dict], str]] = {
{"type": "loadbalancer/net/", "fill": {"LoadBalancerName": "Name"}, "when": {"Type": ["network"]}},
], "the classic API names its load balancer by LoadBalancerName; the v2 API by Name, its type by Type, "
"an application load balancer when it gives none, which the rule cannot tell apart"),
+ **{f"events:{operation}": ([
+ {"type": "rule-on-default-event-bus", "fill": {"RuleName": rule}, "when": {"EventBusName": ["default"]},
+ "absent": {"EventBusName": "default"}},
+ {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": rule},
+ "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}},
+ ], f"a rule is named by its {rule} on the event bus EventBusName names, the default one when it names none "
+ "('If you omit this, the default event bus is used'), whose rules have no bus in their ARN; the rule takes "
+ "the bus's name for the rule's and cannot tell the default bus's rules from a custom bus's")
+ for operation, rule in (("DeleteRule", "Name"), ("DescribeRule", "Name"), ("DisableRule", "Name"),
+ ("EnableRule", "Name"), ("ListTargetsByRule", "Rule"), ("PutRule", "Name"),
+ ("PutTargets", "Rule"), ("RemoveTargets", "Rule"))},
+ "events:DescribeEventBus": ([{"type": "event-bus", "fill": {"EventBusName": "Name"}, "absent": {"Name": "default"}}],
+ "a request naming no event bus describes the default one ('If you omit this, the "
+ "default event bus is displayed')"),
**{f"states:{operation}": ([{"types": ["statemachine"], "arn": "stateMachineArn", "before": "#"}],
"Floci takes Step Functions Local's <stateMachineArn>#<test case> and runs the machine "
"the part before the # names, so that part is the one checked")
@@ -234,6 +264,17 @@ UNQUALIFIED: dict[str, str] = {
"Step Functions uses the state machine's ARN instead of using the version ARN or alias ARN')",
}
+# Resource types whose service follows the one variable their format ends in with an id it mints, `/<id>`,
+# which the format leaves out and a request naming one by its name does not give, and why.
+MINTED_IDS: dict[str, str] = {
+ "events:connection": "EventBridge mints a connection's ARN as connection/<name>/<id> (botocore's ConnectionArn "
+ "pattern ends in connection/<name>/<id>) and checks a connection on it: the user "
+ "guide grants events:RetrieveConnectionCredentials on connection/<name>/*",
+ "events:api-destination": "EventBridge mints an API destination's ARN as api-destination/<name>/<id> "
+ "(botocore's ApiDestinationArn pattern ends in api-destination/<name>/<id>), "
+ "as it does a connection's",
+}
+
# The variables of an ARN format the account, partition and Region fill.
KNOWN_VARIABLES = {"Partition", "Region", "Account"}
VARIABLE_RE = re.compile(r"\$\{(\w+)}")
@@ -310,8 +351,9 @@ def _protocols(model: dict) -> set[str]:
def request_members(models: dict[str, dict], operation: str) -> dict[str, str]:
"""The top-level members of the operation's request that hold a string (`Name`) or a list of
- strings (`Name[]`), by name, as the vendored path reads them; empty for a request this file does
- not read."""
+ strings (`Name[]`), by name, and the ARN members one level inside one (`Name.FieldArn`,
+ `Name[].FieldArn`), by that path, as the vendored path reads them; empty for a request this file
+ does not read."""
found: dict[str, str] = {}
for model in models.values():
spec = model["operations"].get(operation)
@@ -322,13 +364,34 @@ def request_members(models: dict[str, dict], operation: str) -> dict[str, str]:
if member.get("location") not in BODY_LOCATIONS:
continue
shape = model["shapes"][member["shape"]]
- if shape["type"] == "string":
- found.setdefault(name, name)
- elif shape["type"] == "list" and model["shapes"][shape["member"]["shape"]]["type"] == "string":
- found.setdefault(name, name + "[]")
+ if _strings(model, shape) is not None:
+ found.setdefault(name, name + _strings(model, shape))
+ for path in _nested_arns(model, name, shape):
+ found.setdefault(path.removesuffix("[]"), path)
return found
+def _strings(model: dict, shape: dict) -> str | None:
+ """How a path reads a shape that holds a string (``) or a list of strings (`[]`); None for another."""
+ if shape["type"] == "string":
+ return ""
+ if shape["type"] == "list" and model["shapes"][shape["member"]["shape"]]["type"] == "string":
+ return "[]"
+ return None
+
+
+def _nested_arns(model: dict, name: str, shape: dict) -> list[str]:
+ """The members ending in `Arn` or `Arns` of a structure, or of a list's structures, holding a string or a list
+ of strings, as `Name.Field` or `Name[].Field`."""
+ element = model["shapes"][shape["member"]["shape"]] if shape["type"] == "list" else shape
+ if element["type"] != "structure":
+ return []
+ prefix = name + ("[]." if shape["type"] == "list" else ".")
+ return [prefix + field + _strings(model, model["shapes"][member["shape"]])
+ for field, member in element.get("members", {}).items()
+ if re.search(r"arns?$", field, re.IGNORECASE) and _strings(model, model["shapes"][member["shape"]]) is not None]
+
+
def account_members(models: dict[str, dict], operation: str) -> list[str]:
"""The top-level members of the operation's request whose shape is an account id, by name."""
found: set[str] = set()
@@ -344,6 +407,46 @@ def account_members(models: dict[str, dict], operation: str) -> list[str]:
return sorted(found)
+# A pattern that takes an ARN of a type before a name: `(arn:...:event-bus\/)?<name>`, the type's word captured.
+NAME_OR_ARN_RE = re.compile(r"^\(arn:[^)]*:([A-Za-z][A-Za-z0-9-]*)\\?/\)\?")
+
+
+def name_or_arn_members(models: dict[str, dict], operation: str) -> dict[str, str]:
+ """The top-level members of the operation's request whose shape's pattern takes an ARN before a name, by name,
+ each with the resource type word of that ARN."""
+ found: dict[str, str] = {}
+ for model in models.values():
+ spec = model["operations"].get(operation)
+ if spec is None or "input" not in spec or not READ_PROTOCOLS & _protocols(model):
+ continue
+ for name, member in model["shapes"][spec["input"]["shape"]].get("members", {}).items():
+ shape = model["shapes"][member["shape"]]
+ match = NAME_OR_ARN_RE.match(shape.get("pattern") or "") if shape["type"] == "string" else None
+ if member.get("location") in BODY_LOCATIONS and match:
+ found.setdefault(name, match.group(1))
+ return found
+
+
+def named_by(word: str, formats: dict[str, str]) -> str | None:
+ """The type whose ARN format's resource is the word and one variable (`event-bus/${EventBusName}`)."""
+ found = [kind for kind, arn in formats.items()
+ if re.fullmatch(r"arn:\$\{Partition}:[^:]*:[^:]*:[^:]*:" + re.escape(word) + r"/\$\{\w+}", arn)]
+ return found[0] if len(found) == 1 else None
+
+
+def with_arn_of(resources: list[dict], formats: dict[str, str], members: dict[str, str]) -> list[dict]:
+ """The resources, each a type named by its variables reading a member that may give an ARN of a type instead of
+ its name, as that type's one variable."""
+ found = []
+ for resource in resources:
+ read = {path.removesuffix("[]") for path in resource.get("fill", {}).values()} | set(resource.get("when", {})) \
+ | set(resource.get("unless", {})) | set(resource.get("absent", {}))
+ arn_of = {member: named_by(members[member], formats) for member in sorted(read) if member in members}
+ arn_of = {member: kind for member, kind in arn_of.items() if kind is not None}
+ found.append(dict(resource, arnOf=arn_of) if "fill" in resource and arn_of else resource)
+ return found
+
+
def with_account(resources: list[dict], formats: dict[str, str], accounts: list[str]) -> list[dict]:
"""The resources, each a type named by its variables taking its account from the request's one account id
member, when it has exactly one and the type's format has an account."""
@@ -387,10 +490,10 @@ def resources_for(operation: str, types: list[str], formats: dict[str, str], mem
kind_stem = stem(kind)
for member in sorted(arns):
by_arn.setdefault(member, []).append(kind)
- # An ARN member named for the type, or for whatever the action acts on, holds it, and a bare name
- # then names something else.
- held = [member for member in arns if stem(member) in ("", "resource")
- or related(stem(member), kind_stem) or kind_stem.startswith(stem(member))]
+ # A top-level ARN member named for the type, or for whatever the action acts on, holds it, and a bare
+ # name then names something else.
+ held = [member for member in arns if "." not in member and (stem(member) in ("", "resource")
+ or related(stem(member), kind_stem) or kind_stem.startswith(stem(member)))]
variables = [v for v in VARIABLE_RE.findall(formats[kind]) if v not in KNOWN_VARIABLES]
fill: dict[str, str] = {}
for variable in sorted(variables, key=lambda v: (kind_of(v) == "", v)):
@@ -438,7 +541,7 @@ def creates_for(operation: str, types: list[str], formats: dict[str, str], membe
if not CREATING_RE.match(name):
return []
created = stem(CREATING_RE.sub("", name))
- arns = sorted(member for member in members if re.search(r"arns?$", member, re.IGNORECASE))
+ arns = sorted(member for member in members if "." not in member and re.search(r"arns?$", member, re.IGNORECASE))
found = []
for child in sorted(formats):
if child in types:
@@ -487,6 +590,7 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d
else:
resources = resources_for(operation, types, formats, members)
resources = with_account(resources, formats, account_members(models, operation.split(":", 1)[1]))
+ resources = with_arn_of(resources, formats, name_or_arn_members(models, operation.split(":", 1)[1]))
entry = {"action": upstream["action"], "types": types, "resources": resources}
creates = creates_for(operation, types, formats, members)
if creates:
@@ -499,12 +603,18 @@ def build(documents: list[dict], provenance: str, data: Path, botocore: str) ->
covered = {operation: value for operation, value in upstream.items() if namespace_of(operation) in NAMESPACES}
_check_overrides(covered)
namespaces = {namespace: sorted({client for operation, value in covered.items()
- if namespace_of(operation) == namespace for client in value["clients"]})
+ if namespace_of(operation) == namespace for client in value["clients"]
+ if client not in CLIENTS_NOT_READ})
for namespace in sorted(NAMESPACES)}
formats = arn_formats(documents, set(NAMESPACES))
unqualified = unqualified_types()
- missing = [f"UNQUALIFIED names {namespace}:{kind}, no resource type with an ARN format of a namespace the file reads"
- for namespace, kinds in unqualified.items() for kind in kinds if kind not in formats.get(namespace, {})]
+ minted = minted_types()
+ missing = [f"{name} names {namespace}:{kind}, no resource type with an ARN format of a namespace the file reads"
+ for name, listed in (("UNQUALIFIED", unqualified), ("MINTED_IDS", minted))
+ for namespace, kinds in listed.items() for kind in kinds if kind not in formats.get(namespace, {})]
+ missing += [f"MINTED_IDS names {namespace}:{kind}, whose ARN format does not end in its one variable"
+ for namespace, kinds in minted.items() for kind in kinds
+ if kind in formats.get(namespace, {}) and not ONE_VARIABLE_RE.match(_resource(formats[namespace][kind]))]
if missing:
raise ValueError("; ".join(missing))
operations = {}
@@ -521,6 +631,7 @@ def build(documents: list[dict], provenance: str, data: Path, botocore: str) ->
"make iam-request-resources-verify checks every action, type and format against AWS.",
},
"namespaces": namespaces,
+ "clientsNotRead": dict(sorted(CLIENTS_NOT_READ.items())),
"handBuilt": list(HAND_BUILT),
"notCovered": dict(sorted(NOT_COVERED.items())),
"otherNamespaces": sorted(namespace for namespace in _with_resource_types(documents)
@@ -528,19 +639,35 @@ def build(documents: list[dict], provenance: str, data: Path, botocore: str) ->
and namespace not in NOT_COVERED),
"arnFormats": formats,
"unqualified": unqualified,
+ "mintedIds": minted,
"operations": operations,
}
def unqualified_types() -> dict[str, list[str]]:
"""`UNQUALIFIED` as the types of each namespace."""
+ return _types_of(UNQUALIFIED)
+
+
+def minted_types() -> dict[str, list[str]]:
+ """`MINTED_IDS` as the types of each namespace."""
+ return _types_of(MINTED_IDS)
+
+
+def _types_of(listed: dict[str, str]) -> dict[str, list[str]]:
+ """`<namespace>:<type>` keys as the types of each namespace."""
found: dict[str, list[str]] = {}
- for key in sorted(UNQUALIFIED):
+ for key in sorted(listed):
namespace, kind = key.split(":", 1)
found.setdefault(namespace, []).append(kind)
return found
+def _resource(arn_format: str) -> str:
+ """The resource part of an ARN format, past its fifth colon."""
+ return arn_format.split(":", 5)[5]
+
+
def _with_resource_types(documents: list[dict]) -> set[str]:
"""The namespaces with an action that acts on a resource type."""
return {document["Name"] for document in documents
@@ -561,7 +688,8 @@ def _check_overrides(covered: dict[str, dict]) -> None:
def render(document: dict) -> str:
"""The document with one operation to a line."""
lines = ["{"]
- for key in ("_source", "namespaces", "handBuilt", "notCovered", "otherNamespaces", "arnFormats", "unqualified"):
+ for key in ("_source", "namespaces", "clientsNotRead", "handBuilt", "notCovered", "otherNamespaces", "arnFormats",
+ "unqualified", "mintedIds"):
lines.append(f' "{key}": {json.dumps(document[key])},')
lines.append(' "operations": {')
operations = list(document["operations"].items())
@@ -576,6 +704,10 @@ def render(document: dict) -> str:
# Gates
# --------------------------------------------------------------------------- #
PATH_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(\[])?$")
+# An ARN member's path may go one level into a structure or a list's structures.
+ARN_PATH_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(\[])?(\.[A-Za-z][A-Za-z0-9_]*(\[])?)?$")
+# A format's resource that is a literal and one variable, at its end.
+ONE_VARIABLE_RE = re.compile(r"^[^$]*\$\{\w+}$")
def validate(document: dict) -> list[str]:
@@ -599,13 +731,21 @@ def validate(document: dict) -> list[str]:
isinstance(kinds, list) and kinds and all(isinstance(kind, str) and kind in formats.get(namespace, {})
for kind in kinds) for namespace, kinds in unqualified.items()):
problems.append("unqualified is not resource types with an ARN format of each namespace the file reads")
+ minted = document.get("mintedIds")
+ if not isinstance(minted, dict) or not all(
+ isinstance(kinds, list) and kinds and all(isinstance(kind, str) and kind in formats.get(namespace, {})
+ and ONE_VARIABLE_RE.match(_resource(formats[namespace][kind]))
+ for kind in kinds) for namespace, kinds in minted.items()):
+ problems.append("mintedIds is not resource types of each namespace the file reads whose ARN format ends in "
+ "its one variable")
for key in ("handBuilt", "otherNamespaces"):
if not isinstance(document.get(key), list) or not all(isinstance(n, str) and NAMESPACE_RE.match(n)
for n in document[key]):
problems.append(f"{key} is not a list of namespaces")
- if not isinstance(document.get("notCovered"), dict) or not all(
- isinstance(reason, str) and reason for reason in document["notCovered"].values()):
- problems.append("notCovered does not give each namespace a reason")
+ for key in ("notCovered", "clientsNotRead"):
+ if not isinstance(document.get(key), dict) or not all(
+ isinstance(reason, str) and reason for reason in document[key].values()):
+ problems.append(f"{key} does not give each a reason")
for operation, entry in operations.items():
namespace = namespace_of(operation)
if not OPERATION_RE.match(operation) or namespace not in namespaces:
@@ -630,13 +770,13 @@ def validate(document: dict) -> list[str]:
def _resource_problems(operation: str, resource: object, types: set[str], formats: dict[str, str]) -> list[str]:
if not isinstance(resource, dict) or not ({"types", "arn"} <= set(resource) <= {"types", "arn", "before"}
- or {"type", "fill"} <= set(resource) <= {"type", "fill", "when", "account"}):
+ or {"type", "fill"} <= set(resource) <= {"type", "fill", "when", "unless", "absent", "arnOf", "account"}):
return [f"{operation} names {resource!r}, which is neither an ARN member nor a type's variables"]
kinds = resource.get("types") or [resource.get("type")]
if not all(isinstance(kind, str) and kind in types and kind in formats for kind in kinds):
return [f"{operation} names {kinds}, not resource types its action acts on with an ARN format"]
if "arn" in resource:
- if not isinstance(resource["arn"], str) or not PATH_RE.match(resource["arn"]):
+ if not isinstance(resource["arn"], str) or not ARN_PATH_RE.match(resource["arn"]):
return [f"{operation} reads an ARN at {resource['arn']!r}, which is no member"]
before = resource.get("before", "#")
return [] if isinstance(before, str) and len(before) == 1 else [
@@ -648,11 +788,22 @@ def _resource_problems(operation: str, resource: object, types: set[str], format
return [f"{operation} fills {fill!r}, which are no variables of {kinds[0]}'s ARN by members"]
if sum(path.endswith("[]") for path in fill.values()) > 1:
return [f"{operation} fills {kinds[0]} from more than one list"]
- when = resource.get("when", {})
- if not isinstance(when, dict) or not all(
- isinstance(path, str) and PATH_RE.match(path) and not path.endswith("[]") and isinstance(values, list) and values
- and all(value is None or isinstance(value, str) for value in values) for path, values in when.items()):
- return [f"{operation} names {kinds[0]} when {when!r}, which is no member's values"]
+ for key in ("when", "unless"):
+ when = resource.get(key, {})
+ if not isinstance(when, dict) or not all(
+ isinstance(path, str) and PATH_RE.match(path) and not path.endswith("[]") and isinstance(values, list)
+ and values and all(value is None or isinstance(value, str) for value in values) for path, values in when.items()):
+ return [f"{operation} names {kinds[0]} {key} {when!r}, which is no member's values"]
+ absent = resource.get("absent", {})
+ if not isinstance(absent, dict) or not all(isinstance(path, str) and PATH_RE.match(path) and not path.endswith("[]")
+ and isinstance(value, str) and value for path, value in absent.items()):
+ return [f"{operation} reads {absent!r} for absent members, which is no member's value"]
+ arn_of = resource.get("arnOf", {})
+ if not isinstance(arn_of, dict) or not all(
+ isinstance(path, str) and PATH_RE.match(path) and not path.endswith("[]") and isinstance(kind, str)
+ and len(set(VARIABLE_RE.findall(formats.get(kind, ""))) - KNOWN_VARIABLES) == 1
+ and formats[kind].endswith("}") for path, kind in arn_of.items()):
+ return [f"{operation} reads {arn_of!r} as ARNs of types, which are no members or types of one variable"]
account = resource.get("account")
if account is not None and (not isinstance(account, str) or not PATH_RE.match(account) or account.endswith("[]")
or "${Account}" not in formats[kinds[0]]):
@@ -673,9 +824,15 @@ def _created_problems(operation: str, created: object, types: set[str], formats:
def derive(document: dict, data: Path) -> list[str]:
"""Where the resources the file gives differ from what botocore gives for its types and formats."""
problems: list[str] = []
+ if document["clientsNotRead"] != dict(sorted(CLIENTS_NOT_READ.items())):
+ problems.append(f"the file leaves out the clients {json.dumps(document['clientsNotRead'])}, CLIENTS_NOT_READ "
+ f"gives {json.dumps(dict(sorted(CLIENTS_NOT_READ.items())))}")
if document["unqualified"] != unqualified_types():
problems.append(f"the file checks {json.dumps(document['unqualified'])} without a qualifier, "
f"UNQUALIFIED gives {json.dumps(unqualified_types())}")
+ if document["mintedIds"] != minted_types():
+ problems.append(f"the file gives {json.dumps(document['mintedIds'])} a minted id, "
+ f"MINTED_IDS gives {json.dumps(minted_types())}")
for operation, entry in document["operations"].items():
namespace = namespace_of(operation)
models = load_models(data, set(document["namespaces"][namespace]))
@@ -697,7 +854,7 @@ def verify_against(vendored: dict, upstream: dict[str, dict], formats: dict[str,
untrue.append(f"AWS checks {operation} as {actual['action']}, not {entry['action']}")
elif (actual["types"] or []) != entry["types"]:
untrue.append(f"AWS gives {entry['action']} the resource types {actual['types']}, not {entry['types']}")
- elif not set(actual["clients"]) <= set(vendored["namespaces"][namespace_of(operation)]):
+ elif not set(actual["clients"]) - set(vendored["clientsNotRead"]) <= set(vendored["namespaces"][namespace_of(operation)]):
untrue.append(f"AWS lists {operation} for {actual['clients']}, which the file does not read")
for namespace, types in vendored["arnFormats"].items():
changed = sorted(kind for kind, arn in types.items() if formats.get(namespace, {}).get(kind) != arn)
diff --git a/tools/aws/test_regen_iam_request_resources.py b/tools/aws/test_regen_iam_request_resources.py
index 4d2751140a..d51512b6e2 100644
--- a/tools/aws/test_regen_iam_request_resources.py
+++ b/tools/aws/test_regen_iam_request_resources.py
@@ -106,6 +106,27 @@ def test_a_create_of_a_child_of_a_type_its_action_acts_on_names_it_from_the_pare
assert r.creates_for("svc:CreateListener", ["loadbalancer/app/"], LISTENERS, members("RoleArn")) == []
+def test_an_arn_inside_a_structure_or_a_lists_structures_is_read_by_its_path():
+ shapes = {"String": {"type": "string"}, "Strings": {"type": "list", "member": {"shape": "String"}},
+ "Priority": {"type": "structure", "members": {"RuleArn": {"shape": "String"}, "Priority": {"shape": "String"},
+ "TargetArns": {"shape": "Strings"}}},
+ "Priorities": {"type": "list", "member": {"shape": "Priority"}},
+ "Config": {"type": "structure", "members": {"RoleArn": {"shape": "String"}, "Name": {"shape": "String"}}},
+ "In": {"type": "structure", "members": {"RulePriorities": {"shape": "Priorities"}, "Config": {"shape": "Config"},
+ "ListenerArn": {"shape": "String"}}}}
+ models = {"svc": {"metadata": {"protocol": "query"}, "operations": {"SetRulePriorities": {"input": {"shape": "In"}}},
+ "shapes": shapes}}
+ found = r.request_members(models, "SetRulePriorities")
+ assert found == {"RulePriorities[].RuleArn": "RulePriorities[].RuleArn",
+ "RulePriorities[].TargetArns": "RulePriorities[].TargetArns[]", "Config.RoleArn": "Config.RoleArn",
+ "ListenerArn": "ListenerArn"}
+ # Each holds the ARN of any type the action acts on, as a top-level one does, and neither holds the type
+ # the way a top-level member named for it does, nor names the parent of a create.
+ resources = r.resources_for("svc:SetRulePriorities", ["thing"], FORMATS, found)
+ assert {"types": ["thing"], "arn": "RulePriorities[].RuleArn"} in resources
+ assert r.creates_for("svc:CreateThing", ["thing"], FORMATS, {"Parts[].ThingArn": "Parts[].ThingArn"}) == []
+
+
def test_stems_drop_the_suffixes_names_carry():
assert r.stem("TargetGroupArns") == "targetgroup"
assert r.stem("DBInstanceIdentifier") == "dbinstance"
@@ -141,6 +162,8 @@ def corrections(monkeypatch):
monkeypatch.setattr(r, "NOT_COVERED", {"later": "a later batch"})
monkeypatch.setattr(r, "CORRECTIONS", {})
monkeypatch.setattr(r, "UNQUALIFIED", {})
+ monkeypatch.setattr(r, "MINTED_IDS", {})
+ monkeypatch.setattr(r, "CLIENTS_NOT_READ", {})
return monkeypatch
@@ -206,6 +229,52 @@ def test_a_type_checked_without_a_qualifier_is_recorded_and_must_be_one_the_file
r.build(DOCUMENTS, "test", tmp_path, "botocore test")
+def test_a_type_whose_service_mints_an_id_after_its_name_is_recorded_and_must_be_one_the_file_reads(corrections, tmp_path):
+ write_models(tmp_path, {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}})})
+ corrections.setattr(r, "MINTED_IDS", {"svc:thing": "its service follows the name with an id it mints"})
+ document = r.build(DOCUMENTS, "test", tmp_path, "botocore test")
+ assert document["mintedIds"] == {"svc": ["thing"]}
+ assert r.validate(document) == [] and r.derive(document, tmp_path) == []
+ # A hand edit no longer matches, and a type the file has no format for fails the build.
+ document["mintedIds"] = {}
+ assert r.validate(document) == [] and len(r.derive(document, tmp_path)) == 1
+ corrections.setattr(r, "MINTED_IDS", {"svc:gone": "no longer there"})
+ with pytest.raises(ValueError, match="svc:gone"):
+ r.build(DOCUMENTS, "test", tmp_path, "botocore test")
+
+
+def test_a_client_not_read_gives_no_members_and_aws_listing_it_is_no_untrue_claim(corrections, tmp_path):
+ corrections.setattr(r, "CLIENTS_NOT_READ", {"svcv2": "a second API Floci does not serve"})
+ write_models(tmp_path, {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}}),
+ "svcv2": model({"GetThing": {"ThingArn": "String"}})})
+ documents = [dict(DOCUMENTS[0], Operations=[dict(op, SDK=op["SDK"] + [{"Name": "svcv2", "Package": "Boto3"}])
+ for op in DOCUMENTS[0]["Operations"]])] + DOCUMENTS[1:]
+ document = r.build(documents, "test", tmp_path, "botocore test")
+ assert document["namespaces"] == {"svc": ["svc"]} and document["clientsNotRead"] == {"svcv2": "a second API Floci does not serve"}
+ assert document["operations"]["svc:GetThing"]["resources"] == [{"type": "thing", "fill": {"ThingName": "ThingName"}}]
+ assert r.validate(document) == [] and r.derive(document, tmp_path) == []
+ upstream = r.checked_actions(documents)
+ assert r.verify_against(document, upstream, {"svc": {"thing": FORMATS["thing"]}}) == ([], [])
+ document["clientsNotRead"] = {}
+ assert len(r.derive(document, tmp_path)) == 1
+
+
+def test_a_member_taking_an_arn_before_a_name_is_read_as_the_variable_of_that_types_arn():
+ shapes = {"String": {"type": "string"},
+ "BusNameOrArn": {"type": "string", "pattern": "(arn:aws[\\w-]*:svc:[a-z]+-[a-z]+-[\\w-]+:[0-9]{12}:bus\\/)?[/\\.\\-_A-Za-z0-9]+"},
+ "In": {"type": "structure", "members": {"Name": {"shape": "String"}, "BusName": {"shape": "BusNameOrArn"}}}}
+ models = {"svc": {"metadata": {"protocol": "json"}, "operations": {"PutRule": {"input": {"shape": "In"}}}, "shapes": shapes}}
+ assert r.name_or_arn_members(models, "PutRule") == {"BusName": "bus"}
+ formats = {"bus": "arn:${Partition}:svc:${Region}:${Account}:bus/${BusName}",
+ "rule": "arn:${Partition}:svc:${Region}:${Account}:rule/${BusName}/${RuleName}"}
+ assert r.named_by("bus", formats) == "bus" and r.named_by("rule", formats) is None
+ rules = [{"type": "rule", "fill": {"BusName": "BusName", "RuleName": "Name"}},
+ {"type": "rule", "fill": {"RuleName": "Name"}, "when": {"BusName": ["default"]}},
+ {"types": ["rule"], "arn": "RuleArn"}]
+ assert r.with_arn_of(rules, formats, {"BusName": "bus"}) == [
+ dict(rules[0], arnOf={"BusName": "bus"}), dict(rules[1], arnOf={"BusName": "bus"}), rules[2]]
+
+
def test_a_correction_for_an_operation_the_file_does_not_read_fails(corrections, tmp_path):
corrections.setattr(r, "CORRECTIONS", {"svc:Gone": ([], "no longer there")})
with pytest.raises(ValueError, match="svc:Gone"):
@@ -213,9 +282,10 @@ def test_a_correction_for_an_operation_the_file_does_not_read_fails(corrections,
def good_document() -> dict:
- return {"namespaces": {"svc": ["svc"]}, "handBuilt": ["hand"], "notCovered": {"later": "a later batch"},
+ return {"namespaces": {"svc": ["svc"]}, "clientsNotRead": {"svcv2": "not served"}, "handBuilt": ["hand"],
+ "notCovered": {"later": "a later batch"},
"otherNamespaces": ["other"], "arnFormats": {"svc": {"thing": FORMATS["thing"], "group": FORMATS["group"]}},
- "unqualified": {"svc": ["thing"]},
+ "unqualified": {"svc": ["thing"]}, "mintedIds": {"svc": ["thing"]},
"operations": {
"svc:A": {"action": "svc:A", "types": ["thing"], "resources": [{"types": ["thing"], "arn": "ThingArn"}]},
"svc:B": {"action": "svc:B", "types": ["group"], "resources": [{"type": "group", "fill": {"GroupName": "Names[]"}}]},
@@ -227,6 +297,9 @@ def test_a_well_formed_document_validates():
document = good_document()
document["operations"]["svc:B"]["resources"][0]["when"] = {"Type": ["application", None]}
document["operations"]["svc:B"]["resources"][0]["account"] = "registryId"
+ document["operations"]["svc:B"]["resources"][0]["unless"] = {"Bus": ["default"]}
+ document["operations"]["svc:B"]["resources"][0]["absent"] = {"Bus": "default"}
+ document["operations"]["svc:B"]["resources"][0]["arnOf"] = {"Bus": "thing"}
document["operations"]["svc:A"]["resources"][0]["before"] = "#"
assert r.validate(document) == []
assert r.validate(with_a_create()) == []
@@ -241,7 +314,9 @@ def with_a_create() -> dict:
@pytest.mark.parametrize("change, problem", [
(lambda d: d["operations"]["svc:A"]["resources"][0].update(types=["pool"]), "not resource types"),
- (lambda d: d["operations"]["svc:A"]["resources"][0].update(arn="a.b"), "no member"),
+ (lambda d: d["operations"]["svc:A"]["resources"][0].update(arn="a.b.c"), "no member"),
+ (lambda d: d["operations"]["svc:A"]["resources"][0].update(arn="a[][]"), "no member"),
+ (lambda d: d["operations"]["svc:B"]["resources"][0]["fill"].update(GroupName="Groups[].Name"), "no variables"),
(lambda d: d["operations"]["svc:B"]["resources"][0]["fill"].update(Other="Name"), "no variables"),
(lambda d: d["operations"]["svc:B"]["resources"][0]["fill"].update(GroupId="Ids[]"), "more than one list"),
(lambda d: d["operations"]["svc:A"].update(action="other:A"), "no action of its namespace"),
@@ -259,10 +334,22 @@ def with_a_create() -> dict:
(lambda d: d["operations"]["svc:B"]["resources"][0].update(account="a.b"), "no account of its ARN"),
(lambda d: d["arnFormats"]["svc"].update(group="arn:${Partition}:svc:::group/${GroupName}")
or d["operations"]["svc:B"]["resources"][0].update(account="registryId"), "no account of its ARN"),
+ (lambda d: d["operations"]["svc:B"]["resources"][0].update(unless={"Type": []}), "no member's values"),
+ (lambda d: d["operations"]["svc:B"]["resources"][0].update(absent={"Bus": ""}), "absent members"),
+ (lambda d: d["operations"]["svc:B"]["resources"][0].update(absent={"Bus[]": "default"}), "absent members"),
+ (lambda d: d["operations"]["svc:B"]["resources"][0].update(arnOf={"Bus": "pool"}), "types of one variable"),
+ (lambda d: d["arnFormats"]["svc"].update(group="arn:${Partition}:svc:${Region}:${Account}:group/${GroupName}/${Id}")
+ or d["operations"]["svc:B"]["resources"][0].update(arnOf={"Bus": "group"}), "types of one variable"),
+ (lambda d: d["operations"]["svc:A"]["resources"][0].update(unless={"Type": ["a"]}), "neither an ARN member"),
+ (lambda d: d["clientsNotRead"].update(svcv2=""), "clientsNotRead"),
(lambda d: d.update(unqualified={"svc": ["pool"]}), "unqualified"),
(lambda d: d.update(unqualified={"other": ["thing"]}), "unqualified"),
(lambda d: d.update(unqualified={"svc": []}), "unqualified"),
(lambda d: d.pop("unqualified"), "unqualified"),
+ (lambda d: d.update(mintedIds={"svc": ["group"]}), "mintedIds"),
+ (lambda d: d.update(mintedIds={"other": ["thing"]}), "mintedIds"),
+ (lambda d: d.update(mintedIds={"svc": []}), "mintedIds"),
+ (lambda d: d.pop("mintedIds"), "mintedIds"),
])
def test_a_malformed_document_is_rejected(change, problem):
document = good_document()
@@ -301,7 +388,9 @@ def test_every_correction_is_the_vendored_entry_of_an_operation_the_file_reads()
assert r.CORRECTIONS
for operation, (resources, reason) in r.CORRECTIONS.items():
assert operation in operations and reason, operation
- assert operations[operation]["resources"] == resources, operation
+ # A resource's account and the ARNs its members may give are botocore's, on top of the correction.
+ assert [{key: value for key, value in resource.items() if key not in ("account", "arnOf")}
+ for resource in operations[operation]["resources"]] == resources, operation
def test_a_correction_gives_the_operation_its_resources(corrections):
@@ -326,6 +415,20 @@ def test_the_vendored_file_is_well_formed():
# StartExecution's name is the execution's, so only its state machine ARN is read, up to a test case's #.
assert operations["states:StartExecution"]["resources"] == [
{"types": ["statemachine"], "arn": "stateMachineArn", "before": "#"}]
+ # An ARN inside a structure or each of a list's structures.
+ assert operations["elasticloadbalancing:SetRulePriorities"]["resources"] == [
+ {"types": ["listener-rule/app", "listener-rule/net"], "arn": "RulePriorities[].RuleArn"}]
+ assert operations["states:CreateStateMachineAlias"]["resources"] == [
+ {"types": ["statemachine"], "arn": "routingConfiguration[].stateMachineVersionArn"}]
+ # An EventBridge rule is on the bus EventBusName names, by name or ARN, or the default one when it names none.
+ assert operations["events:DescribeRule"]["resources"] == [
+ {"type": "rule-on-default-event-bus", "fill": {"RuleName": "Name"}, "when": {"EventBusName": ["default"]},
+ "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}},
+ {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Name"},
+ "unless": {"EventBusName": ["default"]}, "absent": {"EventBusName": "default"}, "arnOf": {"EventBusName": "event-bus"}}]
+ assert operations["events:DescribeEventBus"]["resources"] == [
+ {"type": "event-bus", "fill": {"EventBusName": "Name"}, "absent": {"Name": "default"}, "arnOf": {"Name": "event-bus"}}]
+ assert document["namespaces"]["events"] == ["events"] and "eventbridgev2" in document["clientsNotRead"]
# A state machine's version or alias is checked on the state machine.
assert document["unqualified"] == {"states": ["statemachine"]}
# A listener is made under a load balancer, and a rule under a listener.