fix(aws-pipes-alpha): properly infer if given deadLetterTarget is IQu… #34876
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…eue or ITopic instead of using instanceof tests. Prevent custom IQueue implementations of not being set as DeadLetterTargets of Pipes.
Issue # (if applicable)
Closes #34812
Reason for this change
If you create a custom class implementing IQueue or ITopic and try to use it as a DeadLetterTarget of a Pipe DynamoDbStreamSource, it is ignored as the calls to instanceof Queue or Topic fail. Its because IQueue and ITopic are interfaces and not base classes. If I have
class TestQueue implements IQueue {...}, doing(if obj instanceof Queue)will always fail.Description of changes
Instead of testing if its a Queue or Topic with instanceof, since the construct parameters accept IQueue or ITopic, we need to test if the provided object implements IQueue or ITopic.
With the changes provided, as the unit tests show, you can give any object implementing either IQueue or ITopic interfaces and it will be used as a DeadLetterTarget of DynamoDBStream.
Describe any new or updated permissions being added
None.
Description of how you validated changes
All unit tests are passing. I haven't modified any unit test, only added two new that prove that the IQueue or ITopic are used as DeadLetterTarget and we also test that grantPublish or grantSendMessages are appropriately called.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license