Search in sources :

Example 1 with EndpointResponse

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

the class LookUpEndpoint method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "LookUpEndpoint - Prints the definition of the endpoint that has the specified ID." + "Usage: LookUpEndpoint <applicationId> <endpointId>\n\n" + "Where:\n" + "  applicationId - The ID of the Amazon Pinpoint application that has the " + "endpoint." + "  endpointId - The ID of the endpoint ";
    if (args.length < 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String applicationId = args[0];
    String endpointId = args[1];
    // Specifies the endpoint that the Amazon Pinpoint client looks up.
    GetEndpointRequest request = new GetEndpointRequest().withEndpointId(endpointId).withApplicationId(applicationId);
    // Initializes the Amazon Pinpoint client.
    AmazonPinpoint pinpointClient = AmazonPinpointClientBuilder.standard().withRegion(Regions.US_EAST_1).build();
    // Uses the Amazon Pinpoint client to get the endpoint definition.
    GetEndpointResult result = pinpointClient.getEndpoint(request);
    EndpointResponse endpoint = result.getEndpointResponse();
    // Uses the Google Gson library to pretty print the endpoint JSON.
    Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).setPrettyPrinting().create();
    String endpointJson = gson.toJson(endpoint);
    System.out.println(endpointJson);
}
Also used : EndpointResponse(com.amazonaws.services.pinpoint.model.EndpointResponse) GetEndpointResult(com.amazonaws.services.pinpoint.model.GetEndpointResult) GsonBuilder(com.google.gson.GsonBuilder) AmazonPinpoint(com.amazonaws.services.pinpoint.AmazonPinpoint) Gson(com.google.gson.Gson) GetEndpointRequest(com.amazonaws.services.pinpoint.model.GetEndpointRequest)

Example 2 with EndpointResponse

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

the class CreateEndpoint method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "CreateEndpoint - create an endpoint for an application in pinpoint\n\n" + "Usage: CreateEndpoint <appId>\n\n" + "Where:\n" + "  appId - the ID of the application to create an endpoint for.\n\n";
    if (args.length < 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String appId = args[0];
    AmazonPinpoint pinpoint = AmazonPinpointClientBuilder.standard().withRegion(Regions.US_EAST_1).build();
    EndpointResponse response = createEndpoint(pinpoint, appId);
    System.out.println(response.getAddress());
    System.out.println(response.getChannelType());
    System.out.println(response.getApplicationId());
    System.out.println(response.getEndpointStatus());
    System.out.println(response.getRequestId());
    System.out.println(response.getUser());
}
Also used : EndpointResponse(com.amazonaws.services.pinpoint.model.EndpointResponse) AmazonPinpoint(com.amazonaws.services.pinpoint.AmazonPinpoint)

Aggregations

AmazonPinpoint (com.amazonaws.services.pinpoint.AmazonPinpoint)2 EndpointResponse (com.amazonaws.services.pinpoint.model.EndpointResponse)2 GetEndpointRequest (com.amazonaws.services.pinpoint.model.GetEndpointRequest)1 GetEndpointResult (com.amazonaws.services.pinpoint.model.GetEndpointResult)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1