def test_should_find_operation_definitions():
    assert operation_definition("apigateway", "UpdateApiKey") == {
        "name":
        "UpdateApiKey",
        "http": {
            "method": "PATCH",
            "requestUri": "/apikeys/{api_Key}"
        },
        "input": {
            "shape": "UpdateApiKeyRequest"
        },
        "output": {
            "shape": "ApiKey"
        },
        "errors": [{
            "shape": "BadRequestException"
        }, {
            "shape": "ConflictException"
        }, {
            "shape": "LimitExceededException"
        }, {
            "shape": "NotFoundException"
        }, {
            "shape": "UnauthorizedException"
        }, {
            "shape": "TooManyRequestsException"
        }],
        "documentation":
        "<p>Changes information about an ApiKey resource.</p>"
    }
Exemple #2
0
    def _to_api_gateway_statement(self):
        op_def = operation_definition("apigateway", self.event_name)

        http_method = op_def['http']['method']
        request_uri = op_def['http']['requestUri']

        resource_path = re.compile(r"{[a-zA-Z_]+}").sub("*", request_uri)

        region = "*"  # use proper region from requestParameters

        return Statement(
            Effect="Allow",
            Action=[Action("apigateway", http_method)],
            Resource=[f"arn:aws:apigateway:{region}::{resource_path}"])