Example usage for com.amazonaws.services.identitymanagement.model ListGroupsResult isTruncated

List of usage examples for com.amazonaws.services.identitymanagement.model ListGroupsResult isTruncated

Introduction

In this page you can find the example usage for com.amazonaws.services.identitymanagement.model ListGroupsResult isTruncated.

Prototype

Boolean isTruncated

To view the source code for com.amazonaws.services.identitymanagement.model ListGroupsResult isTruncated.

Click Source Link

Document

A flag that indicates whether there are more items to return.

Usage

From source file:com.denismo.aws.iam.LDAPIAMPoller.java

License:Apache License

private void populateGroupsFromIAM() {
    AmazonIdentityManagementClient client = new AmazonIdentityManagementClient(credentials);

    try {//w w w  .ja  v a2s .  c  o m
        ListGroupsResult res = client.listGroups();
        Set<String> groupNames = new HashSet<String>();
        while (true) {
            for (Group group : res.getGroups()) {
                try {
                    addGroup(group);
                    groupNames.add(group.getGroupName());
                    LOG.info("Added group " + group.getGroupName() + " at " + groupsDN);
                } catch (Throwable e) {
                    LOG.error("Exception processing group " + group.getGroupName(), e);
                }
            }
            if (res.isTruncated()) {
                res = client.listGroups(new ListGroupsRequest().withMarker(res.getMarker()));
            } else {
                break;
            }
        }
        removeDeletedGroups(groupNames);
    } finally {
        client.shutdown();
    }
}