Java 类com.amazonaws.services.identitymanagement.model.ListUsersRequest 实例源码

项目:aws-doc-sdk-examples    文件:ListUsers.java   
public static void main(String[] args) {

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        boolean done = false;
        ListUsersRequest request = new ListUsersRequest();

        while(!done) {
            ListUsersResult response = iam.listUsers(request);

            for(User user : response.getUsers()) {
                System.out.format("Retrieved user %s", user.getUserName());
            }

            request.setMarker(response.getMarker());

            if(!response.getIsTruncated()) {
                done = true;
            }
        }
    }
项目:AWSConfig    文件:IamUtilsImpl.java   
/**
 * This method returns all Iam users.
 * @return List<User> returns all Iam users.
 * @throws AmazonClientException
 */

public List<User> getAllIamUsers() throws AmazonClientException {

    String marker = null;
    List<User> allIamUsers = new ArrayList<>();

    try {
         // Fetch all iam users.
        while(true) {

            ListUsersRequest listUsersRequest = new ListUsersRequest();
            listUsersRequest.setMarker(marker);
            ListUsersResult listUsersResult = this.iamClient.listUsers(listUsersRequest);
            allIamUsers.addAll(listUsersResult.getUsers());

            // Check the listUsersResult is truncated. This method returns users in batches of 100.
            if ( listUsersResult.isTruncated() ) {
                marker = listUsersResult.getMarker();           
            } else {
                break;
            }
        }
    } catch(AmazonClientException e) {
        System.out.println("ERROR : fetching all iam users");
        e.printStackTrace();
        throw e;
    }


    List<String> allIamUsersName = allIamUsers.stream().map(e -> e.getUserName()).collect(Collectors.toList());
    System.out.println("INFO : Number of Iam users : " + allIamUsers.size());
    System.out.println("INFO : Iam users : " + allIamUsersName);

    return allIamUsers;
}
项目:clouck    文件:IamWrapperImpl.java   
@Override
public List<AbstractResource<?>> listUsers(Account account, DateTime dt) {
    AmazonIdentityManagement iam = findClient(account);

    ListUsersRequest req = new ListUsersRequest();

    log.debug("start list users for account:{} via api", account.getId() + "=>" + account.getName());
    ListUsersResult res = iam.listUsers(req);

    return converter.toIamUsers(res.getUsers(), account.getId(), dt);
}
项目:aws-sdk-java-resources    文件:IdentityManagementImpl.java   
@Override
public UserCollection getUsers() {
    return getUsers((ListUsersRequest)null);
}
项目:aws-sdk-java-resources    文件:IdentityManagementImpl.java   
@Override
public UserCollection getUsers(ListUsersRequest request) {
    ResourceCollectionImpl result = service.getCollection("Users", request);
    if (result == null) return null;
    return new UserCollectionImpl(result);
}
项目:aws-sdk-java-resources    文件:IdentityManagement.java   
/**
 * Retrieves the Users collection referenced by this resource.
 */
UserCollection getUsers(ListUsersRequest request);