Search in sources :

Example 16 with PinpointClient

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

the class CreateSegment method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "CreateSegment <appId>\n\n" + "Where:\n" + "  appId - the application ID to create a segment for.\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String appId = args[0];
    PinpointClient pinpoint = PinpointClient.builder().region(Region.US_EAST_1).build();
    SegmentResponse result = createSegment(pinpoint, appId);
    System.out.println("Segment " + result.name() + " created.");
    System.out.println(result.segmentType());
    pinpoint.close();
}
Also used : PinpointClient(software.amazon.awssdk.services.pinpoint.PinpointClient) SegmentResponse(software.amazon.awssdk.services.pinpoint.model.SegmentResponse) CreateSegmentResponse(software.amazon.awssdk.services.pinpoint.model.CreateSegmentResponse)

Example 17 with PinpointClient

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

the class GetSegmentById method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "CreateApp - create an application in the Amazon Pinpoint dashboard\n\n" + "Usage:" + "   <appId> <segmentId>\n\n" + "Where:\n" + "   appId - the id of the application.\n\n" + "   segmentId - the id of the segment.\n\n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String appId = args[0];
    String segmentId = args[1];
    PinpointClient pinpoint = PinpointClient.builder().region(Region.US_EAST_1).build();
    System.out.println("Name of the segment is " + getSegmentById(pinpoint, appId, segmentId));
    pinpoint.close();
}
Also used : PinpointClient(software.amazon.awssdk.services.pinpoint.PinpointClient)

Example 18 with PinpointClient

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

the class ImportSegment method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "ImportSegment <appId> <bucket> <key> <roleArn> \n\n" + "Where:\n" + "  appId - the application ID to create a segment for.\n\n" + "  bucket - the name of the Amazon S3 bucket that contains the segment definitons.\n\n" + "  key - the key of the S3 object. " + "  roleArn - ARN of the role that allows Amazon Pinpoint to access S3. You need to set trust management for this to work. See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html";
    if (args.length != 4) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String appId = args[0];
    String bucket = args[1];
    String key = args[2];
    String roleArn = args[3];
    PinpointClient pinpoint = PinpointClient.builder().region(Region.US_EAST_1).build();
    ImportJobResponse response = createImportSegment(pinpoint, appId, bucket, key, roleArn);
    System.out.println("Import job for " + bucket + " submitted.");
    System.out.println("See application " + response.applicationId() + " for import job status.");
    System.out.println("See application " + response.jobStatus() + " for import job status.");
    pinpoint.close();
}
Also used : PinpointClient(software.amazon.awssdk.services.pinpoint.PinpointClient) ImportJobResponse(software.amazon.awssdk.services.pinpoint.model.ImportJobResponse) CreateImportJobResponse(software.amazon.awssdk.services.pinpoint.model.CreateImportJobResponse)

Aggregations

PinpointClient (software.amazon.awssdk.services.pinpoint.PinpointClient)18 Region (software.amazon.awssdk.regions.Region)1 CreateImportJobResponse (software.amazon.awssdk.services.pinpoint.model.CreateImportJobResponse)1 CreateSegmentResponse (software.amazon.awssdk.services.pinpoint.model.CreateSegmentResponse)1 EndpointResponse (software.amazon.awssdk.services.pinpoint.model.EndpointResponse)1 GetEndpointResponse (software.amazon.awssdk.services.pinpoint.model.GetEndpointResponse)1 ImportJobResponse (software.amazon.awssdk.services.pinpoint.model.ImportJobResponse)1 SMSChannelResponse (software.amazon.awssdk.services.pinpoint.model.SMSChannelResponse)1 SegmentResponse (software.amazon.awssdk.services.pinpoint.model.SegmentResponse)1 UpdateEndpointResponse (software.amazon.awssdk.services.pinpoint.model.UpdateEndpointResponse)1 S3Client (software.amazon.awssdk.services.s3.S3Client)1