-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DynamoDB: Support AccountMode (#8621)
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
from .responses import DynamoHandler | ||
|
||
url_bases = [r"https?://dynamodb\.(.+)\.amazonaws\.com"] | ||
url_bases = [ | ||
r"https?://dynamodb\.(.+)\.amazonaws\.com", | ||
r"https?://(.+).ddb\.(.+)\.amazonaws\.com", | ||
] | ||
|
||
url_paths = {"{0}/": DynamoHandler.dispatch} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import boto3 | ||
import pytest | ||
from botocore.config import Config | ||
|
||
from moto import mock_aws | ||
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID | ||
|
||
|
||
@mock_aws | ||
@pytest.mark.parametrize("endpoint_mode", ["disabled", "preferred", "required"]) | ||
def test_dynamodb_with_account_id_routing(endpoint_mode): | ||
endpoint_config = Config(account_id_endpoint_mode=endpoint_mode) | ||
client = boto3.client( | ||
"dynamodb", | ||
aws_access_key_id="ACCESS_KEY", | ||
aws_secret_access_key="SECRET_KEY", | ||
aws_account_id=ACCOUNT_ID, | ||
region_name="us-west-2", | ||
config=endpoint_config, | ||
) | ||
client.create_table( | ||
TableName="test", | ||
KeySchema=[{"AttributeName": "id", "KeyType": "HASH"}], | ||
AttributeDefinitions=[{"AttributeName": "id", "AttributeType": "S"}], | ||
ProvisionedThroughput={"ReadCapacityUnits": 5, "WriteCapacityUnits": 5}, | ||
) |