use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class EnableCustomerKey method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyId> \n\n" + "Where:\n" + " keyId - a key id value to enable (for example, xxxxxbcd-12ab-34cd-56ef-1234567890ab). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String keyId = args[0];
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
enableKey(kmsClient, keyId);
kmsClient.close();
}
use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class ListAliases method main.
public static void main(String[] args) {
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
listAllAliases(kmsClient);
kmsClient.close();
}
use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class CreateCustomerKey method main.
public static void main(String[] args) {
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
String keyDesc = "Created by the AWS KMS API";
System.out.println("The key id is " + createKey(kmsClient, keyDesc));
kmsClient.close();
}
use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class DeleteAlias method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <aliasName> \n\n" + "Where:\n" + " aliasName - an alias name to delete (for example, alias/myAlias). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String aliasName = args[0];
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
deleteSpecificAlias(kmsClient, aliasName);
kmsClient.close();
}
use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class SetKeyPolicy method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyId> <policyName> \n\n" + "Where:\n" + " keyId - a unique identifier for the customer master key (CMK) (for example, xxxxxbcd-12ab-34cd-56ef-1234567890ab). \n\n" + " policyName - the name of the key policy. \n\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String keyId = args[0];
String policyName = args[1];
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
createPolicy(kmsClient, keyId, policyName);
kmsClient.close();
}
Aggregations