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);
}
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());
}
Aggregations