Are the paginators for an operation available via the Clojure AWS api?
In Javascript API they’re in client specific data files, eg. aws-sdk-js/apis/logs-2014-03-28.paginators.json
(this happens to be the one for the Amazon CloudWatch Logs service)
No, nothing is built in for pagination right now.
ok, I’ve been making op specific lazy pagers. I’ll continue on that path for now.
Yep, we have the same.
there is a function being considered for inclusion in clojure 1.11 that helps with pagination @lgouger
(defn filter-log-events
"Issues a CloudWatch Logs query (with the filter syntax {$...}, not the CW Insights syntax.
Collects all pages of results.
`client` is an aws-api client
`request` argument is passed directly as the initial request to the :FilterLogEvents op"
[client request]
(iteration (fn [token]
(aws/invoke client
{:op :FilterLogEvents
:request (if token {:nextToken token} request)}))
:kf :nextToken))
example usage ^
I think he may be talking about a mapping of op -> request & response next token keys
If so, there is this: https://github.com/iann0036/aws-pagination-rules. Not sure how accurate it is.
yeah, different apis use different names for nextToken in the request and response and where the results are. For example S3's listObjectsV2 vs logs DescribeLogGroups
"ListObjectsV2": {
"input_token": "ContinuationToken",
"limit_key": "MaxKeys",
"output_token": "NextContinuationToken",
"result_key": [
"Contents",
"CommonPrefixes"
]
}
and
"DescribeLogGroups": {
"input_token": "nextToken",
"limit_key": "limit",
"output_token": "nextToken",
"result_key": "logGroups"
}
Yeah - right now the paginator descriptors aren’t exposed