Search in sources :

Example 1 with GetSegmentsRequest

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

the class ListSegments method listSegs.

// snippet-start:[pinpoint.java2.listsegments.main]
public static void listSegs(PinpointClient pinpoint, String appId) {
    try {
        GetSegmentsRequest request = GetSegmentsRequest.builder().applicationId(appId).build();
        GetSegmentsResponse response = pinpoint.getSegments(request);
        List<SegmentResponse> segments = response.segmentsResponse().item();
        for (SegmentResponse segment : segments) {
            System.out.println("Segement " + segment.id() + " " + segment.name() + " " + segment.lastModifiedDate());
        }
    } catch (PinpointException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : GetSegmentsRequest(software.amazon.awssdk.services.pinpoint.model.GetSegmentsRequest) PinpointException(software.amazon.awssdk.services.pinpoint.model.PinpointException) GetSegmentsResponse(software.amazon.awssdk.services.pinpoint.model.GetSegmentsResponse) SegmentResponse(software.amazon.awssdk.services.pinpoint.model.SegmentResponse)

Aggregations

GetSegmentsRequest (software.amazon.awssdk.services.pinpoint.model.GetSegmentsRequest)1 GetSegmentsResponse (software.amazon.awssdk.services.pinpoint.model.GetSegmentsResponse)1 PinpointException (software.amazon.awssdk.services.pinpoint.model.PinpointException)1 SegmentResponse (software.amazon.awssdk.services.pinpoint.model.SegmentResponse)1