APIGateway: Support Sagemaker URI's as endpoints (#5434)

This commit is contained in:
Bert Blommers 2022-08-30 21:13:56 +00:00 committed by GitHub
parent 2c98b7574b
commit e621ce419c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -1610,7 +1610,7 @@ class APIGatewayBackend(BaseBackend):
if integration_type in ["AWS", "AWS_PROXY"] and not re.match("^arn:aws:", uri):
raise InvalidArn()
if integration_type in ["AWS", "AWS_PROXY"] and not re.match(
"^arn:aws:apigateway:[a-zA-Z0-9-]+:[a-zA-Z0-9-]+:(path|action)/", uri
"^arn:aws:apigateway:[a-zA-Z0-9-]+:[a-zA-Z0-9-.]+:(path|action)/", uri
):
raise InvalidIntegrationArn()
integration = resource.add_integration(

View File

@ -166,6 +166,23 @@ def test_aws_integration_dynamodb_multiple_resources():
)
@mock_apigateway
def test_aws_integration_sagemaker():
region = "us-west-2"
client = boto3.client("apigateway", region_name=region)
sagemaker_endpoint = "non-existing"
integration_action = f"arn:aws:apigateway:{region}:runtime.sagemaker:path//endpoints/{sagemaker_endpoint}/invocations"
api_id, resource_id = create_integration_test_api(client, integration_action)
# We can't invoke Sagemaker
# Just verify that the integration action was successful
response = client.get_integration(
restApiId=api_id, resourceId=resource_id, httpMethod="PUT"
)
response.should.have.key("uri").equals(integration_action)
def create_table(dynamodb, table_name):
# Create DynamoDB table
dynamodb.create_table(