Search in sources :

Example 1 with DeleteEndpointRequest

use of com.amazonaws.services.pinpoint.model.DeleteEndpointRequest in project aws-doc-sdk-examples by awsdocs.

the class DeleteEndpoints method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "DeleteEndpoints - Removes one or more endpoints from an " + "Amazon Pinpoint application.\n\n" + "Usage: DeleteEndpoints <applicationId> <endpointId1> [endpointId2 ...]\n";
    if (args.length < 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String applicationId = args[0];
    String[] endpointIds = Arrays.copyOfRange(args, 1, args.length);
    // Initializes the Amazon Pinpoint client.
    AmazonPinpoint pinpointClient = AmazonPinpointClientBuilder.standard().withRegion(Regions.US_EAST_1).build();
    try {
        // Deletes each of the specified endpoints with the Amazon Pinpoint client.
        for (String endpointId : endpointIds) {
            DeleteEndpointResult result = pinpointClient.deleteEndpoint(new DeleteEndpointRequest().withEndpointId(endpointId).withApplicationId(applicationId));
            System.out.format("Deleted endpoint %s.\n", result.getEndpointResponse().getId());
        }
    } catch (AmazonServiceException e) {
        System.err.println(e.getErrorMessage());
        System.exit(1);
    }
}
Also used : DeleteEndpointRequest(com.amazonaws.services.pinpoint.model.DeleteEndpointRequest) AmazonServiceException(com.amazonaws.AmazonServiceException) AmazonPinpoint(com.amazonaws.services.pinpoint.AmazonPinpoint) DeleteEndpointResult(com.amazonaws.services.pinpoint.model.DeleteEndpointResult)

Aggregations

AmazonServiceException (com.amazonaws.AmazonServiceException)1 AmazonPinpoint (com.amazonaws.services.pinpoint.AmazonPinpoint)1 DeleteEndpointRequest (com.amazonaws.services.pinpoint.model.DeleteEndpointRequest)1 DeleteEndpointResult (com.amazonaws.services.pinpoint.model.DeleteEndpointResult)1