use of software.amazon.awssdk.services.kms.model.ListGrantsRequest in project aws-doc-sdk-examples by awsdocs.
the class ListGrants method displayGrantIds.
// snippet-start:[kms.java2_list_grant.main]
public static void displayGrantIds(KmsClient kmsClient, String keyId) {
try {
ListGrantsRequest grantsRequest = ListGrantsRequest.builder().keyId(keyId).limit(15).build();
ListGrantsResponse response = kmsClient.listGrants(grantsRequest);
List<GrantListEntry> grants = response.grants();
for (GrantListEntry grant : grants) {
System.out.println("The grant Id is : " + grant.grantId());
}
} catch (KmsException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Aggregations