Aaron

Handle pagination;

... ... @@ -44,6 +44,8 @@ def get_all_headers(data):
def fetch_user_data(user_list):
user_data = []
for user in user_list['Users']:
# Get Group Data
... ... @@ -119,17 +121,17 @@ if __name__ == '__main__':
# Initialize client
client = boto3.client('iam')
user_data = []
users_complete = []
user_list = client.list_users()
user_data += fetch_user_data(user_list)
users_complete += fetch_user_data(user_list)
while user_list['IsTruncated'] is True:
user_list = client.list_users(Marker=user_list['Marker'])
user_data += fetch_user_data(more_users)
user_list = client.list_users(Marker=user_list['Marker'], MaxItems=3)
users_complete += fetch_user_data(user_list)
# Dump user data
out = json.dumps(user_data, default=str, indent=2)
out = json.dumps(users_complete, default=str, indent=2)
if args.outfile:
# Write data to file
... ...