use of software.amazon.awssdk.services.pinpoint.model.GetEndpointResponse in project aws-doc-sdk-examples by awsdocs.
the class UpdateEndpoint method createEndpoint.
// snippet-start:[pinpoint.java2.createendpoint.main]
// snippet-start:[pinpoint.java2.createendpoint.helper]
public static EndpointResponse createEndpoint(PinpointClient client, String appId) {
String endpointId = UUID.randomUUID().toString();
System.out.println("Endpoint ID: " + endpointId);
try {
EndpointRequest endpointRequest = createEndpointRequestData();
UpdateEndpointRequest updateEndpointRequest = UpdateEndpointRequest.builder().applicationId(appId).endpointId(endpointId).endpointRequest(endpointRequest).build();
UpdateEndpointResponse updateEndpointResponse = client.updateEndpoint(updateEndpointRequest);
System.out.println("Update Endpoint Response: " + updateEndpointResponse.messageBody());
GetEndpointRequest getEndpointRequest = GetEndpointRequest.builder().applicationId(appId).endpointId(endpointId).build();
GetEndpointResponse getEndpointResponse = client.getEndpoint(getEndpointRequest);
System.out.println(getEndpointResponse.endpointResponse().address());
System.out.println(getEndpointResponse.endpointResponse().channelType());
System.out.println(getEndpointResponse.endpointResponse().applicationId());
System.out.println(getEndpointResponse.endpointResponse().endpointStatus());
System.out.println(getEndpointResponse.endpointResponse().requestId());
System.out.println(getEndpointResponse.endpointResponse().user());
return getEndpointResponse.endpointResponse();
} catch (PinpointException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
return null;
}
use of software.amazon.awssdk.services.pinpoint.model.GetEndpointResponse in project aws-doc-sdk-examples by awsdocs.
the class LookUpEndpoint method lookupPinpointEndpoint.
// snippet-start:[pinpoint.java2.lookup.main]
public static void lookupPinpointEndpoint(PinpointClient pinpoint, String appId, String endpoint) {
try {
GetEndpointRequest appRequest = GetEndpointRequest.builder().applicationId(appId).endpointId(endpoint).build();
GetEndpointResponse result = pinpoint.getEndpoint(appRequest);
EndpointResponse endResponse = result.endpointResponse();
// 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(endResponse);
System.out.println(endpointJson);
} catch (PinpointException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
System.out.println("Done");
}
Aggregations