use of software.amazon.awssdk.services.sts.model.GetAccessKeyInfoResponse in project aws-doc-sdk-examples by awsdocs.
the class GetAccessKeyInfo method getKeyInfo.
// snippet-start:[sts.java2.get_access_key.main]
public static void getKeyInfo(StsClient stsClient, String accessKeyId) {
try {
GetAccessKeyInfoRequest accessRequest = GetAccessKeyInfoRequest.builder().accessKeyId(accessKeyId).build();
GetAccessKeyInfoResponse accessResponse = stsClient.getAccessKeyInfo(accessRequest);
System.out.println("The account associated with the access key is " + accessResponse.account());
} catch (StsException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Aggregations