Java 类com.amazonaws.services.sns.model.GetPlatformApplicationAttributesRequest 实例源码

项目:aws-java-sns-mobile-push-sample    文件:CreateEndpointJob.java   
public void verifyPlatformApplication(AmazonSNS client) {
    try {
        if (!BatchCreatePlatformEndpointSample.listOfRegions
                .contains(this.region = this.applicationArn.split(":")[3])) {
            System.err.println("[ERROR] The region " + region
                    + " is invalid");
            System.exit(BatchCreatePlatformEndpointSample.MALFORMED_PROPERTIES_ERROR_CODE);
        }
    } catch (ArrayIndexOutOfBoundsException aioobe) {
        System.err.println("[ERROR] The ARN " + this.applicationArn
                + " is malformed");
        System.exit(BatchCreatePlatformEndpointSample.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(BatchCreatePlatformEndpointSample.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(BatchCreatePlatformEndpointSample.NOT_FOUND_ERROR_CODE);
    }
}
项目:aws-snsmobilepush    文件:CreateEndpointJob.java   
public void verifyPlatformApplication(AmazonSNS client) {
    try {
        if (!BatchCreatePlatformEndpointSample.listOfRegions
                .contains(this.region = this.applicationArn.split(":")[3])) {
            System.err.println("[ERROR] The region " + region
                    + " is invalid");
            System.exit(BatchCreatePlatformEndpointSample.MALFORMED_PROPERTIES_ERROR_CODE);
        }
    } catch (ArrayIndexOutOfBoundsException aioobe) {
        System.err.println("[ERROR] The ARN " + this.applicationArn
                + " is malformed");
        System.exit(BatchCreatePlatformEndpointSample.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(BatchCreatePlatformEndpointSample.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(BatchCreatePlatformEndpointSample.NOT_FOUND_ERROR_CODE);
    }
}
项目:unitstack    文件:MockSnsTest.java   
@Test
public void testNonInjectableMocks_shouldReturnNormal() {
  mockSns(new MockParameters());

  CheckIfPhoneNumberIsOptedOutRequest phoneRequest = new CheckIfPhoneNumberIsOptedOutRequest()
      .withPhoneNumber("555123456");
  CheckIfPhoneNumberIsOptedOutResult phoneResult = sns.checkIfPhoneNumberIsOptedOut(phoneRequest);
  assertNotNull(phoneResult);

  CreatePlatformApplicationRequest createPlatformRequest = new CreatePlatformApplicationRequest()
      .withAttributes(ImmutableMap.of("os","oreo"))
      .withName("android").withPlatform("mobile");
  assertNotNull(sns.createPlatformApplication(createPlatformRequest));

  CreatePlatformEndpointRequest createPlatformEndpointReq = new CreatePlatformEndpointRequest()
      .withAttributes(ImmutableMap.of("os","lollypop"))
      .withCustomUserData("something custom")
      .withPlatformApplicationArn("mobile")
      .withToken("5-euro-token");
  assertNotNull(sns.createPlatformEndpoint(createPlatformEndpointReq));

  DeleteEndpointRequest deleteEndpointReq = new DeleteEndpointRequest()
      .withEndpointArn("arn:aws:sms:us-east-1:123456789012:myc:02034b43-fefa-4e07-a5e");
  assertNotNull(sns.deleteEndpoint(deleteEndpointReq));

  DeletePlatformApplicationRequest delPlatformAppReq = new DeletePlatformApplicationRequest()
      .withPlatformApplicationArn("arn:aws:sms:us-east-1:123456789012:myc:02034b43-fefa-4e07-a5e");
  assertNotNull(sns.deletePlatformApplication(delPlatformAppReq));

  GetEndpointAttributesRequest getEndpointAttr = new GetEndpointAttributesRequest();
  assertNotNull(sns.getEndpointAttributes(getEndpointAttr));

  assertNotNull(sns.getPlatformApplicationAttributes(
      new GetPlatformApplicationAttributesRequest().withPlatformApplicationArn("some-arn")));

  assertNotNull(sns.getSMSAttributes(new GetSMSAttributesRequest().withAttributes("attr1","attr2")));

  assertNotNull(sns.listEndpointsByPlatformApplication(new ListEndpointsByPlatformApplicationRequest()
      .withNextToken("0-euro-token").withPlatformApplicationArn("cheap-arn")));

  assertNotNull(sns.listPhoneNumbersOptedOut(new ListPhoneNumbersOptedOutRequest().withNextToken("plastic-token")));

  assertNotNull(sns.listPlatformApplications(new ListPlatformApplicationsRequest().withNextToken("wooden-token")));

  assertNotNull(sns.listPlatformApplications());

  assertNotNull(sns.optInPhoneNumber(new OptInPhoneNumberRequest().withPhoneNumber("123456789")));

  assertNotNull(sns.setEndpointAttributes(new SetEndpointAttributesRequest().withEndpointArn("at the end of the world")
      .withAttributes(ImmutableMap.of("some-prop","some-value"))));

  assertNotNull(sns.setPlatformApplicationAttributes(new SetPlatformApplicationAttributesRequest().withPlatformApplicationArn("arnn:::")
      .withAttributes(ImmutableMap.of("super","mario"))));

  assertNotNull(sns.setSMSAttributes(new SetSMSAttributesRequest().withAttributes(ImmutableMap.of("wtf","mfg"))));

  assertNotNull(sns.removePermission(new RemovePermissionRequest().withLabel("fashion label").withTopicArn("fancy topic")));
}
项目:aws-sdk-java-resources    文件:PlatformApplicationImpl.java   
@Override
public boolean load(GetPlatformApplicationAttributesRequest request) {
    return load(request, null);
}
项目:aws-sdk-java-resources    文件:PlatformApplicationImpl.java   
@Override
public boolean load(GetPlatformApplicationAttributesRequest request,
        ResultCapture<GetPlatformApplicationAttributesResult> extractor) {

    return resource.load(request, extractor);
}
项目:aws-sdk-java-resources    文件:PlatformApplication.java   
/**
 * Makes a call to the service to load this resource's attributes if they
 * are not loaded yet.
 * The following request parameters will be populated from the data of this
 * <code>PlatformApplication</code> resource, and any conflicting parameter
 * value set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>PlatformApplicationArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return Returns {@code true} if the resource is not yet loaded when this
 *         method was invoked, which indicates that a service call has been
 *         made to retrieve the attributes.
 * @see GetPlatformApplicationAttributesRequest
 */
boolean load(GetPlatformApplicationAttributesRequest request);
项目:aws-sdk-java-resources    文件:PlatformApplication.java   
/**
 * Makes a call to the service to load this resource's attributes if they
 * are not loaded yet, and use a ResultCapture to retrieve the low-level
 * client response
 * The following request parameters will be populated from the data of this
 * <code>PlatformApplication</code> resource, and any conflicting parameter
 * value set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>PlatformApplicationArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return Returns {@code true} if the resource is not yet loaded when this
 *         method was invoked, which indicates that a service call has been
 *         made to retrieve the attributes.
 * @see GetPlatformApplicationAttributesRequest
 */
boolean load(GetPlatformApplicationAttributesRequest request,
        ResultCapture<GetPlatformApplicationAttributesResult> extractor);