Add a StopPaginationOnSameToken customization to CloudWatchLogs.GetLogEvents operation #3296
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.
Description
This PR fixes DOTNET-7441 by adding StopPaginationOnSameToken flag to Operation customizations in the generator and adds this flag to CloudWatchLogs.GetLogEvents operation customization.
Motivation and Context
CloudWatchLogs.GetLogEvents operation response includes two pagination tokens (
NextBackwardToken
andNextForwardToken
), but they won't be null once all events are retrieved (instead, CloudWatch will return the same value sent in the request)This means the .NET paginator (which is generated from the model to keep invoking the API until the response token is empty) enters an infinite loop as the
NextForwardToken
will never be null.Additionally this issue was opened #3218 and we couldn't advise to use the paginator since it will enter an infinite loop.
This PR contains the following commits to fix this issue:
Testing
GetLogEvents
pagination with a long and a shortLogStream
and validated that it the pagination stops when it reaches the end of the stream.GetLogEventsTest_TwoResponses
test to reflect the service response.DRY_RUN-36b366d9-c447-45f7-8764-df58b7cb716a
.Screenshots (if appropriate)
Types of changes
Checklist
License