use of com.amazonaws.services.cognitoidentityprovider.model.ListUsersRequest in project aws-sdk-android by aws-amplify.
the class AWSMobileClientTest method deleteAllUsers.
public static void deleteAllUsers(final String userpoolId) {
ListUsersResult listUsersResult;
do {
ListUsersRequest listUsersRequest = new ListUsersRequest().withUserPoolId(userpoolId).withLimit(60);
listUsersResult = getUserpoolLL().listUsers(listUsersRequest);
for (UserType user : listUsersResult.getUsers()) {
if (USERNAME.equals(user.getUsername()) || "bimin".equals(user.getUsername()) || "customAuthTestUser".equals(user.getUsername())) {
// This user is saved to test the identity id permanence
continue;
}
boolean retryConfirmSignUp = false;
do {
try {
Log.d(TAG, "deleteAllUsers: " + user.getUsername());
getUserpoolLL().adminDeleteUser(new AdminDeleteUserRequest().withUsername(user.getUsername()).withUserPoolId(userpoolId));
} catch (UserNotConfirmedException e) {
if (!retryConfirmSignUp) {
AdminConfirmSignUpRequest adminConfirmSignUpRequest = new AdminConfirmSignUpRequest();
adminConfirmSignUpRequest.withUsername(user.getUsername()).withUserPoolId(userpoolId);
getUserpoolLL().adminConfirmSignUp(adminConfirmSignUpRequest);
retryConfirmSignUp = true;
try {
Thread.sleep(10);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} else {
retryConfirmSignUp = false;
}
} catch (Exception e) {
Log.e(TAG, "deleteAllUsers: Some error trying to delete user", e);
}
} while (retryConfirmSignUp);
}
} while (listUsersResult.getPaginationToken() != null);
}
use of com.amazonaws.services.cognitoidentityprovider.model.ListUsersRequest in project aws-sdk-android by aws-amplify.
the class AWSMobileClientPersistenceTest method deleteAllUsers.
public static void deleteAllUsers(final String userpoolId) {
ListUsersResult listUsersResult;
do {
ListUsersRequest listUsersRequest = new ListUsersRequest().withUserPoolId(userpoolId).withLimit(60);
listUsersResult = getUserpoolLL().listUsers(listUsersRequest);
for (UserType user : listUsersResult.getUsers()) {
if (USERNAME.equals(user.getUsername()) || "bimin".equals(user.getUsername())) {
// This user is saved to test the identity id permanence
continue;
}
boolean retryConfirmSignUp = false;
do {
try {
Log.d(TAG, "deleteAllUsers: " + user.getUsername());
getUserpoolLL().adminDeleteUser(new AdminDeleteUserRequest().withUsername(user.getUsername()).withUserPoolId(userpoolId));
} catch (UserNotConfirmedException e) {
if (!retryConfirmSignUp) {
AdminConfirmSignUpRequest adminConfirmSignUpRequest = new AdminConfirmSignUpRequest();
adminConfirmSignUpRequest.withUsername(user.getUsername()).withUserPoolId(userpoolId);
getUserpoolLL().adminConfirmSignUp(adminConfirmSignUpRequest);
retryConfirmSignUp = true;
try {
Thread.sleep(10);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} else {
retryConfirmSignUp = false;
}
} catch (Exception e) {
Log.e(TAG, "deleteAllUsers: Some error trying to delete user", e);
}
} while (retryConfirmSignUp);
}
} while (listUsersResult.getPaginationToken() != null);
}
use of com.amazonaws.services.cognitoidentityprovider.model.ListUsersRequest in project aws-sdk-android by aws-amplify.
the class AWSMobileClientPersistenceWithRestartabilityTest method deleteAllUsers.
public static void deleteAllUsers(final String userPoolId) {
ListUsersResult listUsersResult;
do {
ListUsersRequest listUsersRequest = new ListUsersRequest().withUserPoolId(userPoolId).withLimit(60);
listUsersResult = getCognitoUserPoolLowLevelClient().listUsers(listUsersRequest);
for (UserType user : listUsersResult.getUsers()) {
if (USERNAME.equals(user.getUsername()) || "bimin".equals(user.getUsername())) {
// This user is saved to test the identity id permanence
continue;
}
boolean retryConfirmSignUp = false;
do {
try {
Log.d(TAG, "deleteAllUsers: " + user.getUsername());
getCognitoUserPoolLowLevelClient().adminDeleteUser(new AdminDeleteUserRequest().withUsername(user.getUsername()).withUserPoolId(userPoolId));
} catch (UserNotConfirmedException e) {
if (!retryConfirmSignUp) {
AdminConfirmSignUpRequest adminConfirmSignUpRequest = new AdminConfirmSignUpRequest();
adminConfirmSignUpRequest.withUsername(user.getUsername()).withUserPoolId(userPoolId);
getCognitoUserPoolLowLevelClient().adminConfirmSignUp(adminConfirmSignUpRequest);
retryConfirmSignUp = true;
try {
Thread.sleep(10);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} else {
retryConfirmSignUp = false;
}
} catch (Exception e) {
Log.e(TAG, "deleteAllUsers: Some error trying to delete user", e);
}
} while (retryConfirmSignUp);
}
} while (listUsersResult.getPaginationToken() != null);
}
Aggregations