use of com.amazonaws.services.pinpoint.model.GetEndpointRequest in project aws-doc-sdk-examples by awsdocs.
the class CreateEndpoint method createEndpoint.
public static EndpointResponse createEndpoint(AmazonPinpoint client, String appId) {
String endpointId = UUID.randomUUID().toString();
System.out.println("Endpoint ID: " + endpointId);
EndpointRequest endpointRequest = createEndpointRequestData();
UpdateEndpointRequest updateEndpointRequest = new UpdateEndpointRequest().withApplicationId(appId).withEndpointId(endpointId).withEndpointRequest(endpointRequest);
UpdateEndpointResult updateEndpointResponse = client.updateEndpoint(updateEndpointRequest);
System.out.println("Update Endpoint Response: " + updateEndpointResponse.getMessageBody());
GetEndpointRequest getEndpointRequest = new GetEndpointRequest().withApplicationId(appId).withEndpointId(endpointId);
GetEndpointResult getEndpointResult = client.getEndpoint(getEndpointRequest);
System.out.println("Got Endpoint: " + getEndpointResult.getEndpointResponse().getId());
return getEndpointResult.getEndpointResponse();
}
use of com.amazonaws.services.pinpoint.model.GetEndpointRequest 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);
}
Aggregations