use of software.amazon.awssdk.services.kms.model.CreateGrantRequest in project aws-doc-sdk-examples by awsdocs.
the class CreateGrant method createGrant.
// snippet-start:[kms.java2_create_grant.main]
public static String createGrant(KmsClient kmsClient, String keyId, String granteePrincipal, String operation) {
try {
CreateGrantRequest grantRequest = CreateGrantRequest.builder().keyId(keyId).granteePrincipal(granteePrincipal).operationsWithStrings(operation).build();
CreateGrantResponse response = kmsClient.createGrant(grantRequest);
return response.grantId();
} catch (KmsException e) {
System.err.println(e.getMessage());
System.exit(1);
}
return "";
}
Aggregations