diff --git a/moto/apigateway/models.py b/moto/apigateway/models.py index 95eaad7ad..c729b1d31 100644 --- a/moto/apigateway/models.py +++ b/moto/apigateway/models.py @@ -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( diff --git a/tests/test_apigateway/test_apigateway_integration.py b/tests/test_apigateway/test_apigateway_integration.py index e9ec6033a..16156b4ae 100644 --- a/tests/test_apigateway/test_apigateway_integration.py +++ b/tests/test_apigateway/test_apigateway_integration.py @@ -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(