aws-sdk-rust
aws-sdk-rust copied to clipboard
[request]: Implement paginator for DescribeRules in aws-sdk-elasticloadbalancingv2
A note for the community
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue, please leave a comment
Tell us about your request
Paginator for DescribeRules in aws-sdk-elasticloadbalancingv2.
Tell us about the problem you're trying to solve.
I want to describe all rules for a listener by listener's ARN. DescribeRules operation has an interface for pagination (marker, next_marker, etc.) and I have to use them to list up all rules for a listener. Some operations in aws-sdk-elasticloadbalancingv2 has paginator implementations so they can be paginated easily, but DescribeRules does not. Having paginator for DescribeRules would be nice.
Are you currently working around this issue?
Implements pagination manually. Note that the following code is for v0.3.0.
client
.describe_rules()
.listener_arn(listener_arn.clone())
.send()
.and_then(move |output| async move {
let next_marker = output.next_marker.clone();
let head = futures::stream::once(async { Ok(output) });
let tail = futures::stream::try_unfold(next_marker, move |next_marker| {
let listener_arn = listener_arn.clone();
async move {
let next_marker = match next_marker {
Some(marker) if !marker.is_empty() => marker,
_ => return Ok(None),
};
let output = elbv2
.describe_rules()
.marker(next_marker)
.listener_arn(listener_arn.clone())
.send()
.await?;
let next_marker = output.next_marker.clone();
Ok(Some((output, next_marker)))
}
});
Ok(head.chain(tail))
})
.try_flatten_stream()
Additional context
No response
Thanks for pointing this out. I've forwarded this request to the AWS team that maintains that model and will follow up here with any updates. By the way, that's a super clever way of implementing a paginator, I never considered chaining streams together like that!