com.amazonaws.services.sns.model.GetTopicAttributesResult Java Examples
The following examples show how to use
com.amazonaws.services.sns.model.GetTopicAttributesResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnsExecutor.java From spring-integration-aws with MIT License | 6 votes |
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())); } }); } }
Example #2
Source File: SnsIO.java From beam with Apache License 2.0 | 5 votes |
@SuppressWarnings({"checkstyle:illegalCatch"}) private static boolean topicExists(AmazonSNS client, String topicName) { try { GetTopicAttributesResult topicAttributesResult = client.getTopicAttributes(topicName); return topicAttributesResult != null && topicAttributesResult.getSdkHttpMetadata().getHttpStatusCode() == 200; } catch (Exception e) { LOG.warn("Error checking whether topic {} exists.", topicName, e); throw e; } }
Example #3
Source File: SnsIOTest.java From beam with Apache License 2.0 | 5 votes |
private static void configureAmazonSnsMock(AmazonSNS amazonSNS) { final GetTopicAttributesResult result = Mockito.mock(GetTopicAttributesResult.class); final SdkHttpMetadata metadata = Mockito.mock(SdkHttpMetadata.class); Mockito.when(metadata.getHttpHeaders()).thenReturn(new HashMap<>()); Mockito.when(metadata.getHttpStatusCode()).thenReturn(200); Mockito.when(result.getSdkHttpMetadata()).thenReturn(metadata); Mockito.when(amazonSNS.getTopicAttributes(Mockito.anyString())).thenReturn(result); }
Example #4
Source File: TopicImpl.java From aws-sdk-java-resources with Apache License 2.0 | 4 votes |
@Override public boolean load(GetTopicAttributesRequest request, ResultCapture<GetTopicAttributesResult> extractor) { return resource.load(request, extractor); }
Example #5
Source File: Topic.java From aws-sdk-java-resources with Apache License 2.0 | 2 votes |
/** * 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>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> * * @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 GetTopicAttributesRequest */ boolean load(GetTopicAttributesRequest request, ResultCapture<GetTopicAttributesResult> extractor);