Search in sources :

Example 1 with SetEndpointAttributesRequest

use of com.amazonaws.services.sns.model.SetEndpointAttributesRequest in project krypton-android by kryptco.

the class SNSTransport method registerWithAWS.

public synchronized void registerWithAWS() throws TransportException {
    try {
        AmazonSNSClient client = getClient();
        CreatePlatformEndpointRequest request = new CreatePlatformEndpointRequest().withPlatformApplicationArn(PLATFORM_APPLICATION_ARN).withToken(token);
        CreatePlatformEndpointResult result = client.createPlatformEndpoint(request);
        setEndpointARN(result.getEndpointArn());
        HashMap<String, String> enabledAttribute = new HashMap<>();
        enabledAttribute.put("Enabled", "true");
        SetEndpointAttributesRequest enableRequest = new SetEndpointAttributesRequest().withEndpointArn(endpointARN).withAttributes(enabledAttribute);
        client.setEndpointAttributes(enableRequest);
    } catch (AmazonClientException e) {
        throw new TransportException(e.getMessage());
    }
}
Also used : HashMap(java.util.HashMap) SetEndpointAttributesRequest(com.amazonaws.services.sns.model.SetEndpointAttributesRequest) CreatePlatformEndpointResult(com.amazonaws.services.sns.model.CreatePlatformEndpointResult) AmazonClientException(com.amazonaws.AmazonClientException) CreatePlatformEndpointRequest(com.amazonaws.services.sns.model.CreatePlatformEndpointRequest) AmazonSNSClient(com.amazonaws.services.sns.AmazonSNSClient) TransportException(co.krypt.krypton.exception.TransportException)

Aggregations

TransportException (co.krypt.krypton.exception.TransportException)1 AmazonClientException (com.amazonaws.AmazonClientException)1 AmazonSNSClient (com.amazonaws.services.sns.AmazonSNSClient)1 CreatePlatformEndpointRequest (com.amazonaws.services.sns.model.CreatePlatformEndpointRequest)1 CreatePlatformEndpointResult (com.amazonaws.services.sns.model.CreatePlatformEndpointResult)1 SetEndpointAttributesRequest (com.amazonaws.services.sns.model.SetEndpointAttributesRequest)1 HashMap (java.util.HashMap)1