Search in sources :

Example 1 with UpdateAccessKeyRequest

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

the class UpdateAccessKey method main.

public static void main(String[] args) {
    final String USAGE = "To run this example, supply a username, access key id and status\n" + "Ex: UpdateAccessKey <username> <access-key-id> <Activate|Inactive>\n";
    if (args.length != 3) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String username = args[0];
    String access_id = args[1];
    String status = args[2];
    final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
    UpdateAccessKeyRequest request = new UpdateAccessKeyRequest().withAccessKeyId(access_id).withUserName(username).withStatus(status);
    UpdateAccessKeyResult response = iam.updateAccessKey(request);
    System.out.printf("Successfully updated status of access key %s to" + "status %s for user %s", access_id, status, username);
}
Also used : UpdateAccessKeyRequest(com.amazonaws.services.identitymanagement.model.UpdateAccessKeyRequest) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement) UpdateAccessKeyResult(com.amazonaws.services.identitymanagement.model.UpdateAccessKeyResult)

Aggregations

AmazonIdentityManagement (com.amazonaws.services.identitymanagement.AmazonIdentityManagement)1 UpdateAccessKeyRequest (com.amazonaws.services.identitymanagement.model.UpdateAccessKeyRequest)1 UpdateAccessKeyResult (com.amazonaws.services.identitymanagement.model.UpdateAccessKeyResult)1