Search in sources :

Example 1 with ImportJobRequest

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

the class ImportSegment method createImportSegment.

// snippet-start:[pinpoint.java2.importsegment.main]
public static ImportJobResponse createImportSegment(PinpointClient client, String appId, String bucket, String key, String roleArn) {
    try {
        ImportJobRequest importRequest = ImportJobRequest.builder().defineSegment(true).registerEndpoints(true).roleArn(roleArn).format(Format.JSON).s3Url("s3://" + bucket + "/" + key).build();
        CreateImportJobRequest jobRequest = CreateImportJobRequest.builder().importJobRequest(importRequest).applicationId(appId).build();
        CreateImportJobResponse jobResponse = client.createImportJob(jobRequest);
        return jobResponse.importJobResponse();
    } catch (PinpointException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
    return null;
}
Also used : CreateImportJobResponse(software.amazon.awssdk.services.pinpoint.model.CreateImportJobResponse) PinpointException(software.amazon.awssdk.services.pinpoint.model.PinpointException) CreateImportJobRequest(software.amazon.awssdk.services.pinpoint.model.CreateImportJobRequest) CreateImportJobRequest(software.amazon.awssdk.services.pinpoint.model.CreateImportJobRequest) ImportJobRequest(software.amazon.awssdk.services.pinpoint.model.ImportJobRequest)

Aggregations

CreateImportJobRequest (software.amazon.awssdk.services.pinpoint.model.CreateImportJobRequest)1 CreateImportJobResponse (software.amazon.awssdk.services.pinpoint.model.CreateImportJobResponse)1 ImportJobRequest (software.amazon.awssdk.services.pinpoint.model.ImportJobRequest)1 PinpointException (software.amazon.awssdk.services.pinpoint.model.PinpointException)1