Search in sources :

Example 1 with GetAccessKeyLastUsedRequest

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

the class AccessKeyLastUsed method main.

public static void main(String[] args) {
    final String USAGE = "To run this example, supply an access key id\n" + "Ex: AccessKeyLastUsed <access-key-id>\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String access_id = args[0];
    final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
    GetAccessKeyLastUsedRequest request = new GetAccessKeyLastUsedRequest().withAccessKeyId(access_id);
    GetAccessKeyLastUsedResult response = iam.getAccessKeyLastUsed(request);
    System.out.println("Access key was last used at: " + response.getAccessKeyLastUsed().getLastUsedDate());
}
Also used : GetAccessKeyLastUsedResult(com.amazonaws.services.identitymanagement.model.GetAccessKeyLastUsedResult) GetAccessKeyLastUsedRequest(com.amazonaws.services.identitymanagement.model.GetAccessKeyLastUsedRequest) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement)

Aggregations

AmazonIdentityManagement (com.amazonaws.services.identitymanagement.AmazonIdentityManagement)1 GetAccessKeyLastUsedRequest (com.amazonaws.services.identitymanagement.model.GetAccessKeyLastUsedRequest)1 GetAccessKeyLastUsedResult (com.amazonaws.services.identitymanagement.model.GetAccessKeyLastUsedResult)1