示例#1
0
 public SnsTopicByName(string topicName, IAmazonSimpleNotificationService client, IMessageSerialisationRegister serialisationRegister)
     : base(serialisationRegister)
 {
     TopicName = topicName;
     Client = client;
     Exists();
 }
        PollWriterManager()
        {
            this._snsClient = new AmazonSimpleNotificationServiceClient();

            this._dynamoDBClient = new AmazonDynamoDBClient();
            this._dbContext = new DynamoDBContext(this._dynamoDBClient, new DynamoDBContextConfig { Conversion = DynamoDBEntryConversion.V2 });

            this._swfClient = new AmazonSimpleWorkflowClient();
        }
示例#3
0
        public void Save(string sourceArn, IAmazonSimpleNotificationService client)
        {
            ActionIdentifier[] actions = { SNSActionIdentifiers.Subscribe};

            var snsPolicy = new Policy()
                .WithStatements(GetDefaultStatement(sourceArn))
                .WithStatements(new Statement(Statement.StatementEffect.Allow)
                    .WithPrincipals(_accountIds.Select(a => new Principal(a)).ToArray())
                    .WithResources(new Resource(sourceArn))
                    .WithActionIdentifiers(actions));
            var attributeValue = snsPolicy.ToJson();
            var setQueueAttributesRequest = new SetTopicAttributesRequest(sourceArn, "Policy", attributeValue);

            client.SetTopicAttributes(setQueueAttributesRequest);
        }
示例#4
0
        protected SnsClient(IAwsConfiguration awsConfiguration)
        {
            if (awsConfiguration == null)
                throw new ArgumentNullException("awsConfiguration");

            awsConfiguration.Validate();

            try
            {
                Client = AWSClientFactory.CreateAmazonSimpleNotificationServiceClient(awsConfiguration.AccessKey,
                                                                                      awsConfiguration.SecretKey);
            }
            catch (Exception ex)
            {
                throw new MessagingException(
                    "An error occurred while attempting to access Amazon SNS. See inner exception for more details.",
                    ex);
            }
        }
 public SNSMessagePublisher(RegionEndpoint region)
 {
     Client = GetSnsClient(region);
 }
 internal ListPlatformApplicationsPaginator(IAmazonSimpleNotificationService client, ListPlatformApplicationsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 public TestableSubscriptionManager(IAmazonSQS sqsClient, IAmazonSimpleNotificationService snsClient, string queueName, QueueCache queueCache, MessageMetadataRegistry messageMetadataRegistry, TopicCache topicCache, bool disableSubscribeBatchingOnStart) : base(sqsClient, snsClient, queueName, queueCache, messageMetadataRegistry, topicCache, disableSubscribeBatchingOnStart)
 {
 }
 public SubscriptionService(IAmazonSimpleNotificationService sns)
 {
     _sns = sns ?? throw new ArgumentNullException(nameof(sns));
 }
示例#9
0
 public TopicCache(IAmazonSimpleNotificationService client)
 {
     _client    = client;
     _cache     = new GreenCache <TopicInfo>(ClientContextCacheDefaults.GetCacheSettings());
     _nameIndex = _cache.AddIndex("entityName", x => x.EntityName);
 }
示例#10
0
 public SNSLogger(IAmazonSimpleNotificationService client, string name, string topic)
 {
     this.client = client;
     this.name = name;
     this.topic = topic;
 }
示例#11
0
 /// <summary>
 /// Creates a <see cref="Flow"/> to publish messages to a SNS topic using an <see cref="IAmazonSimpleNotificationService"/>
 /// </summary>
 public static Flow <string, PublishResponse, NotUsed> PlainFlow(string topicArn, IAmazonSimpleNotificationService snsService)
 {
     return(Flow.FromGraph(new SnsPublishFlowStage(topicArn, snsService)));
 }
示例#12
0
 public Shutdown(IAmazonEC2 client, IAmazonSimpleNotificationService snsClient)
 {
     _client    = client;
     _snsClient = snsClient;
 }
示例#13
0
 public SnsPublishFlowStage(string topicArn, IAmazonSimpleNotificationService snsService)
 {
     TopicArn   = topicArn;
     SnsService = snsService;
     Shape      = new FlowShape <string, PublishResponse>(In, Out);
 }
        public AmazonSqsClientContext(ConnectionContext connectionContext, IAmazonSQS amazonSqs, IAmazonSimpleNotificationService amazonSns,
                                      CancellationToken cancellationToken)
            : base(connectionContext)
        {
            _connectionContext = connectionContext;
            _amazonSqs         = amazonSqs;
            _amazonSns         = amazonSns;
            _cancellationToken = cancellationToken;

            _taskScheduler = new LimitedConcurrencyLevelTaskScheduler(1);

            _queueUrls = new Dictionary <string, string>();
            _topicArns = new Dictionary <string, string>();
        }
示例#15
0
 public Shutdown()
 {
     _client    = new AmazonEC2Client();
     _snsClient = new AmazonSimpleNotificationServiceClient();
 }
示例#16
0
 internal SimpleNotificationServicePaginatorFactory(IAmazonSimpleNotificationService client)
 {
     this.client = client;
 }
 public TopicSubscriberService(IAmazonSimpleNotificationService client)
 {
     _client = client;
 }
示例#18
0
 public MessageDispatcher(TransportConfiguration configuration, IAmazonS3 s3Client, IAmazonSQS sqsClient, IAmazonSimpleNotificationService snsClient, QueueCache queueCache, TopicCache topicCache)
 {
     this.topicCache    = topicCache;
     this.snsClient     = snsClient;
     this.configuration = configuration;
     this.s3Client      = s3Client;
     this.sqsClient     = sqsClient;
     this.queueCache    = queueCache;
     serializerStrategy = configuration.UseV1CompatiblePayload ? SimpleJson.PocoJsonSerializerStrategy : ReducedPayloadSerializerStrategy.Instance;
 }
 public CreatePhotographFunction(IAmazonDynamoDB dynamoDb, IAmazonSimpleNotificationService sns)
 {
     _dynamoDb = dynamoDb;
     _sns      = sns;
 }
 public AdvertController(IAdvertStorageService advertStorageService, IConfiguration configuration, IAmazonSimpleNotificationService notificationService)
 {
     _advertStorageService = advertStorageService;
     _configuration        = configuration;
     _notificationService  = notificationService;
 }
 public IndexModel(IAmazonSimpleNotificationService simpleNotificationService, ILogger <IndexModel> logger)
 {
     _simpleNotificationService = simpleNotificationService;
     _logger = logger;
 }
        public LocalTopicArnProvider(IAmazonSimpleNotificationService client, string topicName)
        {
            _client = client;

            _lazyGetArn = new Lazy<string>(() => GetArnInternal(topicName));
        }
 public SNSPublisher(IAmazonSimpleNotificationService amazonSNSClient, string topicArn) :
     this(amazonSNSClient, new TopicConfiguration(topicArn))
 {
 }
示例#24
0
 public NotificationEngine(IAmazonSimpleNotificationService sns, ILogger logger)
 {
     _sns    = sns ?? throw new ArgumentNullException(nameof(sns));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
示例#25
0
 /// <summary>
 /// Creates a <see cref="Sink"/> to publish messages to a SNS topic using an <see cref="IAmazonSimpleNotificationService"/>
 /// </summary>
 public static Sink <string, Task> PlainSink(string topicArn, IAmazonSimpleNotificationService snsService)
 {
     return(PlainFlow(topicArn, snsService).ToMaterialized(Sink.Ignore <PublishResponse>(), Keep.Right));
 }
示例#26
0
 public TopicAddressPublisher(IAmazonSimpleNotificationService snsClient, ILoggerFactory loggerFactory, IMessageSubjectProvider subjectProvider, IMessageSerializationRegister serializationRegister, Func <Exception, Message, bool> handleException, TopicAddress topicAddress)
     : base(topicAddress.TopicArn, snsClient, serializationRegister, loggerFactory, subjectProvider, handleException)
 {
 }
示例#27
0
 internal ListSubscriptionsByTopicPaginator(IAmazonSimpleNotificationService client, ListSubscriptionsByTopicRequest request)
 {
     this._client  = client;
     this._request = request;
 }
示例#28
0
 public AwsEnvironmentBuilder(IAwsClientFactory clientFactory)
 {
     sns = clientFactory.CreateSnsClient();
     sqs = clientFactory.CreateSqsClient();
 }
示例#29
0
 public SnsTopicCreator(IAmazonSimpleNotificationService snsClient,
                        IAlarmLogger logger)
 {
     _snsClient = snsClient;
     _logger    = logger;
 }
 public void Subscribe(IAmazonSimpleNotificationService snsClient, string topicArn)
 {
     QueueUrlSnsTopicSubscribeArn = snsClient.SubscribeQueueAsync(topicArn, _client, _queueUrl).Result;
 }
 public SNSPublisher(IAmazonSimpleNotificationService amazonSNSClient, TopicByName toicByName) :
     this(amazonSNSClient, new TopicConfiguration(amazonSNSClient, toicByName))
 {
 }
示例#32
0
 public SNSLoggerProvider(ISNSClientFactory factory, IOptions<General> general)
 {
     client = factory.CreateSimpleNotificationClient();
     this.general = general;
 }
 private Amazon.SimpleNotificationService.Model.SetSubscriptionAttributesResponse CallAWSServiceOperation(IAmazonSimpleNotificationService client, Amazon.SimpleNotificationService.Model.SetSubscriptionAttributesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Notification Service (SNS)", "SetSubscriptionAttributes");
     try
     {
         #if DESKTOP
         return(client.SetSubscriptionAttributes(request));
         #elif CORECLR
         return(client.SetSubscriptionAttributesAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
示例#34
0
        internal DownloadFileCommand(ArchiveTransferManager manager, string vaultName, string archiveId, string filePath, DownloadOptions options)
        {
            this.manager = manager;
            this.vaultName = vaultName;
            this.archiveId = archiveId;
            this.filePath = filePath;
            this.options = options;

            var glacierClient = this.manager.GlacierClient as AmazonGlacierClient;
            if (glacierClient == null)
                throw new InvalidOperationException("This can only be called using an AmazonGlacierClient");

            this.snsClient = ServiceClientHelpers.CreateServiceFromAnother<AmazonSimpleNotificationServiceClient, AmazonSimpleNotificationServiceConfig>(glacierClient);
            this.sqsClient = ServiceClientHelpers.CreateServiceFromAnother<AmazonSQSClient, AmazonSQSConfig>(glacierClient);

            if (this.options == null)
                this.options = new DownloadOptions();
        }
 public SNSMessagePublisher(string accessKey, string secretKey, string sessionToken, RegionEndpoint region)
 {
     Client = GetSnsClient(accessKey, secretKey, sessionToken, region);
 }
 public SNSPublisher(IAmazonSimpleNotificationService amazonSNSClient, TopicConfiguration topicConfiguration)
 {
     _amazonSNSClient = amazonSNSClient;
     _topicConfiguration = topicConfiguration;
 }
 private PollProcessor()
 {
     this._snsClient = new AmazonSimpleNotificationServiceClient();
     this._dynamoDBClient = new AmazonDynamoDBClient();
     this._dbContext = new DynamoDBContext(this._dynamoDBClient, new DynamoDBContextConfig {Conversion = DynamoDBEntryConversion.V2 });
 }
示例#38
0
 internal ListSMSSandboxPhoneNumbersPaginator(IAmazonSimpleNotificationService client, ListSMSSandboxPhoneNumbersRequest request)
 {
     this._client  = client;
     this._request = request;
 }
示例#39
0
 /// <summary>
 /// Implements the Dispose pattern
 /// </summary>
 /// <param name="disposing">Whether this object is being disposed via a call to Dispose
 /// or garbage collected.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (snsClient != null)
             {
                 snsClient.Dispose();
                 snsClient = null;
             }
             if (sqsClient != null)
             {
                 sqsClient.Dispose();
                 sqsClient = null;
             }
         }
         this.disposed = true;
     }
 }
示例#40
0
 internal ListTopicsPaginator(IAmazonSimpleNotificationService client, ListTopicsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
示例#41
0
 public SnsTopicByArn(string topicArn, IAmazonSimpleNotificationService client, IMessageSerialisationRegister serialisationRegister)
     : base(serialisationRegister)
 {
     Arn = topicArn;
     Client = client;
 }
示例#42
0
 public Handler()
 {
     _snsClient = new AmazonSimpleNotificationServiceClient();
 }
 public TopicConfiguration(IAmazonSimpleNotificationService amazonSNSClient, TopicByName topicByName)
 {
     _amazonSNSClient = amazonSNSClient;
     _topicByName = topicByName;
 }
示例#44
0
 public FuncMessageSender(ISimpleNotificationServiceProvider provider)
 {
     this.snsService = provider.GetSimpleNotificationService();
 }
示例#45
0
        internal DownloadFileCommand(ArchiveTransferManager manager, string vaultName, string archiveId, string filePath, DownloadOptions options)
        {
            this.manager = manager;
            this.vaultName = vaultName;
            this.archiveId = archiveId;
            this.filePath = filePath;
            this.options = options;

            var credentials = ((AmazonGlacierClient)this.manager.GlacierClient).GetCredentials();
            var glacierClient = this.manager.GlacierClient as AmazonGlacierClient;
            if (glacierClient == null)
                throw new InvalidOperationException("This can only be called using an AmazonGlacierClient");

            this.snsClient = new AmazonSimpleNotificationServiceClient(credentials, glacierClient.CloneConfig<AmazonSimpleNotificationServiceConfig>());
            this.sqsClient = new AmazonSQSClient(credentials, glacierClient.CloneConfig<AmazonSQSConfig>());

            if (this.options == null)
                this.options = new DownloadOptions();
        }
示例#46
0
 public SnsTopicByName(string topicName, IAmazonSimpleNotificationService client, IMessageSerialisationRegister serialisationRegister)
     : base(serialisationRegister)
 {
     TopicName = topicName;
     Client    = client;
 }