//snippet-sourcedescription:[ListUserPools.java demonstrates how to to list existing users in the specified User Pool.]
//snippet-keyword:[Java]
//snippet-sourcesyntax:[java]
//snippet-keyword:[Code Sample]
//snippet-keyword:[Amazon Cognito]
//snippet-service:[cognito]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[2019-06-22]
//snippet-sourceauthor:[jschwarzwalder AWS]
/*
 * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
//snippet-start:[cognito.java2.ListUserPools.complete]

package com.example.cognito;

//snippet-start:[cognito.java2.ListUserPools.import]
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.cognitoidentityprovider.CognitoIdentityProviderClient;
import software.amazon.awssdk.services.cognitoidentityprovider.model.*;
//snippet-end:[cognito.java2.ListUserPools.import]

public class ListUserPools {

    public static void main(String[] args) {
        final String USAGE = "\n" +
                "Usage:\n" +
                "    ListUserPools  \n\n" +
                "Example:\n" +
                "    ListUserPools \n";



        //snippet-start:[cognito.java2.ListUserPools.main]
        CognitoIdentityProviderClient cognitoclient = CognitoIdentityProviderClient.builder().region(Region.US_EAST_1).build();

        ListUserPoolsResponse response = cognitoclient
                .listUserPools(
                        ListUserPoolsRequest.builder()
                                .build()
                );

        for (UserPoolDescriptionType userpool : response.userPools()) {
            System.out.println("UserPool " + userpool.name() + ", User ID " +  userpool.id() + ", Status " + userpool.status());
        }
        //snippet-end:[cognito.java2.ListUserPools.main]
    }
}
//snippet-end:[cognito.java2.ListUserPools.complete]
@@ -325,18 +325,17 @@
 te:%5B
-2019-06-22
+4/16/2020
 %5D%0A//
@@ -360,22 +360,16 @@
 or:%5B
-j
 sc
-hwarzwalder
+macdon
  AWS
@@ -390,18 +390,8 @@
 ght 
-2010-2019 
 Amaz
@@ -948,63 +948,8 @@
 %0A */
-%0A//snippet-start:%5Bcognito.java2.ListUserPools.complete%5D
 %0A%0Apa
@@ -1238,17 +1238,325 @@
 r.model.
-*
+CognitoIdentityProviderException;%0Aimport software.amazon.awssdk.services.cognitoidentityprovider.model.ListUserPoolsResponse;%0Aimport software.amazon.awssdk.services.cognitoidentityprovider.model.ListUserPoolsRequest;%0Aimport software.amazon.awssdk.services.cognitoidentityprovider.model.UserPoolDescriptionType
 ;%0A//snip
@@ -1861,69 +1861,8 @@
 %22;%0A%0A
-%0A%0A        //snippet-start:%5Bcognito.java2.ListUserPools.main%5D%0A
     
@@ -1950,16 +1950,33 @@
 uilder()
+%0A                
 .region(
@@ -1996,19 +1996,247 @@
 T_1)
-.build();%0A%0A
+%0A                .build();%0A%0A        listAllUserPools(cognitoclient ) ;%0A    %7D%0A%0A    //snippet-start:%5Bcognito.java2.ListUserPools.main%5D%0A    public static void listAllUserPools(CognitoIdentityProviderClient cognitoclient ) %7B%0A%0A       try %7B%0A    
     
@@ -2365,32 +2365,80 @@
 quest.builder()%0A
+                                .maxResults(10)%0A
                 
@@ -2490,16 +2490,19 @@
         
+   
 for (Use
@@ -2553,24 +2553,27 @@
 rPools()) %7B%0A
+   
             
@@ -2637,17 +2637,16 @@
 r ID %22 +
- 
  userpoo
@@ -2688,16 +2688,114 @@
 tus());%0A
+           %7D%0A        %7D catch (CognitoIdentityProviderException e)%7B%0A            e.getStackTrace();%0A
         
@@ -2865,56 +2865,4 @@
 %7D%0A%7D%0A
-//snippet-end:%5Bcognito.java2.ListUserPools.complete%5D

Update ListUserPools.java