Verify at least one dest config is specified (#4363)
This commit is contained in:
		
							parent
							
								
									25d5db2063
								
							
						
					
					
						commit
						e6b18bcb92
					
				@ -77,11 +77,12 @@ def find_destination_config_in_args(api_args):
 | 
				
			|||||||
        if name in destination_names and arg_value:
 | 
					        if name in destination_names and arg_value:
 | 
				
			||||||
            configs.append((DESTINATION_TYPES_TO_NAMES[name], arg_value))
 | 
					            configs.append((DESTINATION_TYPES_TO_NAMES[name], arg_value))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Only a single destination configuration is allowed.
 | 
					    # One and only one destination configuration is allowed.
 | 
				
			||||||
    if len(configs) > 1:
 | 
					    if len(configs) != 1:
 | 
				
			||||||
        raise InvalidArgumentException(
 | 
					        raise InvalidArgumentException(
 | 
				
			||||||
            "Exactly one destination configuration is supported for a Firehose"
 | 
					            "Exactly one destination configuration is supported for a Firehose"
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return configs[0]
 | 
					    return configs[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -143,6 +143,16 @@ def test_create_delivery_stream_failures():
 | 
				
			|||||||
        in err["Message"]
 | 
					        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.
 | 
					    # Provide a Kinesis source configuration, but use DirectPut stream type.
 | 
				
			||||||
    with pytest.raises(ClientError) as exc:
 | 
					    with pytest.raises(ClientError) as exc:
 | 
				
			||||||
        client.create_delivery_stream(
 | 
					        client.create_delivery_stream(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user