/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#if AWS_ASYNC_API
using System.Threading.Tasks;
#endif
using Amazon.Runtime.SharedInterfaces;
using Amazon.SimpleNotificationService.Model;
namespace Amazon.SimpleNotificationService
{
public partial interface IAmazonSimpleNotificationService : IDisposable
{
#region SubscribeQueue
#if BCL
///
/// Subscribes an existing Amazon SQS queue to an existing Amazon SNS topic.
///
/// The policy applied to the SQS queue is similar to this:
///
/// {
/// "Version" : "2008-10-17",
/// "Statement" : [{
/// "Sid" : "topic-subscription-arn:aws:sns:us-west-2:599109622955:myTopic",
/// "Effect" : "Allow",
/// "Principal" : {
/// "AWS":["*"]
/// },
/// "Action" : ["sqs:SendMessage"],
/// "Resource":["arn:aws:sqs:us-west-2:599109622955:myQueue"],
/// "Condition" : {
/// "ArnLike":{
/// "aws:SourceArn":["arn:aws:sns:us-west-2:599109622955:myTopic"]
/// }
/// }
/// }]
/// }
///
///
///
/// There might be a small time period immediately after
/// subscribing the SQS queue to the SNS topic and updating the SQS queue's
/// policy, where messages are not able to be delivered to the queue. After a
/// moment, the new queue policy will propagate and the queue will be able to
/// receive messages. This delay only occurs immediately after initially
/// subscribing the queue.
///
///
/// The topic to subscribe to
/// The SQS client used to get attributes and set the policy on the SQS queue.
/// The queue to add a subscription to.
/// The subscription ARN as returned by Amazon SNS when the queue is
/// successfully subscribed to the topic.
string SubscribeQueue(string topicArn, ICoreAmazonSQS sqsClient, string sqsQueueUrl);
#endif
#if AWS_ASYNC_API
///
/// Subscribes an existing Amazon SQS queue to an existing Amazon SNS topic asynchronously.
///
/// The policy applied to the SQS queue is similar to this:
///
/// {
/// "Version" : "2008-10-17",
/// "Statement" : [{
/// "Sid" : "topic-subscription-arn:aws:sns:us-west-2:599109622955:myTopic",
/// "Effect" : "Allow",
/// "Principal" : {
/// "AWS":["*"]
/// },
/// "Action" : ["sqs:SendMessage"],
/// "Resource":["arn:aws:sqs:us-west-2:599109622955:myQueue"],
/// "Condition" : {
/// "ArnLike":{
/// "aws:SourceArn":["arn:aws:sns:us-west-2:599109622955:myTopic"]
/// }
/// }
/// }]
/// }
///
///
///
/// There might be a small time period immediately after
/// subscribing the SQS queue to the SNS topic and updating the SQS queue's
/// policy, where messages are not able to be delivered to the queue. After a
/// moment, the new queue policy will propagate and the queue will be able to
/// receive messages. This delay only occurs immediately after initially
/// subscribing the queue.
///
///
/// The topic to subscribe to
/// The SQS client used to get attributes and set the policy on the SQS queue.
/// The queue to add a subscription to.
/// A Task containing the subscription ARN as returned by Amazon SNS when the queue is
/// successfully subscribed to the topic.
Task SubscribeQueueAsync(string topicArn, ICoreAmazonSQS sqsClient, string sqsQueueUrl);
#endif
#if BCL
///
/// Subscribes an existing Amazon SQS queue to existing Amazon SNS topics.
///
/// The policy applied to the SQS queue is similar to this:
///
/// {
/// "Version" : "2008-10-17",
/// "Statement" : [{
/// "Sid" : "topic-subscription-arn:aws:sns:us-west-2:599109622955:myTopic",
/// "Effect" : "Allow",
/// "Principal" : "*",
/// "Action" : ["sqs:SendMessage"],
/// "Resource":["arn:aws:sqs:us-west-2:599109622955:myQueue"],
/// "Condition" : {
/// "ArnLike":{
/// "aws:SourceArn":["arn:aws:sns:us-west-2:599109622955:myTopic"]
/// }
/// }
/// }]
/// }
///
///
///
/// There might be a small time period immediately after
/// subscribing the SQS queue to the SNS topic and updating the SQS queue's
/// policy, where messages are not able to be delivered to the queue. After a
/// moment, the new queue policy will propagate and the queue will be able to
/// receive messages. This delay only occurs immediately after initially
/// subscribing the queue.
///
///
/// The topics to subscribe to
/// The SQS client used to get attributes and set the policy on the SQS queue.
/// The queue to add a subscription to.
/// The mapping of topic ARNs to subscription ARNs as returned by Amazon SNS when the queue is
/// successfully subscribed to each topic.
IDictionary SubscribeQueueToTopics(IList topicArns, ICoreAmazonSQS sqsClient, string sqsQueueUrl);
#endif
#if AWS_ASYNC_API
///
/// Subscribes an existing Amazon SQS queue to existing Amazon SNS topics asynchronously.
///
/// The policy applied to the SQS queue is similar to this:
///
/// {
/// "Version" : "2008-10-17",
/// "Statement" : [{
/// "Sid" : "topic-subscription-arn:aws:sns:us-west-2:599109622955:myTopic",
/// "Effect" : "Allow",
/// "Principal" : "*",
/// "Action" : ["sqs:SendMessage"],
/// "Resource":["arn:aws:sqs:us-west-2:599109622955:myQueue"],
/// "Condition" : {
/// "ArnLike":{
/// "aws:SourceArn":["arn:aws:sns:us-west-2:599109622955:myTopic"]
/// }
/// }
/// }]
/// }
///
///
///
/// There might be a small time period immediately after
/// subscribing the SQS queue to the SNS topic and updating the SQS queue's
/// policy, where messages are not able to be delivered to the queue. After a
/// moment, the new queue policy will propagate and the queue will be able to
/// receive messages. This delay only occurs immediately after initially
/// subscribing the queue.
///
///
/// The topics to subscribe to
/// The SQS client used to get attributes and set the policy on the SQS queue.
/// The queue to add a subscription to.
/// A Task containing the mapping of topic ARNs to subscription ARNs as returned by Amazon SNS wrapped when the queue is
/// successfully subscribed to each topic.
Task> SubscribeQueueToTopicsAsync(IList topicArns, ICoreAmazonSQS sqsClient, string sqsQueueUrl);
#endif
#endregion
#region FindTopic
#if BCL
///
/// Finds an existing Amazon SNS topic by iterating all SNS topics until a match is found.
///
/// The ListTopics method is used to fetch upto 100 SNS topics at a time until a SNS topic
/// with an TopicArn that matches is found.
///
///
/// The name of the topic find
/// The matched SNS topic.
Topic FindTopic(string topicName);
#endif
#if AWS_ASYNC_API
///
/// Finds an existing Amazon SNS topic by iterating all SNS topics until a match is found asynchronously.
///
/// The ListTopics method is used to fetch upto 100 SNS topics at a time until a SNS topic
/// with an TopicArn that matches is found.
///
///
/// The name of the topic find
/// A Task containing the matched SNS topic.
Task FindTopicAsync(string topicName);
#endif
#endregion
#region AuthorizeS3ToPublish
#if BCL
///
/// This is a utility method which updates the policy of a topic to allow the
/// S3 bucket to publish events to it.
///
/// The topic that will have its policy updated.
/// The bucket that will be given access to publish from.
void AuthorizeS3ToPublish(string topicArn, string bucket);
#endif
#if AWS_ASYNC_API
///
/// This is a utility method which updates the policy of a topic to allow the
/// S3 bucket to publish events to it.
///
/// The topic that will have its policy updated.
/// The bucket that will be given access to publish from.
/// /// A Task
Task AuthorizeS3ToPublishAsync(string topicArn, string bucket);
#endif
#endregion
}
}