com.amazonaws.services.identitymanagement.model.ListAccessKeysRequest Java Examples
The following examples show how to use
com.amazonaws.services.identitymanagement.model.ListAccessKeysRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IAMUtils.java From pacbot with Apache License 2.0 | 6 votes |
/** * This method will fetch the access key information of a particular user. * * @param userName * @param iamClient * @return list of access key meta data */ public static List<AccessKeyMetadata> getAccessKeyInformationForUser( final String userName, AmazonIdentityManagementClient iamClient) { ListAccessKeysRequest accessKeysRequest = new ListAccessKeysRequest(); accessKeysRequest.setUserName(userName); logger.debug("userName {} ",userName); List<AccessKeyMetadata> accessKeyMetadatas = new ArrayList<>(); ListAccessKeysResult keysResult = null; do { keysResult = iamClient.listAccessKeys(accessKeysRequest); accessKeyMetadatas.addAll(keysResult.getAccessKeyMetadata()); accessKeysRequest.setMarker(keysResult.getMarker()); } while (keysResult.isTruncated()); return accessKeyMetadatas; }
Example #2
Source File: ListAccessKeys.java From aws-doc-sdk-examples with Apache License 2.0 | 5 votes |
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; ListAccessKeysRequest request = new ListAccessKeysRequest() .withUserName(username); while (!done) { 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; } } }
Example #3
Source File: UserImpl.java From aws-sdk-java-resources with Apache License 2.0 | 5 votes |
@Override public AccessKeyCollection getAccessKeys(ListAccessKeysRequest request) { ResourceCollectionImpl result = resource.getCollection("AccessKeys", request); if (result == null) return null; return new AccessKeyCollectionImpl(result); }
Example #4
Source File: User.java From aws-sdk-java-resources with Apache License 2.0 | 2 votes |
/** * Retrieves the AccessKeys collection referenced by this resource. */ AccessKeyCollection getAccessKeys(ListAccessKeysRequest request);