use of software.amazon.awssdk.services.pinpoint.model.SMSChannelRequest in project aws-doc-sdk-examples by awsdocs.
the class UpdateChannel method toggleSmsChannel.
private static void toggleSmsChannel(PinpointClient client, String appId, SMSChannelResponse getResponse) {
boolean enabled = true;
if (getResponse.enabled()) {
enabled = false;
}
try {
SMSChannelRequest request = SMSChannelRequest.builder().enabled(enabled).build();
UpdateSmsChannelRequest updateRequest = UpdateSmsChannelRequest.builder().smsChannelRequest(request).applicationId(appId).build();
UpdateSmsChannelResponse result = client.updateSmsChannel(updateRequest);
System.out.println("Channel state: " + result.smsChannelResponse().enabled());
} catch (PinpointException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations