DynamoDB - Describe Endpoints (#3716)

This commit is contained in:
Bert Blommers 2021-08-28 07:25:06 +01:00 committed by GitHub
parent cc50acc8b5
commit a6606cbf42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -1085,6 +1085,14 @@ class DynamoDBBackend(BaseBackend):
def delete_table(self, name):
return self.tables.pop(name, None)
def describe_endpoints(self):
return [
{
"Address": "dynamodb.{}.amazonaws.com".format(self.region_name),
"CachePeriodInMinutes": 1440,
}
]
def tag_resource(self, table_arn, tags):
for table in self.tables:
if self.tables[table].table_arn == table_arn:

View File

@ -190,6 +190,10 @@ class DynamoHandler(BaseResponse):
er = "com.amazonaws.dynamodb.v20111205#ResourceNotFoundException"
return self.error(er, "Requested resource not found")
def describe_endpoints(self):
response = {"Endpoints": self.dynamodb_backend.describe_endpoints()}
return dynamo_json_dump(response)
def tag_resource(self):
table_arn = self.body["ResourceArn"]
tags = self.body["Tags"]

View File

@ -6202,3 +6202,18 @@ def test_source_and_restored_table_items_are_not_linked():
set(restored_table_guids).should.equal(
set(guids_original) | set(guids_added_after_restore)
)
@mock_dynamodb2
@pytest.mark.parametrize("region", ["eu-central-1", "ap-south-1"])
def test_describe_endpoints(region):
client = boto3.client("dynamodb", region)
res = client.describe_endpoints()["Endpoints"]
res.should.equal(
[
{
"Address": "dynamodb.{}.amazonaws.com".format(region),
"CachePeriodInMinutes": 1440,
},
]
)