Search in sources :

Example 1 with GetExportJobRequest

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

the class ExportEndpoints method printExportJobStatus.

private static void printExportJobStatus(PinpointClient pinpointClient, String applicationId, String jobId) {
    GetExportJobResponse getExportJobResult;
    String status = "";
    try {
        // Checks the job status until the job completes or fails
        GetExportJobRequest exportJobRequest = GetExportJobRequest.builder().jobId(jobId).applicationId(applicationId).build();
        do {
            getExportJobResult = pinpointClient.getExportJob(exportJobRequest);
            status = getExportJobResult.exportJobResponse().jobStatus().toString().toUpperCase();
            System.out.format("Export job %s . . .\n", status);
            TimeUnit.SECONDS.sleep(3);
        } while (!status.equals("COMPLETED") && !status.equals("FAILED"));
        if (status.equals("COMPLETED")) {
            System.out.println("Finished exporting endpoints.");
        } else {
            System.err.println("Failed to export endpoints.");
            System.exit(1);
        }
    } catch (PinpointException | InterruptedException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : GetExportJobResponse(software.amazon.awssdk.services.pinpoint.model.GetExportJobResponse) GetExportJobRequest(software.amazon.awssdk.services.pinpoint.model.GetExportJobRequest) PinpointException(software.amazon.awssdk.services.pinpoint.model.PinpointException)

Aggregations

GetExportJobRequest (software.amazon.awssdk.services.pinpoint.model.GetExportJobRequest)1 GetExportJobResponse (software.amazon.awssdk.services.pinpoint.model.GetExportJobResponse)1 PinpointException (software.amazon.awssdk.services.pinpoint.model.PinpointException)1