Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion samtranslator/swagger/swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from samtranslator.model.intrinsics import ref, make_conditional, fnSub
from samtranslator.model.exceptions import InvalidDocumentException, InvalidTemplateException
from samtranslator.open_api.base_editor import BaseEditor
from samtranslator.translator.arn_generator import ArnGenerator
from samtranslator.utils.py27hash_fix import Py27Dict, Py27UniStr


Expand Down Expand Up @@ -223,7 +224,7 @@ def _generate_integration_credentials(self, method_invoke_role=None, api_invoke_

@staticmethod
def _get_invoke_role(invoke_role): # type: ignore[no-untyped-def]
CALLER_CREDENTIALS_ARN = "arn:aws:iam::*:user/*"
CALLER_CREDENTIALS_ARN = f"arn:{ArnGenerator.get_partition_name()}:iam::*:user/*" # type: ignore[no-untyped-call]
return invoke_role if invoke_role and invoke_role != "CALLER_CREDENTIALS" else CALLER_CREDENTIALS_ARN

def iter_on_all_methods_for_path(self, path_name, skip_methods_without_apigw_integration=True): # type: ignore[no-untyped-def]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -100,7 +100,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand All @@ -122,9 +122,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"HtmlApiDeploymentf84be626f3": {
"HtmlApiDeployment8a330bd7a7": {
"Properties": {
"Description": "RestApi deployment id: f84be626f359fc9697fd8e228c5ffe53e252f82c",
"Description": "RestApi deployment id: 8a330bd7a7ab7fd27c5b7aa46af537d348a4b0d9",
"RestApiId": {
"Ref": "HtmlApi"
}
Expand All @@ -134,7 +134,7 @@
"HtmlApiProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "HtmlApiDeploymentf84be626f3"
"Ref": "HtmlApiDeployment8a330bd7a7"
},
"RestApiId": {
"Ref": "HtmlApi"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -72,9 +72,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"HtmlApiDeploymentda1577e1dd": {
"HtmlApiDeployment874ee11bea": {
"Properties": {
"Description": "RestApi deployment id: da1577e1ddadc82fbcc104e2477852594eeb133c",
"Description": "RestApi deployment id: 874ee11bea39ab234d0bfbcc481f76e58c4d2195",
"RestApiId": {
"Ref": "HtmlApi"
},
Expand All @@ -85,7 +85,7 @@
"HtmlApiProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "HtmlApiDeploymentda1577e1dd"
"Ref": "HtmlApiDeployment874ee11bea"
},
"RestApiId": {
"Ref": "HtmlApi"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -72,9 +72,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"HtmlApiDeploymentda1577e1dd": {
"HtmlApiDeployment874ee11bea": {
"Properties": {
"Description": "RestApi deployment id: da1577e1ddadc82fbcc104e2477852594eeb133c",
"Description": "RestApi deployment id: 874ee11bea39ab234d0bfbcc481f76e58c4d2195",
"RestApiId": {
"Ref": "HtmlApi"
},
Expand All @@ -85,7 +85,7 @@
"HtmlApiProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "HtmlApiDeploymentda1577e1dd"
"Ref": "HtmlApiDeployment874ee11bea"
},
"RestApiId": {
"Ref": "HtmlApi"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -166,9 +166,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"MyApiWithAwsIamAuthDeployment4253f994cd": {
"MyApiWithAwsIamAuthDeploymentda2f42798a": {
"Properties": {
"Description": "RestApi deployment id: 4253f994cdaf14767907decd5cb875cbafc08704",
"Description": "RestApi deployment id: da2f42798a8e92b56e915bab3a7e653e6f7f120d",
"RestApiId": {
"Ref": "MyApiWithAwsIamAuth"
},
Expand All @@ -195,7 +195,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -241,9 +241,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"MyApiWithAwsIamAuthNoCallerCredentialsDeployment07ee28f86e": {
"MyApiWithAwsIamAuthNoCallerCredentialsDeploymente482264f6c": {
"Properties": {
"Description": "RestApi deployment id: 07ee28f86edc705d064d88266db4dea8f5c305b1",
"Description": "RestApi deployment id: e482264f6c49baa1099a7f5463cf057222ee9b3c",
"RestApiId": {
"Ref": "MyApiWithAwsIamAuthNoCallerCredentials"
},
Expand All @@ -254,7 +254,7 @@
"MyApiWithAwsIamAuthNoCallerCredentialsProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "MyApiWithAwsIamAuthNoCallerCredentialsDeployment07ee28f86e"
"Ref": "MyApiWithAwsIamAuthNoCallerCredentialsDeploymente482264f6c"
},
"RestApiId": {
"Ref": "MyApiWithAwsIamAuthNoCallerCredentials"
Expand All @@ -266,7 +266,7 @@
"MyApiWithAwsIamAuthProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "MyApiWithAwsIamAuthDeployment4253f994cd"
"Ref": "MyApiWithAwsIamAuthDeploymentda2f42798a"
},
"RestApiId": {
"Ref": "MyApiWithAwsIamAuth"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -141,7 +141,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -172,9 +172,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"MyApiWithAwsIamAuthAndDefaultInvokeRoleDeploymentd0103947f7": {
"MyApiWithAwsIamAuthAndDefaultInvokeRoleDeployment0a94105dab": {
"Properties": {
"Description": "RestApi deployment id: d0103947f7e2e1d52ca7afac92f5afc8339a051b",
"Description": "RestApi deployment id: 0a94105dab568f7a8bff9a1eda496ca87694cb3f",
"RestApiId": {
"Ref": "MyApiWithAwsIamAuthAndDefaultInvokeRole"
},
Expand All @@ -185,7 +185,7 @@
"MyApiWithAwsIamAuthAndDefaultInvokeRoleProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "MyApiWithAwsIamAuthAndDefaultInvokeRoleDeploymentd0103947f7"
"Ref": "MyApiWithAwsIamAuthAndDefaultInvokeRoleDeployment0a94105dab"
},
"RestApiId": {
"Ref": "MyApiWithAwsIamAuthAndDefaultInvokeRole"
Expand All @@ -194,9 +194,9 @@
},
"Type": "AWS::ApiGateway::Stage"
},
"MyApiWithAwsIamAuthDeploymentc8adfb74cf": {
"MyApiWithAwsIamAuthDeployment7ad0de4d9a": {
"Properties": {
"Description": "RestApi deployment id: c8adfb74cfae8b8052802a21a258ecbd5178d144",
"Description": "RestApi deployment id: 7ad0de4d9ab0659e436bf913df69d19f6b6b6e34",
"RestApiId": {
"Ref": "MyApiWithAwsIamAuth"
},
Expand All @@ -207,7 +207,7 @@
"MyApiWithAwsIamAuthProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "MyApiWithAwsIamAuthDeploymentc8adfb74cf"
"Ref": "MyApiWithAwsIamAuthDeployment7ad0de4d9a"
},
"RestApiId": {
"Ref": "MyApiWithAwsIamAuth"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand All @@ -52,7 +52,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -100,9 +100,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"MyApiWithAwsIamAuthDeploymentfbe9aee08e": {
"MyApiWithAwsIamAuthDeploymenta388b99c2b": {
"Properties": {
"Description": "RestApi deployment id: fbe9aee08eb164bd4de9a7a7c91782c10b86d7df",
"Description": "RestApi deployment id: a388b99c2b4ca0be2559b61649bdffa5c5fcddcc",
"RestApiId": {
"Ref": "MyApiWithAwsIamAuth"
},
Expand All @@ -113,7 +113,7 @@
"MyApiWithAwsIamAuthProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "MyApiWithAwsIamAuthDeploymentfbe9aee08e"
"Ref": "MyApiWithAwsIamAuthDeploymenta388b99c2b"
},
"RestApiId": {
"Ref": "MyApiWithAwsIamAuth"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -53,7 +53,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand All @@ -71,7 +71,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand All @@ -89,7 +89,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-cn:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -140,9 +140,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"MyApiWithoutAuthDeployment3de35e9b3b": {
"MyApiWithoutAuthDeployment5cac94edbc": {
"Properties": {
"Description": "RestApi deployment id: 3de35e9b3bf45c40811c36bd46b8e8513409c050",
"Description": "RestApi deployment id: 5cac94edbcf51122b60f1a122d953131665eccc8",
"RestApiId": {
"Ref": "MyApiWithoutAuth"
},
Expand All @@ -153,7 +153,7 @@
"MyApiWithoutAuthProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "MyApiWithoutAuthDeployment3de35e9b3b"
"Ref": "MyApiWithoutAuthDeployment5cac94edbc"
},
"RestApiId": {
"Ref": "MyApiWithoutAuth"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-us-gov:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand Down Expand Up @@ -100,7 +100,7 @@
}
],
"x-amazon-apigateway-integration": {
"credentials": "arn:aws:iam::*:user/*",
"credentials": "arn:aws-us-gov:iam::*:user/*",
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
Expand All @@ -122,9 +122,9 @@
},
"Type": "AWS::ApiGateway::RestApi"
},
"HtmlApiDeployment2274fb58ae": {
"HtmlApiDeploymentd5a98edb8f": {
"Properties": {
"Description": "RestApi deployment id: 2274fb58ae60fc2a69a3feb3b433d9bcf6947be5",
"Description": "RestApi deployment id: d5a98edb8f10f3d3a1c0b7693dd9c6afa4f2206b",
"RestApiId": {
"Ref": "HtmlApi"
}
Expand All @@ -134,7 +134,7 @@
"HtmlApiProdStage": {
"Properties": {
"DeploymentId": {
"Ref": "HtmlApiDeployment2274fb58ae"
"Ref": "HtmlApiDeploymentd5a98edb8f"
},
"RestApiId": {
"Ref": "HtmlApi"
Expand Down
Loading