165
165
(str prefix-fn-name " Output" )
166
166
(str aws-fn-name " Output" )))
167
167
168
+ (def quoted-get-paginator
169
+ (quote
170
+ (defn get-paginator
171
+ " Returns a fn that lazily fetches the pages for a given aws fn"
172
+ [page-fn]
173
+ (fn get-pages
174
+ [input]
175
+ (lazy-seq
176
+ (let [page (page-fn input)]
177
+ (if-let [next-continuation-token (:NextContinuationToken page)]
178
+ (cons page (get-pages (assoc input :ContinuationToken next-continuation-token)))
179
+ [page])))))))
180
+
168
181
(def t
169
182
"
170
183
// Code generated by generate.clj DO NOT EDIT
171
184
package aws
172
185
173
-
174
186
import (
175
187
\" encoding/json\"
176
188
\" github.com/aws/aws-sdk-go/aws/session\"
@@ -186,6 +198,12 @@ if message.Op == \"describe\" {
186
198
response := &babashka.DescribeResponse{
187
199
Format: \" json\" ,
188
200
Namespaces: []babashka.Namespace{
201
+ {Name: \" pod.tzzh.paginator\" ,
202
+ Vars: []babashka.Var{
203
+ {Name: \" get-paginator\" ,
204
+ Code: `<%= paginator %>`},
205
+ },
206
+ },
189
207
<% (doseq [[ns-name ns-fns] namespaces]
190
208
%>{Name: \" pod.tzzh.<%= ns-name %>\" ,
191
209
Vars: []babashka.Var{
@@ -236,7 +254,8 @@ if message.Op == \"describe\" {
236
254
237
255
(when (= *file* (System/getProperty " babashka.file" ))
238
256
(let [aws-go " ./aws/aws.go" ]
239
- (spit aws-go (template/eval t {:namespaces aws-api}))
257
+ (spit aws-go (template/eval t {:namespaces aws-api
258
+ :paginator (str quoted-get-paginator)}))
240
259
(let [{:keys [err exit]} (shell/sh " go" " fmt" aws-go)]
241
260
(when-not (empty? err)
242
261
(print err))
0 commit comments