aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
lgouger 2020-03-04T19:44:36.066400Z

Are the paginators for an operation available via the Clojure AWS api?

lgouger 2020-03-04T19:45:19.067100Z

In Javascript API they’re in client specific data files, eg. aws-sdk-js/apis/logs-2014-03-28.paginators.json

lgouger 2020-03-04T19:45:58.067500Z

(this happens to be the one for the Amazon CloudWatch Logs service)

kenny 2020-03-04T19:46:42.067900Z

No, nothing is built in for pagination right now.

lgouger 2020-03-04T19:47:28.068600Z

ok, I’ve been making op specific lazy pagers. I’ll continue on that path for now.

kenny 2020-03-04T19:48:06.069Z

Yep, we have the same.

ghadi 2020-03-04T19:50:05.069600Z

there is a function being considered for inclusion in clojure 1.11 that helps with pagination @lgouger

ghadi 2020-03-04T19:50:12.069800Z

https://clojure.atlassian.net/browse/CLJ-2555

ghadi 2020-03-04T19:51:08.070Z

(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))

ghadi 2020-03-04T19:51:32.070300Z

example usage ^

kenny 2020-03-04T19:52:24.070900Z

I think he may be talking about a mapping of op -> request & response next token keys

kenny 2020-03-04T19:54:20.072300Z

If so, there is this: https://github.com/iann0036/aws-pagination-rules. Not sure how accurate it is.

lgouger 2020-03-04T19:55:27.073100Z

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"
    }

ghadi 2020-03-04T19:57:01.073900Z

Yeah - right now the paginator descriptors aren’t exposed