fix(lambda): accept layer ARNs when deleting versions (#8409)

* fix(lambda): accept layer ARNs when deleting versions
* test(lambda): share layer publication cleanup
* test(iam): include layer deletion in the resource inventory
* fix(lambda): read Lambda's IAM resources whole from the generated table
This commit is contained in:
Jackson Price authored and GitHub committed 2026-11-15 01:56:37 -04:00
1 parent ce25aa0247
commit b8014cbd4e
22 files changed
+1219 -906

No files matched your search

+19 -17
View File
@@ -1925,7 +1925,7 @@ requests retain HTTP 403 XML `AccessDenied` responses, except SNS's, which retur
`AuthorizationError`, the error every SNS operation lists for a caller denied access, whichever
action is denied. The routed protocol determines 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,
A request is checked against the resources it names. Floci builds their ARNs itself for S3,
SQS, SNS, DynamoDB, Kinesis, SSM, KMS, IAM, Resource Groups, EventBridge
Pipes, Aurora DSQL, EKS, API Gateway, CloudWatch Logs and STS. For Secrets Manager, Elastic Load Balancing, ECR,
Step Functions, EventBridge, EventBridge Scheduler, Amazon Cognito user pools and identity pools, Amazon Data Firehose, Cloud
@@ -1935,7 +1935,7 @@ AWS Data Exports, AWS Pricing Calculator, Cost Explorer, CloudTrail, Global Acce
Timestream for InfluxDB, Amazon Redshift, the Amazon Redshift Data API, AWS Payment Cryptography, AWS DataSync, Amazon EMR,
Amazon Rekognition, IAM Identity Center, Amazon Inspector, Amazon Macie, AWS Fault Injection Service, AWS Resource
Access Manager, CloudWatch Observability Access Manager, AWS Resource Explorer, AWS Account Management, AWS Control
Catalog, Amazon OpenSearch Service, IAM Access Analyzer, AWS Security Hub and Amazon GuardDuty they come from a table generated from AWS's Service Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
Catalog, Amazon OpenSearch Service, IAM Access Analyzer, AWS Security Hub, Amazon GuardDuty and Lambda 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. Nothing in it is
@@ -2127,21 +2127,23 @@ names one, as botocore documents ("If you omit this, the default schedule group
`schedule-group/<name>`, all from the generated table. Its tagging is checked on the group its modeled
`/tags/{ResourceArn}` carries, the ARN encoded as an SDK sends it. A Pipes request is checked against `pipe/<name>`. A DSQL request
is checked against `cluster/<id>`, `cluster/<id>/stream/<id>` for a stream, or the ARN a tagging
route names; `CreateCluster` and `ListClusters` against `cluster/*`, as DSQL checks them. A MicroVM image
or network connector request is checked against `microvm-image:<name>` or `network-connector:<id>`
in the request's account and Region, an identifier given as an ARN taken for its name, as the
service looks it up. `RunMicrovm` is checked against the image its `imageIdentifier` names, an
action on a running MicroVM against the image that MicroVM runs, and a managed image's versions
against that image, which `aws` owns. A Lambda event source mapping, code signing config or layer
version request is checked against `event-source-mapping:<uuid>`, `code-signing-config:<id>` or
`layer:<name>:<version>` in the request's account and Region, where Lambda looks them up: a config
by the id that ends its ARN, and a layer by its name as given, even a name given as an ARN or
holding an encoded `/`, and its version as the number Lambda parses, so `01` is checked as `1`.
`PublishLayerVersion` is checked against `layer:<name>`, and `GetLayerVersionByArn` against the
layer version its `Arn` names, its number read the same way. A Lambda tagging request, at
`/2017-03-31/tags/<arn>`, is checked against the caller's own function, MicroVM image or network
connector of that ARN's Region and name, whatever account the ARN names, as Lambda looks it up, and
an event source mapping's ARN as written.
route names; `CreateCluster` and `ListClusters` against `cluster/*`, as DSQL checks them. A Lambda request
is checked on what the table reads from it, as for the other services it reads. A function named by its
name, its ARN, a partial ARN (`123456789012:function:my-function`, its Region optional) or its resource
part (`function:my-function`) is the function of that name, an ARN keeping its account and Region beside
the caller's function of that name. A version or alias written into the name is part of the function
checked, `function:<name>:<qualifier>`. `Qualifier` names a version or alias only for the provisioned
concurrency operations, which the Service Reference gives the function's version and alias; for an
operation it gives the function alone, the function is checked as its name gives it. `AddPermission`'s
`SourceAccount` is the account of its `SourceArn`, not the function's. An action on a running MicroVM is
checked against the image Lambda says the caller's MicroVM runs, and a durable execution callback
against the execution its callback belongs to ("Lambda authorizes callback requests against the ARN of
the durable execution that created the callback"). A MicroVM image, network connector, event source
mapping, code signing config, layer or Web Function is checked on the resource its member names, a
layer version's number read as the number Lambda parses, so `01` is checked as `1`, and a tagging
request on the ARN it names. A managed MicroVM image named by its name is checked in the caller's
account, where the Service Reference puts the type; named by its ARN, in `aws`, the account that ARN
names.
An EKS request is checked in the caller's account, where EKS looks everything up. A cluster route is
checked against the ARN EKS holds the cluster under, or `cluster/<name>` in the request's Region for
+14 -6
View File
@@ -116,15 +116,18 @@ part in authorizing calls to the function:
- Provisioned-concurrency configuration operations also act in the account named by the function
reference. Cross-account access requires that function's policy to allow the caller.
- Other operations act on the caller's own function of the name the ARN gives, whatever account
the ARN names, and are authorized against that function. Floci does not serve them on another
account's function, which AWS allows through a function policy.
the ARN names, and are authorized against both the function the ARN names and the caller's own
function of that name. Floci does not serve them on another account's function, which AWS allows
through a function policy.
- Within one account, a statement naming the caller grants on its own. One naming only the
account, as `AddPermission --principal <account-id>` writes it, delegates to the account, so the
caller's identity policy has to allow the call too.
- An invoke or provisioned-concurrency configuration operation is authorized against the version or
alias it names, in the function name or in `Qualifier`. A grant added with `Qualifier` covers that
version or alias only, and a grant on the function does not cover a qualified operation.
Other operations are authorized against the unqualified function.
- A version or alias written into the function name is part of the function an operation is
authorized against, so a grant added with `Qualifier` covers a call naming that version or alias,
and a grant on the function does not. `Qualifier` itself names a version or alias only for the
provisioned-concurrency configuration operations, which act on it; every other operation is
authorized against the function as its name gives it, as the Service Reference lists the function
alone for those actions.
- A statement conditioned on `InvokedViaFunctionUrl` does not admit a direct `Invoke`.
- `aws:PrincipalOrgID` is not part of the request context, so a grant added with `PrincipalOrgID`
admits no caller.
@@ -519,6 +522,11 @@ validate each `Layers` ARN in the caller's own account eagerly against that stor
real AWS - an unresolvable one is rejected with `InvalidParameterValueException: Layer version
... does not exist.`, not silently accepted.
`DeleteLayerVersion` accepts either a layer name or an unversioned layer ARN, with
`VersionNumber` supplied separately. ARN deletion resolves the stored version in the ARN's
region and removes its archive. IAM checks use that same layer-version ARN; another
account's ARN cannot select a same-named layer in the caller's account.
An ARN naming another account or another partition is answered on the live service by the layer's
resource policy: an AWS-managed public layer resolves, and everything else is
`AccessDeniedException`. Measured on `CreateFunction` in ap-southeast-1, a foreign-account ARN and
@@ -20,6 +20,7 @@ import io.floci.aws.services.iam.ResourceArnBuilder;
import io.floci.aws.services.iam.model.IamRole;
import io.floci.aws.services.iam.model.IamUser;
import io.floci.aws.services.lambdaweb.LambdaWebService;
import io.floci.aws.services.lambdaweb.model.WebFunctionEndpoint;
import io.floci.aws.services.s3.S3ConditionKeys;
import io.floci.aws.services.s3.S3ControlTagConditionKeys;
import io.floci.aws.services.s3.S3ObjectActions;
@@ -609,25 +610,28 @@ public class IamConditionContextResolver {
.forEach(value -> putIfPresent(conditions, REQUEST_AUTH_TYPE, value));
}
if (RequestConditionKeys.takes(action, RESOURCE_AUTH_TYPE)) {
putIfPresent(conditions, RESOURCE_AUTH_TYPE, storedAuthType(ctx));
putIfPresent(conditions, RESOURCE_AUTH_TYPE, storedAuthType(action, ctx));
}
return conditions.isEmpty() ? null : conditions;
}
private String storedAuthType(ContainerRequestContext ctx) {
/** The authType of the web function endpoint the request names, as the request resources read it. */
private String storedAuthType(String action, ContainerRequestContext ctx) {
if (!lambdaWebService.isResolvable()) {
return null;
}
String region = requestContext.getRegion() == null ? config.defaultRegion() : requestContext.getRegion();
String endpointArn = ResourceArnBuilder.webFunctionArn(ctx.getUriInfo().getPath(), region,
requestContext.getAccountId());
String endpointArn = RequestResources.of(action, ctx, regionResolver.partitionForRegion(region), region,
requestContext.getAccountId(), null, IamActionRegistry.pathLabels("lambda", ctx)).stream()
.filter(arn -> arn.contains("/endpoint/")).findFirst().orElse("");
int child = endpointArn.lastIndexOf("/endpoint/");
if (child < 0) {
return null;
}
try {
return lambdaWebService.get().getEndpoint(region, endpointArn.substring(0, child),
endpointArn.substring(child + "/endpoint/".length())).authType;
WebFunctionEndpoint endpoint = lambdaWebService.get().getEndpoint(region, endpointArn.substring(0, child),
endpointArn.substring(child + "/endpoint/".length()));
return endpoint == null ? null : endpoint.authType;
} catch (AwsException expected) {
// The handler refuses the same names, so the key is only left out, as for a missing endpoint on AWS.
return null;
@@ -61,7 +61,7 @@ final class RequestResourceMembers {
private static final Set<String> ARN_KEYS = Set.of("types", "arn", "made", "endpoint");
/** The keys of a resource whose format's variables members fill, or its service finds by them. */
private static final Set<String> FILL_KEYS = Set.of("type", "fill", "when", "unless", "arnOf", "account", "fixed",
"made", "find", "endpoint", "default", "whenDefault", "unlessDefault", "defaults");
"made", "find", "endpoint", "default", "whenDefault", "unlessDefault", "defaults", "partialArn");
/** The keys of a resource named through a member naming another of its service's own: it is read no other way. */
private static final Set<String> THROUGH_KEYS = Set.of("types", "through", "when", "endpoint");
/** The keys of a resource its service acts on for a request naming none of it: it is read no other way. */
@@ -221,13 +221,25 @@ final class RequestResourceMembers {
* variable that is the one of another type's format names that type's default when the request leaves it out
* ({@code defaults}, the member mapped to the type), which the service gives: an ECS service of a request with no
* {@code cluster} is on the default cluster. One member of {@code find} may be a list, each of whose values the
* service finds (ECS's {@code taskDefinitions[]}).
* service finds (ECS's {@code taskDefinitions[]}). A
* {@code partialArn} type's members may give its ARN with the leading parts left out, its account and resource
* ({@code 123456789012:function:my-function}) or its Region too, which the reader completes in the request's
* partition, and Region where the value leaves that out.
*/
record Resource(List<String> types, Member arn, Map<String, Member> fill, Map<String, List<String>> when,
Map<String, List<String>> unless, Map<String, String> arnOf, Member account,
Map<String, String> fixed, boolean made, List<Member> find, String endpoint, Member through,
boolean byDefault, Map<String, String> whenDefault, Map<String, String> unlessDefault,
Map<String, String> defaults) {
Map<String, String> defaults, boolean partialArn) {
Resource(List<String> types, Member arn, Map<String, Member> fill, Map<String, List<String>> when,
Map<String, List<String>> unless, Map<String, String> arnOf, Member account,
Map<String, String> fixed, boolean made, List<Member> find, String endpoint, Member through,
boolean byDefault, Map<String, String> whenDefault, Map<String, String> unlessDefault,
Map<String, String> defaults) {
this(types, arn, fill, when, unless, arnOf, account, fixed, made, find, endpoint, through, byDefault,
whenDefault, unlessDefault, defaults, false);
}
Resource(List<String> types, Member arn, Map<String, Member> fill, Map<String, List<String>> when,
Map<String, List<String>> unless, Map<String, String> arnOf, Member account,
@@ -684,9 +696,15 @@ final class RequestResourceMembers {
throw new IllegalStateException(RESOURCE_NAME + " takes " + type + "'s account for " + operation
+ " from " + account.name() + ", no member of one account or a type of none");
}
boolean partialArn = resource.has("partialArn");
if (partialArn && (!resource.path("partialArn").isBoolean() || !resource.path("partialArn").booleanValue()
|| fill.isEmpty())) {
throw new IllegalStateException(RESOURCE_NAME + " reads " + type + " for " + operation
+ " from a partial ARN " + resource.path("partialArn") + ", not true for a type its members fill");
}
return new Resource(List.of(type), null, Map.copyOf(fill), when, unless, Map.copyOf(arnOf), account,
Map.copyOf(fixed), made, List.copyOf(find), endpoint, null, byDefault, whenDefault, unlessDefault,
defaults(operation, type, resource.path("defaults"), fill, formats));
defaults(operation, type, resource.path("defaults"), fill, formats), partialArn);
}
/**
@@ -47,6 +47,8 @@ public final class RequestResources {
private static final Pattern VARIABLE = Pattern.compile("\\$\\{(\\w+)}");
private static final Pattern ACCOUNT_ID = Pattern.compile("\\d{12}");
/** An ARN without its leading {@code arn:<partition>:<service>:}, its Region optional: {@code 123456789012:function:f}. */
private static final Pattern PARTIAL_ARN = Pattern.compile("(?:([a-z]{2}(?:-[a-z0-9]+)+-\\d+):)?(\\d{12}):(.+)");
private static final String WITHOUT_LEADING_SLASH = "WithoutLeadingSlash";
/** Values for a type's variables, and the ARN whose account and Region the resource they name is in, if any. */
@@ -639,6 +641,8 @@ public final class RequestResources {
.map(value -> variable.getKey().endsWith(WITHOUT_LEADING_SLASH)
? asVariable(variable.getKey(), value)
: withoutTypePath(value, resource.types().getFirst()))
.map(value -> resource.partialArn() ? completed(value, variable.getValue(), resource, formats,
format, partition, region, accountId) : value)
.toList();
// An element of a list naming no resource names its service's default (a PutEvents entry with no bus).
if (variable.getValue().eachElement() && stored != null && resource.fill().size() == 1) {
@@ -714,6 +718,39 @@ public final class RequestResources {
}
}
/**
* The value of a member of a {@code partialArn} type as an ARN: one giving its account and resource
* ({@code 123456789012:function:my-function}), or its Region too, completed in the request's partition and, where
* it leaves the Region out, the request's; one giving the resource alone ({@code function:my-function}) in the
* caller's account too; as given otherwise, a name or a whole ARN. A member that may give the ARN of another type
* ({@code arnOf}) is completed as that type's.
*/
static String completed(String value, RequestResourceMembers.Member member,
RequestResourceMembers.Resource resource,
Map<String, RequestResourceMembers.ArnFormat> formats,
RequestResourceMembers.ArnFormat format, String partition, String region,
String accountId) {
RequestResourceMembers.ArnFormat named = arnOf(resource, member.path(), formats);
RequestResourceMembers.ArnFormat type = named == null ? format : named;
String[] parts = type.format().split(":", 6);
int variable = parts.length < 6 ? -1 : parts[5].indexOf("${");
if (variable <= 0) {
return value;
}
String word = parts[5].substring(0, variable);
Matcher partial = PARTIAL_ARN.matcher(value);
String arn;
if (partial.matches() && partial.group(3).startsWith(word)) {
arn = new AwsArnUtils.Arn(partition, parts[2], partial.group(1) == null ? region : partial.group(1),
partial.group(2), partial.group(3)).toString();
} else if (value.startsWith(word) && value.length() > word.length()) {
arn = new AwsArnUtils.Arn(partition, parts[2], region, accountId, value).toString();
} else {
return value;
}
return type.pattern().matcher(arn).matches() ? arn : value;
}
/**
* The value as the variable takes it: a variable named for leaving out the leading {@code /} takes a Parameter
* Store name without the whitespace around it, which a put drops, and without one leading {@code /}, as an SSM
@@ -18,9 +18,6 @@ import io.floci.aws.services.cloudwatch.logs.LogGroupTagTarget;
import io.floci.aws.services.eks.EksController;
import io.floci.aws.services.eks.EksService;
import io.floci.aws.services.kms.KmsService;
import io.floci.aws.services.lambda.LambdaArnUtils;
import io.floci.aws.services.lambda.durable.DurableTokens;
import io.floci.aws.services.lambdamicrovms.LambdaMicrovmsService;
import io.floci.aws.services.s3.S3ControlArnUtils;
import io.floci.aws.services.s3.S3ObjectKeys;
import io.floci.aws.services.s3.S3ResourceArns;
@@ -47,7 +44,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.StringJoiner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
@@ -88,8 +84,6 @@ public class ResourceArnBuilder {
* which IamService itself does not depend on, and a direct injection would close that loop.
*/
private final Instance<IamService> iamService;
/** Looked up lazily for the same reason, to read the image a MicroVM runs. */
private final Instance<LambdaMicrovmsService> microvmsService;
/** Looked up lazily for the same reason, to read the ARN an EKS cluster or what it holds is stored under. */
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. */
@@ -108,14 +102,12 @@ public class ResourceArnBuilder {
@Inject
public ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService,
Instance<LambdaMicrovmsService> microvmsService,
Instance<EksService> eksService,
Instance<KmsService> kmsService,
Instance<StoredResourceArns> storedResourceArns,
CurrentVertxRequest currentVertxRequest) {
this.objectMapper = objectMapper;
this.iamService = iamService;
this.microvmsService = microvmsService;
this.eksService = eksService;
this.kmsService = kmsService;
this.storedResourceArns = storedResourceArns;
@@ -123,30 +115,21 @@ public class ResourceArnBuilder {
}
public ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService,
Instance<LambdaMicrovmsService> microvmsService,
Instance<EksService> eksService,
Instance<KmsService> kmsService,
Instance<StoredResourceArns> storedResourceArns) {
this(objectMapper, iamService, microvmsService, eksService, kmsService,
storedResourceArns, null);
this(objectMapper, iamService, eksService, kmsService, storedResourceArns, null);
}
public ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService,
Instance<LambdaMicrovmsService> microvmsService,
Instance<EksService> eksService,
Instance<KmsService> kmsService) {
this(objectMapper, iamService, microvmsService, eksService, kmsService, null);
this(objectMapper, iamService, eksService, kmsService, null);
}
public ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService,
Instance<LambdaMicrovmsService> microvmsService,
Instance<EksService> eksService) {
this(objectMapper, iamService, microvmsService, eksService, null);
}
public ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService,
Instance<LambdaMicrovmsService> microvmsService) {
this(objectMapper, iamService, microvmsService, null);
this(objectMapper, iamService, eksService, null);
}
ResourceArnBuilder(ObjectMapper objectMapper, Instance<IamService> iamService) {
@@ -162,7 +145,7 @@ public class ResourceArnBuilder {
}
ResourceArnBuilder(ObjectMapper objectMapper, CurrentVertxRequest currentVertxRequest) {
this(objectMapper, null, null, null, null, null, currentVertxRequest);
this(objectMapper, null, null, null, null, currentVertxRequest);
}
public String build(String credentialScope, ContainerRequestContext ctx,
@@ -203,7 +186,6 @@ public class ResourceArnBuilder {
: IamActionRegistry.decodedPath(ctx);
return switch (credentialScope) {
case "s3" -> buildS3Resources(operation, path, ctx, region);
case "lambda" -> List.of(buildLambdaArn(path, ctx, region, accountId));
case "sqs" -> List.of(buildSqsArn(ctx, region, accountId));
case "sns" -> List.of(buildSnsArn(ctx, region, accountId));
case "dynamodb" -> buildDynamoDbArns(ctx, region, accountId);
@@ -951,281 +933,6 @@ public class ResourceArnBuilder {
}
}
// ── Lambda ──────────────────────────────────────────────────────────────────
/**
* The function a Lambda request acts on, as an IAM policy names it. An invoke runs the function
* in the account and Region its full or partial ARN names, so it is evaluated against that
* function, and against the version or alias it names in the function name or in
* {@code Qualifier}, since Lambda authorizes a qualified call against the qualified ARN (Lambda
* Developer Guide, "Referencing functions in the Resource section of policies"). The reads
* {@link #readsInTheAccountItNames} names act in the account a qualified ARN names too. Every
* other route acts on the caller's own function of that name, whatever account an ARN names.
* Those are evaluated unqualified, because not every one of them acts on the qualifier it is
* given.
*/
private String buildLambdaArn(String path, ContainerRequestContext ctx, String region, String accountId) {
String webFunctionArn = webFunctionArn(path, region, accountId);
if (webFunctionArn != null) {
return webFunctionArn;
}
String microvmArn = microvmArn(path, ctx, region, accountId);
if (microvmArn != null) {
return microvmArn;
}
// TagResource, ListTags and UntagResource name the tagged function, image or other resource by its ARN.
if (path.startsWith("/2017-03-31/tags/")) {
return lambdaTaggedArn(path.substring("/2017-03-31/tags/".length()), accountId);
}
String executionArn = durableExecutionArn(path);
if (executionArn == null) {
executionArn = durableCallbackExecutionArn(path);
}
if (executionArn != null) {
return executionArn;
}
String childArn = lambdaChildArn(path, ctx, region, accountId);
if (childArn != null) {
return childArn;
}
// path: /2015-03-31/functions/name or similar
String name = extractSegmentAfter(path, "functions");
if (name == null) {
return createdFunctionArn(path, ctx, region, accountId);
}
if (path.endsWith("/code-signing-config")) {
return codeSigningFunctionArn(name, region, accountId);
}
boolean qualifiedTarget = path.endsWith("/functions/" + name + "/invocations")
|| path.endsWith("/functions/" + name + "/response-streaming-invocations")
|| path.endsWith("/functions/" + name + "/provisioned-concurrency");
try {
if (!qualifiedTarget) {
LambdaArnUtils.ResolvedFunctionRef ref = LambdaArnUtils.resolve(name);
boolean namedAccount = readsInTheAccountItNames(path, name, ref, ctx);
return AwsArnUtils.Arn.of("lambda",
namedAccount ? ref.region() : region,
namedAccount ? ref.account() : accountId,
"function:" + ref.name()).toString();
}
LambdaArnUtils.ResolvedFunctionRef ref = LambdaArnUtils.resolveWithQualifier(
name, ctx.getUriInfo().getQueryParameters().getFirst("Qualifier"));
String resource = ref.qualifier() != null
? "function:" + ref.name() + ":" + ref.qualifier()
: "function:" + ref.name();
return AwsArnUtils.Arn.of("lambda",
ref.region() != null ? ref.region() : region,
ref.account() != null ? ref.account() : accountId,
resource).toString();
} catch (AwsException e) {
// A reference Lambda refuses, which its handler answers with a 400 before acting on anything.
return AwsArnUtils.Arn.of("lambda", region, accountId, "function:" + name).toString();
}
}
/** Code-signing attachment routes use Lambda's broader NamespacedFunctionName shape. */
private static String codeSigningFunctionArn(String name, String region, String accountId) {
try {
LambdaArnUtils.ResolvedFunctionRef ref = LambdaArnUtils.resolveNamespacedFunctionName(name);
return AwsArnUtils.Arn.of("lambda", region, accountId, "function:" + ref.name()).toString();
} catch (AwsException e) {
// A reference Lambda refuses, which its handler answers with a 400 before acting on anything.
return AwsArnUtils.Arn.of("lambda", region, accountId, "function:" + name).toString();
}
}
/**
* The function {@code CreateFunction} makes, which its body names, in the caller's account and Region, as
* every route but an invoke acts there: the Service Reference gives it the {@code function} resource, so
* its own action, and the tagging action its tags need, are checked on that function. {@code *} for any
* other route that names no function.
*/
private String createdFunctionArn(String path, ContainerRequestContext ctx, String region, String accountId) {
if (!"POST".equalsIgnoreCase(ctx.getMethod()) || !"/2015-03-31/functions".equals(path)) {
return "*";
}
JsonNode body = readJsonBody(ctx);
JsonNode name = body == null ? null : body.get("FunctionName");
if (name == null || !name.isTextual() || name.asText().isEmpty()) {
return "*";
}
try {
return AwsArnUtils.Arn.of("lambda", region, accountId,
"function:" + LambdaArnUtils.resolve(name.asText()).name()).toString();
} catch (AwsException e) {
// A name Lambda refuses, which its handler answers with a 400 before creating anything.
return AwsArnUtils.Arn.of("lambda", region, accountId, "function:" + name.asText()).toString();
}
}
/**
* The resource of a Lambda event source mapping, code signing config or layer route, as the Service
* Reference gives it. A mapping is looked up by its UUID, a config by the id that ends its ARN and a
* layer version by its layer's name as given, an ARN included, and its number, each in the request's
* account and Region, so that is the resource checked. A layer route's path is split as the router
* splits it, before decoding, so an encoded {@code /} stays inside the layer's name, and its version
* number is read as Lambda parses it, so {@code 01} is version 1. {@code PublishLayerVersion} is checked
* against the layer and {@code GetLayerVersionByArn} against the version its {@code Arn} names, its
* number read the same way. Listing configs, layers or a layer's versions, and creating a config, name
* no resource, so they are {@code *}. Null for every other Lambda route.
*/
private static String lambdaChildArn(String path, ContainerRequestContext ctx, String region, String accountId) {
String mapping = segmentAfterPrefix(path, "/2015-03-31/event-source-mappings/");
if (mapping != null) {
return AwsArnUtils.Arn.of("lambda", region, accountId, "event-source-mapping:" + mapping).toString();
}
if (path.startsWith("/2020-04-22/code-signing-configs")) {
String config = segmentAfterPrefix(path, "/2020-04-22/code-signing-configs/");
return config == null ? "*"
: AwsArnUtils.Arn.of("lambda", region, accountId,
"code-signing-config:" + trailingName(config)).toString();
}
if (path.equals("/2018-10-31/layers")) {
String arn = ctx.getUriInfo().getQueryParameters().getFirst("Arn");
boolean byArn = "LayerVersion".equals(ctx.getUriInfo().getQueryParameters().getFirst("find"));
return byArn && AwsArnUtils.isArnFor(arn, "lambda") ? layerVersionArn(arn) : "*";
}
String layers = "/2018-10-31/layers/";
if (!path.startsWith(layers)) {
return null;
}
String raw = IamActionRegistry.rawPath(ctx);
if (!raw.startsWith(layers)) {
return "*";
}
String[] segments = raw.substring(layers.length()).split("/");
if (segments.length < 2 || !"versions".equals(segments[1])) {
return "*";
}
String layer = "layer:" + pathSegment(segments[0]);
if (segments.length == 2) {
return "POST".equalsIgnoreCase(ctx.getMethod())
? AwsArnUtils.Arn.of("lambda", region, accountId, layer).toString() : "*";
}
return AwsArnUtils.Arn.of("lambda", region, accountId,
layer + ":" + layerVersion(pathSegment(segments[2]))).toString();
}
/** A layer version ARN, its version number written as Lambda parses it. */
private static String layerVersionArn(String arn) {
int colon = arn.lastIndexOf(':');
return arn.substring(0, colon + 1) + layerVersion(arn.substring(colon + 1));
}
/** A layer version number as Lambda parses it, so {@code 01} is 1; as given when it is no number. */
private static String layerVersion(String version) {
try {
return Long.toString(Long.parseLong(version));
} catch (NumberFormatException e) {
return version;
}
}
/**
* A path segment as sent, decoded as a path parameter is: a {@code +} stays a {@code +}. A malformed
* escape is kept as sent.
*/
private static String pathSegment(String raw) {
try {
return URLDecoder.decode(raw.replace("+", "%2B"), StandardCharsets.UTF_8);
} catch (IllegalArgumentException e) {
return raw;
}
}
/**
* The resource of a Lambda MicroVM or network connector route, as the Service Reference gives it:
* {@code microvm-image:<name>} for an action on an image, its versions and builds, and
* {@code network-connector:<id>} for one on a connector. An identifier given as an ARN is taken for
* its trailing name, in the request's account and Region, since that is the resource the service
* looks up and acts on, whatever account or Region the ARN names. {@code RunMicrovm} is checked
* against the image its {@code imageIdentifier} names, read the same way, an action on a running
* MicroVM against the image that MicroVM runs, and a managed image's versions against the managed
* image. Creating an image or a connector, listing them and listing MicroVMs name no resource, so
* they are {@code *}, as is a MicroVM the account does not hold. Null for every other Lambda route.
*/
private String microvmArn(String path, ContainerRequestContext ctx, String region, String accountId) {
if (path.startsWith("/2025-09-09/")) {
String image = segmentAfterPrefix(path, "/2025-09-09/microvm-images/");
if (image != null) {
return microvmImageArn(region, accountId, image);
}
String managed = segmentAfterPrefix(path, "/2025-09-09/managed-microvm-images/");
if (managed != null) {
return LambdaMicrovmsService.namesManagedImage(managed)
? LambdaMicrovmsService.managedImageArn(region) : "*";
}
String microvm = segmentAfterPrefix(path, "/2025-09-09/microvms/");
if (microvm != null) {
return runningMicrovmImageArn(region, microvm);
}
if (path.equals("/2025-09-09/microvms") && "POST".equalsIgnoreCase(ctx.getMethod())) {
JsonNode body = readJsonBody(ctx);
String identifier = body == null ? null : body.path("imageIdentifier").asText(null);
return identifier == null || identifier.isBlank() ? "*" : microvmImageArn(region, accountId, identifier);
}
return "*";
}
if (path.startsWith("/2026-04-04/")) {
String connector = segmentAfterPrefix(path, "/2026-04-04/network-connectors/");
return connector == null ? "*"
: AwsArnUtils.Arn.of("lambda", region, accountId,
"network-connector:" + trailingName(connector)).toString();
}
return null;
}
private static String microvmImageArn(String region, String accountId, String identifier) {
return AwsArnUtils.Arn.of("lambda", region, accountId, "microvm-image:" + trailingName(identifier)).toString();
}
/** The image the caller's MicroVM runs, or {@code *} when the account holds no such MicroVM to act on. */
private String runningMicrovmImageArn(String region, String microvmId) {
if (microvmsService == null) {
return "*";
}
return microvmsService.get().findMicrovm(region, microvmId)
.map(vm -> vm.imageArn)
.filter(arn -> arn != null && !arn.isBlank())
.orElse("*");
}
/** An identifier's name: an ARN's part after its last {@code :}, as the MicroVM service unwraps it. */
private static String trailingName(String identifier) {
return AwsArnUtils.looksLikeArn(identifier) ? identifier.substring(identifier.lastIndexOf(':') + 1) : identifier;
}
/**
* The resource a Lambda tag route acts on, from the ARN it names. Tagging looks a function up by the
* ARN's Region and name, and a MicroVM image or network connector by the ARN's Region and trailing
* name, in the caller's own account whatever account the ARN names, so that resource is the one
* checked. The MicroVM tag handler takes only a Lambda ARN naming an image or a connector with no
* version, so the target is read through {@link LambdaMicrovmsService#taggedResource}, as it reads it.
* Any other ARN, an event source mapping's included, has to name its resource exactly or is
* refused, so it is checked as written.
*/
private static String lambdaTaggedArn(String tagged, String accountId) {
// The image or connector LambdaMicrovmsService tags: the caller's own, in the ARN's Region.
Optional<String> microvmResource = LambdaMicrovmsService.taggedResource(tagged);
if (microvmResource.isPresent()) {
String region = AwsArnUtils.parse(tagged).region();
if (!region.isBlank()) {
return AwsArnUtils.Arn.of("lambda", region, accountId, microvmResource.get()).toString();
}
}
if (!AwsArnUtils.looksLikeArn(tagged)) {
return "*";
}
try {
LambdaArnUtils.ResolvedFunctionRef ref = LambdaArnUtils.resolve(tagged);
return ref.qualifier() != null ? tagged
: AwsArnUtils.Arn.of("lambda", ref.region(), accountId, "function:" + ref.name()).toString();
} catch (AwsException e) {
// Not a function ARN Lambda takes, which it tags only when the ARN names the resource exactly.
return tagged;
}
}
/**
* The resource of an Aurora DSQL route, as the Service Authorization Reference names it: the cluster
* a cluster route names, the stream a stream route names (its cluster, to create or list streams), or
@@ -1448,6 +1155,18 @@ public class ResourceArnBuilder {
return null;
}
/**
* A path segment as sent, decoded as a path parameter is: a {@code +} stays a {@code +}. A malformed
* escape is kept as sent.
*/
private static String pathSegment(String raw) {
try {
return URLDecoder.decode(raw.replace("+", "%2B"), StandardCharsets.UTF_8);
} catch (IllegalArgumentException e) {
return raw;
}
}
/** The path segment right after {@code prefix}, or null when the path doesn't start with it or names none. */
private static String segmentAfterPrefix(String path, String prefix) {
if (!path.startsWith(prefix)) {
@@ -1459,95 +1178,6 @@ public class ResourceArnBuilder {
return segment.isEmpty() ? null : segment;
}
/**
* The resource of a Lambda Web Functions route. An action on a revision or an endpoint is evaluated
* against that child's ARN; an action on the function, a create of a revision or endpoint, the list of
* either, and the tag and resource-policy routes against the function's (Lambda Developer Guide,
* "Lambda Web Function permissions"). ListWebFunctions, GetWebAccountSettings and CreateWebFunction
* name no resource. Null for every other Lambda route.
*/
public static String webFunctionArn(String path, String region, String accountId) {
if (!path.startsWith("/2025-03-07/")) {
return null;
}
String rest = path.substring("/2025-03-07/".length());
if (rest.startsWith("tags/") || rest.startsWith("resource-policy/")) {
String arn = rest.substring(rest.indexOf('/') + 1);
return AwsArnUtils.looksLikeArn(arn) ? arn : "*";
}
if (!rest.startsWith("web-functions/")) {
return "*";
}
List<String> segments = new ArrayList<>(List.of(rest.substring("web-functions/".length()).split("/")));
if (segments.isEmpty() || segments.getFirst().isEmpty()) {
return "*";
}
String functionArn;
if (AwsArnUtils.looksLikeArn(segments.getFirst()) && segments.size() > 1) {
// A function ARN carries one slash: arn:...:web-function/<name>.
functionArn = segments.get(0) + "/" + segments.get(1);
segments.subList(0, 2).clear();
} else {
functionArn = AwsArnUtils.Arn.of("lambda", region, accountId,
"web-function/" + segments.getFirst()).toString();
segments.removeFirst();
}
if (segments.size() >= 2 && ("revisions".equals(segments.get(0)) || "endpoints".equals(segments.get(0)))) {
String child = "revisions".equals(segments.get(0)) ? "revision" : "endpoint";
String id = String.join("/", segments.subList(1, segments.size()));
if (AwsArnUtils.looksLikeArn(id) && id.contains("/" + child + "/")) {
// A revision or endpoint ARN ends in its id: arn:...:web-function/<name>/revision/<id>.
id = id.substring(id.lastIndexOf('/') + 1);
}
return functionArn + "/" + child + "/" + id;
}
return functionArn;
}
/**
* {@code GetFunction}, {@code GetFunctionConfiguration} and {@code ListDurableExecutionsByFunction}
* read a function named by a qualified full ARN in the account the ARN names, where the version or
* alias is resolved ({@code LambdaService.getFunction(region, name, qualifier)}). Unqualified, or
* by partial ARN, they read the caller's own function of that name, as every other route acts.
*/
private static boolean readsInTheAccountItNames(String path, String name,
LambdaArnUtils.ResolvedFunctionRef ref,
ContainerRequestContext ctx) {
if (!"GET".equals(ctx.getMethod()) || !AwsArnUtils.looksLikeArn(name)) {
return false;
}
String route = path.substring(path.indexOf("/functions/" + name) + "/functions/".length() + name.length());
if (!route.isEmpty() && !route.equals("/configuration") && !route.equals("/durable-executions")) {
return false;
}
String qualifier = ctx.getUriInfo().getQueryParameters().getFirst("Qualifier");
return ref.qualifier() != null || (qualifier != null && !qualifier.isBlank());
}
/** Durable execution actions are authorized against the execution ARN, which carries the version. */
private static String durableExecutionArn(String path) {
String prefix = "/durable-executions/";
int executions = path.indexOf(prefix);
if (executions < 0) {
return null;
}
Matcher matcher = LambdaArnUtils.DURABLE_EXECUTION_ARN.matcher(path.substring(executions + prefix.length()));
return matcher.lookingAt() ? matcher.group() : null;
}
/** A callback id carries its execution ARN, so the callback actions are authorized against that execution. */
private static String durableCallbackExecutionArn(String path) {
String prefix = "/durable-execution-callbacks/";
int callbacks = path.indexOf(prefix);
int action = path.lastIndexOf('/');
if (callbacks < 0 || action <= callbacks + prefix.length()) {
return null;
}
return DurableTokens.callbackExecutionArn(path.substring(callbacks + prefix.length(), action))
.filter(arn -> LambdaArnUtils.DURABLE_EXECUTION_ARN.matcher(arn).matches())
.orElse(null);
}
// ── Bedrock ──────────────────────────────────────────────────────────────────
/**
@@ -2099,16 +1729,6 @@ public class ResourceArnBuilder {
}
}
private String extractSegmentAfter(String path, String segment) {
String marker = "/" + segment + "/";
int idx = path.indexOf(marker);
if (idx < 0) return null;
String after = path.substring(idx + marker.length());
// take only the first segment (stop at next /)
int slash = after.indexOf('/');
return slash > 0 ? after.substring(0, slash) : after;
}
// ── STS ─────────────────────────────────────────────────────────────────────
/**
* Uses the serving operation, as {@link #buildLogResources} does: {@code AssumeRole} is
@@ -8,7 +8,6 @@ import io.floci.aws.core.common.PaginatedResult;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.common.SignedMarkers;
import io.floci.aws.core.common.SmithyValidationErrors;
import io.floci.aws.core.common.StoredResourceArns;
import io.floci.aws.services.lambda.model.LambdaLayerVersion;
import io.floci.aws.services.lambda.zip.DeploymentPackage;
import io.floci.aws.services.lambda.zip.ZipExtractor;
@@ -35,7 +34,7 @@ import java.util.stream.Collectors;
* Business logic for Lambda Layer management.
*/
@ApplicationScoped
public class LambdaLayerService implements StoredResourceArns {
public class LambdaLayerService {
private static final Logger LOG = Logger.getLogger(LambdaLayerService.class);
@@ -101,19 +100,8 @@ public class LambdaLayerService implements StoredResourceArns {
this.s3Service = s3Service;
}
@Override
public String namespace() {
return "lambda";
}
@Override
public Optional<String> find(String type, List<String> names, String region) {
// Layer version selectors supply the complete identifier, so no generated suffix needs a lookup.
return Optional.empty();
}
@Override
public Optional<String> resolveStoredArn(String arn) {
/** The caller's stored layer version a layer version ARN selects; empty for another ARN or no such version. */
public Optional<String> storedLayerVersionArn(String arn) {
if (!LAYER_VERSION_ARN.matcher(arn).matches()) {
return Optional.empty();
}
@@ -340,11 +328,14 @@ public class LambdaLayerService implements StoredResourceArns {
* Deletes a specific layer version.
*/
public void deleteLayerVersion(String region, String layerName, long versionNumber) {
LambdaLayerVersion lv = layerStore.get(region, layerName, versionNumber).orElse(null);
LambdaLayerVersion lv = AwsArnUtils.looksLikeArn(layerName)
? findLayerVersionByArn(layerName + ":" + versionNumber)
: layerStore.get(region, layerName, versionNumber).orElse(null);
if (lv == null) {
// AWS returns 204 even if the layer version doesn't exist
return;
}
String layerRegion = AwsArnUtils.parse(lv.getLayerVersionArn()).region();
// Delete the extracted code from disk
if (lv.getCodeLocalPath() != null) {
@@ -352,9 +343,9 @@ public class LambdaLayerService implements StoredResourceArns {
deleteDirectory(codePath);
}
layerStore.delete(region, layerName, versionNumber);
deleteLayerArchive(region, lv);
LOG.infov("Deleted layer version: {0} v{1} in region {2}", layerName, versionNumber, region);
layerStore.delete(layerRegion, lv.getLayerName(), versionNumber);
deleteLayerArchive(layerRegion, lv);
LOG.infov("Deleted layer version: {0} v{1} in region {2}", lv.getLayerName(), versionNumber, layerRegion);
}
private void deleteLayerArchive(String region, LambdaLayerVersion lv) {
@@ -377,6 +368,15 @@ public class LambdaLayerService implements StoredResourceArns {
* answers them.
*/
public LambdaLayerVersion getLayerVersionByArn(String layerVersionArn) {
LambdaLayerVersion lv = findLayerVersionByArn(layerVersionArn);
if (lv == null) {
throw new AwsException("ResourceNotFoundException",
"The resource you requested does not exist.", 404);
}
return lv;
}
private LambdaLayerVersion findLayerVersionByArn(String layerVersionArn) {
if (layerVersionArn == null || layerVersionArn.isEmpty()) {
throw SmithyValidationErrors.validationException(
SmithyValidationErrors.notNull("arn"));
@@ -397,12 +397,7 @@ public class LambdaLayerService implements StoredResourceArns {
// A foreign account is a miss rather than a substitution: resolveLayerByArn scopes the
// lookup to the caller's own account. This is where cross-account sharing would hook in
// if layer permissions were ever implemented.
LambdaLayerVersion lv = resolveLayerByArn(layerVersionArn);
if (lv == null) {
throw new AwsException("ResourceNotFoundException",
"The resource you requested does not exist.", 404);
}
return lv;
return resolveLayerByArn(layerVersionArn);
}
/**
@@ -0,0 +1,62 @@
package io.floci.aws.services.lambda;
import io.floci.aws.core.common.StoredResourceArns;
import io.floci.aws.services.lambda.durable.DurableTokens;
import io.floci.aws.services.lambdamicrovms.LambdaMicrovmsService;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
import java.util.List;
import java.util.Optional;
/**
* What IAM asks Lambda of the resources a request names: the stored layer version a layer version ARN selects, the
* image the caller's MicroVM runs, which the Service Reference checks an action on a running MicroVM on, and the
* durable execution a callback belongs to, which Lambda authorizes a callback request against.
*/
@ApplicationScoped
public class LambdaStoredResourceArns implements StoredResourceArns {
private final LambdaLayerService layers;
private final Instance<LambdaMicrovmsService> microvms;
@Inject
public LambdaStoredResourceArns(LambdaLayerService layers, Instance<LambdaMicrovmsService> microvms) {
this.layers = layers;
this.microvms = microvms;
}
@Override
public String namespace() {
return "lambda";
}
/** Lambda mints no id into an ARN a request names by its name, so there is nothing to find. */
@Override
public Optional<String> find(String type, List<String> names, String region) {
return Optional.empty();
}
/** The caller's stored layer version a layer version ARN selects, its number written as Lambda parses it. */
@Override
public Optional<String> resolveStoredArn(String arn) {
return layers.storedLayerVersionArn(arn);
}
/**
* The image of the caller's MicroVM a {@code microvmIdentifier} names, and the durable execution of the callback a
* {@code CallbackId} names; empty when the caller has no such MicroVM, or the id names no callback.
*/
@Override
public List<String> through(String member, String value, String region) {
return switch (member) {
case "microvmIdentifier" -> microvms.isResolvable()
? microvms.get().findMicrovm(region, value).map(vm -> vm.imageArn)
.filter(arn -> !arn.isBlank()).map(List::of).orElse(List.of())
: List.of();
case "CallbackId" -> DurableTokens.callbackExecutionArn(value).map(List::of).orElse(List.of());
default -> List.of();
};
}
}
@@ -1,13 +1,13 @@
{
"_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-15", "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": {"access-analyzer": ["accessanalyzer"], "account": ["account"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudfront": ["cloudfront"], "cloudfront-keyvaluestore": ["cloudfront-keyvaluestore"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "controlcatalog": ["controlcatalog"], "controltower": ["controltower"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "ecs": ["ecs"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "emr-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "lambda": ["lambda"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "scheduler": ["scheduler"], "secretsmanager": ["secretsmanager"], "securityhub": ["securityhub"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "ssm": ["ssm"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"], "xray": ["xray"]},
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "sns", "sqs", "sts"],
"_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "--source-dir /tmp/claude-1000/-home-depende-eclipse-workspace-floci-priamo-w/7fb47f8b-d191-43e7-b4fe-2f9ad25437c8/scratchpad/lam/ref", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-15", "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": {"access-analyzer": ["accessanalyzer"], "account": ["account"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudfront": ["cloudfront"], "cloudfront-keyvaluestore": ["cloudfront-keyvaluestore"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "controlcatalog": ["controlcatalog"], "controltower": ["controltower"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "ecs": ["ecs"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "emr-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "lambda": ["lambda", "lambda-core", "lambda-microvms", "lambda-web"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "scheduler": ["scheduler"], "secretsmanager": ["secretsmanager"], "securityhub": ["securityhub"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "ssm": ["ssm"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"], "xray": ["xray"]},
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "logs", "pipes", "resource-groups", "s3", "sns", "sqs", "sts"],
"notCovered": {"airflow": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appsync": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "aps": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, `autoScalingGroup:<id>:autoScalingGroupName/<name>`, while Floci mints `autoScalingGroup:<name>`, which other services (ECS capacity providers) read back; the mint is fixed first", "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 reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "batch": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rules do not fill a name from, so nearly every operation's resource would be left open", "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 reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "codedeploy": "not read yet: the Service Reference gives an on-premises instance's ARN as `instance:${InstanceName}`, while the CodeDeploy permissions reference gives arn:aws:codedeploy:region:account-id:instance/instance-ID and AWS's GetOnPremisesInstance example answers instance/<name>_<id>, an id the service mints after the name; reading it needs that format corrected", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "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 reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "detective": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dlm": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2-instance-connect": "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: an environment's ARN carries its application's name, `environment/<application>/<name>`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "REST: its requests namLine truncated
"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", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "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", "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", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "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", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "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"],
"arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "account": {"account": "arn:${Partition}:account::${Account}:account", "accountInOrganization": "arn:${Partition}:account::${ManagementAccountId}:account/o-${OrganizationId}/${MemberAccountId}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudfront": {"anycast-ip-list": "arn:${Partition}:cloudfront::${Account}:anycast-ip-list/${Id}", "cache-policy": "arn:${Partition}:cloudfront::${Account}:cache-policy/${Id}", "connection-function": "arn:${Partition}:cloudfront::${Account}:connection-function/${Id}", "connection-group": "arn:${Partition}:cloudfront::${Account}:connection-group/${Id}", "continuous-deployment-policy": "arn:${Partition}:cloudfront::${Account}:continuous-deployment-policy/${Id}", "distribution": "arn:${Partition}:cloudfront::${Account}:distribution/${DistributionId}", "distribution-tenant": "arn:${Partition}:cloudfront::${Account}:distribution-tenant/${Id}", "field-level-encryption-config": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-config/${Id}", "field-level-encryption-profile": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-profile/${Id}", "function": "arn:${Partition}:cloudfront::${Account}:function/${Name}", "key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${Name}", "origin-access-control": "arn:${Partition}:cloudfront::${Account}:origin-access-control/${Id}", "origin-access-identity": "arn:${Partition}:cloudfront::${Account}:origin-access-identity/${Id}", "origin-request-policy": "arn:${Partition}:cloudfront::${Account}:origin-request-policy/${Id}", "realtime-log-config": "arn:${Partition}:cloudfront::${Account}:realtime-log-config/${Name}", "response-headers-policy": "arn:${Partition}:cloudfront::${Account}:response-headers-policy/${Id}", "streaming-distribution": "arn:${Partition}:cloudfront::${Account}:streaming-distribution/${DistributionId}", "trust-store": "arn:${Partition}:cloudfront::${Account}:trust-store/${Id}", "vpcorigin": "arn:${Partition}:cloudfront::${Account}:vpcorigin/${Id}"}, "cloudfront-keyvaluestore": {"key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${ResourceId}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${Line truncated
"resourceTagKeys": {"access-analyzer": {"Analyzer": ["aws:ResourceTag/"]}, "acm": {"acme-domain-validation": ["aws:ResourceTag/"], "acme-endpoint": ["aws:ResourceTag/"], "acme-external-account-binding": ["aws:ResourceTag/"], "certificate": ["aws:ResourceTag/"]}, "application-autoscaling": {"ScalableTarget": ["aws:ResourceTag/"]}, "athena": {"capacity-reservation": ["aws:ResourceTag/"], "datacatalog": ["aws:ResourceTag/"], "session": ["aws:ResourceTag/"], "system-table": ["aws:ResourceTag/"], "workgroup": ["aws:ResourceTag/"]}, "bcm-data-exports": {"billingview": ["aws:ResourceTag/"], "export": ["aws:ResourceTag/"]}, "bcm-pricing-calculator": {"bill-scenario": ["aws:ResourceTag/"], "workload-estimate": ["aws:ResourceTag/"]}, "budgets": {"budget": ["aws:ResourceTag/"], "budgetAction": ["aws:ResourceTag/"]}, "ce": {"anomalymonitor": ["aws:ResourceTag/"], "anomalysubscription": ["aws:ResourceTag/"], "billingview": ["aws:ResourceTag/"], "costcategory": ["aws:ResourceTag/"]}, "cloudfront": {"anycast-ip-list": ["aws:ResourceTag/"], "connection-function": ["aws:ResourceTag/"], "connection-group": ["aws:ResourceTag/"], "distribution": ["aws:ResourceTag/"], "distribution-tenant": ["aws:ResourceTag/"], "function": ["aws:ResourceTag/"], "key-value-store": ["aws:ResourceTag/"], "streaming-distribution": ["aws:ResourceTag/"], "trust-store": ["aws:ResourceTag/"], "vpcorigin": ["aws:ResourceTag/"]}, "cloudtrail": {"channel": ["aws:ResourceTag/"], "dashboard": ["aws:ResourceTag/"], "eventdatastore": ["aws:ResourceTag/"], "trail": ["aws:ResourceTag/"]}, "codebuild": {"project": ["aws:ResourceTag/"], "report-group": ["aws:ResourceTag/"]}, "codepipeline": {"action": ["aws:ResourceTag/"], "actiontype": ["aws:ResourceTag/"], "pipeline": ["aws:ResourceTag/"], "stage": ["aws:ResourceTag/"], "webhook": ["aws:ResourceTag/"]}, "cognito-identity": {"identitypool": ["aws:ResourceTag/"]}, "cognito-idp": {"userpool": ["aws:ResourceTag/"]}, "controltower": {"EnabledBaseline": ["aws:ResourceTag/"], "EnabledControl": ["aws:ResourceTag/"], "LandingZone": ["aws:ResourceTag/"]}, "datasync": {"agent": ["aws:ResourceTag/"], "discoveryjob": ["aws:ResourceTag/"], "location": ["aws:ResourceTag/"], "storagesystem": ["aws:ResourceTag/"], "task": ["aws:ResourceTag/"], "taskexecution": ["aws:ResourceTag/"]}, "dynamodb": {"index": ["aws:ResourceTag/"], "stream": ["aws:ResourceTag/"], "table": ["aws:ResourceTag/"]}, "ec2": {"application-status-check": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-block": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-manager-data-export": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-cancellation-quote": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-fleet": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-modification-quote": ["aws:ResourceTag/", "ec2:ResourceTag/"], "carrier-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "client-vpn-endpoint": ["aws:ResourceTag/", "ec2:ResourceTag/"], "coip-pool": ["aws:ResourceTag/", "ec2:ResourceTag/"], "customer-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "declarative-policies-report": ["aws:ResourceTag/", "ec2:ResourceTag/"], "dedicated-host": ["aws:ResourceTag/", "ec2:ResourceTag/"], "dhcp-options": ["aws:ResourceTag/", "ec2:ResourceTag/"], "egress-only-internet-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "elastic-gpu": ["aws:ResourceTag/", "ec2:ResourceTag/"], "elastic-ip": ["aws:ResourceTag/", "ec2:ResourceTag/"], "export-image-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "export-instance-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "fleet": ["aws:ResourceTag/", "ec2:ResourceTag/"], "fpga-image": ["aws:ResourceTag/", "ec2:ResourceTag/"], "host-reservation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "image": ["aws:ResourceTag/", "ec2:ResourceTag/"], "image-usage-report": ["aws:ResourceTag/", "ec2:ResourceTag/"], "import-image-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "import-snapshot-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance-connect-endpoint": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance-event-window": ["aws:ResourceTag/", "ec2:ResourceTag/"], "internet-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-external-resource-verification-token": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-internet-registry-association": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-policy": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-pool": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-pool-allocation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-prefix-list-resolver": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-prefix-list-resolver-target": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-resource-discovery": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-resource-discovery-associatioLine truncated
"resourceKeys": {"ec2": {"capacity-reservation": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:AvailabilityZoneId": {"member": "AvailabilityZoneId"}, "ec2:CapacityReservationFleet": {"member": "CapacityReservationFleetId", "arn": "capacity-reservation-fleet"}, "ec2:EbsOptimized": {"member": "EbsOptimized"}, "ec2:EndDateType": {"member": "EndDateType"}, "ec2:EphemeralStorage": {"member": "EphemeralStorage"}, "ec2:InstanceMatchCriteria": {"member": "InstanceMatchCriteria"}, "ec2:InstanceType": {"member": "InstanceType"}, "ec2:Tenancy": {"member": "Tenancy"}}, "carrier-gateway": {"ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "dhcp-options": {"ec2:DhcpOptionsID": {"member": "DhcpOptionsId"}}, "fpga-image": {"ec2:Owner": {"member": "OwnerId"}, "ec2:Public": {"member": "Public"}}, "image": {"ec2:ImageID": {"member": "ImageId"}, "ec2:ImageType": {"member": "ImageType"}, "ec2:Owner": {"member": "OwnerId"}, "ec2:Public": {"member": "Public"}, "ec2:RootDeviceType": {"member": "RootDeviceType"}}, "instance": {"ec2:EbsOptimized": {"member": "EbsOptimized"}, "ec2:InstanceID": {"member": "InstanceId"}, "ec2:InstanceType": {"member": "InstanceType"}, "ec2:RootDeviceType": {"member": "RootDeviceType"}}, "internet-gateway": {"ec2:InternetGatewayID": {"member": "InternetGatewayId"}}, "launch-template": {"ec2:LaunchTemplate": {"member": "LaunchTemplateId", "arn": "launch-template"}}, "network-acl": {"ec2:NetworkAclID": {"member": "NetworkAclId"}, "ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "network-interface": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:NetworkInterfaceID": {"member": "NetworkInterfaceId"}, "ec2:Subnet": {"member": "SubnetId", "arn": "subnet"}, "ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "reserved-instances": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:InstanceType": {"member": "InstanceType"}}, "route-table": {"ec2:RouteTableID": {"member": "RouteTableId"}, "ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "secondary-interface": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:AvailabilityZoneId": {"member": "AvailabilityZoneId"}}, "security-group": {"ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "snapshot": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:Encrypted": {"member": "Encrypted"}, "ec2:Owner": {"member": "OwnerId"}, "ec2:SnapshotID": {"member": "SnapshotId"}, "ec2:VolumeSize": {"member": "VolumeSize"}}, "subnet": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:AvailabilityZoneId": {"member": "AvailabilityZoneId"}, "ec2:SubnetID": {"member": "SubnetId"}, "ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "transit-gateway": {"ec2:transitGatewayId": {"member": "TransitGatewayId"}}, "transit-gateway-attachment": {"ec2:transitGatewayAttachmentId": {"member": "TransitGatewayAttachmentId"}}, "transit-gateway-connect-peer": {"ec2:transitGatewayConnectPeerId": {"member": "TransitGatewayConnectPeerId"}}, "transit-gateway-metering-policy": {"ec2:transitGatewayMeteringPolicyId": {"member": "TransitGatewayMeteringPolicyId"}}, "transit-gateway-multicast-domain": {"ec2:transitGatewayMulticastDomainId": {"member": "TransitGatewayMulticastDomainId"}}, "transit-gateway-policy-table": {"ec2:transitGatewayPolicyTableId": {"member": "TransitGatewayPolicyTableId"}}, "transit-gateway-route-table": {"ec2:transitGatewayRouteTableId": {"member": "TransitGatewayRouteTableId"}}, "transit-gateway-route-table-announcement": {"ec2:transitGatewayRouteTableAnnouncementId": {"member": "TransitGatewayRouteTableAnnouncementId"}}, "volume": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:AvailabilityZoneId": {"member": "AvailabilityZoneId"}, "ec2:Encrypted": {"member": "Encrypted"}, "ec2:KmsKeyId": {"member": "KmsKeyId"}, "ec2:VolumeID": {"member": "VolumeId"}, "ec2:VolumeInitializationRate": {"member": "VolumeInitializationRate"}, "ec2:VolumeType": {"member": "VolumeType"}}, "vpc": {"ec2:VpcID": {"member": "VpcId"}}, "vpc-peering-connection": {"ec2:VpcPeeringConnectionID": {"member": "VpcPeeringConnectionId"}}}},
"unqualified": {"lambda": ["function"], "ssm": ["parameter"], "states": ["statemachine"]},
"unqualified": {"ssm": ["parameter"], "states": ["statemachine"]},
"mintedIds": {"events": ["api-destination", "connection"]},
"mintedSuffixes": {"secretsmanager": {"Secret": "-??????"}},
"integerVariables": {"lambda": {"layerVersion": ["LayerVersion"]}},
@@ -1645,7 +1645,7 @@
"ec2:ModifyVpcBlockPublicAccessOptions": {"action": "ec2:ModifyVpcBlockPublicAccessOptions", "types": [], "resources": []},
"ec2:ModifyVpcEncryptionControl": {"action": "ec2:ModifyVpcEncryptionControl", "types": ["vpc-encryption-control"], "resources": [{"type": "vpc-encryption-control", "fill": {"VpcEncryptionControlId": "VpcEncryptionControlId"}}]},
"ec2:ModifyVpcEndpoint": {"action": "ec2:ModifyVpcEndpoint", "types": ["route-table", "security-group", "subnet", "vpc-endpoint"], "resources": [{"type": "route-table", "fill": {"RouteTableId": "AddRouteTableIds[]"}}, {"type": "security-group", "fill": {"SecurityGroupId": "AddSecurityGroupIds[]"}}, {"type": "subnet", "fill": {"SubnetId": "AddSubnetIds[]"}}, {"type": "vpc-endpoint", "fill": {"VpcEndpointId": "VpcEndpointId"}}], "ec2Query": {"AddRouteTableIds[]": "AddRouteTableId", "AddSubnetIds[]": "AddSubnetId", "AddSecurityGroupIds[]": "AddSecurityGroupId"}},
"ec2:ModifyVpcEndpointConnectionNotification": {"action": "ec2:ModifyVpcEndpointConnectionNotification", "types": ["vpc-endpoint", "vpc-endpoint-service"], "resources": [{"types": ["vpc-endpoint", "vpc-endpoint-service"], "arn": "ConnectionNotificationArn"}, {"types": ["vpc-endpoint"], "through": "ConnectionNotificationId"}]},
"ec2:ModifyVpcEndpointConnectionNotification": {"action": "ec2:ModifyVpcEndpointConnectionNotification", "types": ["vpc-endpoint", "vpc-endpoint-service"], "resources": [{"types": ["vpc-endpoint", "vpc-endpoint-service"], "arn": "ConnectionNotificationArn"}, {"types": ["vpc-endpoint", "vpc-endpoint-service"], "through": "ConnectionNotificationId"}]},
"ec2:ModifyVpcEndpointPayerResponsibility": {"action": "ec2:ModifyVpcEndpointPayerResponsibility", "types": ["vpc-endpoint-service"], "resources": [{"type": "vpc-endpoint-service", "fill": {"VpcEndpointServiceId": "ServiceId"}}]},
"ec2:ModifyVpcEndpointServiceConfiguration": {"action": "ec2:ModifyVpcEndpointServiceConfiguration", "types": ["vpc-endpoint-service"], "resources": [{"types": ["vpc-endpoint-service"], "arn": "AddGatewayLoadBalancerArns[]"}, {"types": ["vpc-endpoint-service"], "arn": "AddNetworkLoadBalancerArns[]"}, {"types": ["vpc-endpoint-service"], "arn": "RemoveGatewayLoadBalancerArns[]"}, {"types": ["vpc-endpoint-service"], "arn": "RemoveNetworkLoadBalancerArns[]"}, {"type": "vpc-endpoint-service", "fill": {"VpcEndpointServiceId": "ServiceId"}}], "ec2Query": {"AddNetworkLoadBalancerArns[]": "AddNetworkLoadBalancerArn", "RemoveNetworkLoadBalancerArns[]": "RemoveNetworkLoadBalancerArn", "AddGatewayLoadBalancerArns[]": "AddGatewayLoadBalancerArn", "RemoveGatewayLoadBalancerArns[]": "RemoveGatewayLoadBalancerArn"}},
"ec2:ModifyVpcEndpointServicePayerResponsibility": {"action": "ec2:ModifyVpcEndpointServicePayerResponsibility", "types": ["vpc-endpoint-service"], "resources": [{"type": "vpc-endpoint-service", "fill": {"VpcEndpointServiceId": "ServiceId"}}]},
@@ -2560,8 +2560,156 @@
"kinesisanalytics:UntagResource": {"action": "kinesisanalytics:UntagResource", "types": ["application"], "resources": [{"types": ["application"], "arn": "ResourceARN"}]},
"kinesisanalytics:UpdateApplication": {"action": "kinesisanalytics:UpdateApplication", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationName": "ApplicationName"}}]},
"kinesisanalytics:UpdateApplicationMaintenanceConfiguration": {"action": "kinesisanalytics:UpdateApplicationMaintenanceConfiguration", "types": ["application"], "resources": [{"type": "application", "fill": {"ApplicationName": "ApplicationName"}}]},
"lambda:AddEventSource": {"action": "lambda:AddEventSource", "types": [], "resources": []},
"lambda:AddLayerVersionPermission": {"action": "lambda:AddLayerVersionPermission", "types": ["layerVersion"], "resources": [{"type": "layerVersion", "fill": {"LayerName": "LayerName", "LayerVersion": "VersionNumber"}, "arnOf": {"LayerName": "layer"}}], "located": {"LayerName": "{LayerName}", "VersionNumber": "{VersionNumber}"}},
"lambda:AddPermission": {"action": "lambda:AddPermission", "types": ["function"], "resources": [{"types": ["function"], "arn": "SourceArn"}, {"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:CheckpointDurableExecution": {"action": "lambda:CheckpointDurableExecution", "types": ["durable execution"], "resources": [{"types": ["durable execution"], "arn": "DurableExecutionArn"}], "located": {"DurableExecutionArn": "{DurableExecutionArn}"}},
"lambda:CreateAlias": {"action": "lambda:CreateAlias", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:CreateCapacityProvider": {"action": "lambda:CreateCapacityProvider", "types": ["capacityProvider"], "resources": [{"types": ["capacityProvider"], "arn": "KmsKeyArn"}, {"type": "capacityProvider", "fill": {"CapacityProviderName": "CapacityProviderName"}, "arnOf": {"CapacityProviderName": "capacityProvider"}}]},
"lambda:CreateCodeSigningConfig": {"action": "lambda:CreateCodeSigningConfig", "types": [], "resources": [], "makes": [{"type": "code signing config", "fill": {}}]},
"lambda:CreateEventSourceMapping": {"action": "lambda:CreateEventSourceMapping", "types": [], "resources": []},
"lambda:CreateFunction": {"action": "lambda:CreateFunction", "types": ["function"], "resources": [{"types": ["function"], "arn": "Code.SourceKMSKeyArn"}, {"types": ["function"], "arn": "CodeSigningConfigArn"}, {"types": ["function"], "arn": "DeadLetterConfig.TargetArn"}, {"types": ["function"], "arn": "DurableConfig.KMSKeyArn"}, {"types": ["function"], "arn": "FileSystemConfigs[].Arn"}, {"types": ["function"], "arn": "KMSKeyArn"}, {"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}]},
"lambda:CreateFunctionUrlConfig": {"action": "lambda:CreateFunctionUrlConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:CreateMicrovmAuthToken": {"action": "lambda:CreateMicrovmAuthToken", "types": ["microvmImage"], "resources": [{"types": ["microvmImage"], "through": "microvmIdentifier"}], "located": {"microvmIdentifier": "{microvmIdentifier}"}},
"lambda:CreateMicrovmImage": {"action": "lambda:CreateMicrovmImage", "types": [], "resources": [], "makes": [{"type": "microvmImage", "fill": {"MicrovmImageName": "name"}}]},
"lambda:CreateMicrovmShellAuthToken": {"action": "lambda:CreateMicrovmShellAuthToken", "types": ["microvmImage"], "resources": [{"types": ["microvmImage"], "through": "microvmIdentifier"}], "located": {"microvmIdentifier": "{microvmIdentifier}"}},
"lambda:CreateNetworkConnector": {"action": "lambda:CreateNetworkConnector", "types": ["networkConnector"], "resources": [{"type": "networkConnector", "fill": {}}]},
"lambda:CreateRuntime": {"action": "lambda:CreateRuntime", "types": [], "resources": []},
"lambda:CreateRuntimeAlias": {"action": "lambda:CreateRuntimeAlias", "types": [], "resources": []},
"lambda:CreateRuntimeVersion": {"action": "lambda:CreateRuntimeVersion", "types": [], "resources": []},
"lambda:CreateWebFunction": {"action": "lambda:CreateWebFunction", "types": ["webFunction"], "resources": [{"type": "webFunction", "fill": {"FunctionName": "functionName"}}]},
"lambda:CreateWebFunctionEndpoint": {"action": "lambda:CreateWebFunctionEndpoint", "types": ["webFunction"], "resources": [{"type": "webFunction", "fill": {"FunctionName": "functionName"}}], "located": {"functionName": "{functionName}"}},
"lambda:CreateWebFunctionRevision": {"action": "lambda:CreateWebFunctionRevision", "types": ["webFunction"], "resources": [{"types": ["webFunction"], "arn": "serviceConfig.egressNetworkConnectorArn"}, {"type": "webFunction", "fill": {"FunctionName": "functionName"}}], "located": {"functionName": "{functionName}"}},
"lambda:DeleteAlias": {"action": "lambda:DeleteAlias", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:DeleteCapacityProvider": {"action": "lambda:DeleteCapacityProvider", "types": ["capacityProvider"], "resources": [{"type": "capacityProvider", "fill": {"CapacityProviderName": "CapacityProviderName"}, "arnOf": {"CapacityProviderName": "capacityProvider"}}], "located": {"CapacityProviderName": "{CapacityProviderName}"}},
"lambda:DeleteCodeSigningConfig": {"action": "lambda:DeleteCodeSigningConfig", "types": ["code signing config"], "resources": [{"types": ["code signing config"], "arn": "CodeSigningConfigArn"}], "located": {"CodeSigningConfigArn": "{CodeSigningConfigArn}"}},
"lambda:DeleteEventSourceMapping": {"action": "lambda:DeleteEventSourceMapping", "types": ["eventSourceMapping"], "resources": [{"type": "eventSourceMapping", "fill": {"UUID": "UUID"}}], "located": {"UUID": "{UUID}"}},
"lambda:DeleteFunction": {"action": "lambda:DeleteFunction", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:DeleteFunctionCodeSigningConfig": {"action": "lambda:DeleteFunctionCodeSigningConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:DeleteFunctionConcurrency": {"action": "lambda:DeleteFunctionConcurrency", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:DeleteFunctionEventInvokeConfig": {"action": "lambda:DeleteFunctionEventInvokeConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:DeleteFunctionUrlConfig": {"action": "lambda:DeleteFunctionUrlConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:DeleteLayerVersion": {"action": "lambda:DeleteLayerVersion", "types": ["layerVersion"], "resources": [{"type": "layerVersion", "fill": {"LayerName": "LayerName", "LayerVersion": "VersionNumber"}, "arnOf": {"LayerName": "layer"}}], "located": {"LayerName": "{LayerName}", "VersionNumber": "{VersionNumber}"}},
"lambda:DeleteMicrovmImage": {"action": "lambda:DeleteMicrovmImage", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:DeleteMicrovmImageVersion": {"action": "lambda:DeleteMicrovmImageVersion", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:DeleteNetworkConnector": {"action": "lambda:DeleteNetworkConnector", "types": ["networkConnector"], "resources": [{"type": "networkConnector", "fill": {"NetworkConnectorId": "Identifier"}}], "located": {"Identifier": "{Identifier}"}},
"lambda:DeleteProvisionedConcurrencyConfig": {"action": "lambda:DeleteProvisionedConcurrencyConfig", "types": ["function alias", "function version"], "resources": [{"type": "function alias", "fill": {"FunctionName": "FunctionName", "Alias": "Qualifier"}, "arnOf": {"FunctionName": "function"}, "partialArn": true}, {"type": "function version", "fill": {"FunctionName": "FunctionName", "Version": "Qualifier"}, "arnOf": {"FunctionName": "function"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}", "Qualifier": "?Qualifier"}},
"lambda:DeleteResourcePolicy": {"action": "lambda:DeleteResourcePolicy", "types": ["function", "webFunction"], "resources": [{"types": ["function", "webFunction"], "arn": "ResourceArn"}, {"types": ["function", "webFunction"], "arn": "resourceArn"}], "located": {"ResourceArn": "{ResourceArn}", "resourceArn": "{resourceArn}"}},
"lambda:DeleteRuntime": {"action": "lambda:DeleteRuntime", "types": [], "resources": []},
"lambda:DeleteRuntimeAlias": {"action": "lambda:DeleteRuntimeAlias", "types": [], "resources": []},
"lambda:DeleteRuntimeVersion": {"action": "lambda:DeleteRuntimeVersion", "types": [], "resources": []},
"lambda:DeleteWebFunction": {"action": "lambda:DeleteWebFunction", "types": ["webFunction"], "resources": [{"type": "webFunction", "fill": {"FunctionName": "functionName"}}], "located": {"functionName": "{functionName}"}},
"lambda:DeleteWebFunctionEndpoint": {"action": "lambda:DeleteWebFunctionEndpoint", "types": ["webFunctionEndpoint"], "resources": [{"type": "webFunctionEndpoint", "fill": {"EndpointName": "endpointName", "FunctionName": "functionName"}, "arnOf": {"functionName": "webFunction"}}], "located": {"endpointName": "{endpointName}", "functionName": "{functionName}"}},
"lambda:DeleteWebFunctionRevision": {"action": "lambda:DeleteWebFunctionRevision", "types": ["webFunctionRevision"], "resources": [{"type": "webFunctionRevision", "fill": {"FunctionName": "functionName", "RevisionId": "revisionId"}, "arnOf": {"functionName": "webFunction"}}], "located": {"functionName": "{functionName}", "revisionId": "{revisionId}"}},
"lambda:GetAccountSettings": {"action": "lambda:GetAccountSettings", "types": [], "resources": []},
"lambda:GetAlias": {"action": "lambda:GetAlias", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetCapacityProvider": {"action": "lambda:GetCapacityProvider", "types": ["capacityProvider"], "resources": [{"type": "capacityProvider", "fill": {"CapacityProviderName": "CapacityProviderName"}, "arnOf": {"CapacityProviderName": "capacityProvider"}}], "located": {"CapacityProviderName": "{CapacityProviderName}"}},
"lambda:GetCodeSigningConfig": {"action": "lambda:GetCodeSigningConfig", "types": ["code signing config"], "resources": [{"types": ["code signing config"], "arn": "CodeSigningConfigArn"}], "located": {"CodeSigningConfigArn": "{CodeSigningConfigArn}"}},
"lambda:GetDurableExecution": {"action": "lambda:GetDurableExecution", "types": ["durable execution"], "resources": [{"types": ["durable execution"], "arn": "DurableExecutionArn"}], "located": {"DurableExecutionArn": "{DurableExecutionArn}"}},
"lambda:GetDurableExecutionHistory": {"action": "lambda:GetDurableExecutionHistory", "types": ["durable execution"], "resources": [{"types": ["durable execution"], "arn": "DurableExecutionArn"}], "located": {"DurableExecutionArn": "{DurableExecutionArn}"}},
"lambda:GetDurableExecutionState": {"action": "lambda:GetDurableExecutionState", "types": ["durable execution"], "resources": [{"types": ["durable execution"], "arn": "DurableExecutionArn"}], "located": {"DurableExecutionArn": "{DurableExecutionArn}"}},
"lambda:GetEventSource": {"action": "lambda:GetEventSource", "types": [], "resources": []},
"lambda:GetEventSourceMapping": {"action": "lambda:GetEventSourceMapping", "types": ["eventSourceMapping"], "resources": [{"type": "eventSourceMapping", "fill": {"UUID": "UUID"}}], "located": {"UUID": "{UUID}"}},
"lambda:GetFunction": {"action": "lambda:GetFunction", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetFunctionCodeSigningConfig": {"action": "lambda:GetFunctionCodeSigningConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetFunctionConcurrency": {"action": "lambda:GetFunctionConcurrency", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetFunctionConfiguration": {"action": "lambda:GetFunctionConfiguration", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetFunctionEventInvokeConfig": {"action": "lambda:GetFunctionEventInvokeConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetFunctionRecursionConfig": {"action": "lambda:GetFunctionRecursionConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetFunctionScalingConfig": {"action": "lambda:GetFunctionScalingConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetFunctionUrlConfig": {"action": "lambda:GetFunctionUrlConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetLayerVersion": {"action": "lambda:GetLayerVersion", "types": ["layerVersion"], "resources": [{"type": "layerVersion", "fill": {"LayerName": "LayerName", "LayerVersion": "VersionNumber"}, "arnOf": {"LayerName": "layer"}}], "located": {"LayerName": "{LayerName}", "VersionNumber": "{VersionNumber}"}},
"lambda:GetLayerVersionByArn": {"action": "lambda:GetLayerVersion", "types": ["layerVersion"], "resources": [{"types": ["layerVersion"], "arn": "Arn"}], "located": {"Arn": "?Arn"}},
"lambda:GetLayerVersionPolicy": {"action": "lambda:GetLayerVersionPolicy", "types": ["layerVersion"], "resources": [{"type": "layerVersion", "fill": {"LayerName": "LayerName", "LayerVersion": "VersionNumber"}, "arnOf": {"LayerName": "layer"}}], "located": {"LayerName": "{LayerName}", "VersionNumber": "{VersionNumber}"}},
"lambda:GetMicrovm": {"action": "lambda:GetMicrovm", "types": ["microvmImage"], "resources": [{"types": ["microvmImage"], "through": "microvmIdentifier"}], "located": {"microvmIdentifier": "{microvmIdentifier}"}},
"lambda:GetMicrovmImage": {"action": "lambda:GetMicrovmImage", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:GetMicrovmImageBuild": {"action": "lambda:GetMicrovmImageBuild", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:GetMicrovmImageVersion": {"action": "lambda:GetMicrovmImageVersion", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:GetNetworkConnector": {"action": "lambda:GetNetworkConnector", "types": ["networkConnector"], "resources": [{"type": "networkConnector", "fill": {"NetworkConnectorId": "Identifier"}}], "located": {"Identifier": "{Identifier}"}},
"lambda:GetPolicy": {"action": "lambda:GetPolicy", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetProvisionedConcurrencyConfig": {"action": "lambda:GetProvisionedConcurrencyConfig", "types": ["function alias", "function version"], "resources": [{"type": "function alias", "fill": {"FunctionName": "FunctionName", "Alias": "Qualifier"}, "arnOf": {"FunctionName": "function"}, "partialArn": true}, {"type": "function version", "fill": {"FunctionName": "FunctionName", "Version": "Qualifier"}, "arnOf": {"FunctionName": "function"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}", "Qualifier": "?Qualifier"}},
"lambda:GetResourcePolicy": {"action": "lambda:GetResourcePolicy", "types": ["function", "webFunction"], "resources": [{"types": ["function", "webFunction"], "arn": "ResourceArn"}, {"types": ["function", "webFunction"], "arn": "resourceArn"}], "located": {"ResourceArn": "{ResourceArn}", "resourceArn": "{resourceArn}"}},
"lambda:GetRuntime": {"action": "lambda:GetRuntime", "types": [], "resources": []},
"lambda:GetRuntimeAlias": {"action": "lambda:GetRuntimeAlias", "types": [], "resources": []},
"lambda:GetRuntimeManagementConfig": {"action": "lambda:GetRuntimeManagementConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:GetRuntimeVersion": {"action": "lambda:GetRuntimeVersion", "types": [], "resources": []},
"lambda:GetWebAccountSettings": {"action": "lambda:GetWebAccountSettings", "types": [], "resources": []},
"lambda:GetWebFunction": {"action": "lambda:GetWebFunction", "types": ["webFunction"], "resources": [{"type": "webFunction", "fill": {"FunctionName": "functionName"}}], "located": {"functionName": "{functionName}"}},
"lambda:GetWebFunctionEndpoint": {"action": "lambda:GetWebFunctionEndpoint", "types": ["webFunctionEndpoint"], "resources": [{"type": "webFunctionEndpoint", "fill": {"EndpointName": "endpointName", "FunctionName": "functionName"}, "arnOf": {"functionName": "webFunction"}}], "located": {"endpointName": "{endpointName}", "functionName": "{functionName}"}},
"lambda:GetWebFunctionRevision": {"action": "lambda:GetWebFunctionRevision", "types": ["webFunctionRevision"], "resources": [{"type": "webFunctionRevision", "fill": {"FunctionName": "functionName", "RevisionId": "revisionId"}, "arnOf": {"functionName": "webFunction"}}], "located": {"functionName": "{functionName}", "revisionId": "{revisionId}"}},
"lambda:Invoke": {"action": "lambda:InvokeFunction", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:InvokeAsync": {"action": "lambda:InvokeAsync", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:InvokeWithResponseStream": {"action": "lambda:InvokeFunction", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:ListAliases": {"action": "lambda:ListAliases", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:ListCapacityProviders": {"action": "lambda:ListCapacityProviders", "types": [], "resources": []},
"lambda:ListCodeSigningConfigs": {"action": "lambda:ListCodeSigningConfigs", "types": [], "resources": []},
"lambda:ListDurableExecutionsByFunction": {"action": "lambda:ListDurableExecutionsByFunction", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:ListEventSourceMappings": {"action": "lambda:ListEventSourceMappings", "types": [], "resources": []},
"lambda:ListEventSources": {"action": "lambda:ListEventSources", "types": [], "resources": []},
"lambda:ListFunctionEventInvokeConfigs": {"action": "lambda:ListFunctionEventInvokeConfigs", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:ListFunctionUrlConfigs": {"action": "lambda:ListFunctionUrlConfigs", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:ListFunctionVersionsByCapacityProvider": {"action": "lambda:ListFunctionVersionsByCapacityProvider", "types": ["capacityProvider"], "resources": [{"type": "capacityProvider", "fill": {"CapacityProviderName": "CapacityProviderName"}, "arnOf": {"CapacityProviderName": "capacityProvider"}}], "located": {"CapacityProviderName": "{CapacityProviderName}"}},
"lambda:ListFunctions": {"action": "lambda:ListFunctions", "types": [], "resources": []},
"lambda:ListFunctionsByCodeSigningConfig": {"action": "lambda:ListFunctionsByCodeSigningConfig", "types": ["code signing config"], "resources": [{"types": ["code signing config"], "arn": "CodeSigningConfigArn"}], "located": {"CodeSigningConfigArn": "{CodeSigningConfigArn}"}},
"lambda:ListLayerVersions": {"action": "lambda:ListLayerVersions", "types": [], "resources": []},
"lambda:ListLayers": {"action": "lambda:ListLayers", "types": [], "resources": []},
"lambda:ListManagedMicrovmImageVersions": {"action": "lambda:ListManagedMicrovmImageVersions", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:ListManagedMicrovmImages": {"action": "lambda:ListManagedMicrovmImages", "types": [], "resources": []},
"lambda:ListMicrovmImageBuilds": {"action": "lambda:ListMicrovmImageBuilds", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:ListMicrovmImageVersions": {"action": "lambda:ListMicrovmImageVersions", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:ListMicrovmImages": {"action": "lambda:ListMicrovmImages", "types": [], "resources": []},
"lambda:ListMicrovms": {"action": "lambda:ListMicrovms", "types": [], "resources": []},
"lambda:ListNetworkConnectorVersions": {"action": "lambda:ListNetworkConnectorVersions", "types": ["networkConnector"], "resources": [{"type": "networkConnector", "fill": {"NetworkConnectorId": "Identifier"}}], "located": {"Identifier": "{Identifier}"}},
"lambda:ListNetworkConnectors": {"action": "lambda:ListNetworkConnectors", "types": [], "resources": []},
"lambda:ListProvisionedConcurrencyConfigs": {"action": "lambda:ListProvisionedConcurrencyConfigs", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:ListRuntimeAliases": {"action": "lambda:ListRuntimeAliases", "types": [], "resources": []},
"lambda:ListRuntimeVersions": {"action": "lambda:ListRuntimeVersions", "types": [], "resources": []},
"lambda:ListRuntimes": {"action": "lambda:ListRuntimes", "types": [], "resources": []},
"lambda:ListTags": {"action": "lambda:ListTags", "types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "resources": [{"types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "arn": "Resource"}, {"types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "arn": "resource"}], "located": {"Resource": "{Resource}", "resource": "{resource}"}},
"lambda:ListVersionsByFunction": {"action": "lambda:ListVersionsByFunction", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:ListWebFunctionEndpoints": {"action": "lambda:ListWebFunctionEndpoints", "types": ["webFunction"], "resources": [{"type": "webFunction", "fill": {"FunctionName": "functionName"}}], "located": {"functionName": "{functionName}"}},
"lambda:ListWebFunctionRevisions": {"action": "lambda:ListWebFunctionRevisions", "types": ["webFunction"], "resources": [{"type": "webFunction", "fill": {"FunctionName": "functionName"}}], "located": {"functionName": "{functionName}"}},
"lambda:ListWebFunctions": {"action": "lambda:ListWebFunctions", "types": [], "resources": []},
"lambda:PublishLayerVersion": {"action": "lambda:PublishLayerVersion", "types": ["layer"], "resources": [{"type": "layer", "fill": {"LayerName": "LayerName"}, "arnOf": {"LayerName": "layer"}}], "located": {"LayerName": "{LayerName}"}},
"lambda:PublishVersion": {"action": "lambda:PublishVersion", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:PutFunctionCodeSigningConfig": {"action": "lambda:PutFunctionCodeSigningConfig", "types": ["code signing config", "function"], "resources": [{"types": ["code signing config", "function"], "arn": "CodeSigningConfigArn"}, {"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:PutFunctionConcurrency": {"action": "lambda:PutFunctionConcurrency", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:PutFunctionEventInvokeConfig": {"action": "lambda:PutFunctionEventInvokeConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:PutFunctionRecursionConfig": {"action": "lambda:PutFunctionRecursionConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:PutFunctionScalingConfig": {"action": "lambda:PutFunctionScalingConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:PutProvisionedConcurrencyConfig": {"action": "lambda:PutProvisionedConcurrencyConfig", "types": ["function alias", "function version"], "resources": [{"type": "function alias", "fill": {"FunctionName": "FunctionName", "Alias": "Qualifier"}, "arnOf": {"FunctionName": "function"}, "partialArn": true}, {"type": "function version", "fill": {"FunctionName": "FunctionName", "Version": "Qualifier"}, "arnOf": {"FunctionName": "function"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}", "Qualifier": "?Qualifier"}},
"lambda:PutResourcePolicy": {"action": "lambda:PutResourcePolicy", "types": ["function", "webFunction"], "resources": [{"types": ["function", "webFunction"], "arn": "ResourceArn"}, {"types": ["function", "webFunction"], "arn": "resourceArn"}], "located": {"ResourceArn": "{ResourceArn}", "resourceArn": "{resourceArn}"}},
"lambda:PutRuntimeManagementConfig": {"action": "lambda:PutRuntimeManagementConfig", "types": ["function"], "resources": [{"types": ["function"], "arn": "RuntimeVersionArn"}, {"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:RemoveEventSource": {"action": "lambda:RemoveEventSource", "types": [], "resources": []},
"lambda:RemoveLayerVersionPermission": {"action": "lambda:RemoveLayerVersionPermission", "types": ["layerVersion"], "resources": [{"type": "layerVersion", "fill": {"LayerName": "LayerName", "LayerVersion": "VersionNumber"}, "arnOf": {"LayerName": "layer"}}], "located": {"LayerName": "{LayerName}", "VersionNumber": "{VersionNumber}"}},
"lambda:RemovePermission": {"action": "lambda:RemovePermission", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:RestoreRuntime": {"action": "lambda:RestoreRuntime", "types": [], "resources": []},
"lambda:ResumeMicrovm": {"action": "lambda:ResumeMicrovm", "types": ["microvmImage"], "resources": [{"types": ["microvmImage"], "through": "microvmIdentifier"}], "located": {"microvmIdentifier": "{microvmIdentifier}"}},
"lambda:RunMicrovm": {"action": "lambda:RunMicrovm", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}]},
"lambda:SendDurableExecutionCallbackFailure": {"action": "lambda:SendDurableExecutionCallbackFailure", "types": ["durable execution"], "resources": [{"types": ["durable execution"], "through": "CallbackId"}], "located": {"CallbackId": "{CallbackId}"}},
"lambda:SendDurableExecutionCallbackHeartbeat": {"action": "lambda:SendDurableExecutionCallbackHeartbeat", "types": ["durable execution"], "resources": [{"types": ["durable execution"], "through": "CallbackId"}], "located": {"CallbackId": "{CallbackId}"}},
"lambda:SendDurableExecutionCallbackSuccess": {"action": "lambda:SendDurableExecutionCallbackSuccess", "types": ["durable execution"], "resources": [{"types": ["durable execution"], "through": "CallbackId"}], "located": {"CallbackId": "{CallbackId}"}},
"lambda:StopDurableExecution": {"action": "lambda:StopDurableExecution", "types": ["durable execution"], "resources": [{"types": ["durable execution"], "arn": "DurableExecutionArn"}], "located": {"DurableExecutionArn": "{DurableExecutionArn}"}},
"lambda:SuspendMicrovm": {"action": "lambda:SuspendMicrovm", "types": ["microvmImage"], "resources": [{"types": ["microvmImage"], "through": "microvmIdentifier"}], "located": {"microvmIdentifier": "{microvmIdentifier}"}},
"lambda:TagResource": {"action": "lambda:TagResource", "types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "resources": [{"types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "arn": "Resource"}, {"types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "arn": "resource"}], "located": {"Resource": "{Resource}", "resource": "{resource}"}},
"lambda:TerminateMicrovm": {"action": "lambda:TerminateMicrovm", "types": ["microvmImage"], "resources": [{"types": ["microvmImage"], "through": "microvmIdentifier"}], "located": {"microvmIdentifier": "{microvmIdentifier}"}},
"lambda:UntagResource": {"action": "lambda:UntagResource", "types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "resources": [{"types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "arn": "Resource"}, {"types": ["capacityProvider", "code signing config", "eventSourceMapping", "function", "microvmImage", "networkConnector", "webFunction"], "arn": "resource"}], "located": {"Resource": "{Resource}", "resource": "{resource}"}},
"lambda:UpdateAlias": {"action": "lambda:UpdateAlias", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:UpdateCapacityProvider": {"action": "lambda:UpdateCapacityProvider", "types": ["capacityProvider"], "resources": [{"type": "capacityProvider", "fill": {"CapacityProviderName": "CapacityProviderName"}, "arnOf": {"CapacityProviderName": "capacityProvider"}}], "located": {"CapacityProviderName": "{CapacityProviderName}"}},
"lambda:UpdateCodeSigningConfig": {"action": "lambda:UpdateCodeSigningConfig", "types": ["code signing config"], "resources": [{"types": ["code signing config"], "arn": "AllowedPublishers.SigningProfileVersionArns[]"}, {"types": ["code signing config"], "arn": "CodeSigningConfigArn"}], "located": {"CodeSigningConfigArn": "{CodeSigningConfigArn}"}},
"lambda:UpdateEventSourceMapping": {"action": "lambda:UpdateEventSourceMapping", "types": ["eventSourceMapping"], "resources": [{"types": ["eventSourceMapping"], "arn": "KMSKeyArn"}, {"type": "eventSourceMapping", "fill": {"UUID": "UUID"}}], "located": {"UUID": "{UUID}"}},
"lambda:UpdateFunctionCode": {"action": "lambda:UpdateFunctionCode", "types": ["function"], "resources": [{"types": ["function"], "arn": "SourceKMSKeyArn"}, {"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:UpdateFunctionConfiguration": {"action": "lambda:UpdateFunctionConfiguration", "types": ["function"], "resources": [{"types": ["function"], "arn": "DeadLetterConfig.TargetArn"}, {"types": ["function"], "arn": "DurableConfig.KMSKeyArn"}, {"types": ["function"], "arn": "FileSystemConfigs[].Arn"}, {"types": ["function"], "arn": "KMSKeyArn"}, {"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:UpdateFunctionEventInvokeConfig": {"action": "lambda:UpdateFunctionEventInvokeConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:UpdateFunctionUrlConfig": {"action": "lambda:UpdateFunctionUrlConfig", "types": ["function"], "resources": [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": true}], "located": {"FunctionName": "{FunctionName}"}},
"lambda:UpdateMicrovmImage": {"action": "lambda:UpdateMicrovmImage", "types": ["microvmImage"], "resources": [{"types": ["microvmImage"], "arn": "baseImageArn"}, {"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:UpdateMicrovmImageVersion": {"action": "lambda:UpdateMicrovmImageVersion", "types": ["microvmImage"], "resources": [{"type": "microvmImage", "fill": {"MicrovmImageName": "imageIdentifier"}}], "located": {"imageIdentifier": "{imageIdentifier}"}},
"lambda:UpdateNetworkConnector": {"action": "lambda:UpdateNetworkConnector", "types": ["networkConnector"], "resources": [{"type": "networkConnector", "fill": {"NetworkConnectorId": "Identifier"}}], "located": {"Identifier": "{Identifier}"}},
"lambda:UpdateRuntime": {"action": "lambda:UpdateRuntime", "types": [], "resources": []},
"lambda:UpdateRuntimeAlias": {"action": "lambda:UpdateRuntimeAlias", "types": [], "resources": []},
"lambda:UpdateRuntimeVersion": {"action": "lambda:UpdateRuntimeVersion", "types": [], "resources": []},
"lambda:UpdateWebFunctionEndpoint": {"action": "lambda:UpdateWebFunctionEndpoint", "types": ["webFunctionEndpoint"], "resources": [{"type": "webFunctionEndpoint", "fill": {"EndpointName": "endpointName", "FunctionName": "functionName"}, "arnOf": {"functionName": "webFunction"}}], "located": {"endpointName": "{endpointName}", "functionName": "{functionName}"}},
"lambda:UploadFunction": {"action": "lambda:UploadFunction", "types": [], "resources": []},
"logs:CreateDelivery": {"action": "logs:CreateDelivery", "types": ["delivery", "delivery-destination", "delivery-source"], "resources": [{"types": ["delivery", "delivery-destination", "delivery-source"], "arn": "deliveryDestinationArn"}, {"type": "delivery", "fill": {}, "made": true}, {"type": "delivery-source", "fill": {"DeliverySourceName": "deliverySourceName"}}]},
"logs:DeleteDelivery": {"action": "logs:DeleteDelivery", "types": ["delivery"], "resources": [{"type": "delivery", "fill": {}, "find": ["id"]}]},
"logs:DeleteDeliveryDestination": {"action": "logs:DeleteDeliveryDestination", "types": ["delivery-destination"], "resources": [{"type": "delivery-destination", "fill": {"DeliveryDestinationName": "name"}}]},
+27
View File
@@ -1178,6 +1178,33 @@
"UpdateMicrovmImageVersion": {"method": "PATCH", "requestUri": "/2025-09-09/microvm-images/{imageIdentifier}/versions/{imageVersion}"}
}
},
"lambda-web": {
"credentialScope": "lambda",
"apiVersion": "2025-03-07",
"accessDeniedStatus": 403,
"operations": {
"CreateWebFunction": {"method": "PUT", "requestUri": "/2025-03-07/web-functions"},
"CreateWebFunctionEndpoint": {"method": "PUT", "requestUri": "/2025-03-07/web-functions/{functionName}/endpoints"},
"CreateWebFunctionRevision": {"method": "POST", "requestUri": "/2025-03-07/web-functions/{functionName}/revisions"},
"DeleteResourcePolicy": {"method": "DELETE", "requestUri": "/2025-03-07/resource-policy/{resourceArn}"},
"DeleteWebFunction": {"method": "DELETE", "requestUri": "/2025-03-07/web-functions/{functionName}"},
"DeleteWebFunctionEndpoint": {"method": "DELETE", "requestUri": "/2025-03-07/web-functions/{functionName}/endpoints/{endpointName}"},
"DeleteWebFunctionRevision": {"method": "DELETE", "requestUri": "/2025-03-07/web-functions/{functionName}/revisions/{revisionId}"},
"GetResourcePolicy": {"method": "GET", "requestUri": "/2025-03-07/resource-policy/{resourceArn}"},
"GetWebAccountSettings": {"method": "GET", "requestUri": "/2025-03-07/web-account-settings"},
"GetWebFunction": {"method": "GET", "requestUri": "/2025-03-07/web-functions/{functionName}"},
"GetWebFunctionEndpoint": {"method": "GET", "requestUri": "/2025-03-07/web-functions/{functionName}/endpoints/{endpointName}"},
"GetWebFunctionRevision": {"method": "GET", "requestUri": "/2025-03-07/web-functions/{functionName}/revisions/{revisionId}"},
"ListTags": {"method": "GET", "requestUri": "/2025-03-07/tags/{resource}"},
"ListWebFunctionEndpoints": {"method": "POST", "requestUri": "/2025-03-07/web-functions/{functionName}/list-endpoints"},
"ListWebFunctionRevisions": {"method": "POST", "requestUri": "/2025-03-07/web-functions/{functionName}/list-revisions"},
"ListWebFunctions": {"method": "POST", "requestUri": "/2025-03-07/web-functions"},
"PutResourcePolicy": {"method": "PUT", "requestUri": "/2025-03-07/resource-policy/{resourceArn}"},
"TagResource": {"method": "POST", "requestUri": "/2025-03-07/tags/{resource}"},
"UntagResource": {"method": "DELETE", "requestUri": "/2025-03-07/tags/{resource}"},
"UpdateWebFunctionEndpoint": {"method": "PATCH", "requestUri": "/2025-03-07/web-functions/{functionName}/endpoints/{endpointName}"}
}
},
"macie2": {
"credentialScope": "macie2",
"apiVersion": "2020-01-01",
@@ -36,6 +36,7 @@ import org.mockito.ArgumentCaptor;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.time.Clock;
import java.time.Instant;
@@ -170,29 +171,33 @@ class IamConditionContextResolverTest {
String resource = "lambda:Resource/WebFunctionAuthType";
assertEquals(Map.of(request, List.of("IamAuth")), resolver.resolve("lambda", "lambda:CreateWebFunction",
webRequest("/2025-03-07/web-functions", "{\"endpointConfig\":{\"authType\":\"IamAuth\"}}")));
webRequest("PUT", "/2025-03-07/web-functions", "{\"endpointConfig\":{\"authType\":\"IamAuth\"}}")));
assertEquals(Map.of(request, List.of("IamAuth")), resolver.resolve("lambda",
"lambda:CreateWebFunctionEndpoint", webRequest("/2025-03-07/web-functions/app/endpoints",
"lambda:CreateWebFunctionEndpoint", webRequest("PUT", "/2025-03-07/web-functions/app/endpoints",
"{\"authType\":\"IamAuth\"}")));
assertEquals(Map.of(request, List.of("IamAuth"), resource, List.of("ApplicationManaged")),
resolver.resolve("lambda", "lambda:UpdateWebFunctionEndpoint",
webRequest("/2025-03-07/web-functions/app/endpoints/dev", "{\"authType\":\"IamAuth\"}")));
webRequest("PATCH", "/2025-03-07/web-functions/app/endpoints/dev", "{\"authType\":\"IamAuth\"}")));
assertEquals(Map.of(resource, List.of("ApplicationManaged")), resolver.resolve("lambda",
"lambda:UpdateWebFunctionEndpoint", webRequest("/2025-03-07/web-functions/app/endpoints/dev",
"lambda:UpdateWebFunctionEndpoint", webRequest("PATCH", "/2025-03-07/web-functions/app/endpoints/dev",
"{\"description\":\"d\"}")), "an update without authType names none");
for (String action : List.of("lambda:GetWebFunctionEndpoint", "lambda:DeleteWebFunctionEndpoint")) {
assertEquals(Map.of(resource, List.of("ApplicationManaged")), resolver.resolve("lambda", action,
webRequest("/2025-03-07/web-functions/" + function + "/endpoints/" + function + "/endpoint/dev",
"")));
assertNull(resolver.resolve("lambda", action,
webRequest("/2025-03-07/web-functions/app/endpoints/gone", "")), "a missing endpoint has none");
// A function and an endpoint named by their ARNs, which a client sends encoded.
String encoded = function.replace("/", "%2F");
for (String[] action : new String[][] {{"lambda:GetWebFunctionEndpoint", "GET"},
{"lambda:DeleteWebFunctionEndpoint", "DELETE"}}) {
assertEquals(Map.of(resource, List.of("ApplicationManaged")), resolver.resolve("lambda", action[0],
webRequest(action[1], "/2025-03-07/web-functions/" + encoded + "/endpoints/" + encoded
+ "%2Fendpoint%2Fdev", "")));
assertNull(resolver.resolve("lambda", action[0],
webRequest(action[1], "/2025-03-07/web-functions/app/endpoints/gone", "")),
"a missing endpoint has none");
}
assertNull(resolver.resolve("lambda", "lambda:GetWebFunctionEndpoint",
webRequest("/2025-03-07/web-functions/arn:bad/endpoints/dev", "")), "a malformed ARN has none");
webRequest("GET", "/2025-03-07/web-functions/arn:bad/endpoints/dev", "")), "a malformed ARN has none");
assertNull(resolver.resolve("lambda", "lambda:GetWebFunction",
webRequest("/2025-03-07/web-functions/app", "")));
webRequest("GET", "/2025-03-07/web-functions/app", "")));
assertNull(resolver.resolve("lambda", "lambda:ListWebFunctionEndpoints",
webRequest("/2025-03-07/web-functions/app/list-endpoints", "{}")));
webRequest("POST", "/2025-03-07/web-functions/app/list-endpoints", "{}")));
}
/**
@@ -309,11 +314,15 @@ class IamConditionContextResolverTest {
}
}
private ContainerRequestContext webRequest(String path, String body) throws Exception {
private ContainerRequestContext webRequest(String method, String path, String body) throws Exception {
ContainerRequestContext containerRequest = mock(ContainerRequestContext.class);
UriInfo uriInfo = mock(UriInfo.class);
when(containerRequest.getUriInfo()).thenReturn(uriInfo);
when(uriInfo.getPath()).thenReturn(path);
when(containerRequest.getMethod()).thenReturn(method);
when(uriInfo.getPath()).thenReturn(URI.create(path).getPath());
when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:4566" + path));
when(uriInfo.getBaseUri()).thenReturn(URI.create("http://localhost:4566/"));
when(uriInfo.getQueryParameters()).thenReturn(new MultivaluedHashMap<>());
when(containerRequest.getProperty("floci.bufferedJsonBody"))
.thenReturn(body.isEmpty() ? null : mapper.readTree(body));
return containerRequest;
@@ -158,8 +158,9 @@ class RequestResourceMembersTest {
void theTableReadsItsNamespacesAndGivesEachTypeItNamesAnArnFormat() {
RequestResourceMembers.Table table = RequestResourceMembers.table();
assertTrue(table.namespaces().containsAll(List.of("cognito-idp", "ecr", "elasticloadbalancing", "states")));
assertTrue(table.handBuilt().contains("lambda"));
assertEquals(Set.of("dynamodb", "lambda", "logs"), table.namespaces().stream().filter(table.handBuilt()::contains)
assertTrue(table.namespaces().contains("lambda"));
assertFalse(table.handBuilt().contains("lambda"));
assertEquals(Set.of("dynamodb", "logs"), table.namespaces().stream().filter(table.handBuilt()::contains)
.collect(Collectors.toSet()));
Set<String> logsDelivery = Stream.of("PutDeliverySource", "GetDeliverySource", "DeleteDeliverySource",
"DescribeDeliverySources", "PutDeliveryDestination", "GetDeliveryDestination",
@@ -168,8 +169,6 @@ class RequestResourceMembersTest {
.map(operation -> "logs:" + operation).collect(Collectors.toSet());
Set<String> expected = new HashSet<>(logsDelivery);
expected.add("logs:PutDestination");
expected.add("lambda:GetLayerVersion");
expected.add("lambda:GetLayerVersionByArn");
// What AWS was measured to check where the Service Reference lists no resource type (MEASURED).
expected.add("dynamodb:ListTables");
assertEquals(expected, table.operations().keySet().stream()
@@ -415,9 +415,10 @@ class IamRestRouteEnforcementIntegrationTest {
}
@Test
void lambdaTaggingIsCheckedAgainstTheCallersOwnResourceWhateverAccountTheArnNames() {
// Lambda tags the caller's own function or MicroVM image of the ARN's name, so a grant on another
// account's ARN of that name does not cover it, and a grant on the caller's own does.
void lambdaTaggingByAnotherAccountsArnIsCheckedOnThatArnAndTheCallersOwnResourceOfItsName() {
// The ARN names another account's function or MicroVM image, which is checked, and Lambda tags the caller's
// own of that name, which is checked too, so a grant on either alone does not cover it; one on the caller's
// own covers a request naming its own ARN.
String user = user("route-lambda-tags-account");
String name = "route-tagged-" + suffix();
String body = "{\"Tags\":{\"team\":\"a\"}}";
@@ -428,7 +429,8 @@ class IamRestRouteEnforcementIntegrationTest {
policy(user, allow("lambda:TagResource", foreign));
refused(as(user, "lambda").body(body).post("/2017-03-31/tags/" + foreign).then(), "lambda:TagResource");
policy(user, allow("lambda:TagResource", own));
as(user, "lambda").body(body).post("/2017-03-31/tags/" + foreign).then().statusCode(not(403));
refused(as(user, "lambda").body(body).post("/2017-03-31/tags/" + foreign).then(), "lambda:TagResource");
as(user, "lambda").body(body).post("/2017-03-31/tags/" + own).then().statusCode(not(403));
}
}
@@ -22,6 +22,7 @@ import io.floci.aws.services.iam.model.IamUser;
import io.floci.aws.services.iam.model.InstanceProfile;
import io.floci.aws.services.iam.model.ServerCertificate;
import io.floci.aws.services.kms.KmsService;
import io.floci.aws.services.lambda.LambdaStoredResourceArns;
import io.floci.aws.services.lambdamicrovms.LambdaMicrovmsService;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
import io.vertx.core.http.HttpServerRequest;
@@ -49,6 +50,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -147,20 +149,12 @@ class ResourceArnBuilderTest {
return new ResourceArnBuilder(new ObjectMapper(), instance);
}
/** A builder reading {@code microvms}, for an action on a running MicroVM. */
private static ResourceArnBuilder backedBy(LambdaMicrovmsService microvms) {
@SuppressWarnings("unchecked")
Instance<LambdaMicrovmsService> instance = mock(Instance.class);
when(instance.get()).thenReturn(microvms);
return new ResourceArnBuilder(new ObjectMapper(), null, instance);
}
/** A builder reading {@code eks}, for an EKS route naming a cluster or what it holds. */
private static ResourceArnBuilder backedBy(EksService eks) {
@SuppressWarnings("unchecked")
Instance<EksService> instance = mock(Instance.class);
when(instance.get()).thenReturn(eks);
return new ResourceArnBuilder(new ObjectMapper(), null, null, instance);
return new ResourceArnBuilder(new ObjectMapper(), null, instance);
}
private static IamService storeHolding(String userName, String path, String arn) {
@@ -1408,7 +1402,7 @@ class ResourceArnBuilderTest {
@SuppressWarnings("unchecked")
Instance<KmsService> instance = mock(Instance.class);
when(instance.get()).thenReturn(kms);
return new ResourceArnBuilder(new ObjectMapper(), null, null, null, instance);
return new ResourceArnBuilder(new ObjectMapper(), null, null, instance);
}
/** A builder reading the stored ARNs of a namespace, for every request of that namespace. */
@@ -1416,7 +1410,7 @@ class ResourceArnBuilderTest {
@SuppressWarnings("unchecked")
Instance<StoredResourceArns> instance = mock(Instance.class);
when(instance.iterator()).thenAnswer(invocation -> List.of(stored).iterator());
return new ResourceArnBuilder(new ObjectMapper(), null, null, null, null, instance);
return new ResourceArnBuilder(new ObjectMapper(), null, null, null, instance);
}
/** The finder of the stored ARNs of a namespace, answering one name of one type with one ARN. */
@@ -2013,270 +2007,130 @@ class ResourceArnBuilderTest {
// ── Lambda ──────────────────────────────────────────────────────────────────
@Test
void lambdaBuildsFunctionArn() {
when(uriInfo.getPath()).thenReturn("/2015-03-31/functions/my-function/invocations");
String arn = builder.build("lambda", ctx, "us-east-1", "000000000000");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function", arn);
private static final String FUNCTION = "arn:aws:lambda:us-east-1:000000000000:function:my-function";
private static final String OTHER_FUNCTION = "arn:aws:lambda:us-east-1:111122223333:function:my-function";
/** The resources a Lambda request names, read from the generated table for the operation it is dispatched as. */
private List<String> lambda(String method, String sent, String operation) {
return lambda(builder, method, sent, operation);
}
/** CreateFunction is checked on the function its body names, in the caller's account and Region. */
@Test
void lambdaCreateFunctionIsCheckedOnTheFunctionItsBodyNames() {
when(uriInfo.getPath()).thenReturn("/2015-03-31/functions");
when(ctx.getMethod()).thenReturn("POST");
setJsonBody("{\"FunctionName\":\"my-function\",\"Runtime\":\"nodejs20.x\"}");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
setJsonBody("{\"FunctionName\":\"arn:aws:lambda:us-east-1:111122223333:function:my-function\"}");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
setJsonBody("{\"Runtime\":\"nodejs20.x\"}");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(ctx.getMethod()).thenReturn("GET");
setJsonBody("{\"FunctionName\":\"my-function\"}");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));
private List<String> lambda(ResourceArnBuilder from, String method, String sent, String operation) {
when(ctx.getMethod()).thenReturn(method);
request(sent);
return from.buildResources("lambda", "lambda:" + operation, ctx, "us-east-1", ACCOUNT, "aws");
}
/** A function is named by its name, its ARN or a partial ARN, and a whole or partial ARN keeps its account. */
@Test
void lambdaFunctionArnKeepsTheAccountItNames() {
when(uriInfo.getPath()).thenReturn(
"/2015-03-31/functions/arn:aws:lambda:us-east-1:111122223333:function:my-function/invocations");
assertEquals("arn:aws:lambda:us-east-1:111122223333:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2015-03-31/functions/111122223333:function:my-function/invocations");
assertEquals("arn:aws:lambda:us-east-1:111122223333:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
void aFunctionIsNamedByItsNameOrItsWholeOrPartialArn() {
assertEquals(List.of(FUNCTION), lambda("POST", "/2015-03-31/functions/my-function/invocations", "Invoke"));
assertEquals(Set.of(OTHER_FUNCTION, FUNCTION), Set.copyOf(lambda("POST",
"/2015-03-31/functions/" + OTHER_FUNCTION + "/invocations", "Invoke")));
assertEquals(Set.of(OTHER_FUNCTION, FUNCTION), Set.copyOf(lambda("POST",
"/2015-03-31/functions/111122223333:function:my-function/invocations", "Invoke")));
assertEquals(Set.of("arn:aws:lambda:eu-west-1:111122223333:function:my-function",
"arn:aws:lambda:eu-west-1:000000000000:function:my-function",
"arn:aws:lambda:us-east-1:111122223333:function:my-function", FUNCTION),
Set.copyOf(lambda("GET", "/2015-03-31/functions/eu-west-1:111122223333:function:my-function",
"GetFunction")));
// Code-signing attachment names its function by Lambda's broader shape, the resource part alone included.
assertEquals(List.of("arn:aws:lambda:us-east-1:000000000000:function:protected"),
lambda("GET", "/2020-06-30/functions/function:protected/code-signing-config",
"GetFunctionCodeSigningConfig"));
// A reference Lambda refuses is named as given: its handler answers it with a 400.
assertEquals(List.of("arn:aws:lambda:us-east-1:000000000000:function:not:a:function:ref"),
lambda("POST", "/2015-03-31/functions/not:a:function:ref/invocations", "Invoke"));
}
/**
* A version or alias written into the function's name is part of the name it is checked on; the Qualifier member
* names nothing for an action the Service Reference gives the function alone.
*/
@Test
void lambdaCodeSigningUsesTheNamespacedFunctionTarget() {
when(uriInfo.getPath()).thenReturn(
"/2020-06-30/functions/function:protected/code-signing-config");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:protected",
builder.build("lambda", ctx, "us-east-1", ACCOUNT));
}
@Test
void lambdaInvokeKeepsTheQualifierItRuns() {
when(uriInfo.getPath()).thenReturn(
"/2015-03-31/functions/arn:aws:lambda:us-east-1:111122223333:function:my-function:live/invocations");
assertEquals("arn:aws:lambda:us-east-1:111122223333:function:my-function:live",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2015-03-31/functions/my-function/invocations");
void aQualifierInTheNameIsPartOfTheFunctionItNames() {
assertEquals(List.of(FUNCTION + ":1"), lambda("DELETE", "/2015-03-31/functions/my-function:1",
"DeleteFunction"));
assertEquals(Set.of(OTHER_FUNCTION + ":live", FUNCTION + ":live"), Set.copyOf(lambda("POST",
"/2015-03-31/functions/" + OTHER_FUNCTION + ":live/invocations", "Invoke")));
queryParams.putSingle("Qualifier", "1");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function:1",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
assertEquals(List.of(FUNCTION), lambda("POST", "/2015-03-31/functions/my-function/invocations", "Invoke"));
assertEquals(List.of(FUNCTION), lambda("GET", "/2015-03-31/functions/my-function", "GetFunction"));
assertEquals(List.of(FUNCTION), lambda("POST",
"/2021-11-15/functions/my-function/response-streaming-invocations", "InvokeWithResponseStream"));
}
/** Provisioned concurrency acts on the alias or version its Qualifier names, of the function it names. */
@Test
void provisionedConcurrencyKeepsTheOwnerAndQualifierItConfigures() {
when(uriInfo.getPath()).thenReturn(
"/2019-09-30/functions/arn:aws:lambda:us-east-1:111122223333:function:example/provisioned-concurrency");
void provisionedConcurrencyActsOnTheVersionOrAliasItsQualifierNames() {
queryParams.putSingle("Qualifier", "live");
assertEquals("arn:aws:lambda:us-east-1:111122223333:function:example:live",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2019-09-30/functions/example/provisioned-concurrency");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:example:live",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
assertEquals(List.of(FUNCTION + ":live"), lambda("GET",
"/2019-09-30/functions/my-function/provisioned-concurrency", "GetProvisionedConcurrencyConfig"));
assertEquals(Set.of(OTHER_FUNCTION + ":live", FUNCTION + ":live"), Set.copyOf(lambda("GET",
"/2019-09-30/functions/" + OTHER_FUNCTION + "/provisioned-concurrency",
"GetProvisionedConcurrencyConfig")));
}
/** CreateFunction is checked on the function its body names. */
@Test
void createFunctionIsCheckedOnTheFunctionItsBodyNames() {
setJsonBody("{\"FunctionName\":\"my-function\",\"Runtime\":\"nodejs20.x\"}");
assertEquals(List.of(FUNCTION), lambda("POST", "/2015-03-31/functions", "CreateFunction"));
setJsonBody("{\"FunctionName\":\"" + OTHER_FUNCTION + "\"}");
assertEquals(Set.of(OTHER_FUNCTION, FUNCTION), Set.copyOf(lambda("POST", "/2015-03-31/functions",
"CreateFunction")));
setJsonBody("{\"Runtime\":\"nodejs20.x\"}");
assertEquals(List.of("*"), lambda("POST", "/2015-03-31/functions", "CreateFunction"));
}
@Test
void lambdaWebRoutesResolveTheFunctionRevisionOrEndpointTheyActOn() {
void webFunctionRoutesNameTheFunctionRevisionOrEndpointTheyActOn() {
String fn = "arn:aws:lambda:us-east-1:000000000000:web-function/app";
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-functions/app");
assertEquals(fn, builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-functions/app/revisions");
assertEquals(fn, builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-functions/app/list-endpoints");
assertEquals(fn, builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-functions/app/revisions/rev-abcde");
assertEquals(fn + "/revision/rev-abcde", builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-functions/app/endpoints/prod");
assertEquals(fn + "/endpoint/prod", builder.build("lambda", ctx, "us-east-1", "000000000000"));
// A function named by its ARN keeps the account and region it names.
when(uriInfo.getPath()).thenReturn(
"/2025-03-07/web-functions/arn:aws:lambda:us-east-1:111122223333:web-function/app/endpoints/prod");
assertEquals("arn:aws:lambda:us-east-1:111122223333:web-function/app/endpoint/prod",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
// A revision or endpoint named by its ARN resolves to its id under the path's function.
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-functions/app/revisions/"
+ "arn:aws:lambda:us-east-1:000000000000:web-function/app/revision/rev-abcde");
assertEquals(fn + "/revision/rev-abcde", builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-functions/app/endpoints/"
+ "arn:aws:lambda:us-east-1:000000000000:web-function/app/endpoint/prod");
assertEquals(fn + "/endpoint/prod", builder.build("lambda", ctx, "us-east-1", "000000000000"));
// The tag and policy routes carry the function ARN in the path.
when(uriInfo.getPath()).thenReturn("/2025-03-07/tags/" + fn);
assertEquals(fn, builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-03-07/resource-policy/" + fn);
assertEquals(fn, builder.build("lambda", ctx, "us-east-1", "000000000000"));
// Listing functions, the account settings and creating a function name no resource.
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-functions");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-03-07/web-account-settings");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));
assertEquals(List.of(fn), lambda("GET", "/2025-03-07/web-functions/app", "GetWebFunction"));
assertEquals(List.of(fn), lambda("POST", "/2025-03-07/web-functions/app/list-revisions",
"ListWebFunctionRevisions"));
assertEquals(List.of(fn), lambda("POST", "/2025-03-07/web-functions/app/list-endpoints",
"ListWebFunctionEndpoints"));
assertEquals(List.of(fn + "/revision/rev-abcde"), lambda("GET",
"/2025-03-07/web-functions/app/revisions/rev-abcde", "GetWebFunctionRevision"));
assertEquals(List.of(fn + "/endpoint/prod"), lambda("GET", "/2025-03-07/web-functions/app/endpoints/prod",
"GetWebFunctionEndpoint"));
// The tag and policy routes carry the function's ARN.
assertEquals(List.of(fn), lambda("GET", "/2025-03-07/tags/" + fn.replace("/", "%2F"), "ListTags"));
assertEquals(List.of(fn), lambda("GET", "/2025-03-07/resource-policy/" + fn.replace("/", "%2F"),
"GetResourcePolicy"));
// Listing functions and the account settings name no resource.
assertEquals(List.of("*"), lambda("POST", "/2025-03-07/web-functions", "ListWebFunctions"));
assertEquals(List.of("*"), lambda("GET", "/2025-03-07/web-account-settings", "GetWebAccountSettings"));
}
@Test
void lambdaMicrovmAndNetworkConnectorRoutesResolveTheImageOrConnectorTheyName() {
void microvmImageAndNetworkConnectorRoutesNameTheImageOrConnectorTheyActOn() {
String image = "arn:aws:lambda:us-east-1:000000000000:microvm-image:img";
when(uriInfo.getPath()).thenReturn("/2025-09-09/microvm-images/img");
assertEquals(image, builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-09-09/microvm-images/img/versions/1/builds/b-1");
assertEquals(image, builder.build("lambda", ctx, "us-east-1", "000000000000"));
// An image named by its ARN is looked up by its name in the request's account and Region, so that
// is the resource checked, whatever account or Region the ARN names.
when(uriInfo.getPath()).thenReturn(
"/2025-09-09/microvm-images/arn:aws:lambda:eu-west-1:111122223333:microvm-image:shared/versions");
assertEquals("arn:aws:lambda:us-east-1:000000000000:microvm-image:shared",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2026-04-04/network-connectors/nc-1/versions");
assertEquals("arn:aws:lambda:us-east-1:000000000000:network-connector:nc-1",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
// RunMicrovm runs the image its imageIdentifier names, read as the service reads it.
when(ctx.getMethod()).thenReturn("POST");
when(uriInfo.getPath()).thenReturn("/2025-09-09/microvms");
assertEquals(List.of(image), lambda("GET", "/2025-09-09/microvm-images/img", "GetMicrovmImage"));
assertEquals(List.of(image), lambda("GET", "/2025-09-09/microvm-images/img/versions/1/builds/b-1",
"GetMicrovmImageBuild"));
// An image named by its ARN keeps the account and Region it names, beside the caller's of that name.
String shared = "arn:aws:lambda:eu-west-1:111122223333:microvm-image:shared";
assertEquals(Set.of(shared, "arn:aws:lambda:eu-west-1:000000000000:microvm-image:shared",
"arn:aws:lambda:us-east-1:111122223333:microvm-image:shared",
"arn:aws:lambda:us-east-1:000000000000:microvm-image:shared"),
Set.copyOf(lambda("GET", "/2025-09-09/microvm-images/" + shared + "/versions",
"ListMicrovmImageVersions")));
assertEquals(List.of("arn:aws:lambda:us-east-1:000000000000:network-connector:nc-1"),
lambda("GET", "/2026-04-04/network-connectors/nc-1/versions", "ListNetworkConnectorVersions"));
// RunMicrovm runs the image its imageIdentifier names.
setJsonBody("{\"imageIdentifier\":\"img\"}");
assertEquals(image, builder.build("lambda", ctx, "us-east-1", "000000000000"));
setJsonBody("{\"imageIdentifier\":\"arn:aws:lambda:eu-west-1:111122223333:microvm-image:img\"}");
assertEquals(image, builder.build("lambda", ctx, "us-east-1", "000000000000"));
assertEquals(List.of(image), lambda("POST", "/2025-09-09/microvms", "RunMicrovm"));
setJsonBody("{}");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));
// A managed image's versions are checked against the managed image, which aws owns.
when(ctx.getMethod()).thenReturn("GET");
when(uriInfo.getPath()).thenReturn("/2025-09-09/managed-microvm-images/al2023-1/versions");
assertEquals("arn:aws:lambda:us-east-1:aws:microvm-image:al2023-1",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
// Creating or listing either, listing MicroVMs, a managed image there is none of, and a MicroVM the
// account does not hold name no resource here.
for (String path : new String[] {"/2025-09-09/microvm-images", "/2025-09-09/managed-microvm-images",
"/2025-09-09/managed-microvm-images/other/versions", "/2025-09-09/microvms",
"/2025-09-09/microvms/vm-1", "/2026-04-04/network-connectors"}) {
when(uriInfo.getPath()).thenReturn(path);
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"), path);
}
}
@Test
void lambdaMappingConfigAndLayerRoutesResolveTheResourceTheyName() {
when(ctx.getMethod()).thenReturn("GET");
request("/2015-03-31/event-source-mappings/14e0db71-5d35-4eb5-b481-8945cf9d10c2");
assertEquals("arn:aws:lambda:us-east-1:000000000000:event-source-mapping:14e0db71-5d35-4eb5-b481-8945cf9d10c2",
builder.build("lambda", ctx, "us-east-1", ACCOUNT));
// A config is looked up by the id that ends its ARN, in the request's account and Region.
String config = "arn:aws:lambda:us-east-1:000000000000:code-signing-config:csc-0123456789abcdef0";
for (String path : new String[] {"/2020-04-22/code-signing-configs/" + config,
"/2020-04-22/code-signing-configs/" + config + "/functions",
"/2020-04-22/code-signing-configs/arn:aws:lambda:eu-west-1:111122223333:code-signing-config:"
+ "csc-0123456789abcdef0"}) {
request(path);
assertEquals(config, builder.build("lambda", ctx, "us-east-1", ACCOUNT), path);
}
// A layer version, its policy and its permissions.
String version = "arn:aws:lambda:us-east-1:000000000000:layer:my-layer:3";
for (String path : new String[] {"/2018-10-31/layers/my-layer/versions/3",
"/2018-10-31/layers/my-layer/versions/3/policy",
"/2018-10-31/layers/my-layer/versions/3/policy/statement-1"}) {
String operation = path.endsWith("/statement-1") ? "RemoveLayerVersionPermission"
: path.endsWith("/policy") ? "GetLayerVersionPolicy" : "GetLayerVersion";
when(ctx.getMethod()).thenReturn(operation.startsWith("Remove") ? "DELETE" : "GET");
request(path);
assertEquals(version, layerResource(operation, "us-east-1"), path);
}
// GetLayerVersion accepts an unversioned ARN and checks the version that it names.
String named = "arn:aws:lambda:us-east-1:000000000000:layer:my-layer";
when(ctx.getMethod()).thenReturn("GET");
request("/2018-10-31/layers/" + named + "/versions/3");
assertEquals(version, layerResource("GetLayerVersion", "us-east-1"));
// GetLayerVersionByArn reads the version its Arn names.
request("/2018-10-31/layers");
queryParams.putSingle("find", "LayerVersion");
queryParams.putSingle("Arn", version);
assertEquals(version, layerResource("GetLayerVersionByArn", "us-east-1"));
queryParams.clear();
// Listing layers, a layer's versions or configs, and creating a config, name no resource.
for (String path : new String[] {"/2018-10-31/layers", "/2018-10-31/layers/my-layer/versions",
"/2020-04-22/code-signing-configs"}) {
request(path);
String operation = path.endsWith("/versions") ? "ListLayerVersions" : "ListLayers";
assertEquals("*", path.contains("/layers")
? layerResource(operation, "us-east-1")
: builder.build("lambda", ctx, "us-east-1", ACCOUNT), path);
}
when(ctx.getMethod()).thenReturn("POST");
request("/2020-04-22/code-signing-configs");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", ACCOUNT));
// PublishLayerVersion makes a version of the layer, so it is checked against the layer.
request("/2018-10-31/layers/my-layer/versions");
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my-layer",
layerResource("PublishLayerVersion", "us-east-1"));
// A function's own settings, such as its concurrency or versions, are checked against the function.
request("/2015-03-31/functions/my-function/versions");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", ACCOUNT));
when(ctx.getMethod()).thenReturn("PUT");
request("/2017-10-31/functions/my-function/concurrency");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", ACCOUNT));
}
@ParameterizedTest
@CsvSource({"aws,us-west-2,us-east-1", "aws-cn,cn-northwest-1,cn-north-1",
"aws-us-gov,us-gov-east-1,us-gov-west-1"})
void lambdaLayerArnLookupKeepsItsCoordinatesAndNormalizesTheVersion(
String partition, String layerRegion, String requestRegion) {
String layer = "arn:" + partition + ":lambda:" + layerRegion + ":111122223333:layer:shared";
when(ctx.getMethod()).thenReturn("GET");
request("/2018-10-31/layers/" + layer.replace(":", "%3A") + "/versions/01");
assertEquals(layer + ":1", layerResource("GetLayerVersion", requestRegion));
}
@Test
void otherLayerRoutesKeepTheirLiteralNameResource() {
String layer = "arn:aws:lambda:us-west-2:111122223333:layer:shared";
String expected = "arn:aws:lambda:us-east-1:" + ACCOUNT + ":layer:" + layer + ":1";
when(ctx.getMethod()).thenReturn("DELETE");
request("/2018-10-31/layers/" + layer + "/versions/01");
assertEquals(expected, layerResource("DeleteLayerVersion", "us-east-1"));
when(ctx.getMethod()).thenReturn("GET");
request("/2018-10-31/layers/" + layer + "/versions/01/policy");
assertEquals(expected, layerResource("GetLayerVersionPolicy", "us-east-1"));
}
@Test
void aLayerVersionIsReadAsLambdaReadsItsNameAndNumber() {
// Lambda parses the version number, so 01 is version 1, and the router keeps an encoded / inside the
// layer's name, so the layer checked is the one Lambda looks up.
when(ctx.getMethod()).thenReturn("GET");
request("/2018-10-31/layers/my-layer/versions/01");
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my-layer:1",
layerResource("GetLayerVersion", "us-east-1"));
request("/2018-10-31/layers/my%2Flayer/versions/3/policy");
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my/layer:3",
layerResource("GetLayerVersionPolicy", "us-east-1"));
when(ctx.getMethod()).thenReturn("POST");
request("/2018-10-31/layers/my%2Flayer/versions");
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my/layer",
layerResource("PublishLayerVersion", "us-east-1"));
// GetLayerVersionByArn parses the number the same way.
when(ctx.getMethod()).thenReturn("GET");
request("/2018-10-31/layers");
queryParams.putSingle("find", "LayerVersion");
queryParams.putSingle("Arn", "arn:aws:lambda:us-east-1:000000000000:layer:my-layer:01");
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my-layer:1",
layerResource("GetLayerVersionByArn", "us-east-1"));
}
private String layerResource(String operation, String region) {
return builder.buildResources("lambda", "lambda:" + operation, ctx, region, ACCOUNT,
AwsRegions.partitionFor(region)).getFirst();
assertEquals(List.of("*"), lambda("POST", "/2025-09-09/microvms", "RunMicrovm"));
// Listing images, connectors and MicroVMs names no resource.
assertEquals(List.of("*"), lambda("GET", "/2025-09-09/microvm-images", "ListMicrovmImages"));
assertEquals(List.of("*"), lambda("GET", "/2025-09-09/microvms", "ListMicrovms"));
assertEquals(List.of("*"), lambda("GET", "/2026-04-04/network-connectors", "ListNetworkConnectors"));
}
/** An action on a running MicroVM is checked on the image it runs, which Lambda gives for the caller's MicroVM. */
@Test
void anActionOnARunningMicrovmIsCheckedAgainstTheImageItRuns() {
String image = "arn:aws:lambda:us-east-1:000000000000:microvm-image:img";
@@ -2286,15 +2140,92 @@ class ResourceArnBuilderTest {
LambdaMicrovmsService microvms = mock(LambdaMicrovmsService.class);
when(microvms.findMicrovm(any(), any())).thenReturn(Optional.empty());
when(microvms.findMicrovm("us-east-1", "microvm-1")).thenReturn(Optional.of(vm));
ResourceArnBuilder backed = backedBy(microvms);
@SuppressWarnings("unchecked")
Instance<LambdaMicrovmsService> instance = mock(Instance.class);
when(instance.isResolvable()).thenReturn(true);
when(instance.get()).thenReturn(microvms);
ResourceArnBuilder backed = reading(new LambdaStoredResourceArns(null, instance));
for (String path : new String[] {"/2025-09-09/microvms/microvm-1",
"/2025-09-09/microvms/microvm-1/suspend", "/2025-09-09/microvms/microvm-1/auth-token"}) {
when(uriInfo.getPath()).thenReturn(path);
assertEquals(image, backed.build("lambda", ctx, "us-east-1", "000000000000"), path);
}
when(uriInfo.getPath()).thenReturn("/2025-09-09/microvms/microvm-2");
assertEquals("*", backed.build("lambda", ctx, "us-east-1", "000000000000"));
assertEquals(List.of(image), lambda(backed, "GET", "/2025-09-09/microvms/microvm-1", "GetMicrovm"));
assertEquals(List.of(image), lambda(backed, "POST", "/2025-09-09/microvms/microvm-1/suspend",
"SuspendMicrovm"));
assertEquals(List.of(image), lambda(backed, "POST", "/2025-09-09/microvms/microvm-1/auth-token",
"CreateMicrovmAuthToken"));
assertEquals(List.of("*"), lambda(backed, "GET", "/2025-09-09/microvms/microvm-2", "GetMicrovm"));
}
@Test
void mappingConfigAndLayerRoutesNameTheResourceTheyActOn() {
assertEquals(List.of("arn:aws:lambda:us-east-1:000000000000:event-source-mapping:"
+ "14e0db71-5d35-4eb5-b481-8945cf9d10c2"),
lambda("GET", "/2015-03-31/event-source-mappings/14e0db71-5d35-4eb5-b481-8945cf9d10c2",
"GetEventSourceMapping"));
String config = "arn:aws:lambda:us-east-1:000000000000:code-signing-config:csc-0123456789abcdef0";
assertEquals(List.of(config), lambda("GET", "/2020-04-22/code-signing-configs/" + config,
"GetCodeSigningConfig"));
assertEquals(List.of(config), lambda("GET", "/2020-04-22/code-signing-configs/" + config + "/functions",
"ListFunctionsByCodeSigningConfig"));
// A layer version, its policy and its permissions.
String version = "arn:aws:lambda:us-east-1:000000000000:layer:my-layer:3";
assertEquals(version, layerResource("GetLayerVersion", "us-east-1", "GET",
"/2018-10-31/layers/my-layer/versions/3"));
assertEquals(version, layerResource("GetLayerVersionPolicy", "us-east-1", "GET",
"/2018-10-31/layers/my-layer/versions/3/policy"));
assertEquals(version, layerResource("RemoveLayerVersionPermission", "us-east-1", "DELETE",
"/2018-10-31/layers/my-layer/versions/3/policy/statement-1"));
// GetLayerVersion accepts an unversioned ARN and checks the version that it names.
assertEquals(version, layerResource("GetLayerVersion", "us-east-1", "GET",
"/2018-10-31/layers/arn:aws:lambda:us-east-1:000000000000:layer:my-layer/versions/3"));
// GetLayerVersionByArn reads the version its Arn names.
queryParams.putSingle("find", "LayerVersion");
queryParams.putSingle("Arn", version);
assertEquals(version, layerResource("GetLayerVersionByArn", "us-east-1", "GET", "/2018-10-31/layers"));
queryParams.clear();
// Listing layers, a layer's versions or configs, and creating a config, name no resource.
assertEquals("*", layerResource("ListLayers", "us-east-1", "GET", "/2018-10-31/layers"));
assertEquals("*", layerResource("ListLayerVersions", "us-east-1", "GET", "/2018-10-31/layers/my-layer/versions"));
assertEquals(List.of("*"), lambda("GET", "/2020-04-22/code-signing-configs", "ListCodeSigningConfigs"));
assertEquals(List.of("*"), lambda("POST", "/2020-04-22/code-signing-configs", "CreateCodeSigningConfig"));
// PublishLayerVersion makes a version of the layer, so it is checked against the layer.
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my-layer",
layerResource("PublishLayerVersion", "us-east-1", "POST", "/2018-10-31/layers/my-layer/versions"));
}
@ParameterizedTest
@CsvSource({"aws,us-west-2,us-east-1", "aws-cn,cn-northwest-1,cn-north-1",
"aws-us-gov,us-gov-east-1,us-gov-west-1"})
void lambdaLayerArnLookupKeepsItsCoordinatesAndNormalizesTheVersion(
String partition, String layerRegion, String requestRegion) {
String layer = "arn:" + partition + ":lambda:" + layerRegion + ":111122223333:layer:shared";
String sent = "/2018-10-31/layers/" + layer.replace(":", "%3A") + "/versions/01";
assertEquals(layer + ":1", layerResource("GetLayerVersion", requestRegion, "GET", sent));
assertEquals(layer + ":1", layerResource("DeleteLayerVersion", requestRegion, "DELETE", sent));
}
@Test
void aLayerVersionIsReadAsLambdaReadsItsNameAndNumber() {
// Lambda parses the version number, so 01 is version 1, and the router keeps an encoded / inside the
// layer's name, so the layer checked is the one Lambda looks up.
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my-layer:1",
layerResource("GetLayerVersion", "us-east-1", "GET", "/2018-10-31/layers/my-layer/versions/01"));
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my/layer:3",
layerResource("GetLayerVersionPolicy", "us-east-1", "GET",
"/2018-10-31/layers/my%2Flayer/versions/3/policy"));
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my/layer",
layerResource("PublishLayerVersion", "us-east-1", "POST", "/2018-10-31/layers/my%2Flayer/versions"));
// GetLayerVersionByArn parses the number the same way.
queryParams.putSingle("find", "LayerVersion");
queryParams.putSingle("Arn", "arn:aws:lambda:us-east-1:000000000000:layer:my-layer:01");
assertEquals("arn:aws:lambda:us-east-1:000000000000:layer:my-layer:1",
layerResource("GetLayerVersionByArn", "us-east-1", "GET", "/2018-10-31/layers"));
}
private String layerResource(String operation, String region, String method, String sent) {
when(ctx.getMethod()).thenReturn(method);
request(sent);
return builder.buildResources("lambda", "lambda:" + operation, ctx, region, ACCOUNT,
AwsRegions.partitionFor(region)).getFirst();
}
@Test
@@ -2537,44 +2468,17 @@ class ResourceArnBuilderTest {
assertNull(builder.taggedArn(ctx));
}
/** A tag route names the resource by its ARN, which keeps its account and Region beside the caller's. */
@Test
void lambdaTagRoutesAndAStreamingInvokeResolveTheResourceTheyName() {
// Tagging acts on the caller's own function, image or connector of the ARN's Region and name,
// whatever account the ARN names, so that is the resource checked.
when(uriInfo.getPath()).thenReturn("/2017-03-31/tags/arn:aws:lambda:eu-west-1:111122223333:function:shared");
assertEquals("arn:aws:lambda:eu-west-1:000000000000:function:shared",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn(
"/2017-03-31/tags/arn:aws:lambda:eu-west-1:111122223333:microvm-image:img");
assertEquals("arn:aws:lambda:eu-west-1:000000000000:microvm-image:img",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn(
"/2017-03-31/tags/arn:aws:lambda:eu-west-1:111122223333:network-connector:nc-1");
assertEquals("arn:aws:lambda:eu-west-1:000000000000:network-connector:nc-1",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
// A mapping's ARN has to name it exactly, and Lambda refuses a qualified function, a running MicroVM
// and an image in no Region, so these stay as written.
String mapping = "arn:aws:lambda:us-east-1:111122223333:event-source-mapping:"
+ "14e0db71-5d35-4eb5-b481-8945cf9d10c2";
for (String arn : new String[] {mapping, "arn:aws:lambda:us-east-1:111122223333:function:shared:prod",
"arn:aws:lambda:us-east-1:111122223333:microvm:vm-1", "arn:aws:lambda::111122223333:microvm-image:img"}) {
when(uriInfo.getPath()).thenReturn("/2017-03-31/tags/" + arn);
assertEquals(arn, builder.build("lambda", ctx, "us-east-1", "000000000000"), arn);
}
// A version-qualified connector is no tag target, so it stays as written rather than naming the connector.
String qualified = "arn:aws:lambda:eu-west-1:111122223333:network-connector:nc-1:1";
when(uriInfo.getPath()).thenReturn("/2017-03-31/tags/" + qualified);
assertEquals(qualified, builder.build("lambda", ctx, "us-east-1", "000000000000"));
// A target without the arn: prefix names no resource.
when(uriInfo.getPath()).thenReturn("/2017-03-31/tags/x:y:z:eu-west-1:microvm-image:img");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2017-03-31/tags/shared");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));
// A streaming invoke is an invoke: its qualifier and the account its function ARN names count.
when(uriInfo.getPath()).thenReturn("/2021-11-15/functions/my-function/response-streaming-invocations");
queryParams.putSingle("Qualifier", "prod");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function:prod",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
void lambdaTagRoutesNameTheResourceTheirArnNames() {
String shared = "arn:aws:lambda:eu-west-1:111122223333:function:shared";
assertTrue(lambda("GET", "/2017-03-31/tags/" + shared, "ListTags").contains(shared));
String image = "arn:aws:lambda:eu-west-1:111122223333:microvm-image:img";
assertTrue(lambda("POST", "/2017-03-31/tags/" + image, "TagResource").contains(image));
String mapping = "arn:aws:lambda:us-east-1:111122223333:event-source-mapping:14e0db71-5d35-4eb5-b481-8945cf9d10c2";
assertTrue(lambda("GET", "/2017-03-31/tags/" + mapping, "ListTags").contains(mapping));
// A target that is no Lambda ARN names no resource.
assertEquals(List.of("*"), lambda("GET", "/2017-03-31/tags/shared", "ListTags"));
}
@Test
@@ -2590,95 +2494,30 @@ class ResourceArnBuilderTest {
assertEquals("*", builder.build("pipes", ctx, "us-east-1", "000000000000"));
}
@Test
void lambdaRoutesOtherThanInvokeAreCheckedAgainstTheCallersUnqualifiedFunction() {
when(uriInfo.getPath()).thenReturn(
"/2015-03-31/functions/arn:aws:lambda:us-east-1:111122223333:function:my-function:1/code");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2015-03-31/functions/111122223333:function:my-function/policy");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2015-03-31/functions/my-function");
queryParams.putSingle("Qualifier", "1");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
}
@Test
void lambdaQualifiedReadsByArnAreCheckedInTheAccountTheyRead() {
when(ctx.getMethod()).thenReturn("GET");
when(uriInfo.getPath()).thenReturn(
"/2015-03-31/functions/arn:aws:lambda:us-east-1:111122223333:function:my-function:1");
assertEquals("arn:aws:lambda:us-east-1:111122223333:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn(
"/2015-03-31/functions/arn:aws:lambda:us-east-1:111122223333:function:my-function/configuration");
queryParams.putSingle("Qualifier", "live");
assertEquals("arn:aws:lambda:us-east-1:111122223333:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
}
@Test
void lambdaReadsThatDoNotFollowTheArnAreCheckedOnTheCallersFunction() {
when(ctx.getMethod()).thenReturn("GET");
when(uriInfo.getPath()).thenReturn(
"/2015-03-31/functions/arn:aws:lambda:us-east-1:111122223333:function:my-function");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2015-03-31/functions/111122223333:function:my-function:1");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn(
"/2015-03-31/functions/arn:aws:lambda:us-east-1:111122223333:function:my-function:1/policy");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(ctx.getMethod()).thenReturn("DELETE");
when(uriInfo.getPath()).thenReturn(
"/2015-03-31/functions/arn:aws:lambda:us-east-1:111122223333:function:my-function:1");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
}
@Test
void lambdaReferenceLambdaRefusesIsNamedAsGiven() {
when(uriInfo.getPath()).thenReturn("/2015-03-31/functions/not:a:function:ref/invocations");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:not:a:function:ref",
builder.build("lambda", ctx, "us-east-1", "000000000000"));
}
/** A durable execution's actions are checked on the execution its ARN names, which a client sends encoded. */
@Test
void lambdaDurableExecutionRoutesNameTheExecution() {
when(uriInfo.getPath()).thenReturn("/2025-12-01/durable-executions/arn:aws:lambda:us-east-1:000000000000:"
+ "function:my-function:$LATEST/durable-execution/run-1/0b1c/stop");
String arn = builder.build("lambda", ctx, "us-east-1", "000000000000");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function:$LATEST/durable-execution/run-1/0b1c",
arn);
String execution = "arn:aws:lambda:us-east-1:000000000000:function:my-function:1/durable-execution/run-1/0b1c";
String sent = execution.replace("/", "%2F");
assertEquals(List.of(execution), lambda("POST", "/2025-12-01/durable-executions/" + sent + "/stop",
"StopDurableExecution"));
assertEquals(List.of(execution), lambda("GET", "/2025-12-01/durable-executions/" + sent,
"GetDurableExecution"));
}
/** Lambda authorizes a callback request against the ARN of the durable execution that created the callback. */
@Test
void lambdaDurableCallbackRoutesNameTheExecutionInTheCallbackId() {
String executionArn = "arn:aws:lambda:us-east-1:000000000000:function:my-function:1/durable-execution/run-1/0b1c";
String callbackId = Base64.getEncoder().encodeToString((executionArn + "|c1|nonce").getBytes(StandardCharsets.UTF_8));
when(uriInfo.getPath()).thenReturn("/2025-12-01/durable-execution-callbacks/" + callbackId + "/succeed");
assertEquals(executionArn, builder.build("lambda", ctx, "us-east-1", "000000000000"));
when(uriInfo.getPath()).thenReturn("/2025-12-01/durable-execution-callbacks/not-a-callback/heartbeat");
assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000"));
}
@Test
void lambdaDurableExecutionGetNamesTheExecution() {
when(uriInfo.getPath()).thenReturn("/2025-12-01/durable-executions/arn:aws:lambda:us-east-1:000000000000:"
+ "function:my-function:1/durable-execution/run-1/0b1c");
String arn = builder.build("lambda", ctx, "us-east-1", "000000000000");
assertEquals("arn:aws:lambda:us-east-1:000000000000:function:my-function:1/durable-execution/run-1/0b1c", arn);
void lambdaDurableCallbackRoutesNameTheExecutionOfTheCallback() {
String execution = "arn:aws:lambda:us-east-1:000000000000:function:my-function:1/durable-execution/run-1/0b1c";
String callbackId = Base64.getEncoder().encodeToString((execution + "|c1|nonce").getBytes(StandardCharsets.UTF_8));
@SuppressWarnings("unchecked")
Instance<LambdaMicrovmsService> none = mock(Instance.class);
ResourceArnBuilder backed = reading(new LambdaStoredResourceArns(null, none));
assertEquals(List.of(execution), lambda(backed, "POST",
"/2025-12-01/durable-execution-callbacks/" + callbackId.replace("/", "%2F") + "/succeed",
"SendDurableExecutionCallbackSuccess"));
assertEquals(List.of("*"), lambda(backed, "POST", "/2025-12-01/durable-execution-callbacks/not-a-callback/heartbeat",
"SendDurableExecutionCallbackHeartbeat"));
}
// ── EKS ──────────────────────────────────────────────────────────────────────
@@ -154,9 +154,11 @@ class LambdaCrossAccountInvokeIntegrationTest {
String caller = createUser(CALLER, "invoker-" + suffix(), INVOKE_ANYTHING);
invoke(caller, functionArn + ":live").statusCode(200);
invoke(caller, functionArn, "live").statusCode(200);
invoke(caller, functionArn).statusCode(403);
invoke(caller, functionArn + ":1").statusCode(403);
// The Service Reference gives InvokeFunction the function alone, so a Qualifier names nothing for it: the
// call is checked on the function as named, which the alias grant does not cover.
invoke(caller, functionArn, "live").statusCode(403);
}
@Test
@@ -224,17 +226,26 @@ class LambdaCrossAccountInvokeIntegrationTest {
*/
@Test
void aQualifiedReadOfAnotherAccountsFunctionNeedsItsGrant() {
String foreignArn = createFunction(OWNER, "read-" + suffix());
String name = "read-" + suffix();
String foreignArn = createFunction(OWNER, name);
publishVersionAndAlias(OWNER, name, "live");
String user = createUser(CALLER, "reader-" + suffix(), """
{"Version":"2012-10-17","Statement":[
{"Effect":"Allow","Action":"lambda:GetFunction","Resource":"*"}]}""");
lambda(user).get("/2015-03-31/functions/{name}", foreignArn + ":$LATEST").then().statusCode(403);
lambda(user).queryParam("Qualifier", "$LATEST").get("/2015-03-31/functions/{name}", foreignArn)
lambda(user).get("/2015-03-31/functions/{name}", foreignArn + ":live").then().statusCode(403);
lambda(user).queryParam("Qualifier", "live").get("/2015-03-31/functions/{name}", foreignArn)
.then().statusCode(403);
// An alias in the function's name is part of the function checked, so a grant on the function does not
// cover it, and one on the alias does; a Qualifier names nothing for GetFunction, which the Service
// Reference gives the function alone, so the grant on the function covers that read.
addPermission(OWNER, foreignArn, null, Map.of("Principal", CALLER, "Action", "lambda:GetFunction"));
lambda(user).get("/2015-03-31/functions/{name}", foreignArn + ":$LATEST")
lambda(user).get("/2015-03-31/functions/{name}", foreignArn + ":live").then().statusCode(403);
lambda(user).queryParam("Qualifier", "live").get("/2015-03-31/functions/{name}", foreignArn)
.then().statusCode(200).body("Configuration.FunctionArn", startsWith(foreignArn));
addPermission(OWNER, foreignArn, "live", Map.of("Principal", CALLER, "Action", "lambda:GetFunction"));
lambda(user).get("/2015-03-31/functions/{name}", foreignArn + ":live")
.then().statusCode(200).body("Configuration.FunctionArn", startsWith(foreignArn));
}
@@ -0,0 +1,103 @@
package io.floci.aws.services.lambda;
import io.floci.aws.testing.AwsTestClients;
import io.floci.aws.testing.EnforcementFixtures;
import io.floci.aws.testing.EnforcementFixtures.UserCredentials;
import io.floci.aws.testing.IamEnforcementProfile;
import io.floci.aws.testing.PartitionCleanup;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.lambda.LambdaClient;
import software.amazon.awssdk.services.lambda.model.LambdaException;
import software.amazon.awssdk.services.lambda.model.PublishLayerVersionResponse;
import software.amazon.awssdk.services.lambda.model.ResourceNotFoundException;
import java.net.URI;
import java.util.UUID;
import static io.floci.aws.services.lambda.LambdaLayerFixtures.publishLayerVersion;
import static io.floci.aws.testing.EnforcementFixtures.auth;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@QuarkusTest
@TestProfile(IamEnforcementProfile.class)
class LambdaDeleteLayerArnIamIntegrationTest {
private static final String ACCOUNT = "741681410023";
@TestHTTPResource("/")
URI endpoint;
@RegisterExtension
final PartitionCleanup cleanup = new PartitionCleanup();
@ParameterizedTest
@CsvSource({"us-east-1,us-east-1,false", "us-east-1,us-east-1,true",
"cn-north-1,cn-north-1,true", "us-gov-west-1,us-gov-west-1,true", "us-west-2,us-east-1,true"})
void deletionChecksTheVersionNamedByTheSelector(String layerRegion, String requestRegion, boolean arnSelector)
throws Exception {
String name = "layer-delete-iam-" + UUID.randomUUID();
try (LambdaClient owner = AwsTestClients.create(LambdaClient.builder(), ACCOUNT, Region.of(layerRegion), endpoint)) {
PublishLayerVersionResponse published = publishLayerVersion(
owner, name, ACCOUNT, Region.of(layerRegion), endpoint, cleanup);
String user = "layer-deleter-" + UUID.randomUUID();
String authorization = auth(ACCOUNT, requestRegion, "iam");
UserCredentials credentials = EnforcementFixtures.createUser(cleanup, endpoint.getPort(), authorization, user);
String selector = arnSelector ? published.layerArn() : name;
String resource = published.layerVersionArn();
try (LambdaClient caller = AwsTestClients.create(LambdaClient.builder(),
credentials.accessKeyId(), credentials.secretAccessKey(), Region.of(requestRegion), endpoint)) {
policy(authorization, user, resource + "-other", null);
denied(caller, selector, published.version());
policy(authorization, user, "*", resource);
denied(caller, selector, published.version());
assertEquals(resource, owner.getLayerVersion(request -> request
.layerName(name).versionNumber(published.version())).layerVersionArn());
policy(authorization, user, resource, null);
assertEquals(204, caller.deleteLayerVersion(request -> request.layerName(selector)
.versionNumber(published.version())).sdkHttpResponse().statusCode());
assertThrows(ResourceNotFoundException.class, () -> owner.getLayerVersion(request -> request
.layerName(name).versionNumber(published.version())));
}
}
}
private void policy(String authorization, String user, String allowed, String denied) {
String statements = """
{
"Effect": "Allow",
"Action": "lambda:DeleteLayerVersion",
"Resource": "%s"
}
""".formatted(allowed);
if (denied != null) {
statements += "," + """
{
"Effect": "Deny",
"Action": "lambda:DeleteLayerVersion",
"Resource": "%s"
}
""".formatted(denied);
}
EnforcementFixtures.putUserPolicy(endpoint.getPort(), authorization, user, "layer-delete",
"""
{
"Version": "2012-10-17",
"Statement": [%s]
}
""".formatted(statements));
}
private static void denied(LambdaClient caller, String selector, long version) {
LambdaException denied = assertThrows(LambdaException.class, () -> caller.deleteLayerVersion(request ->
request.layerName(selector).versionNumber(version)));
assertEquals(403, denied.statusCode());
}
}
@@ -0,0 +1,111 @@
package io.floci.aws.services.lambda;
import io.floci.aws.testing.AwsTestClients;
import io.floci.aws.testing.PartitionCleanup;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.lambda.LambdaClient;
import software.amazon.awssdk.services.lambda.model.LambdaException;
import software.amazon.awssdk.services.lambda.model.PublishLayerVersionResponse;
import software.amazon.awssdk.services.lambda.model.ResourceNotFoundException;
import java.net.URI;
import java.util.UUID;
import static io.floci.aws.services.lambda.LambdaLayerFixtures.publishLayerVersion;
import static io.restassured.RestAssured.given;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@QuarkusTest
class LambdaDeleteLayerArnIntegrationTest {
private static final String ACCOUNT = "741681410021";
@TestHTTPResource("/")
URI endpoint;
@RegisterExtension
final PartitionCleanup cleanup = new PartitionCleanup();
@ParameterizedTest
@CsvSource({"us-east-1,false", "us-east-1,true", "cn-north-1,false", "cn-north-1,true",
"us-gov-west-1,false", "us-gov-west-1,true"})
void deletesOnlyTheSelectedVersionAndItsArchive(String region, boolean arnSelector) throws Exception {
try (LambdaClient client = client(ACCOUNT, Region.of(region))) {
String name = "layer-delete-" + UUID.randomUUID();
PublishLayerVersionResponse first = publishLayerVersion(
client, name, ACCOUNT, Region.of(region), endpoint, cleanup);
PublishLayerVersionResponse second = publishLayerVersion(
client, name, ACCOUNT, Region.of(region), endpoint, cleanup);
String location = client.getLayerVersion(request -> request.layerName(name)
.versionNumber(first.version())).content().location();
String selector = arnSelector ? first.layerArn() : name;
assertEquals(204, client.deleteLayerVersion(request -> request.layerName(selector)
.versionNumber(first.version())).sdkHttpResponse().statusCode());
assertThrows(ResourceNotFoundException.class, () -> client.getLayerVersion(request -> request
.layerName(name).versionNumber(first.version())));
given().urlEncodingEnabled(false).get(location).then().statusCode(404);
assertEquals(second.layerVersionArn(), client.getLayerVersion(request -> request.layerName(name)
.versionNumber(second.version())).layerVersionArn());
assertEquals(204, client.deleteLayerVersion(request -> request.layerName(selector)
.versionNumber(first.version())).sdkHttpResponse().statusCode());
}
}
@Test
void arnDeletionUsesTheLayerRegionAndPreservesTheRequestRegion() throws Exception {
try (LambdaClient owner = client(ACCOUNT, Region.US_WEST_2);
LambdaClient caller = client(ACCOUNT, Region.US_EAST_1)) {
String name = "layer-regional-delete-" + UUID.randomUUID();
PublishLayerVersionResponse stored = publishLayerVersion(
owner, name, ACCOUNT, Region.US_WEST_2, endpoint, cleanup);
PublishLayerVersionResponse local = publishLayerVersion(
caller, name, ACCOUNT, Region.US_EAST_1, endpoint, cleanup);
String location = owner.getLayerVersion(request -> request.layerName(name)
.versionNumber(stored.version())).content().location();
caller.deleteLayerVersion(request -> request.layerName(stored.layerArn()).versionNumber(stored.version()));
assertThrows(ResourceNotFoundException.class, () -> owner.getLayerVersion(request -> request
.layerName(name).versionNumber(stored.version())));
given().urlEncodingEnabled(false).get(location).then().statusCode(404);
assertEquals(local.layerVersionArn(), caller.getLayerVersion(request -> request
.layerName(name).versionNumber(local.version())).layerVersionArn());
}
}
@Test
void foreignOrMalformedSelectorsCannotDeleteOwnedVersions() throws Exception {
String otherAccount = "741681410022";
try (LambdaClient client = client(ACCOUNT, Region.US_EAST_1);
LambdaClient other = client(otherAccount, Region.US_EAST_1)) {
String name = "layer-isolated-delete-" + UUID.randomUUID();
PublishLayerVersionResponse owned = publishLayerVersion(
client, name, ACCOUNT, Region.US_EAST_1, endpoint, cleanup);
PublishLayerVersionResponse foreign = publishLayerVersion(
other, name, otherAccount, Region.US_EAST_1, endpoint, cleanup);
client.deleteLayerVersion(request -> request.layerName(foreign.layerArn()).versionNumber(foreign.version()));
for (String invalid : new String[] {owned.layerVersionArn(),
owned.layerArn().replace("arn:aws:", "arn:aws-cn:")}) {
LambdaException error = assertThrows(LambdaException.class, () -> client.deleteLayerVersion(request ->
request.layerName(invalid).versionNumber(owned.version())));
assertEquals(400, error.statusCode());
}
assertEquals(owned.layerVersionArn(), client.getLayerVersion(request -> request
.layerName(name).versionNumber(owned.version())).layerVersionArn());
assertEquals(foreign.layerVersionArn(), other.getLayerVersion(request -> request
.layerName(name).versionNumber(foreign.version())).layerVersionArn());
}
}
private LambdaClient client(String account, Region region) {
return AwsTestClients.create(LambdaClient.builder(), account, region, endpoint);
}
}
@@ -3,9 +3,16 @@ package io.floci.aws.services.lambda;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.storage.AccountAwareStorageBackend;
import io.floci.aws.services.lambda.model.LambdaLayerVersion;
import io.floci.aws.testing.AwsTestClients;
import io.floci.aws.testing.PartitionCleanup;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.lambda.LambdaClient;
import software.amazon.awssdk.services.lambda.model.PublishLayerVersionResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.zip.ZipEntry;
@@ -24,6 +31,20 @@ public final class LambdaLayerFixtures {
return bytes.toByteArray();
}
public static PublishLayerVersionResponse publishLayerVersion(
LambdaClient client, String name, String account, Region region, URI endpoint, PartitionCleanup cleanup)
throws IOException {
byte[] archive = layerArchive();
PublishLayerVersionResponse published = client.publishLayerVersion(request -> request.layerName(name)
.content(content -> content.zipFile(SdkBytes.fromByteArray(archive))));
cleanup.register(() -> {
try (LambdaClient owner = AwsTestClients.create(LambdaClient.builder(), account, region, endpoint)) {
owner.deleteLayerVersion(request -> request.layerName(name).versionNumber(published.version()));
}
});
return published;
}
public static LambdaLayerService accountScopedService(
String defaultAccount, String region, Map<String, LambdaLayerVersion> layersByAccount) {
AccountAwareStorageBackend<LambdaLayerVersion> storage = AccountAwareStorageBackend.inMemory(defaultAccount);
@@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.lambda.LambdaClient;
import software.amazon.awssdk.services.lambda.model.LambdaException;
@@ -21,7 +20,7 @@ import software.amazon.awssdk.services.lambda.model.PublishLayerVersionResponse;
import java.net.URI;
import java.util.UUID;
import static io.floci.aws.services.lambda.LambdaLayerFixtures.layerArchive;
import static io.floci.aws.services.lambda.LambdaLayerFixtures.publishLayerVersion;
import static io.floci.aws.testing.EnforcementFixtures.auth;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -53,17 +52,10 @@ class LambdaLayerNameArnIamIntegrationTest {
private void verifyLayerPermissions(Region layerRegion, Region requestRegion, boolean arnSelector) throws Exception {
String name = "layer-iam-" + UUID.randomUUID();
byte[] archive = layerArchive();
PublishLayerVersionResponse published;
try (LambdaClient owner = AwsTestClients.create(LambdaClient.builder(), ACCOUNT, layerRegion, endpoint)) {
published = owner.publishLayerVersion(request -> request.layerName(name)
.content(content -> content.zipFile(SdkBytes.fromByteArray(archive))));
published = publishLayerVersion(owner, name, ACCOUNT, layerRegion, endpoint, cleanup);
}
cleanup.register(() -> {
try (LambdaClient owner = AwsTestClients.create(LambdaClient.builder(), ACCOUNT, layerRegion, endpoint)) {
owner.deleteLayerVersion(request -> request.layerName(name).versionNumber(published.version()));
}
});
String user = "layer-reader-" + UUID.randomUUID();
String authorization = auth(ACCOUNT, requestRegion.id(), "iam");
+199 -25
View File
@@ -184,6 +184,18 @@ cited and the action not one the reference lists for the operation, which a rule
Redshift Serverless restore asks KMS to decrypt with the snapshot's key. `forwardedActions` records what the
reference gives each such action, the type it acts on, that type's ARN format and the `ViaService` key, which
`--verify` checks against AWS.
A qualified type the reference gives an action, one whose format is another type's and one more `:${...}` (Lambda's
`function alias` and `function version`), which no member fills alone, is named by that type's member and the
request's one member documented as naming the qualified types ("The version number or alias name"): Lambda's
`GetProvisionedConcurrencyConfig` acts on the function's alias or version its `Qualifier` names. A member whose botocore pattern spells a
type's resource word and takes its ARN without the leading parts, `123456789012:function:my-function`, names the type
by such a partial ARN too (`partialArn`), which the reader completes in the request's partition. An account id member
beside an ARN member of the same name (`SourceAccount` beside `SourceArn`) is that ARN's resource's account. A record
field named after the end of a type's name (a MicroVM's `imageArn`, of its `microvmImage`) reaches that type through
the record's id, which a request may give as the thing's identifier (`microvmIdentifier` for `microvmId`), and an
operation documented as acting on a thing "in a <type>" ("a callback operation in a durable execution") reaches that
type through the thing's id. Clients of one namespace serving one endpoint keep every type an ARN member of theirs
may name, each ARN read by its format, since a request cannot tell them apart.
A type's ARN given with a qualifier, one more `:<name>` past its format, is checked without one where the
metadata says the qualifier names nothing of its own (`unqualified`): the reference gives Step Functions'
`statemachinealias` and `statemachineversion` formats as the state machine's and one more `:${...}`, and no action
@@ -260,10 +272,10 @@ NAMESPACES = ("access-analyzer", "account", "acm", "application-autoscaling", "a
"payment-cryptography", "quicksight", "ram", "redshift", "redshift-data", "redshift-serverless",
"rekognition", "resource-explorer-2", "route53", "servicediscovery", "servicequotas", "ssm", "sso",
"states", "textract", "timestream-influxdb", "translate", "signer", "xray", "securityhub", "guardduty",
"secretsmanager", "scheduler")
"secretsmanager", "scheduler", "lambda")
# The namespaces whose resources ResourceArnBuilder builds itself.
HAND_BUILT = ("apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes",
HAND_BUILT = ("apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "logs", "pipes",
"resource-groups", "s3", "sns", "sqs", "sts")
# Operations of a namespace in `HAND_BUILT` read from the reference all the same, each with its reason.
@@ -279,10 +291,6 @@ READ_IN_HAND_BUILT: dict[str, str] = {
READ_IN_HAND_BUILT["logs:PutDestination"] = (
"CloudWatch Logs destination creation names the destination by destinationName, which ResourceArnBuilder "
"reads from the generated request-resource table")
for operation in ("GetLayerVersion", "GetLayerVersionByArn"):
READ_IN_HAND_BUILT[f"lambda:{operation}"] = (
"Lambda layer lookups name the version through modeled path and query members; "
"other Lambda resources retain their existing builders")
# ---------------------------------------------------------------------------------------------------------------------
# MEASURED: what AWS was measured to check where neither botocore nor the Service Reference says it.
@@ -471,6 +479,14 @@ UNIQUE_KEY_RE = re.compile(r"(?P<things>[A-Za-z][A-Za-z ]*?) (?:are|is) uniquely
r"(?P<parts>[A-Za-z ,]+?)(?:,? which\b|\.|$)")
# One more `:${...}` past a format: what a type of the reference qualifies another's ARN by.
QUALIFIER_RE = re.compile(r":\$\{\w+}")
# A member documented as naming a version or an alias, the words a type's qualified types add to its name, and what
# follows: Lambda's `Qualifier`, "Specify a version or alias to invoke a published version of the function", "The
# version number or alias name", "The alias name", "The function version to filter executions by".
DOC_QUALIFIER = (r"^(?:specify )?(?:a |an |the )?(?:[a-z]+ )?(?P<first>{words})(?: number| name)?"
r"(?: or (?:a |an |the )?(?P<second>{words})(?: number| name)?)?(?P<rest>(?: .*)?)$")
# An operation documented as acting on a thing of its service's own inside a resource of a type: "Sends a successful
# completion response for a callback operation in a durable execution".
DOC_THING_IN_RE = re.compile(r"\bfor an? (?P<thing>[a-z][a-z -]*?) in an? (?P<phrase>[a-z][a-z -]*?)(?:[.,;]|$)")
# A string pattern that takes an alias, `alias/...`, as one of its alternatives.
ALIAS_PATTERN_RE = re.compile(r"(?:^|[|(])\^?alias/")
# A format's resource that is a word and one variable (`connection/${ConnectionName}`), and the two path segments of
@@ -1365,8 +1381,13 @@ def account_members(models: dict[str, dict], operation: str) -> list[str]:
if member.get("location") in BODY_LOCATIONS
and model["shapes"][member["shape"]].get("pattern") in ACCOUNT_ID_PATTERNS | {r"(\d{12})"}
and model["shapes"][member["shape"]]["type"] == "string"}
for name, member in model["shapes"][spec["input"]["shape"]].get("members", {}).items():
request = model["shapes"][spec["input"]["shape"]].get("members", {})
for name, member in request.items():
shape = model["shapes"][member["shape"]]
# An account id beside an ARN of the same name, Lambda's `SourceAccount` beside its `SourceArn`, is the
# account of the resource that ARN names, not of one the request acts on.
if name.endswith("Account") and name.removesuffix("Account") + "Arn" in request:
continue
if member.get("location") in BODY_LOCATIONS and shape["type"] == "string" \
and (shape.get("pattern") in ACCOUNT_ID_PATTERNS
or (name in account_names and not CREATING_RE.match(operation))):
@@ -1386,6 +1407,11 @@ DOC_ARN_OR_NAME_RE = re.compile(r"^(?:the |a |an )?(?:full )?(?:arn|amazon resou
# Or naming the type before them, anywhere in the documentation: "This can either be the cluster name or ARN".
DOC_TYPE_NAME_OR_ARN_RE = re.compile(r"\bthe (?P<phrase>[a-z][a-z -]*?) name or (?:the )?(?:full )?"
r"(?:arn|amazon resource name \(arn\))\b")
# Or listing the two, the thing the member names leading its documentation: "The web function to retrieve. You can
# specify either of the following: The function name, for example my-function. The function ARN."
DOC_EITHER_NAME_OR_ARN_RE = re.compile(r"\byou can specify either of the following: (?:the )?[a-z][a-z -]*? name\b"
r".*\bthe [a-z][a-z -]*? arn\b")
DOC_LEAD_THING_RE = re.compile(r"^(?:the |a |an )?(?P<phrase>[a-z][a-z -]*)")
def name_or_arn_members(models: dict[str, dict], operation: str) -> dict[str, str]:
@@ -1423,22 +1449,29 @@ def documented_name_or_arn_members(models: dict[str, dict], operation: str) -> d
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():
word = _documented_name_or_arn(member.get("documentation")) \
if member.get("location") in BODY_LOCATIONS and model["shapes"][member["shape"]]["type"] == "string" \
body = member.get("location") in BODY_LOCATIONS
word = _documented_name_or_arn(member.get("documentation"), located=not body) \
if (body or _located(member) is not None) and model["shapes"][member["shape"]]["type"] == "string" \
else None
if word:
found.setdefault(name, word)
return found
def _documented_name_or_arn(documentation: str | None) -> str | None:
def _documented_name_or_arn(documentation: str | None, located: bool = False) -> str | None:
"""The resource type word of the ARN a member's documentation says it holds instead of a name: `cluster` for "The
short name or full Amazon Resource Name (ARN) of the cluster that hosts the service", or with its `of` left out
("(ARN)the cluster"), the two the other way round ("The Amazon Resource Name (ARN) or short name of the
cluster"), or the type before them ("This can either be the cluster name or ARN"); None for any other."""
cluster"), or the type before them ("This can either be the cluster name or ARN"); for a member a REST request
carries in its path or query, those, or the two listed after the thing the documentation leads with ("The web
function to retrieve. You can specify either of the following: The function name ... The function ARN" names a
`web-function`); None for any other."""
lead = _lead(documentation)
match = DOC_NAME_OR_ARN_RE.match(lead) or DOC_ARN_OR_NAME_RE.match(lead) \
or DOC_TYPE_NAME_OR_ARN_RE.search(_lead_text(documentation))
if located and DOC_EITHER_NAME_OR_ARN_RE.search(_lead_text(documentation)):
match = DOC_LEAD_THING_RE.match(lead)
else:
match = DOC_NAME_OR_ARN_RE.match(lead) or DOC_ARN_OR_NAME_RE.match(lead) \
or DOC_TYPE_NAME_OR_ARN_RE.search(_lead_text(documentation))
if not match:
return None
words = []
@@ -2209,6 +2242,8 @@ def read_resources(operation: str, types: list[str], formats: dict[str, str], mo
resources = with_subject_through(operation, resources, members, map_fields(models, name), optional, models)
resources = with_documented_defaults(resources, formats, defaulted_members(models, name))
resources = with_optional_qualifier(resources, optional)
resources = with_qualifier(resources, types, formats, members, models, name)
resources = with_partial_arns(resources, partial_arn_members(models, name, formats))
# Two rules naming the same resource the same way name it once.
return [resource for index, resource in enumerate(resources) if resource not in resources[:index]]
@@ -2420,10 +2455,14 @@ def by_client(operation: str, models: dict[str, dict], read, formats: dict[str,
apart = {client: read({client: models[client]}) for client in clients}
if all(apart[client] == apart[clients[0]] for client in clients):
return merged
for client in clients:
apart[client] = narrowed(apart[client], client_words(models[client]), models[client], name, formats)
prefixes = {client: models[client]["metadata"].get("endpointPrefix") for client in clients}
shared = len(set(prefixes.values())) < len(clients)
# Clients serving one endpoint cannot be told apart by a request, so an ARN member of theirs keeps every type the
# action acts on, each ARN read by its format: Lambda's `lambda` and `lambda-microvms` both tag on
# `/2017-03-31/tags/{Resource}`.
for client in clients:
apart[client] = narrowed(apart[client], client_words(models[client]), models[client], name, formats,
arn_types=not shared)
resources: list[dict] = []
for client in clients:
for resource in apart[client]:
@@ -2435,10 +2474,11 @@ def by_client(operation: str, models: dict[str, dict], read, formats: dict[str,
def narrowed(resources: list[dict], words: set[str], model: dict, operation: str,
formats: dict[str, str] | None = None) -> list[dict]:
"""A client's resources, each ARN member's types narrowed to those its own pattern names, and a type its patterns
never name read as its versioned twin they do (`event-bus` as `event-busv2`, EventBridge V2's own), when that
twin's format has the variables it fills."""
formats: dict[str, str] | None = None, arn_types: bool = True) -> list[dict]:
"""A client's resources, each ARN member's types narrowed to those its own pattern names, by the type's name or its
ARN's resource word (`event-source-mapping` for `eventSourceMapping`), unless `arn_types` is false, and a type its
patterns never name read as its versioned twin they do (`event-bus` as `event-busv2`, EventBridge V2's own), when
that twin's format has the variables it fills."""
def word(kind: str) -> str:
match = RESOURCE_PART_RE.match((formats or {}).get(kind, ""))
return match.group(1) if match else ""
@@ -2452,12 +2492,12 @@ def narrowed(resources: list[dict], words: set[str], model: dict, operation: str
root = model["shapes"][spec["input"]["shape"]] if "input" in spec else {"members": {}}
found = []
for resource in resources:
if "arn" in resource and "." not in resource["arn"]:
if arn_types and "arn" in resource and "." not in resource["arn"]:
member = root.get("members", {}).get(resource["arn"].removesuffix("[]"))
shape = model["shapes"][member["shape"]] if member else {}
element = model["shapes"][shape["member"]["shape"]] if shape.get("type") == "list" else shape
own = pattern_words(element.get("pattern") or "")
kinds = [kind for kind in resource["types"] if kind in own]
kinds = [kind for kind in resource["types"] if kind in own or (word(kind) and word(kind) in own)]
found.append(dict(resource, types=kinds) if kinds and kinds != resource["types"] else resource)
else:
found.append(resource)
@@ -2574,6 +2614,105 @@ def with_optional_qualifier(resources: list[dict], optional: set[str]) -> list[d
return found
def qualified_kinds(formats: dict[str, str]) -> dict[str, dict[str, str]]:
"""Each type the reference gives qualified types of, by type: those whose format is the type's and one more
`:${<variable>}`, each by the word its name adds to the type's. Lambda's `function alias`,
`function:${FunctionName}:${Alias}`, adds `alias`, and `function version` adds `version`."""
found: dict[str, dict[str, str]] = {}
for kind, arn in formats.items():
for other, extended in formats.items():
if other != kind and extended.startswith(arn) and QUALIFIER_RE.fullmatch(extended[len(arn):]) \
and other.lower().startswith(kind.lower()):
found.setdefault(kind, {})[other.lower()[len(kind):].strip()] = other
return found
def qualifier_members(models: dict[str, dict], operation: str, words: set[str]) -> list[str]:
"""The top-level members of the operation's request documented as naming one of a type's qualified types, by the
words those add to the type's name, each of them: Lambda's `Qualifier`, "The version number or alias name"."""
found: list[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():
if member.get("location") not in BODY_LOCATIONS and _located(member) is None:
continue
if model["shapes"][member["shape"]]["type"] != "string":
continue
lead = re.match(DOC_QUALIFIER.format(words="|".join(sorted(map(re.escape, words)))),
_lead(member.get("documentation")))
if not lead or name in found:
continue
given = {word for word in (lead.group("first"), lead.group("second")) if word}
# One naming another of those words after its own names something else of that kind: `CreateAlias`'s
# `FunctionVersion`, "The function version that the alias invokes", is what the alias points to, and
# `ListAliases`'s, "Specify a function version to only list aliases that invoke that version", filters.
if not any(re.search(r"\b" + re.escape(word) + r"(?:e?s)?\b", lead.group("rest")) for word in words - given):
found.append(name)
return found
def with_qualifier(resources: list[dict], types: list[str], formats: dict[str, str], members: dict[str, str],
models: dict[str, dict], operation: str) -> list[dict]:
"""The resources, and each qualified type the action acts on (`qualified_kinds`) that no resource names, named by
its type's variable and the request's one member documented as naming the qualified types (`qualifier_members`)
for its own, the type's member giving its name or its ARN: `GetProvisionedConcurrencyConfig` acts on the
function's alias or version its `Qualifier` names. An action acting on the type alone is checked on it as its
members name it."""
found = list(resources)
for kind, qualified in qualified_kinds(formats).items():
variables = [v for v in VARIABLE_RE.findall(formats[kind]) if v not in KNOWN_VARIABLES]
named = qualifier_members(models, operation, set(qualified))
if len(variables) != 1 or len(named) != 1 or members.get(variables[0]) != variables[0]:
continue
variable, qualifier = variables[0], named[0]
for other in qualified.values():
own = [v for v in VARIABLE_RE.findall(formats[other]) if v not in KNOWN_VARIABLES and v != variable]
if other in types and len(own) == 1 and not any(resource.get("type") == other for resource in found):
# The type's member may give the type's own ARN, whose name fills the variable.
found.append({"type": other, "fill": {variable: variable, own[0]: qualifier}, "arnOf": {variable: kind}})
return found
def partial_arn_members(models: dict[str, dict], operation: str, formats: dict[str, str]) -> dict[str, set[str]]:
"""The top-level members of the operation's request whose botocore pattern takes an ARN of a type with its leading
parts left out, its account and resource (`123456789012:function:my-function`), each with those types: the pattern
spells the type's resource word and takes such a tail. Lambda's `FunctionName` takes "Partial ARN -
123456789012:function:my-function"."""
found: dict[str, set[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():
if member.get("location") not in BODY_LOCATIONS and _located(member) is None:
continue
pattern = model["shapes"][member["shape"]].get("pattern")
if not pattern:
continue
for kind, arn in formats.items():
word = RESOURCE_PART_RE.match(arn)
if not word or word.group(1) + ":" not in pattern:
continue
tail = "123456789012:" + VARIABLE_RE.sub("x", arn.split(":", 5)[5]) # partition-literal: a sample
try:
if re.fullmatch(pattern, tail):
found.setdefault(name, set()).add(kind)
except re.error:
continue
return found
def with_partial_arns(resources: list[dict], partial: dict[str, set[str]]) -> list[dict]:
"""The resources, each a type named by a member that may give its ARN with the leading parts left out
(`partial_arn_members`) marked so: the reader completes such a value in the request's partition, and in its
Region where the value leaves that out too."""
return [dict(resource, partialArn=True) if "type" in resource and any(
resource["type"] in partial.get(path, set()) for path in resource.get("fill", {}).values()) else resource
for resource in resources]
def _named(value: object) -> set[str]:
"""The member names an operation's resources read: every key and string they hold, each up to its first `[` or
`.`, a superset that keeps `located` to the members something reads."""
@@ -2654,8 +2793,13 @@ def with_through(resources: list[dict], types: list[str], members: dict[str, str
through = []
for member, kinds in sorted(reached.items()):
on = [kind for kind in types if kind in kinds]
if on and members.get(member) == member:
through.append({"types": on, "through": member})
# The request may name the thing by its identifier where its record holds its id: a MicroVM's
# `microvmIdentifier` and the `microvmId` its record holds.
given = member if members.get(member) == member else next(
(other for other, path in sorted(members.items()) if path == other and stem(other) == stem(member)
and kind_of(other) in ("id", "identifier")), None)
if on and given and not any(resource.get("through") == given for resource in through):
through.append({"types": on, "through": given})
return resources + through
@@ -2675,12 +2819,39 @@ def through_members(models: dict[str, dict], formats: dict[str, str]) -> dict[st
if not member.endswith("Id") or not thing or not shape_name.lower().startswith(thing) \
or any(related(thing, known) for known in stems):
continue
kinds = {stems[stem(field)] for field in fields if field != member and stem(field) in stems}
# A field named after a type, or after the end of one's name: a MicroVM's `imageArn` beside its
# `microvmId` names the `microvmImage` it runs.
kinds = {kind for field in fields if field != member and stem(field)
for known, kind in stems.items() if related(stem(field), known)}
if kinds:
found.setdefault(member, set()).update(kinds)
for member, kinds in documented_through(models, formats).items():
found.setdefault(member, set()).update(kinds)
return {member: sorted(kinds) for member, kinds in sorted(found.items())}
def documented_through(models: dict[str, dict], formats: dict[str, str]) -> dict[str, set[str]]:
"""The members naming a thing of their service's own the reference gives no type, each with the type an operation
taking it is documented as acting on it in: "Sends a successful completion response for a callback operation in a
durable execution" (`SendDurableExecutionCallbackSuccess`), whose request names the callback by its
`CallbackId`."""
found: dict[str, set[str]] = {}
for model in models.values():
for spec in model["operations"].values():
if "input" not in spec:
continue
documented = DOC_THING_IN_RE.search(_lead(spec.get("documentation")))
kinds = [kind for kind in formats if documented and kind.lower() == documented.group("phrase")]
if len(kinds) != 1:
continue
thing = re.sub(r"[^a-z0-9]", "", documented.group("thing"))
for member in model["shapes"][spec["input"]["shape"]].get("members", {}):
if kind_of(member) in ("id", "identifier") and stem(member) and thing.startswith(stem(member)) \
and not any(related(stem(member), stem(kind)) for kind in formats):
found.setdefault(member, set()).add(kinds[0])
return found
def rest_operations(data: Path) -> dict[str, set[str]]:
"""The operation names of each botocore model whose REST routes Floci reads under a namespace the file reads."""
return {client: set(model["operations"])
@@ -3127,7 +3298,7 @@ def _resource_problems(operation: str, resource: object, types: set[str], format
or {"type", "fill"} <= set(resource) <= {"type", "fill", "when", "unless", "arnOf", "account",
"fixed", "made", "find", "endpoint",
"default", "whenDefault", "unlessDefault",
"defaults"}):
"defaults", "partialArn"}):
return [f"{operation} names {resource!r}, which is neither an ARN member nor a type's variables"]
for key in ("whenDefault", "unlessDefault"):
pair = resource.get(key)
@@ -3194,6 +3365,9 @@ def _resource_problems(operation: str, resource: object, types: set[str], format
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]]):
return [f"{operation} takes {kinds[0]}'s account from {account!r}, which is no member or no account of its ARN"]
if resource.get("partialArn", True) is not True or ("partialArn" in resource and not fill):
return [f"{operation} reads {kinds[0]} from a partial ARN {resource.get('partialArn')!r}, which is not true for a "
f"type filled by its members"]
return []
+1
View File
@@ -67,6 +67,7 @@ MODELS: dict[str, str] = {
"lambda": "lambda",
"lambda-core": "lambda",
"lambda-microvms": "lambda",
"lambda-web": "lambda",
"macie2": "macie2",
"oam": "oam",
"opensearch": "es",
+135 -5
View File
@@ -1002,18 +1002,32 @@ def test_the_vendored_file_is_well_formed():
assert not any("when" in resource or "unless" in resource
for operation, entry in operations.items() if operation.startswith("events:")
and "endpoint" in json.dumps(entry) for resource in entry["resources"])
# A state machine's version or alias is checked on the state machine.
assert document["unqualified"] == {"lambda": ["function"], "ssm": ["parameter"], "states": ["statemachine"]}
# A state machine's version or alias is checked on the state machine; a Lambda function's is checked qualified.
assert document["unqualified"] == {"ssm": ["parameter"], "states": ["statemachine"]}
assert document["integerVariables"] == {"lambda": {"layerVersion": ["LayerVersion"]}}
assert {operation for operation in operations if operation.startswith("lambda:")} == {
"lambda:GetLayerVersion", "lambda:GetLayerVersionByArn"}
# Lambda is read whole: a partial ARN names a function, a provisioned concurrency config acts on the version or
# alias its Qualifier names, the action the reference gives it, and AddPermission's SourceAccount is its source's.
assert "lambda" in document["namespaces"] and "lambda" not in document["handBuilt"]
assert operations["lambda:Invoke"]["resources"] == [
{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": True}]
assert operations["lambda:PublishVersion"]["resources"] == [
{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": True}]
assert operations["lambda:GetProvisionedConcurrencyConfig"]["resources"] == [
{"type": kind, "fill": {"FunctionName": "FunctionName", variable: "Qualifier"},
"arnOf": {"FunctionName": "function"}, "partialArn": True}
for kind, variable in (("function alias", "Alias"), ("function version", "Version"))]
assert not any("account" in resource for resource in operations["lambda:AddPermission"]["resources"])
assert operations["lambda:GetMicrovm"]["resources"] == [{"types": ["microvmImage"], "through": "microvmIdentifier"}]
assert operations["lambda:SendDurableExecutionCallbackSuccess"]["resources"] == [
{"types": ["durable execution"], "through": "CallbackId"}]
assert operations["lambda:GetWebFunctionEndpoint"]["resources"][0]["arnOf"] == {"functionName": "webFunction"}
# A listener is made under a load balancer, and a rule under a listener.
assert operations["elasticloadbalancing:CreateListener"]["creates"] == [
{"type": f"listener/{kind}", "parent": f"loadbalancer/{kind}/", "arn": "LoadBalancerArn"}
for kind in ("app", "gwy", "net")]
assert operations["elasticloadbalancing:CreateRule"]["creates"] == [
{"type": f"listener-rule/{kind}", "parent": f"listener/{kind}", "arn": "ListenerArn"} for kind in ("app", "net")]
assert set(document["handBuilt"]) >= {"lambda", "s3", "sqs"}
assert set(document["handBuilt"]) >= {"s3", "sqs"}
# A scalable target is found by the three members naming it, its ARN ending in the id the service mints.
assert operations["application-autoscaling:DeregisterScalableTarget"]["resources"] == [
{"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]
@@ -2148,3 +2162,119 @@ def test_eip_operations_read_scalar_targets_from_models(operation, members, kind
action = "ec2:" + operation
entry = r.entry_for(action, {"action": action, "types": kinds}, formats, {"ec2": ec2})
assert entry["resources"] == [{"type": kind, "fill": {variables[kind]: variables[kind]}} for kind in kinds]
QUALIFIED_FORMATS = {"function": "arn:${Partition}:svc:${Region}:${Account}:function:${FunctionName}",
"function alias": "arn:${Partition}:svc:${Region}:${Account}:function:${FunctionName}:${Alias}",
"function version": "arn:${Partition}:svc:${Region}:${Account}:function:${FunctionName}:${Version}"}
def _qualified_model() -> dict:
functions = model({"Invoke": {"FunctionName": "FunctionName", "Qualifier": "String"},
"GetConfig": {"FunctionName": "FunctionName", "Qualifier": "String"},
"CreateAlias": {"FunctionName": "FunctionName", "Name": "String", "FunctionVersion": "String"},
"ListAliases": {"FunctionName": "FunctionName", "FunctionVersion": "String"},
"Publish": {"FunctionName": "FunctionName"}})
functions["shapes"]["FunctionName"] = {"type": "string", "pattern": (
r"(arn:(aws[a-zA-Z-]*)?:svc:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_\.]+)"
r"(:(\$LATEST|[a-zA-Z0-9-_]+))?")}
docs = {("Invoke", "Qualifier"): "<p>Specify a version or alias to invoke a published version of the function.</p>",
("GetConfig", "Qualifier"): "<p>The version number or alias name.</p>",
("CreateAlias", "FunctionVersion"): "<p>The function version that the alias invokes.</p>",
("ListAliases", "FunctionVersion"): "<p>Specify a function version to only list aliases that invoke that "
"version.</p>"}
for (operation, member), text in docs.items():
functions["shapes"][operation + "In"]["members"][member]["documentation"] = text
return functions
def test_a_member_documented_as_a_version_or_alias_names_the_qualified_types_an_action_acts_on():
functions = {"svc": _qualified_model()}
assert r.qualified_kinds(QUALIFIED_FORMATS) == {
"function": {"alias": "function alias", "version": "function version"}}
assert r.qualifier_members(functions, "Invoke", {"alias", "version"}) == ["Qualifier"]
assert r.qualifier_members(functions, "GetConfig", {"alias", "version"}) == ["Qualifier"]
# What an alias points to, or a filter naming aliases, is no qualifier of the request's function.
assert r.qualifier_members(functions, "CreateAlias", {"alias", "version"}) == []
assert r.qualifier_members(functions, "ListAliases", {"alias", "version"}) == []
named = [{"type": "function", "fill": {"FunctionName": "FunctionName"}}]
members = {"FunctionName": "FunctionName", "Qualifier": "Qualifier"}
# An action acting on the type alone is checked on it as its members name it.
assert r.with_qualifier(named, ["function"], QUALIFIED_FORMATS, members, functions, "Invoke") == named
# An action acting on the qualified types names each by the function and the qualifier.
assert r.with_qualifier([], ["function alias", "function version"], QUALIFIED_FORMATS, members, functions,
"GetConfig") == [
{"type": "function alias", "fill": {"FunctionName": "FunctionName", "Alias": "Qualifier"},
"arnOf": {"FunctionName": "function"}},
{"type": "function version", "fill": {"FunctionName": "FunctionName", "Version": "Qualifier"},
"arnOf": {"FunctionName": "function"}}]
# A request with no qualifier member is as it was.
assert r.with_qualifier(named, ["function"], QUALIFIED_FORMATS, {"FunctionName": "FunctionName"}, functions,
"Publish") == named
def test_a_member_whose_pattern_takes_an_arn_without_its_leading_parts_names_its_type_by_a_partial_arn():
functions = {"svc": _qualified_model()}
assert r.partial_arn_members(functions, "Publish", QUALIFIED_FORMATS) == {
"FunctionName": {"function", "function alias", "function version"}}
# A pattern that does not spell the type's resource word takes no partial ARN of it.
functions["svc"]["shapes"]["FunctionName"]["pattern"] = "[a-zA-Z0-9-_:]+"
assert r.partial_arn_members(functions, "Publish", QUALIFIED_FORMATS) == {}
marked = r.with_partial_arns([{"type": "function", "fill": {"FunctionName": "FunctionName"}},
{"types": ["function"], "arn": "Other"}], {"FunctionName": {"function"}})
assert marked == [{"type": "function", "fill": {"FunctionName": "FunctionName"}, "partialArn": True},
{"types": ["function"], "arn": "Other"}]
def test_an_account_id_beside_an_arn_of_the_same_name_is_that_arns_account(tmp_path):
write_models(tmp_path, {"svc": model({"AddPermission": {"FunctionName": "String", "SourceArn": "String",
"SourceAccount": "AccountId"},
"GetThing": {"ThingName": "String", "OwnerAccount": "AccountId"}})})
models = r.load_models(tmp_path, {"svc"})
assert r.account_members(models, "AddPermission") == []
assert r.account_members(models, "GetThing") == ["OwnerAccount"]
def test_a_record_field_named_after_the_end_of_a_types_name_reaches_that_type_and_a_request_names_it_by_its_identifier():
formats = {"microvmImage": "arn:${Partition}:svc:${Region}:${Account}:microvm-image:${MicrovmImageName}"}
vms = model({"GetMicrovm": {"microvmIdentifier": "String"}})
vms["shapes"]["MicrovmItem"] = {"type": "structure", "members": {
"microvmId": {"shape": "String"}, "imageArn": {"shape": "String"}, "state": {"shape": "String"}}}
models = {"svc": vms}
assert r.through_members(models, formats) == {"microvmId": ["microvmImage"]}
assert r.with_through([], ["microvmImage"], {"microvmIdentifier": "microvmIdentifier"},
{"microvmId": ["microvmImage"]}) == [{"types": ["microvmImage"], "through": "microvmIdentifier"}]
def test_an_operation_documented_as_acting_on_a_thing_in_a_resource_reaches_that_resource_through_the_things_id():
formats = {"durable execution": "arn:${Partition}:svc:${Region}:${Account}:function:${FunctionName}:${Version}"
"/durable-execution/${ExecutionName}/${ExecutionId}"}
callbacks = model({"SendCallbackSuccess": {"CallbackId": "String"}, "Other": {"CallbackId": "String"}})
callbacks["operations"]["SendCallbackSuccess"]["documentation"] = (
"<p>Sends a successful completion response for a callback operation in a durable execution.</p>")
assert r.documented_through({"svc": callbacks}, formats) == {"CallbackId": {"durable execution"}}
callbacks["operations"]["SendCallbackSuccess"]["documentation"] = "<p>Sends a response for a callback.</p>"
assert r.documented_through({"svc": callbacks}, formats) == {}
def test_a_path_member_documented_as_either_a_name_or_an_arn_takes_the_arn_of_the_thing_it_leads_with():
assert r._documented_name_or_arn(
"<p>The web function to retrieve. You can specify either of the following:</p> <ul> <li> <p>The function "
"name, for example <code>my-function</code>.</p> </li> <li> <p>The function ARN.</p> </li> </ul>",
located=True) == "web-function"
# A body member keeps the phrasings it had.
assert r._documented_name_or_arn("<p>The web function. You can specify either of the following: The function "
"name. The function ARN.</p>") is None
def test_clients_sharing_an_endpoint_keep_every_type_an_arn_member_may_name_and_others_narrow_by_the_arns_word():
formats = {"function": "arn:${Partition}:svc:${Region}:${Account}:function:${FunctionName}",
"eventSourceMapping": "arn:${Partition}:svc:${Region}:${Account}:event-source-mapping:${UUID}",
"image": "arn:${Partition}:svc:${Region}:${Account}:image:${ImageName}"}
tags = model({"TagResource": {"Resource": "TaggableArn"}})
tags["shapes"]["TaggableArn"] = {"type": "string",
"pattern": "arn:aws:svc:[a-z0-9-]+:[0-9]{12}:(function:[a-z]+|event-source-mapping:[a-f0-9-]+)"}
resources = [{"types": ["eventSourceMapping", "function", "image"], "arn": "Resource"}]
assert r.narrowed(resources, set(), tags, "TagResource", formats) == [
{"types": ["eventSourceMapping", "function"], "arn": "Resource"}]
assert r.narrowed(resources, set(), tags, "TagResource", formats, arn_types=False) == resources