Verify at least one dest config is specified (#4363)

This commit is contained in:
kbalk 2021-09-30 15:57:03 -04:00 committed by GitHub
parent 25d5db2063
commit e6b18bcb92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -77,11 +77,12 @@ def find_destination_config_in_args(api_args):
if name in destination_names and arg_value:
configs.append((DESTINATION_TYPES_TO_NAMES[name], arg_value))
# Only a single destination configuration is allowed.
if len(configs) > 1:
# One and only one destination configuration is allowed.
if len(configs) != 1:
raise InvalidArgumentException(
"Exactly one destination configuration is supported for a Firehose"
)
return configs[0]

View File

@ -143,6 +143,16 @@ def test_create_delivery_stream_failures():
in err["Message"]
)
# At least one destination configuration is required.
with pytest.raises(ClientError) as exc:
client.create_delivery_stream(DeliveryStreamName=f"{failure_name}_2manyconfigs")
err = exc.value.response["Error"]
assert err["Code"] == "InvalidArgumentException"
assert (
"Exactly one destination configuration is supported for a Firehose"
in err["Message"]
)
# Provide a Kinesis source configuration, but use DirectPut stream type.
with pytest.raises(ClientError) as exc:
client.create_delivery_stream(