use of com.amazonaws.services.identitymanagement.model.AccessKeyMetadata in project aws-doc-sdk-examples by awsdocs.
the class ListAccessKeys method main.
public static void main(String[] args) {
final String USAGE = "To run this example, supply an IAM username\n" + "Ex: ListAccessKeys <username>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String username = args[0];
final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
boolean done = false;
while (!done) {
ListAccessKeysRequest request = new ListAccessKeysRequest().withUserName(username);
ListAccessKeysResult response = iam.listAccessKeys(request);
for (AccessKeyMetadata metadata : response.getAccessKeyMetadata()) {
System.out.format("Retrieved access key %s", metadata.getAccessKeyId());
}
request.setMarker(response.getMarker());
if (!response.getIsTruncated()) {
done = true;
}
}
}
Aggregations