use of io.kubernetes.client.extended.pager.Pager in project java by kubernetes-client.
the class PagerExample method main.
public static void main(String[] args) throws IOException {
ApiClient client = Config.defaultClient();
OkHttpClient httpClient = client.getHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();
client.setHttpClient(httpClient);
Configuration.setDefaultApiClient(client);
CoreV1Api api = new CoreV1Api();
int i = 0;
Pager<V1Namespace, V1NamespaceList> pager = new Pager<V1Namespace, V1NamespaceList>((Pager.PagerParams param) -> {
try {
return api.listNamespaceCall(null, null, param.getContinueToken(), null, null, param.getLimit(), null, null, 1, null, null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}, client, 10, V1NamespaceList.class);
for (V1Namespace namespace : pager) {
System.out.println(namespace.getMetadata().getName());
}
System.out.println("------------------");
}
Aggregations