- AWS Code Sample demonstrates how to obtain a list of identities for your AWS account.

/** * Copyright, Inc. or its affiliates. All Rights Reserved. * * This file is licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. A copy of * the License is located at * * * * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * */ package; import; import; import; import; import; import java.util.List; public class ListIdentities { public static void main(String[] args) throws IOException { Region region = Region.US_WEST_2; SesClient client = SesClient.builder() .region(region) .build(); listSESIdentities(client); } public static void listSESIdentities(SesClient client) { try { ListIdentitiesResponse identitiesResponse = client.listIdentities(); List<String> identities = identitiesResponse.identities(); for (String identity: identities) { System.out.println("The identity is "+identity); } } catch (SesException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } }

Sample Details

Service: ses

Last tested: 2020-10-02

Author: AWS-scmacdon

Type: full-example