Search in sources :

Example 6 with KmsClient

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();
}
Also used : Region(software.amazon.awssdk.regions.Region) KmsClient(software.amazon.awssdk.services.kms.KmsClient)

Example 7 with KmsClient

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();
}
Also used : Region(software.amazon.awssdk.regions.Region) KmsClient(software.amazon.awssdk.services.kms.KmsClient)

Example 8 with KmsClient

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();
}
Also used : Region(software.amazon.awssdk.regions.Region) KmsClient(software.amazon.awssdk.services.kms.KmsClient)

Example 9 with KmsClient

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();
}
Also used : Region(software.amazon.awssdk.regions.Region) KmsClient(software.amazon.awssdk.services.kms.KmsClient)

Example 10 with KmsClient

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();
}
Also used : Region(software.amazon.awssdk.regions.Region) KmsClient(software.amazon.awssdk.services.kms.KmsClient)

Aggregations

KmsClient (software.amazon.awssdk.services.kms.KmsClient)17 Region (software.amazon.awssdk.regions.Region)15 SdkBytes (software.amazon.awssdk.core.SdkBytes)3 KmsException (software.amazon.awssdk.services.kms.model.KmsException)2 DynamoDbClient (software.amazon.awssdk.services.dynamodb.DynamoDbClient)1 DecryptRequest (software.amazon.awssdk.services.kms.model.DecryptRequest)1 DecryptResponse (software.amazon.awssdk.services.kms.model.DecryptResponse)1 EncryptRequest (software.amazon.awssdk.services.kms.model.EncryptRequest)1 EncryptResponse (software.amazon.awssdk.services.kms.model.EncryptResponse)1