Search in sources :

Example 1 with DeleteAccessKeyRequest

use of com.amazonaws.services.identitymanagement.model.DeleteAccessKeyRequest in project aws-doc-sdk-examples by awsdocs.

the class DeleteAccessKey method main.

public static void main(String[] args) {
    final String USAGE = "To run this example, supply a username and access key id\n" + "Ex: DeleteAccessKey <username> <access-key-id>\n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String username = args[0];
    String access_key = args[1];
    final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
    DeleteAccessKeyRequest request = new DeleteAccessKeyRequest().withAccessKeyId(access_key).withUserName(username);
    DeleteAccessKeyResult response = iam.deleteAccessKey(request);
    System.out.println("Successfully deleted access key " + access_key + " from user " + username);
}
Also used : DeleteAccessKeyResult(com.amazonaws.services.identitymanagement.model.DeleteAccessKeyResult) DeleteAccessKeyRequest(com.amazonaws.services.identitymanagement.model.DeleteAccessKeyRequest) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement)

Aggregations

AmazonIdentityManagement (com.amazonaws.services.identitymanagement.AmazonIdentityManagement)1 DeleteAccessKeyRequest (com.amazonaws.services.identitymanagement.model.DeleteAccessKeyRequest)1 DeleteAccessKeyResult (com.amazonaws.services.identitymanagement.model.DeleteAccessKeyResult)1