Search in sources :

Example 1 with ListAliasesResponse

use of software.amazon.awssdk.services.kms.model.ListAliasesResponse in project aws-doc-sdk-examples by awsdocs.

the class ListAliases method listAllAliases.

// snippet-start:[kms.java2_list_aliases.main]
public static void listAllAliases(KmsClient kmsClient) {
    try {
        ListAliasesRequest aliasesRequest = ListAliasesRequest.builder().limit(15).build();
        ListAliasesResponse aliasesResponse = kmsClient.listAliases(aliasesRequest);
        List<AliasListEntry> aliases = aliasesResponse.aliases();
        for (AliasListEntry alias : aliases) {
            System.out.println("The alias name is: " + alias.aliasName());
        }
    } catch (KmsException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : AliasListEntry(software.amazon.awssdk.services.kms.model.AliasListEntry) KmsException(software.amazon.awssdk.services.kms.model.KmsException) ListAliasesRequest(software.amazon.awssdk.services.kms.model.ListAliasesRequest) ListAliasesResponse(software.amazon.awssdk.services.kms.model.ListAliasesResponse)

Aggregations

AliasListEntry (software.amazon.awssdk.services.kms.model.AliasListEntry)1 KmsException (software.amazon.awssdk.services.kms.model.KmsException)1 ListAliasesRequest (software.amazon.awssdk.services.kms.model.ListAliasesRequest)1 ListAliasesResponse (software.amazon.awssdk.services.kms.model.ListAliasesResponse)1