diff --git a/Makefile b/Makefile index be78aab60d..a47fd46b82 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ # by tools/aws/regen_sesv2_shapes.py. # src/main/resources/aws/ecs-request-shapes.json is generated from botocore's ECS model # by tools/aws/regen_ecs_shapes.py. +# src/test/resources/aws/rest-routes.json, the REST routes IamRestRouteCoverageTest checks, is +# generated from botocore's models by tools/aws/regen_rest_routes.py. PYTHON ?= python3 @@ -217,6 +219,7 @@ aws-data-sync: ## Regenerate src/main/resources/aws/*.json and the IAM managed-p $(PYTHON) tools/aws/regen_sesv2_shapes.py $(PYTHON) tools/aws/regen_ecs_shapes.py $(PYTHON) tools/aws/regen_query_services.py + $(PYTHON) tools/aws/regen_rest_routes.py $(PYTHON) tools/aws/regen_managed_policies.py aws-data-check: ## CI gate: the vendored AWS data must match a fresh generation @@ -266,6 +269,12 @@ aws-data-check: ## CI gate: the vendored AWS data must match a fresh generation echo " Run 'make aws-data-sync' and commit the result."; \ exit 1; \ } + @$(PYTHON) tools/aws/regen_rest_routes.py --check || { \ + echo ""; \ + echo "error: src/test/resources/aws/rest-routes.json is out of date."; \ + echo " Run 'make aws-data-sync' and commit the result."; \ + exit 1; \ + } @$(PYTHON) tools/aws/regen_managed_policies.py --check || { \ echo ""; \ echo "error: the IAM managed-policy catalog (src/main/resources/iam/managed-polic*) is out of date or malformed."; \ diff --git a/docs/services/iam.md b/docs/services/iam.md index 51e5e85389..57c277292e 100644 --- a/docs/services/iam.md +++ b/docs/services/iam.md @@ -1246,6 +1246,17 @@ a Query `Action` field on it does not change the action it is checked as, and it still percent-encoded, as the router matches it, so an encoded `/` inside a parameter cannot make the route's rule miss. +The REST routes mapped to an action are those of S3, Lambda, API Gateway, SES v2, RDS Data and +Kinesis. In Lambda they are the function, alias, event source mapping, function URL, durable +execution and Web Function routes, `InvokeWithResponseStream` (checked as `lambda:InvokeFunction`) +and `GetLayerVersionByArn` (`lambda:GetLayerVersion`); the other Lambda routes, such as layers, +versions, concurrency and MicroVMs, are not mapped yet. API Gateway's management API, v1 and v2, is +checked as `apigateway:` and the HTTP method, `apigateway:GET`, `apigateway:POST` and so on, except +`RejectDomainNameAccessAssociation` (`apigateway:RejectAccessAssociation`) and `PutRoutingRule` +(`apigateway:UpdateRoutingRule`); the v2 routing rule, portal and portal product operations, which +AWS checks as actions of their own names, are not served. A route no rule maps is not checked, as +an unsigned REST request is not; the other REST services' routes are not mapped yet. + An S3 `CreateBucket` is checked as `s3:CreateBucket`, and also needs one action for each header that configures the new bucket, as the CreateBucket API reference lists them: `s3:PutBucketAcl` for a canned ACL other than `private` or a grant header, diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/IamActionRegistry.java b/src/main/java/io/github/hectorvent/floci/services/iam/IamActionRegistry.java index 137727f11d..d718f04b87 100644 --- a/src/main/java/io/github/hectorvent/floci/services/iam/IamActionRegistry.java +++ b/src/main/java/io/github/hectorvent/floci/services/iam/IamActionRegistry.java @@ -29,7 +29,20 @@ public class IamActionRegistry { private static final Logger LOG = Logger.getLogger(IamActionRegistry.class); - private record ActionRule(String service, String method, Pattern pathPattern, String action) {} + /** + * A route and the action it is checked as. A rule naming a query parameter matches only a request + * carrying it with that value, as {@code GET /layers?find=LayerVersion} is GetLayerVersionByArn + * where {@code GET /layers} is ListLayers. + */ + private record ActionRule(String service, String method, Pattern pathPattern, String queryParameter, + String queryValue, String action) { + + boolean matches(String scope, String requestMethod, String path, ContainerRequestContext ctx) { + return service.equals(scope) && method.equals(requestMethod) && pathPattern.matcher(path).find() + && (queryParameter == null + || queryValue.equals(ctx.getUriInfo().getQueryParameters().getFirst(queryParameter))); + } + } private static final List RULES = List.of( // ── S3 ───────────────────────────────────────────────────────────────── @@ -99,6 +112,10 @@ public class IamActionRegistry { rule("lambda", "PUT", "^/2025-03-07/resource-policy/.+", "lambda:PutResourcePolicy"), rule("lambda", "GET", "^/2025-03-07/resource-policy/.+", "lambda:GetResourcePolicy"), rule("lambda", "DELETE", "^/2025-03-07/resource-policy/.+", "lambda:DeleteResourcePolicy"), + // InvokeWithResponseStream and GetLayerVersionByArn are authorized as the action they share with + // Invoke and GetLayerVersion (iam-authorized-actions.json). + rule("lambda", "POST", ".*/functions/[^/]+/response-streaming-invocations$", "lambda:InvokeFunction"), + rule("lambda", "GET", "^/2018-10-31/layers$", "find", "LayerVersion", "lambda:GetLayerVersion"), // ── DynamoDB (JSON 1.1, action from X-Amz-Target handled separately) ── // Handled via Query-style action extraction in the filter @@ -112,15 +129,17 @@ public class IamActionRegistry { rule("rds-data", "POST", "^/RollbackTransaction/?$", "rds-data:RollbackTransaction"), // ── API Gateway ──────────────────────────────────────────────────────── - rule("apigateway", "GET", ".*/account$", "apigateway:GET"), - rule("apigateway", "PATCH", ".*/account$", "apigateway:PATCH"), - rule("apigateway", "GET", ".*/restapis$", "apigateway:GET"), - rule("apigateway", "POST", ".*/restapis$", "apigateway:POST"), - rule("apigateway", "GET", ".*/restapis/.+", "apigateway:GET"), - rule("apigateway", "PUT", ".*/restapis/.+", "apigateway:PUT"), - rule("apigateway", "PATCH", ".*/restapis/.+", "apigateway:PATCH"), - rule("apigateway", "DELETE", ".*/restapis/.+", "apigateway:DELETE"), - rule("apigateway", "POST", ".*/restapis/.+", "apigateway:POST"), + // The management API, v1 and v2, is authorized by HTTP method on the resource path: + // apigateway:GET, POST, PUT, PATCH or DELETE. Two operations have an action of their own. The + // others AWS authorizes only by an action of their own name, the v2 routing rules, portals and + // portal products, are not served by Floci and need their own rules when they are. + rule("apigateway", "POST", "^/rejectdomainnameaccessassociations$", "apigateway:RejectAccessAssociation"), + rule("apigateway", "PUT", "^/v2/domainnames/[^/]+/routingrules/[^/]+$", "apigateway:UpdateRoutingRule"), + rule("apigateway", "GET", ".*", "apigateway:GET"), + rule("apigateway", "POST", ".*", "apigateway:POST"), + rule("apigateway", "PUT", ".*", "apigateway:PUT"), + rule("apigateway", "PATCH", ".*", "apigateway:PATCH"), + rule("apigateway", "DELETE", ".*", "apigateway:DELETE"), // ── SES v2 ───────────────────────────────────────────────────────────── // SES v1 is a Query API and resolves from its Action like any other; v2 is REST-JSON under @@ -255,7 +274,13 @@ public class IamActionRegistry { ); private static ActionRule rule(String service, String method, String path, String action) { - return new ActionRule(service, method, Pattern.compile(path, Pattern.CASE_INSENSITIVE), action); + return rule(service, method, path, null, null, action); + } + + private static ActionRule rule(String service, String method, String path, String queryParameter, + String queryValue, String action) { + return new ActionRule(service, method, Pattern.compile(path, Pattern.CASE_INSENSITIVE), queryParameter, + queryValue, action); } /** @@ -319,9 +344,7 @@ public class IamActionRegistry { } for (ActionRule rule : RULES) { - if (rule.service().equals(credentialScope) - && rule.method().equals(method) - && rule.pathPattern().matcher(path).find()) { + if (rule.matches(credentialScope, method, path, ctx)) { return rule.action(); } } diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java b/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java index a22f87bdda..27c799b234 100644 --- a/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java +++ b/src/main/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilder.java @@ -660,7 +660,8 @@ public class ResourceArnBuilder { // path: /2015-03-31/functions/name or similar String name = extractSegmentAfter(path, "functions"); if (name == null) return "*"; - boolean invoke = path.endsWith("/functions/" + name + "/invocations"); + boolean invoke = path.endsWith("/functions/" + name + "/invocations") + || path.endsWith("/functions/" + name + "/response-streaming-invocations"); try { if (!invoke) { LambdaArnUtils.ResolvedFunctionRef ref = LambdaArnUtils.resolve(name); diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamActionRegistryTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamActionRegistryTest.java index 13793d4988..dbcfe5c51a 100644 --- a/src/test/java/io/github/hectorvent/floci/services/iam/IamActionRegistryTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamActionRegistryTest.java @@ -241,6 +241,20 @@ class IamActionRegistryTest { assertEquals("lambda:InvokeFunction", registry.resolveRoute("lambda", invoke)); } + @Test + void aRuleNamingAQueryParameterMatchesOnlyARequestCarryingItWithItsValue() { + // GET /layers?find=LayerVersion is GetLayerVersionByArn, while GET /layers is ListLayers. + MultivaluedHashMap byArn = new MultivaluedHashMap<>(); + byArn.putSingle("find", "LayerVersion"); + assertEquals("lambda:GetLayerVersion", registry.resolveRoute("lambda", + mockCtx("GET", "/2018-10-31/layers", byArn, MediaType.APPLICATION_JSON_TYPE, "{}"))); + MultivaluedHashMap other = new MultivaluedHashMap<>(); + other.putSingle("find", "Layer"); + assertNull(registry.resolveRoute("lambda", + mockCtx("GET", "/2018-10-31/layers", other, MediaType.APPLICATION_JSON_TYPE, "{}"))); + assertNull(lambdaAction("GET", "/2018-10-31/layers")); + } + @Test void durableExecutionRoutesResolveToTheirActions() { String arn = "arn%3Aaws%3Alambda%3Aus-east-1%3A000000000000%3Afunction%3Af%3A%24LATEST" diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamRestRouteCoverageTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamRestRouteCoverageTest.java new file mode 100644 index 0000000000..516b2ec6c0 --- /dev/null +++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamRestRouteCoverageTest.java @@ -0,0 +1,145 @@ +package io.github.hectorvent.floci.services.iam; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.UriInfo; +import org.junit.jupiter.api.DynamicTest; +import org.junit.jupiter.api.TestFactory; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * A REST request is authorized by its route, so an operation is checked as the IAM action AWS checks + * for it only if a rule in {@link IamActionRegistry} maps its route to that action. This builds a + * request on each operation's route, as botocore's model gives it ({@code rest-routes.json}, from + * {@code tools/aws/regen_rest_routes.py}), and compares the action the registry resolves with the one + * {@code iam-authorized-actions.json} names for the operation, or else the operation's own name. + */ +class IamRestRouteCoverageTest { + + private static final ObjectMapper MAPPER = new ObjectMapper(); + private static final Pattern LABEL = Pattern.compile("\\{([^}+]+)(\\+?)}"); + + /** The REST namespaces whose entries in {@code iam-authorized-actions.json} only the route table can apply. */ + private static final Set ROUTED_NAMESPACES = Set.of("s3", "apigateway", "lambda"); + + /** + * Operations Floci does not serve, whose request runs as another operation instead and so is checked + * as that one: S3 has no bucket metadata configuration, and {@code ?metadataConfiguration} on a + * bucket falls through to ListObjects and DeleteBucket. Checking it as the metadata table action + * would let that action list or delete the bucket. + */ + private static final Map RUN_AS_ANOTHER_OPERATION = Map.of( + "GetBucketMetadataConfiguration", "s3:ListBucket", + "DeleteBucketMetadataConfiguration", "s3:DeleteBucket"); + + private final IamActionRegistry registry = new IamActionRegistry(); + + @TestFactory + Stream eachVendoredActionOfARestServiceIsWhatItsRouteResolvesTo() throws IOException { + JsonNode models = load("/aws/rest-routes.json").path("models"); + JsonNode authorized = load("/aws/iam-authorized-actions.json").path("authorizedActions"); + List tests = new ArrayList<>(); + for (String namespace : ROUTED_NAMESPACES) { + Iterator> entries = authorized.path(namespace).fields(); + while (entries.hasNext()) { + Map.Entry entry = entries.next(); + List routes = routesOf(models, namespace, entry.getKey()); + String expected = RUN_AS_ANOTHER_OPERATION.getOrDefault(entry.getKey(), entry.getValue().asText()); + tests.add(DynamicTest.dynamicTest(namespace + " " + entry.getKey(), () -> { + assertFalse(routes.isEmpty(), "no model route for " + entry.getKey()); + for (Route route : routes) { + assertEquals(expected, resolve(route), route.toString()); + } + })); + } + } + return tests.stream(); + } + + /** Every model route of {@code operation} among the models Floci authorizes under {@code scope}. */ + private static List routesOf(JsonNode models, String scope, String operation) { + List routes = new ArrayList<>(); + Iterator> all = models.fields(); + while (all.hasNext()) { + Map.Entry model = all.next(); + JsonNode route = model.getValue().path("operations").path(operation); + if (scope.equals(model.getValue().path("credentialScope").asText()) && !route.isMissingNode()) { + routes.add(new Route(scope, model.getKey(), operation, route.path("method").asText(), + route.path("requestUri").asText())); + } + } + return routes; + } + + private String resolve(Route route) { + return registry.resolveRoute(route.scope(), route.request()); + } + + private static JsonNode load(String resource) throws IOException { + try (InputStream in = IamRestRouteCoverageTest.class.getResourceAsStream(resource)) { + return MAPPER.readTree(in); + } + } + + /** An operation's route: its method, and its request URI with each label filled in. */ + private record Route(String scope, String model, String operation, String method, String requestUri) { + + ContainerRequestContext request() { + int question = requestUri.indexOf('?'); + String path = fill(question < 0 ? requestUri : requestUri.substring(0, question)); + MultivaluedMap query = new MultivaluedHashMap<>(); + if (question >= 0) { + for (String parameter : requestUri.substring(question + 1).split("&")) { + int equals = parameter.indexOf('='); + query.add(equals < 0 ? parameter : parameter.substring(0, equals), + equals < 0 ? "" : parameter.substring(equals + 1)); + } + } + ContainerRequestContext ctx = mock(ContainerRequestContext.class); + UriInfo uriInfo = mock(UriInfo.class); + when(uriInfo.getQueryParameters()).thenReturn(query); + when(uriInfo.getPath()).thenReturn(path); + when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:4566" + path)); + when(uriInfo.getBaseUri()).thenReturn(URI.create("http://localhost:4566/")); + when(ctx.getUriInfo()).thenReturn(uriInfo); + when(ctx.getMethod()).thenReturn(method); + return ctx; + } + + /** The path with each {@code {label}} filled in, and a greedy {@code {label+}} given two segments. */ + private static String fill(String template) { + Matcher label = LABEL.matcher(template); + StringBuilder path = new StringBuilder(); + while (label.find()) { + String value = label.group(1).toLowerCase() + "-value"; + label.appendReplacement(path, label.group(2).isEmpty() ? value : value + "/part"); + } + label.appendTail(path); + return path.toString(); + } + + @Override + public String toString() { + return model + " " + operation + ": " + method + " " + requestUri; + } + } +} diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamRestRouteEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamRestRouteEnforcementIntegrationTest.java new file mode 100644 index 0000000000..70d840e01a --- /dev/null +++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamRestRouteEnforcementIntegrationTest.java @@ -0,0 +1,100 @@ +package io.github.hectorvent.floci.services.iam; + +import io.github.hectorvent.floci.testing.EnforcementFixtures; +import io.github.hectorvent.floci.testing.IamEnforcementProfile; +import io.github.hectorvent.floci.testing.PartitionCleanup; +import io.quarkus.test.common.http.TestHTTPResource; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; +import io.restassured.response.ValidatableResponse; +import io.restassured.specification.RequestSpecification; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import static io.github.hectorvent.floci.testing.EnforcementFixtures.auth; +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; + +/** + * REST requests whose route no rule mapped to an IAM action were let through under enforcement + * unchecked. These routes are mapped now, and a caller needs the action AWS checks for them. + */ +@QuarkusTest +@TestProfile(IamEnforcementProfile.class) +class IamRestRouteEnforcementIntegrationTest { + + private static final String ADMIN = "test"; + private static final String ACCOUNT = "000000000000"; + + @TestHTTPResource("/") + static URI baseUri; + + @RegisterExtension + final PartitionCleanup cleanup = new PartitionCleanup(); + + /** Each user's access key ID, by user name. */ + private final Map keys = new HashMap<>(); + + @Test + void apiGatewayManagementRoutesBeyondRestApisAreCheckedByMethod() { + String user = user("route-apigateway"); + String plan = "{\"name\":\"route-plan-" + suffix() + "\"}"; + + policy(user, allow("apigateway:GET", "*")); + refused(as(user, "apigateway").body(plan).post("/usageplans").then(), "apigateway:POST"); + as(user, "apigateway").get("/usageplans").then().statusCode(200); + + policy(user, allow("apigateway:POST", "*")); + String id = as(user, "apigateway").body(plan).post("/usageplans").then().statusCode(201).extract().path("id"); + cleanup.register(() -> given().header("Authorization", auth(ADMIN, "apigateway")).delete("/usageplans/" + id)); + } + + @Test + void getLayerVersionByArnIsCheckedAsGetLayerVersion() { + String user = user("route-layer"); + String arn = "arn:aws:lambda:us-east-1:" + ACCOUNT + ":layer:route-layer-" + suffix() + ":1"; + + policy(user, allow("lambda:ListLayers", "*")); + refused(as(user, "lambda").queryParam("find", "LayerVersion").queryParam("Arn", arn) + .get("/2018-10-31/layers").then(), "lambda:GetLayerVersion"); + policy(user, allow("lambda:GetLayerVersion", "*")); + // Allowed, the request reaches Lambda, which has no such layer. + as(user, "lambda").queryParam("find", "LayerVersion").queryParam("Arn", arn) + .get("/2018-10-31/layers").then().statusCode(404); + } + + private static void refused(ValidatableResponse response, String action) { + response.statusCode(403).body(containsString(action)).body(not(containsString("iam:PassRole"))); + } + + private static String allow(String action, String resource) { + return "{\"Effect\":\"Allow\",\"Action\":\"" + action + "\",\"Resource\":\"" + resource + "\"}"; + } + + private void policy(String user, String statements) { + EnforcementFixtures.putUserPolicy(baseUri.getPort(), auth(ADMIN, "iam"), user, "p", + "{\"Version\":\"2012-10-17\",\"Statement\":[" + statements + "]}"); + } + + /** Creates a user, removed afterwards, and returns its access key ID under the user's name. */ + private String user(String name) { + String userName = name + "-" + suffix(); + String accessKeyId = EnforcementFixtures.createUser(cleanup, baseUri.getPort(), auth(ADMIN, "iam"), userName) + .accessKeyId(); + keys.put(userName, accessKeyId); + return userName; + } + + private RequestSpecification as(String user, String service) { + return given().header("Authorization", auth(keys.get(user), service)).contentType("application/json"); + } + + private static String suffix() { + return Long.toString(System.nanoTime(), 36); + } +} diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilderTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilderTest.java index 874ec88dac..e9d30f3c89 100644 --- a/src/test/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilderTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/iam/ResourceArnBuilderTest.java @@ -1179,6 +1179,15 @@ class ResourceArnBuilderTest { assertEquals("*", builder.build("lambda", ctx, "us-east-1", "000000000000")); } + @Test + void aStreamingInvokeResolvesItsQualifiedFunctionAsAnInvokeDoes() { + // 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")); + } + @Test void lambdaRoutesOtherThanInvokeAreCheckedAgainstTheCallersUnqualifiedFunction() { when(uriInfo.getPath()).thenReturn( diff --git a/src/test/resources/aws/rest-routes.json b/src/test/resources/aws/rest-routes.json new file mode 100644 index 0000000000..992f391680 --- /dev/null +++ b/src/test/resources/aws/rest-routes.json @@ -0,0 +1,460 @@ +{ + "_source": {"generator": "tools/aws/regen_rest_routes.py", "botocore": "botocore 1.43.113 (installed package)"}, + "models": { + "apigateway": { + "credentialScope": "apigateway", + "apiVersion": "2015-07-09", + "operations": { + "CreateApiKey": {"method": "POST", "requestUri": "/apikeys"}, + "CreateAuthorizer": {"method": "POST", "requestUri": "/restapis/{restapi_id}/authorizers"}, + "CreateBasePathMapping": {"method": "POST", "requestUri": "/domainnames/{domain_name}/basepathmappings"}, + "CreateDeployment": {"method": "POST", "requestUri": "/restapis/{restapi_id}/deployments"}, + "CreateDocumentationPart": {"method": "POST", "requestUri": "/restapis/{restapi_id}/documentation/parts"}, + "CreateDocumentationVersion": {"method": "POST", "requestUri": "/restapis/{restapi_id}/documentation/versions"}, + "CreateDomainName": {"method": "POST", "requestUri": "/domainnames"}, + "CreateDomainNameAccessAssociation": {"method": "POST", "requestUri": "/domainnameaccessassociations"}, + "CreateModel": {"method": "POST", "requestUri": "/restapis/{restapi_id}/models"}, + "CreateRequestValidator": {"method": "POST", "requestUri": "/restapis/{restapi_id}/requestvalidators"}, + "CreateResource": {"method": "POST", "requestUri": "/restapis/{restapi_id}/resources/{parent_id}"}, + "CreateRestApi": {"method": "POST", "requestUri": "/restapis"}, + "CreateStage": {"method": "POST", "requestUri": "/restapis/{restapi_id}/stages"}, + "CreateUsagePlan": {"method": "POST", "requestUri": "/usageplans"}, + "CreateUsagePlanKey": {"method": "POST", "requestUri": "/usageplans/{usageplanId}/keys"}, + "CreateVpcLink": {"method": "POST", "requestUri": "/vpclinks"}, + "DeleteApiKey": {"method": "DELETE", "requestUri": "/apikeys/{api_Key}"}, + "DeleteAuthorizer": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/authorizers/{authorizer_id}"}, + "DeleteBasePathMapping": {"method": "DELETE", "requestUri": "/domainnames/{domain_name}/basepathmappings/{base_path}"}, + "DeleteClientCertificate": {"method": "DELETE", "requestUri": "/clientcertificates/{clientcertificate_id}"}, + "DeleteDeployment": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/deployments/{deployment_id}"}, + "DeleteDocumentationPart": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/documentation/parts/{part_id}"}, + "DeleteDocumentationVersion": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/documentation/versions/{doc_version}"}, + "DeleteDomainName": {"method": "DELETE", "requestUri": "/domainnames/{domain_name}"}, + "DeleteDomainNameAccessAssociation": {"method": "DELETE", "requestUri": "/domainnameaccessassociations/{domain_name_access_association_arn}"}, + "DeleteGatewayResponse": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/gatewayresponses/{response_type}"}, + "DeleteIntegration": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration"}, + "DeleteIntegrationResponse": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}"}, + "DeleteMethod": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}"}, + "DeleteMethodResponse": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}"}, + "DeleteModel": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/models/{model_name}"}, + "DeleteRequestValidator": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}"}, + "DeleteResource": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}"}, + "DeleteRestApi": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}"}, + "DeleteStage": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/stages/{stage_name}"}, + "DeleteUsagePlan": {"method": "DELETE", "requestUri": "/usageplans/{usageplanId}"}, + "DeleteUsagePlanKey": {"method": "DELETE", "requestUri": "/usageplans/{usageplanId}/keys/{keyId}"}, + "DeleteVpcLink": {"method": "DELETE", "requestUri": "/vpclinks/{vpclink_id}"}, + "FlushStageAuthorizersCache": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/stages/{stage_name}/cache/authorizers"}, + "FlushStageCache": {"method": "DELETE", "requestUri": "/restapis/{restapi_id}/stages/{stage_name}/cache/data"}, + "GenerateClientCertificate": {"method": "POST", "requestUri": "/clientcertificates"}, + "GetAccount": {"method": "GET", "requestUri": "/account"}, + "GetApiKey": {"method": "GET", "requestUri": "/apikeys/{api_Key}"}, + "GetApiKeys": {"method": "GET", "requestUri": "/apikeys"}, + "GetAuthorizer": {"method": "GET", "requestUri": "/restapis/{restapi_id}/authorizers/{authorizer_id}"}, + "GetAuthorizers": {"method": "GET", "requestUri": "/restapis/{restapi_id}/authorizers"}, + "GetBasePathMapping": {"method": "GET", "requestUri": "/domainnames/{domain_name}/basepathmappings/{base_path}"}, + "GetBasePathMappings": {"method": "GET", "requestUri": "/domainnames/{domain_name}/basepathmappings"}, + "GetClientCertificate": {"method": "GET", "requestUri": "/clientcertificates/{clientcertificate_id}"}, + "GetClientCertificates": {"method": "GET", "requestUri": "/clientcertificates"}, + "GetDeployment": {"method": "GET", "requestUri": "/restapis/{restapi_id}/deployments/{deployment_id}"}, + "GetDeployments": {"method": "GET", "requestUri": "/restapis/{restapi_id}/deployments"}, + "GetDocumentationPart": {"method": "GET", "requestUri": "/restapis/{restapi_id}/documentation/parts/{part_id}"}, + "GetDocumentationParts": {"method": "GET", "requestUri": "/restapis/{restapi_id}/documentation/parts"}, + "GetDocumentationVersion": {"method": "GET", "requestUri": "/restapis/{restapi_id}/documentation/versions/{doc_version}"}, + "GetDocumentationVersions": {"method": "GET", "requestUri": "/restapis/{restapi_id}/documentation/versions"}, + "GetDomainName": {"method": "GET", "requestUri": "/domainnames/{domain_name}"}, + "GetDomainNameAccessAssociations": {"method": "GET", "requestUri": "/domainnameaccessassociations"}, + "GetDomainNames": {"method": "GET", "requestUri": "/domainnames"}, + "GetExport": {"method": "GET", "requestUri": "/restapis/{restapi_id}/stages/{stage_name}/exports/{export_type}"}, + "GetGatewayResponse": {"method": "GET", "requestUri": "/restapis/{restapi_id}/gatewayresponses/{response_type}"}, + "GetGatewayResponses": {"method": "GET", "requestUri": "/restapis/{restapi_id}/gatewayresponses"}, + "GetIntegration": {"method": "GET", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration"}, + "GetIntegrationResponse": {"method": "GET", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}"}, + "GetMethod": {"method": "GET", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}"}, + "GetMethodResponse": {"method": "GET", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}"}, + "GetModel": {"method": "GET", "requestUri": "/restapis/{restapi_id}/models/{model_name}"}, + "GetModelTemplate": {"method": "GET", "requestUri": "/restapis/{restapi_id}/models/{model_name}/default_template"}, + "GetModels": {"method": "GET", "requestUri": "/restapis/{restapi_id}/models"}, + "GetRequestValidator": {"method": "GET", "requestUri": "/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}"}, + "GetRequestValidators": {"method": "GET", "requestUri": "/restapis/{restapi_id}/requestvalidators"}, + "GetResource": {"method": "GET", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}"}, + "GetResources": {"method": "GET", "requestUri": "/restapis/{restapi_id}/resources"}, + "GetRestApi": {"method": "GET", "requestUri": "/restapis/{restapi_id}"}, + "GetRestApis": {"method": "GET", "requestUri": "/restapis"}, + "GetSdk": {"method": "GET", "requestUri": "/restapis/{restapi_id}/stages/{stage_name}/sdks/{sdk_type}"}, + "GetSdkType": {"method": "GET", "requestUri": "/sdktypes/{sdktype_id}"}, + "GetSdkTypes": {"method": "GET", "requestUri": "/sdktypes"}, + "GetStage": {"method": "GET", "requestUri": "/restapis/{restapi_id}/stages/{stage_name}"}, + "GetStages": {"method": "GET", "requestUri": "/restapis/{restapi_id}/stages"}, + "GetTags": {"method": "GET", "requestUri": "/tags/{resource_arn}"}, + "GetUsage": {"method": "GET", "requestUri": "/usageplans/{usageplanId}/usage"}, + "GetUsagePlan": {"method": "GET", "requestUri": "/usageplans/{usageplanId}"}, + "GetUsagePlanKey": {"method": "GET", "requestUri": "/usageplans/{usageplanId}/keys/{keyId}"}, + "GetUsagePlanKeys": {"method": "GET", "requestUri": "/usageplans/{usageplanId}/keys"}, + "GetUsagePlans": {"method": "GET", "requestUri": "/usageplans"}, + "GetVpcLink": {"method": "GET", "requestUri": "/vpclinks/{vpclink_id}"}, + "GetVpcLinks": {"method": "GET", "requestUri": "/vpclinks"}, + "ImportApiKeys": {"method": "POST", "requestUri": "/apikeys?mode=import"}, + "ImportDocumentationParts": {"method": "PUT", "requestUri": "/restapis/{restapi_id}/documentation/parts"}, + "ImportRestApi": {"method": "POST", "requestUri": "/restapis?mode=import"}, + "PutGatewayResponse": {"method": "PUT", "requestUri": "/restapis/{restapi_id}/gatewayresponses/{response_type}"}, + "PutIntegration": {"method": "PUT", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration"}, + "PutIntegrationResponse": {"method": "PUT", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}"}, + "PutMethod": {"method": "PUT", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}"}, + "PutMethodResponse": {"method": "PUT", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}"}, + "PutRestApi": {"method": "PUT", "requestUri": "/restapis/{restapi_id}"}, + "RejectDomainNameAccessAssociation": {"method": "POST", "requestUri": "/rejectdomainnameaccessassociations"}, + "TagResource": {"method": "PUT", "requestUri": "/tags/{resource_arn}"}, + "TestInvokeAuthorizer": {"method": "POST", "requestUri": "/restapis/{restapi_id}/authorizers/{authorizer_id}"}, + "TestInvokeMethod": {"method": "POST", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}"}, + "UntagResource": {"method": "DELETE", "requestUri": "/tags/{resource_arn}"}, + "UpdateAccount": {"method": "PATCH", "requestUri": "/account"}, + "UpdateApiKey": {"method": "PATCH", "requestUri": "/apikeys/{api_Key}"}, + "UpdateAuthorizer": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/authorizers/{authorizer_id}"}, + "UpdateBasePathMapping": {"method": "PATCH", "requestUri": "/domainnames/{domain_name}/basepathmappings/{base_path}"}, + "UpdateClientCertificate": {"method": "PATCH", "requestUri": "/clientcertificates/{clientcertificate_id}"}, + "UpdateDeployment": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/deployments/{deployment_id}"}, + "UpdateDocumentationPart": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/documentation/parts/{part_id}"}, + "UpdateDocumentationVersion": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/documentation/versions/{doc_version}"}, + "UpdateDomainName": {"method": "PATCH", "requestUri": "/domainnames/{domain_name}"}, + "UpdateGatewayResponse": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/gatewayresponses/{response_type}"}, + "UpdateIntegration": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration"}, + "UpdateIntegrationResponse": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}"}, + "UpdateMethod": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}"}, + "UpdateMethodResponse": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}"}, + "UpdateModel": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/models/{model_name}"}, + "UpdateRequestValidator": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}"}, + "UpdateResource": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/resources/{resource_id}"}, + "UpdateRestApi": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}"}, + "UpdateStage": {"method": "PATCH", "requestUri": "/restapis/{restapi_id}/stages/{stage_name}"}, + "UpdateUsage": {"method": "PATCH", "requestUri": "/usageplans/{usageplanId}/keys/{keyId}/usage"}, + "UpdateUsagePlan": {"method": "PATCH", "requestUri": "/usageplans/{usageplanId}"}, + "UpdateVpcLink": {"method": "PATCH", "requestUri": "/vpclinks/{vpclink_id}"} + } + }, + "apigatewayv2": { + "credentialScope": "apigateway", + "apiVersion": "2018-11-29", + "operations": { + "CreateApi": {"method": "POST", "requestUri": "/v2/apis"}, + "CreateApiMapping": {"method": "POST", "requestUri": "/v2/domainnames/{domainName}/apimappings"}, + "CreateAuthorizer": {"method": "POST", "requestUri": "/v2/apis/{apiId}/authorizers"}, + "CreateDeployment": {"method": "POST", "requestUri": "/v2/apis/{apiId}/deployments"}, + "CreateDomainName": {"method": "POST", "requestUri": "/v2/domainnames"}, + "CreateIntegration": {"method": "POST", "requestUri": "/v2/apis/{apiId}/integrations"}, + "CreateIntegrationResponse": {"method": "POST", "requestUri": "/v2/apis/{apiId}/integrations/{integrationId}/integrationresponses"}, + "CreateModel": {"method": "POST", "requestUri": "/v2/apis/{apiId}/models"}, + "CreatePortal": {"method": "POST", "requestUri": "/v2/portals"}, + "CreatePortalProduct": {"method": "POST", "requestUri": "/v2/portalproducts"}, + "CreateProductPage": {"method": "POST", "requestUri": "/v2/portalproducts/{portalProductId}/productpages"}, + "CreateProductRestEndpointPage": {"method": "POST", "requestUri": "/v2/portalproducts/{portalProductId}/productrestendpointpages"}, + "CreateRoute": {"method": "POST", "requestUri": "/v2/apis/{apiId}/routes"}, + "CreateRouteResponse": {"method": "POST", "requestUri": "/v2/apis/{apiId}/routes/{routeId}/routeresponses"}, + "CreateRoutingRule": {"method": "POST", "requestUri": "/v2/domainnames/{domainName}/routingrules"}, + "CreateStage": {"method": "POST", "requestUri": "/v2/apis/{apiId}/stages"}, + "CreateVpcLink": {"method": "POST", "requestUri": "/v2/vpclinks"}, + "DeleteAccessLogSettings": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/stages/{stageName}/accesslogsettings"}, + "DeleteApi": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}"}, + "DeleteApiMapping": {"method": "DELETE", "requestUri": "/v2/domainnames/{domainName}/apimappings/{apiMappingId}"}, + "DeleteAuthorizer": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/authorizers/{authorizerId}"}, + "DeleteCorsConfiguration": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/cors"}, + "DeleteDeployment": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/deployments/{deploymentId}"}, + "DeleteDomainName": {"method": "DELETE", "requestUri": "/v2/domainnames/{domainName}"}, + "DeleteIntegration": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/integrations/{integrationId}"}, + "DeleteIntegrationResponse": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/integrations/{integrationId}/integrationresponses/{integrationResponseId}"}, + "DeleteModel": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/models/{modelId}"}, + "DeletePortal": {"method": "DELETE", "requestUri": "/v2/portals/{portalId}"}, + "DeletePortalProduct": {"method": "DELETE", "requestUri": "/v2/portalproducts/{portalProductId}"}, + "DeletePortalProductSharingPolicy": {"method": "DELETE", "requestUri": "/v2/portalproducts/{portalProductId}/sharingpolicy"}, + "DeleteProductPage": {"method": "DELETE", "requestUri": "/v2/portalproducts/{portalProductId}/productpages/{productPageId}"}, + "DeleteProductRestEndpointPage": {"method": "DELETE", "requestUri": "/v2/portalproducts/{portalProductId}/productrestendpointpages/{productRestEndpointPageId}"}, + "DeleteRoute": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/routes/{routeId}"}, + "DeleteRouteRequestParameter": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/routes/{routeId}/requestparameters/{requestParameterKey}"}, + "DeleteRouteResponse": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/routes/{routeId}/routeresponses/{routeResponseId}"}, + "DeleteRouteSettings": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/stages/{stageName}/routesettings/{routeKey}"}, + "DeleteRoutingRule": {"method": "DELETE", "requestUri": "/v2/domainnames/{domainName}/routingrules/{routingRuleId}"}, + "DeleteStage": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/stages/{stageName}"}, + "DeleteVpcLink": {"method": "DELETE", "requestUri": "/v2/vpclinks/{vpcLinkId}"}, + "DisablePortal": {"method": "DELETE", "requestUri": "/v2/portals/{portalId}/publish"}, + "ExportApi": {"method": "GET", "requestUri": "/v2/apis/{apiId}/exports/{specification}"}, + "GetApi": {"method": "GET", "requestUri": "/v2/apis/{apiId}"}, + "GetApiMapping": {"method": "GET", "requestUri": "/v2/domainnames/{domainName}/apimappings/{apiMappingId}"}, + "GetApiMappings": {"method": "GET", "requestUri": "/v2/domainnames/{domainName}/apimappings"}, + "GetApis": {"method": "GET", "requestUri": "/v2/apis"}, + "GetAuthorizer": {"method": "GET", "requestUri": "/v2/apis/{apiId}/authorizers/{authorizerId}"}, + "GetAuthorizers": {"method": "GET", "requestUri": "/v2/apis/{apiId}/authorizers"}, + "GetDeployment": {"method": "GET", "requestUri": "/v2/apis/{apiId}/deployments/{deploymentId}"}, + "GetDeployments": {"method": "GET", "requestUri": "/v2/apis/{apiId}/deployments"}, + "GetDomainName": {"method": "GET", "requestUri": "/v2/domainnames/{domainName}"}, + "GetDomainNames": {"method": "GET", "requestUri": "/v2/domainnames"}, + "GetIntegration": {"method": "GET", "requestUri": "/v2/apis/{apiId}/integrations/{integrationId}"}, + "GetIntegrationResponse": {"method": "GET", "requestUri": "/v2/apis/{apiId}/integrations/{integrationId}/integrationresponses/{integrationResponseId}"}, + "GetIntegrationResponses": {"method": "GET", "requestUri": "/v2/apis/{apiId}/integrations/{integrationId}/integrationresponses"}, + "GetIntegrations": {"method": "GET", "requestUri": "/v2/apis/{apiId}/integrations"}, + "GetModel": {"method": "GET", "requestUri": "/v2/apis/{apiId}/models/{modelId}"}, + "GetModelTemplate": {"method": "GET", "requestUri": "/v2/apis/{apiId}/models/{modelId}/template"}, + "GetModels": {"method": "GET", "requestUri": "/v2/apis/{apiId}/models"}, + "GetPortal": {"method": "GET", "requestUri": "/v2/portals/{portalId}"}, + "GetPortalProduct": {"method": "GET", "requestUri": "/v2/portalproducts/{portalProductId}"}, + "GetPortalProductSharingPolicy": {"method": "GET", "requestUri": "/v2/portalproducts/{portalProductId}/sharingpolicy"}, + "GetProductPage": {"method": "GET", "requestUri": "/v2/portalproducts/{portalProductId}/productpages/{productPageId}"}, + "GetProductRestEndpointPage": {"method": "GET", "requestUri": "/v2/portalproducts/{portalProductId}/productrestendpointpages/{productRestEndpointPageId}"}, + "GetRoute": {"method": "GET", "requestUri": "/v2/apis/{apiId}/routes/{routeId}"}, + "GetRouteResponse": {"method": "GET", "requestUri": "/v2/apis/{apiId}/routes/{routeId}/routeresponses/{routeResponseId}"}, + "GetRouteResponses": {"method": "GET", "requestUri": "/v2/apis/{apiId}/routes/{routeId}/routeresponses"}, + "GetRoutes": {"method": "GET", "requestUri": "/v2/apis/{apiId}/routes"}, + "GetRoutingRule": {"method": "GET", "requestUri": "/v2/domainnames/{domainName}/routingrules/{routingRuleId}"}, + "GetStage": {"method": "GET", "requestUri": "/v2/apis/{apiId}/stages/{stageName}"}, + "GetStages": {"method": "GET", "requestUri": "/v2/apis/{apiId}/stages"}, + "GetTags": {"method": "GET", "requestUri": "/v2/tags/{resource-arn}"}, + "GetVpcLink": {"method": "GET", "requestUri": "/v2/vpclinks/{vpcLinkId}"}, + "GetVpcLinks": {"method": "GET", "requestUri": "/v2/vpclinks"}, + "ImportApi": {"method": "PUT", "requestUri": "/v2/apis"}, + "ListPortalProducts": {"method": "GET", "requestUri": "/v2/portalproducts"}, + "ListPortals": {"method": "GET", "requestUri": "/v2/portals"}, + "ListProductPages": {"method": "GET", "requestUri": "/v2/portalproducts/{portalProductId}/productpages"}, + "ListProductRestEndpointPages": {"method": "GET", "requestUri": "/v2/portalproducts/{portalProductId}/productrestendpointpages"}, + "ListRoutingRules": {"method": "GET", "requestUri": "/v2/domainnames/{domainName}/routingrules"}, + "PreviewPortal": {"method": "POST", "requestUri": "/v2/portals/{portalId}/preview"}, + "PublishPortal": {"method": "POST", "requestUri": "/v2/portals/{portalId}/publish"}, + "PutPortalProductSharingPolicy": {"method": "PUT", "requestUri": "/v2/portalproducts/{portalProductId}/sharingpolicy"}, + "PutRoutingRule": {"method": "PUT", "requestUri": "/v2/domainnames/{domainName}/routingrules/{routingRuleId}"}, + "ReimportApi": {"method": "PUT", "requestUri": "/v2/apis/{apiId}"}, + "ResetAuthorizersCache": {"method": "DELETE", "requestUri": "/v2/apis/{apiId}/stages/{stageName}/cache/authorizers"}, + "TagResource": {"method": "POST", "requestUri": "/v2/tags/{resource-arn}"}, + "UntagResource": {"method": "DELETE", "requestUri": "/v2/tags/{resource-arn}"}, + "UpdateApi": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}"}, + "UpdateApiMapping": {"method": "PATCH", "requestUri": "/v2/domainnames/{domainName}/apimappings/{apiMappingId}"}, + "UpdateAuthorizer": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}/authorizers/{authorizerId}"}, + "UpdateDeployment": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}/deployments/{deploymentId}"}, + "UpdateDomainName": {"method": "PATCH", "requestUri": "/v2/domainnames/{domainName}"}, + "UpdateIntegration": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}/integrations/{integrationId}"}, + "UpdateIntegrationResponse": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}/integrations/{integrationId}/integrationresponses/{integrationResponseId}"}, + "UpdateModel": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}/models/{modelId}"}, + "UpdatePortal": {"method": "PATCH", "requestUri": "/v2/portals/{portalId}"}, + "UpdatePortalProduct": {"method": "PATCH", "requestUri": "/v2/portalproducts/{portalProductId}"}, + "UpdateProductPage": {"method": "PATCH", "requestUri": "/v2/portalproducts/{portalProductId}/productpages/{productPageId}"}, + "UpdateProductRestEndpointPage": {"method": "PATCH", "requestUri": "/v2/portalproducts/{portalProductId}/productrestendpointpages/{productRestEndpointPageId}"}, + "UpdateRoute": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}/routes/{routeId}"}, + "UpdateRouteResponse": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}/routes/{routeId}/routeresponses/{routeResponseId}"}, + "UpdateStage": {"method": "PATCH", "requestUri": "/v2/apis/{apiId}/stages/{stageName}"}, + "UpdateVpcLink": {"method": "PATCH", "requestUri": "/v2/vpclinks/{vpcLinkId}"} + } + }, + "lambda": { + "credentialScope": "lambda", + "apiVersion": "2015-03-31", + "operations": { + "AddLayerVersionPermission": {"method": "POST", "requestUri": "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy"}, + "AddPermission": {"method": "POST", "requestUri": "/2015-03-31/functions/{FunctionName}/policy"}, + "CheckpointDurableExecution": {"method": "POST", "requestUri": "/2025-12-01/durable-executions/{DurableExecutionArn}/checkpoint"}, + "CreateAlias": {"method": "POST", "requestUri": "/2015-03-31/functions/{FunctionName}/aliases"}, + "CreateCapacityProvider": {"method": "POST", "requestUri": "/2025-11-30/capacity-providers"}, + "CreateCodeSigningConfig": {"method": "POST", "requestUri": "/2020-04-22/code-signing-configs"}, + "CreateEventSourceMapping": {"method": "POST", "requestUri": "/2015-03-31/event-source-mappings"}, + "CreateFunction": {"method": "POST", "requestUri": "/2015-03-31/functions"}, + "CreateFunctionUrlConfig": {"method": "POST", "requestUri": "/2021-10-31/functions/{FunctionName}/url"}, + "DeleteAlias": {"method": "DELETE", "requestUri": "/2015-03-31/functions/{FunctionName}/aliases/{Name}"}, + "DeleteCapacityProvider": {"method": "DELETE", "requestUri": "/2025-11-30/capacity-providers/{CapacityProviderName}"}, + "DeleteCodeSigningConfig": {"method": "DELETE", "requestUri": "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"}, + "DeleteEventSourceMapping": {"method": "DELETE", "requestUri": "/2015-03-31/event-source-mappings/{UUID}"}, + "DeleteFunction": {"method": "DELETE", "requestUri": "/2015-03-31/functions/{FunctionName}"}, + "DeleteFunctionCodeSigningConfig": {"method": "DELETE", "requestUri": "/2020-06-30/functions/{FunctionName}/code-signing-config"}, + "DeleteFunctionConcurrency": {"method": "DELETE", "requestUri": "/2017-10-31/functions/{FunctionName}/concurrency"}, + "DeleteFunctionEventInvokeConfig": {"method": "DELETE", "requestUri": "/2019-09-25/functions/{FunctionName}/event-invoke-config"}, + "DeleteFunctionUrlConfig": {"method": "DELETE", "requestUri": "/2021-10-31/functions/{FunctionName}/url"}, + "DeleteLayerVersion": {"method": "DELETE", "requestUri": "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}"}, + "DeleteProvisionedConcurrencyConfig": {"method": "DELETE", "requestUri": "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"}, + "DeleteResourcePolicy": {"method": "DELETE", "requestUri": "/2026-07-09/resource-policy/{ResourceArn}"}, + "GetAccountSettings": {"method": "GET", "requestUri": "/2016-08-19/account-settings"}, + "GetAlias": {"method": "GET", "requestUri": "/2015-03-31/functions/{FunctionName}/aliases/{Name}"}, + "GetCapacityProvider": {"method": "GET", "requestUri": "/2025-11-30/capacity-providers/{CapacityProviderName}"}, + "GetCodeSigningConfig": {"method": "GET", "requestUri": "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"}, + "GetDurableExecution": {"method": "GET", "requestUri": "/2025-12-01/durable-executions/{DurableExecutionArn}"}, + "GetDurableExecutionHistory": {"method": "GET", "requestUri": "/2025-12-01/durable-executions/{DurableExecutionArn}/history"}, + "GetDurableExecutionState": {"method": "GET", "requestUri": "/2025-12-01/durable-executions/{DurableExecutionArn}/state"}, + "GetEventSourceMapping": {"method": "GET", "requestUri": "/2015-03-31/event-source-mappings/{UUID}"}, + "GetFunction": {"method": "GET", "requestUri": "/2015-03-31/functions/{FunctionName}"}, + "GetFunctionCodeSigningConfig": {"method": "GET", "requestUri": "/2020-06-30/functions/{FunctionName}/code-signing-config"}, + "GetFunctionConcurrency": {"method": "GET", "requestUri": "/2019-09-30/functions/{FunctionName}/concurrency"}, + "GetFunctionConfiguration": {"method": "GET", "requestUri": "/2015-03-31/functions/{FunctionName}/configuration"}, + "GetFunctionEventInvokeConfig": {"method": "GET", "requestUri": "/2019-09-25/functions/{FunctionName}/event-invoke-config"}, + "GetFunctionRecursionConfig": {"method": "GET", "requestUri": "/2024-08-31/functions/{FunctionName}/recursion-config"}, + "GetFunctionScalingConfig": {"method": "GET", "requestUri": "/2025-11-30/functions/{FunctionName}/function-scaling-config"}, + "GetFunctionUrlConfig": {"method": "GET", "requestUri": "/2021-10-31/functions/{FunctionName}/url"}, + "GetLayerVersion": {"method": "GET", "requestUri": "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}"}, + "GetLayerVersionByArn": {"method": "GET", "requestUri": "/2018-10-31/layers?find=LayerVersion"}, + "GetLayerVersionPolicy": {"method": "GET", "requestUri": "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy"}, + "GetPolicy": {"method": "GET", "requestUri": "/2015-03-31/functions/{FunctionName}/policy"}, + "GetProvisionedConcurrencyConfig": {"method": "GET", "requestUri": "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"}, + "GetResourcePolicy": {"method": "GET", "requestUri": "/2026-07-09/resource-policy/{ResourceArn}"}, + "GetRuntimeManagementConfig": {"method": "GET", "requestUri": "/2021-07-20/functions/{FunctionName}/runtime-management-config"}, + "Invoke": {"method": "POST", "requestUri": "/2015-03-31/functions/{FunctionName}/invocations"}, + "InvokeAsync": {"method": "POST", "requestUri": "/2014-11-13/functions/{FunctionName}/invoke-async"}, + "InvokeWithResponseStream": {"method": "POST", "requestUri": "/2021-11-15/functions/{FunctionName}/response-streaming-invocations"}, + "ListAliases": {"method": "GET", "requestUri": "/2015-03-31/functions/{FunctionName}/aliases"}, + "ListCapacityProviders": {"method": "GET", "requestUri": "/2025-11-30/capacity-providers"}, + "ListCodeSigningConfigs": {"method": "GET", "requestUri": "/2020-04-22/code-signing-configs"}, + "ListDurableExecutionsByFunction": {"method": "GET", "requestUri": "/2025-12-01/functions/{FunctionName}/durable-executions"}, + "ListEventSourceMappings": {"method": "GET", "requestUri": "/2015-03-31/event-source-mappings"}, + "ListFunctionEventInvokeConfigs": {"method": "GET", "requestUri": "/2019-09-25/functions/{FunctionName}/event-invoke-config/list"}, + "ListFunctionUrlConfigs": {"method": "GET", "requestUri": "/2021-10-31/functions/{FunctionName}/urls"}, + "ListFunctionVersionsByCapacityProvider": {"method": "GET", "requestUri": "/2025-11-30/capacity-providers/{CapacityProviderName}/function-versions"}, + "ListFunctions": {"method": "GET", "requestUri": "/2015-03-31/functions"}, + "ListFunctionsByCodeSigningConfig": {"method": "GET", "requestUri": "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}/functions"}, + "ListLayerVersions": {"method": "GET", "requestUri": "/2018-10-31/layers/{LayerName}/versions"}, + "ListLayers": {"method": "GET", "requestUri": "/2018-10-31/layers"}, + "ListProvisionedConcurrencyConfigs": {"method": "GET", "requestUri": "/2019-09-30/functions/{FunctionName}/provisioned-concurrency?List=ALL"}, + "ListTags": {"method": "GET", "requestUri": "/2017-03-31/tags/{Resource}"}, + "ListVersionsByFunction": {"method": "GET", "requestUri": "/2015-03-31/functions/{FunctionName}/versions"}, + "PublishLayerVersion": {"method": "POST", "requestUri": "/2018-10-31/layers/{LayerName}/versions"}, + "PublishVersion": {"method": "POST", "requestUri": "/2015-03-31/functions/{FunctionName}/versions"}, + "PutFunctionCodeSigningConfig": {"method": "PUT", "requestUri": "/2020-06-30/functions/{FunctionName}/code-signing-config"}, + "PutFunctionConcurrency": {"method": "PUT", "requestUri": "/2017-10-31/functions/{FunctionName}/concurrency"}, + "PutFunctionEventInvokeConfig": {"method": "PUT", "requestUri": "/2019-09-25/functions/{FunctionName}/event-invoke-config"}, + "PutFunctionRecursionConfig": {"method": "PUT", "requestUri": "/2024-08-31/functions/{FunctionName}/recursion-config"}, + "PutFunctionScalingConfig": {"method": "PUT", "requestUri": "/2025-11-30/functions/{FunctionName}/function-scaling-config"}, + "PutProvisionedConcurrencyConfig": {"method": "PUT", "requestUri": "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"}, + "PutResourcePolicy": {"method": "PUT", "requestUri": "/2026-07-09/resource-policy/{ResourceArn}"}, + "PutRuntimeManagementConfig": {"method": "PUT", "requestUri": "/2021-07-20/functions/{FunctionName}/runtime-management-config"}, + "RemoveLayerVersionPermission": {"method": "DELETE", "requestUri": "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy/{StatementId}"}, + "RemovePermission": {"method": "DELETE", "requestUri": "/2015-03-31/functions/{FunctionName}/policy/{StatementId}"}, + "SendDurableExecutionCallbackFailure": {"method": "POST", "requestUri": "/2025-12-01/durable-execution-callbacks/{CallbackId}/fail"}, + "SendDurableExecutionCallbackHeartbeat": {"method": "POST", "requestUri": "/2025-12-01/durable-execution-callbacks/{CallbackId}/heartbeat"}, + "SendDurableExecutionCallbackSuccess": {"method": "POST", "requestUri": "/2025-12-01/durable-execution-callbacks/{CallbackId}/succeed"}, + "StopDurableExecution": {"method": "POST", "requestUri": "/2025-12-01/durable-executions/{DurableExecutionArn}/stop"}, + "TagResource": {"method": "POST", "requestUri": "/2017-03-31/tags/{Resource}"}, + "UntagResource": {"method": "DELETE", "requestUri": "/2017-03-31/tags/{Resource}"}, + "UpdateAlias": {"method": "PUT", "requestUri": "/2015-03-31/functions/{FunctionName}/aliases/{Name}"}, + "UpdateCapacityProvider": {"method": "PUT", "requestUri": "/2025-11-30/capacity-providers/{CapacityProviderName}"}, + "UpdateCodeSigningConfig": {"method": "PUT", "requestUri": "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"}, + "UpdateEventSourceMapping": {"method": "PUT", "requestUri": "/2015-03-31/event-source-mappings/{UUID}"}, + "UpdateFunctionCode": {"method": "PUT", "requestUri": "/2015-03-31/functions/{FunctionName}/code"}, + "UpdateFunctionConfiguration": {"method": "PUT", "requestUri": "/2015-03-31/functions/{FunctionName}/configuration"}, + "UpdateFunctionEventInvokeConfig": {"method": "POST", "requestUri": "/2019-09-25/functions/{FunctionName}/event-invoke-config"}, + "UpdateFunctionUrlConfig": {"method": "PUT", "requestUri": "/2021-10-31/functions/{FunctionName}/url"} + } + }, + "s3": { + "credentialScope": "s3", + "apiVersion": "2006-03-01", + "operations": { + "AbortMultipartUpload": {"method": "DELETE", "requestUri": "/{Bucket}/{Key+}"}, + "CompleteMultipartUpload": {"method": "POST", "requestUri": "/{Bucket}/{Key+}"}, + "CopyObject": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}"}, + "CreateBucket": {"method": "PUT", "requestUri": "/{Bucket}"}, + "CreateBucketMetadataConfiguration": {"method": "POST", "requestUri": "/{Bucket}?metadataConfiguration"}, + "CreateBucketMetadataTableConfiguration": {"method": "POST", "requestUri": "/{Bucket}?metadataTable"}, + "CreateMultipartUpload": {"method": "POST", "requestUri": "/{Bucket}/{Key+}?uploads"}, + "CreateSession": {"method": "GET", "requestUri": "/{Bucket}?session"}, + "DeleteBucket": {"method": "DELETE", "requestUri": "/{Bucket}"}, + "DeleteBucketAnalyticsConfiguration": {"method": "DELETE", "requestUri": "/{Bucket}?analytics"}, + "DeleteBucketCors": {"method": "DELETE", "requestUri": "/{Bucket}?cors"}, + "DeleteBucketEncryption": {"method": "DELETE", "requestUri": "/{Bucket}?encryption"}, + "DeleteBucketIntelligentTieringConfiguration": {"method": "DELETE", "requestUri": "/{Bucket}?intelligent-tiering"}, + "DeleteBucketInventoryConfiguration": {"method": "DELETE", "requestUri": "/{Bucket}?inventory"}, + "DeleteBucketLifecycle": {"method": "DELETE", "requestUri": "/{Bucket}?lifecycle"}, + "DeleteBucketMetadataConfiguration": {"method": "DELETE", "requestUri": "/{Bucket}?metadataConfiguration"}, + "DeleteBucketMetadataTableConfiguration": {"method": "DELETE", "requestUri": "/{Bucket}?metadataTable"}, + "DeleteBucketMetricsConfiguration": {"method": "DELETE", "requestUri": "/{Bucket}?metrics"}, + "DeleteBucketOwnershipControls": {"method": "DELETE", "requestUri": "/{Bucket}?ownershipControls"}, + "DeleteBucketPolicy": {"method": "DELETE", "requestUri": "/{Bucket}?policy"}, + "DeleteBucketReplication": {"method": "DELETE", "requestUri": "/{Bucket}?replication"}, + "DeleteBucketTagging": {"method": "DELETE", "requestUri": "/{Bucket}?tagging"}, + "DeleteBucketWebsite": {"method": "DELETE", "requestUri": "/{Bucket}?website"}, + "DeleteObject": {"method": "DELETE", "requestUri": "/{Bucket}/{Key+}"}, + "DeleteObjectAnnotation": {"method": "DELETE", "requestUri": "/{Bucket}/{Key+}?annotation"}, + "DeleteObjectTagging": {"method": "DELETE", "requestUri": "/{Bucket}/{Key+}?tagging"}, + "DeleteObjects": {"method": "POST", "requestUri": "/{Bucket}?delete"}, + "DeletePublicAccessBlock": {"method": "DELETE", "requestUri": "/{Bucket}?publicAccessBlock"}, + "GetBucketAbac": {"method": "GET", "requestUri": "/{Bucket}?abac"}, + "GetBucketAccelerateConfiguration": {"method": "GET", "requestUri": "/{Bucket}?accelerate"}, + "GetBucketAcl": {"method": "GET", "requestUri": "/{Bucket}?acl"}, + "GetBucketAnalyticsConfiguration": {"method": "GET", "requestUri": "/{Bucket}?analytics"}, + "GetBucketCors": {"method": "GET", "requestUri": "/{Bucket}?cors"}, + "GetBucketEncryption": {"method": "GET", "requestUri": "/{Bucket}?encryption"}, + "GetBucketIntelligentTieringConfiguration": {"method": "GET", "requestUri": "/{Bucket}?intelligent-tiering"}, + "GetBucketInventoryConfiguration": {"method": "GET", "requestUri": "/{Bucket}?inventory"}, + "GetBucketLifecycle": {"method": "GET", "requestUri": "/{Bucket}?lifecycle"}, + "GetBucketLifecycleConfiguration": {"method": "GET", "requestUri": "/{Bucket}?lifecycle"}, + "GetBucketLocation": {"method": "GET", "requestUri": "/{Bucket}?location"}, + "GetBucketLogging": {"method": "GET", "requestUri": "/{Bucket}?logging"}, + "GetBucketMetadataConfiguration": {"method": "GET", "requestUri": "/{Bucket}?metadataConfiguration"}, + "GetBucketMetadataTableConfiguration": {"method": "GET", "requestUri": "/{Bucket}?metadataTable"}, + "GetBucketMetricsConfiguration": {"method": "GET", "requestUri": "/{Bucket}?metrics"}, + "GetBucketNotification": {"method": "GET", "requestUri": "/{Bucket}?notification"}, + "GetBucketNotificationConfiguration": {"method": "GET", "requestUri": "/{Bucket}?notification"}, + "GetBucketOwnershipControls": {"method": "GET", "requestUri": "/{Bucket}?ownershipControls"}, + "GetBucketPolicy": {"method": "GET", "requestUri": "/{Bucket}?policy"}, + "GetBucketPolicyStatus": {"method": "GET", "requestUri": "/{Bucket}?policyStatus"}, + "GetBucketReplication": {"method": "GET", "requestUri": "/{Bucket}?replication"}, + "GetBucketRequestPayment": {"method": "GET", "requestUri": "/{Bucket}?requestPayment"}, + "GetBucketTagging": {"method": "GET", "requestUri": "/{Bucket}?tagging"}, + "GetBucketVersioning": {"method": "GET", "requestUri": "/{Bucket}?versioning"}, + "GetBucketWebsite": {"method": "GET", "requestUri": "/{Bucket}?website"}, + "GetObject": {"method": "GET", "requestUri": "/{Bucket}/{Key+}"}, + "GetObjectAcl": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?acl"}, + "GetObjectAnnotation": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?annotation"}, + "GetObjectAttributes": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?attributes"}, + "GetObjectLegalHold": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?legal-hold"}, + "GetObjectLockConfiguration": {"method": "GET", "requestUri": "/{Bucket}?object-lock"}, + "GetObjectRetention": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?retention"}, + "GetObjectTagging": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?tagging"}, + "GetObjectTorrent": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?torrent"}, + "GetPublicAccessBlock": {"method": "GET", "requestUri": "/{Bucket}?publicAccessBlock"}, + "HeadBucket": {"method": "HEAD", "requestUri": "/{Bucket}"}, + "HeadObject": {"method": "HEAD", "requestUri": "/{Bucket}/{Key+}"}, + "ListBucketAnalyticsConfigurations": {"method": "GET", "requestUri": "/{Bucket}?analytics"}, + "ListBucketIntelligentTieringConfigurations": {"method": "GET", "requestUri": "/{Bucket}?intelligent-tiering"}, + "ListBucketInventoryConfigurations": {"method": "GET", "requestUri": "/{Bucket}?inventory"}, + "ListBucketMetricsConfigurations": {"method": "GET", "requestUri": "/{Bucket}?metrics"}, + "ListBuckets": {"method": "GET", "requestUri": "/"}, + "ListDirectoryBuckets": {"method": "GET", "requestUri": "/"}, + "ListMultipartUploads": {"method": "GET", "requestUri": "/{Bucket}?uploads"}, + "ListObjectAnnotations": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?annotation"}, + "ListObjectVersions": {"method": "GET", "requestUri": "/{Bucket}?versions"}, + "ListObjects": {"method": "GET", "requestUri": "/{Bucket}"}, + "ListObjectsV2": {"method": "GET", "requestUri": "/{Bucket}?list-type=2"}, + "ListParts": {"method": "GET", "requestUri": "/{Bucket}/{Key+}"}, + "PutBucketAbac": {"method": "PUT", "requestUri": "/{Bucket}?abac"}, + "PutBucketAccelerateConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?accelerate"}, + "PutBucketAcl": {"method": "PUT", "requestUri": "/{Bucket}?acl"}, + "PutBucketAnalyticsConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?analytics"}, + "PutBucketCors": {"method": "PUT", "requestUri": "/{Bucket}?cors"}, + "PutBucketEncryption": {"method": "PUT", "requestUri": "/{Bucket}?encryption"}, + "PutBucketIntelligentTieringConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?intelligent-tiering"}, + "PutBucketInventoryConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?inventory"}, + "PutBucketLifecycle": {"method": "PUT", "requestUri": "/{Bucket}?lifecycle"}, + "PutBucketLifecycleConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?lifecycle"}, + "PutBucketLogging": {"method": "PUT", "requestUri": "/{Bucket}?logging"}, + "PutBucketMetricsConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?metrics"}, + "PutBucketNotification": {"method": "PUT", "requestUri": "/{Bucket}?notification"}, + "PutBucketNotificationConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?notification"}, + "PutBucketOwnershipControls": {"method": "PUT", "requestUri": "/{Bucket}?ownershipControls"}, + "PutBucketPolicy": {"method": "PUT", "requestUri": "/{Bucket}?policy"}, + "PutBucketReplication": {"method": "PUT", "requestUri": "/{Bucket}?replication"}, + "PutBucketRequestPayment": {"method": "PUT", "requestUri": "/{Bucket}?requestPayment"}, + "PutBucketTagging": {"method": "PUT", "requestUri": "/{Bucket}?tagging"}, + "PutBucketVersioning": {"method": "PUT", "requestUri": "/{Bucket}?versioning"}, + "PutBucketWebsite": {"method": "PUT", "requestUri": "/{Bucket}?website"}, + "PutObject": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}"}, + "PutObjectAcl": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}?acl"}, + "PutObjectAnnotation": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}?annotation"}, + "PutObjectLegalHold": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}?legal-hold"}, + "PutObjectLockConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?object-lock"}, + "PutObjectRetention": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}?retention"}, + "PutObjectTagging": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}?tagging"}, + "PutPublicAccessBlock": {"method": "PUT", "requestUri": "/{Bucket}?publicAccessBlock"}, + "RenameObject": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}?renameObject"}, + "RestoreObject": {"method": "POST", "requestUri": "/{Bucket}/{Key+}?restore"}, + "SelectObjectContent": {"method": "POST", "requestUri": "/{Bucket}/{Key+}?select&select-type=2"}, + "UpdateBucketMetadataAnnotationTableConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?metadataAnnotationTable"}, + "UpdateBucketMetadataInventoryTableConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?metadataInventoryTable"}, + "UpdateBucketMetadataJournalTableConfiguration": {"method": "PUT", "requestUri": "/{Bucket}?metadataJournalTable"}, + "UpdateObjectEncryption": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}?encryption"}, + "UploadPart": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}"}, + "UploadPartCopy": {"method": "PUT", "requestUri": "/{Bucket}/{Key+}"}, + "WriteGetObjectResponse": {"method": "POST", "requestUri": "/WriteGetObjectResponse"} + } + } + } +} diff --git a/tools/aws/regen_rest_routes.py b/tools/aws/regen_rest_routes.py new file mode 100644 index 0000000000..2bb5460712 --- /dev/null +++ b/tools/aws/regen_rest_routes.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 +"""Regenerate src/test/resources/aws/rest-routes.json from botocore's models. + +A REST request is authorized by its route: `IamActionRegistry` maps the HTTP method and path to the +IAM action, and a route no rule maps is left unchecked. Whether every operation of a service reaches +the action AWS checks for it can only be tested against the operation's real route, which is what +this vendors: for each operation of the models below, its HTTP method and request URI exactly as +the SDKs send them. `IamRestRouteCoverageTest` builds a request on each route and compares the +action the registry gives with the one `iam-authorized-actions.json` names, or the operation's own. + +The models are botocore's `//service-2.json` (Apache-2.0, +https://github.com/boto/botocore), the latest API version of each, located as +`regen_query_services.py` locates them. Which models are read, and which credential scope Floci +authorizes each under, is Floci's choice and stays in this file. + +Run from anywhere in the repo: + python3 tools/aws/regen_rest_routes.py # rewrite the vendored file in place + python3 tools/aws/regen_rest_routes.py --check # exit 1 when the vendored file is stale +""" +from __future__ import annotations + +import argparse +import json +import sys +from pathlib import Path + +from regen_partitions import resolve_botocore_data, strip_source +from regen_query_services import latest_model_dir, load_model + +REPO_ROOT = Path(__file__).resolve().parents[2] +OUTPUT = REPO_ROOT / "src/test/resources/aws/rest-routes.json" + +# botocore model -> the credential scope Floci authorizes its requests under. +MODELS: dict[str, str] = { + "apigateway": "apigateway", + "apigatewayv2": "apigateway", + "lambda": "lambda", + "s3": "s3", +} + + +def build(models: dict[str, dict], provenance: str) -> dict: + """The vendored document from each loaded model.""" + routes = {} + for name in sorted(models): + model = models[name] + if model["metadata"].get("protocol") not in ("rest-json", "rest-xml"): + raise SystemExit(f"error: {name} is not a REST model") + operations = {} + for operation in sorted(model["operations"]): + http = model["operations"][operation]["http"] + operations[operation] = {"method": http["method"], "requestUri": http["requestUri"]} + routes[name] = { + "credentialScope": MODELS[name], + "apiVersion": model["metadata"]["apiVersion"], + "operations": operations, + } + return { + "_source": { + "generator": "tools/aws/regen_rest_routes.py", + "botocore": provenance, + }, + "models": routes, + } + + +def load_models(data: Path) -> dict[str, dict]: + return {name: load_model(latest_model_dir(data, name)) for name in MODELS} + + +def render(doc: dict) -> str: + """The document with one operation to a line, so a model's routes read as a table.""" + lines = ["{", f' "_source": {json.dumps(doc["_source"])},', ' "models": {'] + models = list(doc["models"].items()) + for index, (name, model) in enumerate(models): + lines.append(f" {json.dumps(name)}: {{") + lines.append(f' "credentialScope": {json.dumps(model["credentialScope"])},') + lines.append(f' "apiVersion": {json.dumps(model["apiVersion"])},') + lines.append(' "operations": {') + operations = list(model["operations"].items()) + for position, (operation, route) in enumerate(operations): + comma = "," if position < len(operations) - 1 else "" + lines.append(f" {json.dumps(operation)}: {json.dumps(route)}{comma}") + lines.append(" }") + lines.append(" }" + ("," if index < len(models) - 1 else "")) + lines += [" }", "}"] + return "\n".join(lines) + "\n" + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--check", action="store_true", help="exit 1 when the vendored file differs from a fresh generation") + parser.add_argument("--botocore-data", type=Path, help="botocore data directory") + parser.add_argument("--output", type=Path, default=OUTPUT, help=argparse.SUPPRESS) + args = parser.parse_args(argv) + + data, provenance = resolve_botocore_data(args.botocore_data) + fresh = render(build(load_models(data), provenance)) + + if args.check: + current = args.output.read_text(encoding="utf-8") if args.output.exists() else "" + if strip_source(current) != strip_source(fresh): + print(f"{args.output} is stale (generated from {provenance}).", file=sys.stderr) + return 1 + return 0 + + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(fresh, encoding="utf-8") + shown = args.output.relative_to(REPO_ROOT) if args.output.is_relative_to(REPO_ROOT) else args.output + print(f"wrote {shown} from {provenance}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/aws/test_regen_rest_routes.py b/tools/aws/test_regen_rest_routes.py new file mode 100644 index 0000000000..2bd555c756 --- /dev/null +++ b/tools/aws/test_regen_rest_routes.py @@ -0,0 +1,69 @@ +"""Tests for regen_rest_routes. + +Run with: pytest tools/aws -q (or: make aws-data-test) +""" +from __future__ import annotations + +import gzip +import json + +import pytest + +import regen_rest_routes as r + + +def model(protocol: str, api_version: str, **operations: tuple[str, str]) -> dict: + return { + "metadata": {"protocol": protocol, "apiVersion": api_version}, + "operations": {name: {"http": {"method": method, "requestUri": uri}} for name, (method, uri) in operations.items()}, + } + + +def test_each_operation_keeps_its_method_and_request_uri_under_its_scope(): + doc = r.build({ + "s3": model("rest-xml", "2006-03-01", GetObject=("GET", "/{Bucket}/{Key+}?x-id=GetObject"), + DeleteBucketCors=("DELETE", "/{Bucket}?cors")), + "apigatewayv2": model("rest-json", "2018-11-29", GetApis=("GET", "/v2/apis")), + }, "botocore test") + + assert doc["_source"] == {"generator": "tools/aws/regen_rest_routes.py", "botocore": "botocore test"} + assert list(doc["models"]) == ["apigatewayv2", "s3"] + assert doc["models"]["s3"] == { + "credentialScope": "s3", + "apiVersion": "2006-03-01", + "operations": { + "DeleteBucketCors": {"method": "DELETE", "requestUri": "/{Bucket}?cors"}, + "GetObject": {"method": "GET", "requestUri": "/{Bucket}/{Key+}?x-id=GetObject"}, + }, + } + # A model is authorized under the scope it signs with, which need not be its own name. + assert doc["models"]["apigatewayv2"]["credentialScope"] == "apigateway" + + +def test_each_operation_is_rendered_on_a_line_of_its_own(): + doc = r.build({"s3": model("rest-xml", "2006-03-01", GetObject=("GET", "/{Bucket}/{Key+}"), + HeadBucket=("HEAD", "/{Bucket}"))}, "botocore test") + text = r.render(doc) + + assert json.loads(text) == doc + assert ' "GetObject": {"method": "GET", "requestUri": "/{Bucket}/{Key+}"},' in text.splitlines() + + +def test_a_model_that_is_not_rest_is_refused(): + with pytest.raises(SystemExit): + r.build({"s3": model("json", "2006-03-01", GetObject=("POST", "/"))}, "botocore test") + + +def test_check_passes_on_a_fresh_generation_and_fails_on_a_stale_one(tmp_path): + for name in r.MODELS: + directory = tmp_path / "data" / name / "2020-01-01" + directory.mkdir(parents=True) + with gzip.open(directory / "service-2.json.gz", "wt", encoding="utf-8") as f: + json.dump(model("rest-json", "2020-01-01", Ping=("GET", "/ping")), f) + output = tmp_path / "rest-routes.json" + data = ["--botocore-data", str(tmp_path / "data"), "--output", str(output)] + + assert r.main(data) == 0 + assert r.main(data + ["--check"]) == 0 + output.write_text(output.read_text(encoding="utf-8").replace("/ping", "/pong"), encoding="utf-8") + assert r.main(data + ["--check"]) == 1