Search in sources :

Example 1 with SMSChannelResponse

use of software.amazon.awssdk.services.pinpoint.model.SMSChannelResponse in project aws-doc-sdk-examples by awsdocs.

the class UpdateChannel method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "CreateChannel <appId>\n\n" + "Where:\n" + "  appId - the name of the application whose channel is updated.\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String appId = args[0];
    PinpointClient pinpoint = PinpointClient.builder().region(Region.US_EAST_1).build();
    SMSChannelResponse getResponse = getSMSChannel(pinpoint, appId);
    toggleSmsChannel(pinpoint, appId, getResponse);
    pinpoint.close();
}
Also used : PinpointClient(software.amazon.awssdk.services.pinpoint.PinpointClient) SMSChannelResponse(software.amazon.awssdk.services.pinpoint.model.SMSChannelResponse)

Example 2 with SMSChannelResponse

use of software.amazon.awssdk.services.pinpoint.model.SMSChannelResponse in project aws-doc-sdk-examples by awsdocs.

the class UpdateChannel method getSMSChannel.

// snippet-start:[pinpoint.java2.updatechannel.main]
private static SMSChannelResponse getSMSChannel(PinpointClient client, String appId) {
    try {
        GetSmsChannelRequest request = GetSmsChannelRequest.builder().applicationId(appId).build();
        SMSChannelResponse response = client.getSmsChannel(request).smsChannelResponse();
        System.out.println("Channel state is " + response.enabled());
        return response;
    } catch (PinpointException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
    return null;
}
Also used : SMSChannelResponse(software.amazon.awssdk.services.pinpoint.model.SMSChannelResponse) PinpointException(software.amazon.awssdk.services.pinpoint.model.PinpointException) GetSmsChannelRequest(software.amazon.awssdk.services.pinpoint.model.GetSmsChannelRequest)

Aggregations

SMSChannelResponse (software.amazon.awssdk.services.pinpoint.model.SMSChannelResponse)2 PinpointClient (software.amazon.awssdk.services.pinpoint.PinpointClient)1 GetSmsChannelRequest (software.amazon.awssdk.services.pinpoint.model.GetSmsChannelRequest)1 PinpointException (software.amazon.awssdk.services.pinpoint.model.PinpointException)1