Search in sources :

Example 1 with GetPlatformApplicationAttributesResult

use of com.amazonaws.services.sns.model.GetPlatformApplicationAttributesResult in project ETSMobile-Android2 by ApplETS.

the class CreateEndpointJob method verifyPlatformApplication.

public void verifyPlatformApplication(AmazonSNS client) {
    try {
        if (!listOfRegions.contains(this.region = this.applicationArn.split(":")[3])) {
            System.err.println("[ERROR] The region " + region + " is invalid");
            System.exit(MALFORMED_PROPERTIES_ERROR_CODE);
        }
    } catch (ArrayIndexOutOfBoundsException aioobe) {
        System.err.println("[ERROR] The ARN " + this.applicationArn + " is malformed");
        System.exit(MALFORMED_PROPERTIES_ERROR_CODE);
    }
    client.setEndpoint("https://sns." + this.region + ".amazonaws.com/");
    try {
        GetPlatformApplicationAttributesRequest applicationAttributesRequest = new GetPlatformApplicationAttributesRequest();
        applicationAttributesRequest.setPlatformApplicationArn(this.applicationArn);
        @SuppressWarnings("unused") GetPlatformApplicationAttributesResult getAttributesResult = client.getPlatformApplicationAttributes(applicationAttributesRequest);
    } catch (NotFoundException nfe) {
        System.err.println("[ERROR: APP NOT FOUND] The application ARN provided: " + this.applicationArn + " does not correspond to any existing platform applications. " + nfe.getMessage());
        System.exit(NOT_FOUND_ERROR_CODE);
    } catch (InvalidParameterException ipe) {
        System.err.println("[ERROR: APP ARN INVALID] The application ARN provided: " + this.applicationArn + " is malformed" + ipe.getMessage());
        System.exit(NOT_FOUND_ERROR_CODE);
    }
}
Also used : InvalidParameterException(java.security.InvalidParameterException) GetPlatformApplicationAttributesRequest(com.amazonaws.services.sns.model.GetPlatformApplicationAttributesRequest) GetPlatformApplicationAttributesResult(com.amazonaws.services.sns.model.GetPlatformApplicationAttributesResult) NotFoundException(com.amazonaws.services.sns.model.NotFoundException)

Aggregations

GetPlatformApplicationAttributesRequest (com.amazonaws.services.sns.model.GetPlatformApplicationAttributesRequest)1 GetPlatformApplicationAttributesResult (com.amazonaws.services.sns.model.GetPlatformApplicationAttributesResult)1 NotFoundException (com.amazonaws.services.sns.model.NotFoundException)1 InvalidParameterException (java.security.InvalidParameterException)1