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

项目:spring-integration-aws    文件:SnsExecutor.java   
private void addPermissions() {
    if (permissions != null && permissions.isEmpty() == false) {
        GetTopicAttributesResult result = client
                .getTopicAttributes(topicArn);

        AwsUtil.addPermissions(result.getAttributes(), permissions,
                new AwsUtil.AddPermissionHandler() {

                    @Override
                    public void execute(Permission p) {
                        client.addPermission(new AddPermissionRequest()
                                .withTopicArn(topicArn)
                                .withLabel(p.getLabel())
                                .withAWSAccountIds(p.getAwsAccountIds())
                                .withActionNames(p.getActions()));
                    }
                });
    }
}
项目:unitstack    文件:MockSnsTest.java   
@Test
public void testAddPermission_withSuccessMock_shouldWork() {
  mockSns(new MockParameters());

  AddPermissionRequest addPermissionRequest = new AddPermissionRequest()
      .withActionNames(ImmutableList.of("READ", "WRITE"))
      .withAWSAccountIds(ImmutableList.of("1", "2")).withLabel("unsecure-topic").withTopicArn(
          "arn:aws:sns:us-east-1:123456789012:my_corporate_topic:02034b43-fefa-4e07-a5eb-3be56f8c54ce");

  AddPermissionResult result = sns.addPermission(addPermissionRequest);

  assertNotNull("verify adding permission returns ok", result);
}
项目:unitstack    文件:MockSnsTest.java   
@Test(expected = AmazonSNSException.class)
public void testAddPermission_withInvalidParameterMock_shouldThrowException() {
  mockSns(new MockParameters(InvalidParameterException.class));

  AddPermissionRequest addPermissionRequest = new AddPermissionRequest()
      .withActionNames(ImmutableList.of("READ", "WRITE"))
      .withAWSAccountIds(ImmutableList.of("1", "2")).withLabel("unsecure-topic").withTopicArn(
          "arn:aws:sns:us-east-1:123456789012:my_corporate_topic:02034b43-fefa-4e07-a5eb-3be56f8c54ce");

  sns.addPermission(addPermissionRequest);
}
项目:unitstack    文件:MockSnsTest.java   
@Test
public void testAddPermissionAsync_shouldWork() throws InterruptedException, ExecutionException {
  mockSns(new MockParameters());

  AddPermissionRequest addPermissionRequest = new AddPermissionRequest()
      .withActionNames(ImmutableList.of("READ", "WRITE"))
      .withAWSAccountIds(ImmutableList.of("1", "2")).withLabel("unsecure-topic").withTopicArn(
          "arn:aws:sns:us-east-1:123456789012:my_corporate_topic:02034b43-fefa-4e07-a5eb-3be56f8c54ce");

  Future<AddPermissionResult> result = sns.addPermissionAsync(addPermissionRequest);
  assertNotNull("verify also async call works fine", result.get());
}
项目:aws-sdk-java-resources    文件:TopicImpl.java   
@Override
public void addPermission(String label, List<String> aWSAccountIds,
        List<String> actionNames, ResultCapture<Void> extractor) {

    AddPermissionRequest request = new AddPermissionRequest()
        .withLabel(label)
        .withAWSAccountIds(aWSAccountIds)
        .withActionNames(actionNames);
    addPermission(request, extractor);
}
项目:unitstack    文件:MockSnsTest.java   
@Test
public void testAddPermissionAsync_withNoRequestParams_shouldWork() throws InterruptedException, ExecutionException {
  mockSns(new MockParameters());
  Future<AddPermissionResult> result = sns.addPermissionAsync(new AddPermissionRequest());
  assertNotNull(result.get());
}
项目:Camel    文件:AmazonSNSClientMock.java   
@Override
public AddPermissionResult addPermission(AddPermissionRequest addPermissionRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException();
}
项目:aws-sdk-java-resources    文件:TopicImpl.java   
@Override
public void addPermission(AddPermissionRequest request) {
    addPermission(request, null);
}
项目:aws-sdk-java-resources    文件:TopicImpl.java   
@Override
public void addPermission(AddPermissionRequest request, ResultCapture<Void>
        extractor) {

    resource.performAction("AddPermission", request, extractor);
}
项目:aws-sdk-java-resources    文件:Topic.java   
/**
 * Performs the <code>AddPermission</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Topic</code> resource, and any conflicting parameter value set in
 * the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>TopicArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see AddPermissionRequest
 */
void addPermission(AddPermissionRequest request);
项目:aws-sdk-java-resources    文件:Topic.java   
/**
 * Performs the <code>AddPermission</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Topic</code> resource, and any conflicting parameter value set in
 * the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>TopicArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see AddPermissionRequest
 */
void addPermission(AddPermissionRequest request, ResultCapture<Void>
        extractor);