Search in sources :

Example 1 with UpdateSmsChannelRequest

use of software.amazon.awssdk.services.pinpoint.model.UpdateSmsChannelRequest 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);
    }
}
Also used : SMSChannelRequest(software.amazon.awssdk.services.pinpoint.model.SMSChannelRequest) UpdateSmsChannelRequest(software.amazon.awssdk.services.pinpoint.model.UpdateSmsChannelRequest) PinpointException(software.amazon.awssdk.services.pinpoint.model.PinpointException) UpdateSmsChannelResponse(software.amazon.awssdk.services.pinpoint.model.UpdateSmsChannelResponse)

Aggregations

PinpointException (software.amazon.awssdk.services.pinpoint.model.PinpointException)1 SMSChannelRequest (software.amazon.awssdk.services.pinpoint.model.SMSChannelRequest)1 UpdateSmsChannelRequest (software.amazon.awssdk.services.pinpoint.model.UpdateSmsChannelRequest)1 UpdateSmsChannelResponse (software.amazon.awssdk.services.pinpoint.model.UpdateSmsChannelResponse)1