/// <summary>
        /// Called when this Adapter is Started.
        /// Used to Setup the Connection to AWS S3
        /// </summary>
        public override void OnInit()
        {
            Amazon.RegionEndpoint region = null;
            if (awsAccessKeyId == null)
            {
                LOGERROR("Missing Parameter awsAccessLeyId is required");
            }
            if (awsSecretAccessKey == null)
            {
                LOGERROR("Missing Parameter awsSecretAccessKey is required");
            }
            if (awsBucket == null)
            {
                LOGERROR("Missing Parameter awsBucket is required");
            }

            if (awsRegion == null)
            {
                LOGERROR("Missing Parameter awsRegion is required");
            }
            else
            {
                region = Amazon.RegionEndpoint.GetBySystemName(awsRegion);
                if (region == null)
                {
                    LOGERROR("awsRegion '" + awsRegion + "' not recognized");
                }
            }
            LOGINFO("Creating AWS S3 Client with given credentials");
            s3Client = new AmazonS3Client(awsAccessKeyId, awsSecretAccessKey, region);
        }
        public SampleElasticsearchClient(string endPoint, Amazon.RegionEndpoint regionEndPoint)
        {
            AWSCredentials    awsCredentials = FallbackCredentialsFactory.GetCredentials();
            AwsHttpConnection conn           = new AwsHttpConnection(regionEndPoint.SystemName,
                                                                     new StaticCredentialsProvider(new AwsCredentials()
            {
                AccessKey = awsCredentials.GetCredentials().AccessKey,
                SecretKey = awsCredentials.GetCredentials().SecretKey,
                Token     = awsCredentials.GetCredentials().Token
            }));

            var pool = new SingleNodeConnectionPool(new Uri(endPoint));
            ConnectionSettings settings = new ConnectionSettings(pool, conn)
                                          .DisableDirectStreaming()
                                          .InferMappingFor <LogEntry>(m => m.IndexName("logs"));

            //.DefaultMappingFor<LogEntry>(m => m.IndexName("logs"));

            _esClient = new ElasticClient(settings);

            IndexName logIndex = IndexName.From <LogEntry>();

            var req = new IndexExistsRequest(logIndex);
            var res = _esClient.IndexExists(req);

            if (!res.Exists)
            {
                _esClient.CreateIndex("logs", c => c
                                      .Mappings(md => md.Map <LogEntry>(m => m.AutoMap())));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// A simple function that takes a string and does a ToUpper
        ///
        /// To use this handler to respond to an AWS event, reference the appropriate package from
        /// https://github.com/aws/aws-lambda-dotnet#events
        /// and change the string input parameter to the desired event type.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public static string FunctionHandler(Newtonsoft.Json.Linq.JObject evnt, ILambdaContext context)
        {
            var response = evnt.ToString();

            context.Logger.Log("Complete JSON of the event is:" + evnt.ToString());
            var records = evnt.Property("Records");

            context.Logger.Log("\nRecord Array:" + records.Value);
            // TODO check to see if only one, handle multiple
            Newtonsoft.Json.Linq.JObject record = (Newtonsoft.Json.Linq.JObject)records.First[0];
            var awsRegionString = record.Property("awsRegion").Value;

            context.Logger.Log("\nAWS Region String is:" + awsRegionString);

            Newtonsoft.Json.Linq.JObject tmpObject  = (Newtonsoft.Json.Linq.JObject)record.Property("s3").Value;
            Newtonsoft.Json.Linq.JObject tmpObject2 = (Newtonsoft.Json.Linq.JObject)tmpObject.Property("bucket").Value;
            string bucketName = tmpObject2.Property("name").Value.ToString();

            context.Logger.Log("\nBucket Property Name:" + bucketName);

            tmpObject2 = (Newtonsoft.Json.Linq.JObject)tmpObject.Property("object").Value;
            string keyName = tmpObject2.Property("key").Value.ToString();

            context.Logger.Log("\nKey Property Name:" + keyName);

            // TODO assign a region based on text found
            Amazon.RegionEndpoint awsRegion = Amazon.RegionEndpoint.USEast1;


            ReadObjectDataAsync(awsRegion, bucketName, keyName).Wait();


            return(response);
        }
Ejemplo n.º 4
0
        private AmazonSimpleEmailServiceClient PrepareEmailClient(EmailRequestModel model, IConfiguration config)
        {
            // Choose the AWS region of the Amazon SES endpoint you want to connect to. Note that your sandbox
            // status, sending limits, and Amazon SES identity-related settings are specific to a given
            // AWS region, so be sure to select an AWS region in which you set up Amazon SES. Here, we are using
            // the US West (Oregon) region. Examples of other regions that Amazon SES supports are USEast1
            // and EUWest1. For a complete list, see http://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html
            Amazon.RegionEndpoint REGION = Amazon.RegionEndpoint.USEast1;

            // Instantiate an Amazon SES client, which will make the service call.
            AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(config.GetSection("AWS:AWSAccessKey").Value, config.GetSection("AWS:AWSSecretKey").Value, REGION);

            client.BeforeRequestEvent += delegate(object sender, RequestEventArgs e)
            {
                WebServiceRequestEventArgs args    = e as WebServiceRequestEventArgs;
                SendEmailRequest           request = args.Request as SendEmailRequest;

                //$"Sending email {model.Subject} to {model.ToAddresses}".Log();
            };

            client.ExceptionEvent += delegate(object sender, ExceptionEventArgs e)
            {
                Console.WriteLine($"Sent email {model.Subject} error: {e.ToString()}");
            };

            client.AfterResponseEvent += delegate(object sender, ResponseEventArgs e)
            {
                WebServiceResponseEventArgs args     = e as WebServiceResponseEventArgs;
                SendEmailResponse           response = args.Response as SendEmailResponse;

                //$"Sent email {model.Subject} to {model.ToAddresses} {response.HttpStatusCode} {response.MessageId}".Log();
            };

            return(client);
        }
Ejemplo n.º 5
0
 public SampleS3Client(string format, string bucketName, string bucketPath, Amazon.RegionEndpoint endpoint)
 {
     this.Format     = format;
     this.BucketName = bucketName;
     this.BucketPath = bucketPath;
     _s3Client       = new AmazonS3Client(endpoint);
 }
Ejemplo n.º 6
0
        public AmazonSearcher(List <string> faceFileNames, List <string> dates, ProjectConfigData configData)
        {
            this.dates                 = dates;
            this.awsAccessKeyId        = configData.awsAccessKeyId;
            this.awsSecretAccessKey    = configData.awsSecretAccessKey;
            this.awsRegionEndpoint     = Amazon.RegionEndpoint.GetBySystemName(configData.awsEndpoint);//("eu-west-1");
            this.awsCollectionId       = configData.awsCollectionId;
            this.awsFaceMatchThreshold = configData.awsFaceMatchThreshold;
            this.awsSimilarityLevel    = configData.awsSimilarityLevel;

            if (faceFileNames.Count > 1)
            {
                var tasks = new List <Task <List <Guid> > >();

                for (int i = 0; i < faceFileNames.Count; i++)
                {
                    tasks.Add(Task.Run(async() => SearchOneFace(faceFileNames[i])));
                }

                searchedFaceIds = Task.WhenAll(tasks).Result; // количество списков равное кол-ву поисковых лиц
            }
            else
            {
                searchedFaceIds = new List <Guid>[] { SearchOneFace(faceFileNames[0]) }
            };
        }
Ejemplo n.º 7
0
        private Amazon.RegionEndpoint GetBucketEndpoint(AWSCredentials awsCredentials, string awsBucketName)
        {
            Amazon.RegionEndpoint defaultResult     = Amazon.RegionEndpoint.USEast1;
            Amazon.RegionEndpoint result            = null;
            AmazonS3Client        temporaryS3Client = null;

            try
            {
                temporaryS3Client = new AmazonS3Client(awsCredentials, Amazon.RegionEndpoint.USEast1);
                GetBucketLocationResponse bucketRegionResponse = temporaryS3Client.GetBucketLocation(awsBucketName);
                result = Amazon.RegionEndpoint.GetBySystemName(bucketRegionResponse.Location.Value);
                if (result == null || string.IsNullOrEmpty(result.SystemName))
                {
                    result = defaultResult;
                }
                logger.Debug("The '{0}' bucket is located in the '{1}' region.", awsBucketName, result.DisplayName);
            }
            catch (Exception)
            {
                logger.Log(LogLevel.Warn, "Failed to discover the bucket location for '{0}'. Assuming '{1}'.", awsBucketName, defaultResult.DisplayName);
                result = defaultResult;
            }
            finally
            {
                if (temporaryS3Client != null)
                {
                    temporaryS3Client.Dispose();
                }
            }

            return(result);
        }
Ejemplo n.º 8
0
        public S3Uploader(string Region, string Bucket)
        {
            endPoint = Amazon.RegionEndpoint.GetBySystemName(Region);
            bucket   = Bucket;
            var maxConcur = U.config["MaxConcurrentUploads"] ?? "10";

            maxconcurrency = Convert.ToInt32(maxConcur);


            //set up the limited concurrency
            lock (lockObj)
            {
                if (factory == null)
                {
                    LimitedConcurrencyLevelTaskScheduler lcts = new LimitedConcurrencyLevelTaskScheduler(maxconcurrency);
                    factory = new TaskFactory(lcts);
                }
            }

            U.log($"Creating s3 client to endpoint {endPoint.DisplayName}");

            var cred = new BasicAWSCredentials(Environment.GetEnvironmentVariable("AWS_ACCESS_KEY_ID"), Environment.GetEnvironmentVariable("AWS_SECRET_ACCESS_KEY"));


            S3Client = new AmazonS3Client(cred, endPoint);
        }
Ejemplo n.º 9
0
        public string ObtenerUrlPublicaTemporal(string urlAmazon)
        {
            string          url       = null;
            AmazonObjectUrl amazonUrl = new AmazonObjectUrl(urlAmazon);

            if (amazonUrl.IsValid)
            {
                try
                {
                    Amazon.RegionEndpoint         region      = Amazon.RegionEndpoint.GetBySystemName(Constants.RegionDefecto);
                    Amazon.Runtime.AWSCredentials credentials = new Amazon.Runtime.StoredProfileAWSCredentials(Constants.PerfilSoportesSDKStore);
                    IAmazonS3 s3Client = new AmazonS3Client(credentials, region);

                    GetPreSignedUrlRequest request = new GetPreSignedUrlRequest()
                    {
                        BucketName = amazonUrl.Bucket,
                        Key        = amazonUrl.Key,
                        Expires    = DateTime.Now.AddSeconds(Constants.SegundosVigenciaUrl)
                    };

                    url = s3Client.GetPreSignedURL(request);
                }
                catch (Exception ex)
                {
                    Activa.Trace.Trace.WriteLineLine_Error(ex);
                }
            }
            return(url);
        }
Ejemplo n.º 10
0
        public static void InitLogger(string awsAccessKey, string awsSecretKey, string logName, string streamPrefix = null)
        {
            var logGroupName   = logName;
            var AWS_ACCESS_KEY = awsAccessKey;
            var AWS_SECRET_KEY = awsSecretKey;

            Amazon.RegionEndpoint REGION = Amazon.RegionEndpoint.APSouth1;

            Serilog.Debugging.SelfLog.Enable(Console.WriteLine);
            CloudWatchSinkOptions options = new CloudWatchSinkOptions {
                LogGroupName = logGroupName, LogEventRenderer = new EventLogRenderer()
            };

            if (streamPrefix != null)
            {
                ILogStreamNameProvider streamNameProvider = new ConstantLogStreamNameProvider(streamPrefix);
                options = new CloudWatchSinkOptions {
                    LogGroupName = logGroupName, LogEventRenderer = new EventLogRenderer(), LogStreamNameProvider = streamNameProvider
                };
            }

            // setup AWS CloudWatch client
            AWSCredentials        credentials = new BasicAWSCredentials(AWS_ACCESS_KEY, AWS_SECRET_KEY);
            IAmazonCloudWatchLogs client      = new AmazonCloudWatchLogsClient(credentials, REGION);


            Log.Logger = new LoggerConfiguration().WriteTo.AmazonCloudWatch(options, client)
                         .MinimumLevel.Verbose()
                         .CreateLogger();
        }
Ejemplo n.º 11
0
        public AmazonS3UploadFile()
        {
            /* Environment Variables to set (sample):
             * "AWS_ACCESS_KEY_ID": "--AKIA5J71TNDA53PISACAUXJ",
             * "AWS_SECRET_ACCESS_KEY": "KaPS/59PPOSUGm1SowWxu0iQFL5jPhJcBXZAPXQoQ89Vt",
             */

            var AwsBucketName = Environment.GetEnvironmentVariable("AWS_BUCKET_NAME");

            var hasErrors = new List <string>();

            if (AwsBucketName == null)
            {
                hasErrors.Add($"{nameof(AwsBucketName)} variável de ambiente não pode ser nula");
            }

            if (hasErrors.Count > 0)
            {
                throw new InternalServerError(string.Join(" | ", hasErrors.ToArray()));
            }

            _AwsBucketName = AwsBucketName;

            var credentials = new EnvironmentVariablesAWSCredentials();

            Amazon.RegionEndpoint region = Amazon.RegionEndpoint.USEast1;
            _s3Client = new AmazonS3Client(credentials, region);
        }
 public void Init()
 {
     // Initialize connection to Amazon Storage
     Amazon.RegionEndpoint region = Amazon.RegionEndpoint.GetBySystemName(AmazonRegion);
     _s3Client   = new AmazonS3Client(AmazonAccessKey, AmazonSecretAccessKey, region);
     _dDbContext = new DynamoDBContext(new AmazonDynamoDBClient(AmazonAccessKey, AmazonSecretAccessKey, region));
 }
Ejemplo n.º 13
0
        public void SendEmail(string fromAddress, string toAddress, string _subject, string _body)
        {
            Destination destination = new Destination();

            destination.ToAddresses = (new List <string>()
            {
                toAddress
            });
            Content subject  = new Content(_subject);
            Content textBody = new Content(_body);
            Body    body     = new Body(textBody);

            Message message = new Message(subject, body);

            SendEmailRequest request = new SendEmailRequest(fromAddress, destination, message);

            Amazon.RegionEndpoint REGION = Amazon.RegionEndpoint.USEast1;

            // Instantiate an Amazon SES client, which will make the service call.
            AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(REGION);

            // Send the email.
            try
            {
                //("Attempting to send an email through Amazon SES by using the AWS SDK for .NET...");
                client.SendEmail(request);
                //("Email sent!");
            }
            catch (Exception ex)
            {
                //("Error message: " + ex.Message);
            }
        }
Ejemplo n.º 14
0
        async static Task <List <SendDataPoint> > GetSesStatsForAccount(string Account)
        {
            string strRoleARN = "arn:aws:iam::" + Account + ":role/" + AssumedRoleName;

            Amazon.SecurityToken.AmazonSecurityTokenServiceClient stsClient = new Amazon.SecurityToken.AmazonSecurityTokenServiceClient();
            var assumeRoleResponse = await stsClient.AssumeRoleAsync(new Amazon.SecurityToken.Model.AssumeRoleRequest {
                RoleArn = strRoleARN, RoleSessionName = "TempSession"
            });


            SessionAWSCredentials sessionCredentials =
                new SessionAWSCredentials(assumeRoleResponse.Credentials.AccessKeyId,
                                          assumeRoleResponse.Credentials.SecretAccessKey,
                                          assumeRoleResponse.Credentials.SessionToken);

            var regions = new Amazon.RegionEndpoint[] { Amazon.RegionEndpoint.USEast1, Amazon.RegionEndpoint.USWest2, Amazon.RegionEndpoint.EUWest1 };

            List <SendDataPoint> lst = new List <SendDataPoint>();

            foreach (var region in regions)
            {
                Console.WriteLine($"Checking {region.ToString()} for account {Account}");

                AmazonSimpleEmailServiceClient sesClient = new AmazonSimpleEmailServiceClient(sessionCredentials, region);

                var response = await sesClient.GetSendStatisticsAsync();

                lst.AddRange(response.SendDataPoints);
            }

            return(lst);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Constructs a new empty BucketObjectsWindow.
        /// </summary>
        /// <param name="regionBucketAndPrefix">The region, bucket, and prefix, in the following form: [region:]bucket/prefix.</param>
        /// <param name="batchIdCounter">The <see cref="BatchIdCounter"/> for this window.</param>
        /// <param name="unprefixedStartAtKey">The key to start at or <b>null</b> to start at the beginning.</param>
        /// <param name="unprefixedStopAtKey">The key to stop at or <b>null</b> to start at the beginning.</param>
        /// <param name="cannedAcl">A <see cref="S3CannedACL"/> to use for the target file.</param>
        /// <param name="grant">A <see cref="S3Grant"/> indicating rights grants to apply to the target file.</param>
        public BucketObjectsWindow(string regionBucketAndPrefix, BatchIdCounter batchIdCounter, string unprefixedStartAtKey = null, string unprefixedStopAtKey = null, S3CannedACL cannedAcl = null, S3Grant grant = null, ServerSideEncryptionMethod targetEncryptionMethod = null)
        {
            _batchIdCounter = batchIdCounter;
            Tuple <string, string, string> parsedRegionBucketAndPrefix = ParseRegionBucketAndPrefix(regionBucketAndPrefix);

            Amazon.RegionEndpoint region = Amazon.RegionEndpoint.GetBySystemName(string.IsNullOrEmpty(parsedRegionBucketAndPrefix.Item1)
                ? GetBucketRegion(parsedRegionBucketAndPrefix.Item2)
                : parsedRegionBucketAndPrefix.Item1);
            _s3             = new AmazonS3Client(region);
            _bucket         = parsedRegionBucketAndPrefix.Item2;
            _prefix         = parsedRegionBucketAndPrefix.Item3;
            _grant          = grant;
            _grantCannedAcl = cannedAcl;
            _queue          = new ConcurrentQueue <Batch>();
            if (!string.IsNullOrEmpty(unprefixedStartAtKey))
            {
                _startAtKey         = _prefix + unprefixedStartAtKey;
                _unprefixedLeastKey = unprefixedStartAtKey;
            }
            else
            {
                _unprefixedLeastKey = string.Empty;
            }
            if (!string.IsNullOrEmpty(unprefixedStopAtKey))
            {
                _stopAtKey = _prefix + unprefixedStopAtKey;
            }
            _unprefixedGreatestKey  = string.Empty;
            _targetEncryptionMethod = targetEncryptionMethod;
        }
 /// <summary>
 /// Internal constructor
 /// </summary>
 /// <param name="accHash">Account hash provided by Realeyes</param>
 /// <param name="region">Region to ingest data</param>
 internal EventProcessor(string accHash, Amazon.RegionEndpoint region)
 {
     _accHash     = accHash;
     _region      = region;
     _transport   = new DataTransport(_region);
     _timeService = new TimeSyncService(new TimeSpan(0, 5, 0));
 }
        public SampleAthenaClient(string dataBase, string outputLocation, Amazon.RegionEndpoint endpoint)
        {
            _athenaClient = new Amazon.Athena.AmazonAthenaClient(endpoint);

            this.DataBase       = dataBase;
            this.OutputLocation = outputLocation;
        }
Ejemplo n.º 18
0
 public AmazonS3WriterEtlOperation(Amazon.RegionEndpoint regionEndpoint, string bucketName, IEnumerable <string> files)
 {
     _awsCredentials    = new AnonymousAWSCredentials();
     _storageClass      = S3StorageClass.Standard;
     _awsRegionEndpoint = regionEndpoint;
     _bucketName        = bucketName;
     _files             = files;
 }
Ejemplo n.º 19
0
        /// <summary>
        /// This method is called for every Lambda invocation. This method takes in an Config event object and can be used
        /// to respond to Config notifications.
        /// </summary>
        /// <param name="evnt"></param>
        /// <param name="context"></param>
        /// <returns>Nothing</returns>
        public async Task FunctionHandler(ConfigEvent evnt, ILambdaContext context)
        {
            Console.WriteLine("inside function handler...");
            Amazon.RegionEndpoint     region = Amazon.RegionEndpoint.GetBySystemName(System.Environment.GetEnvironmentVariable(AWS_REGION_PROPERTY));
            AmazonConfigServiceClient configServiceClient = new AmazonConfigServiceClient(region);

            await DoHandle(evnt, context, configServiceClient);
        }
Ejemplo n.º 20
0
        public async Task <Document> DynamoGetItemAsync(Amazon.RegionEndpoint endpoint, string table, Primitive hashKey, Primitive rangeKey)
        {
            AmazonDynamoDBClient client = new AmazonDynamoDBClient(endpoint);
            Table    dbTable            = Table.LoadTable(client, table);
            Document result             = await dbTable.GetItemAsync(hashKey, rangeKey);

            return(result);
        }
Ejemplo n.º 21
0
        public AdminController(IOptions <AWSOptions> awsOptions)
        {
            _awsOptions = awsOptions.Value;
            Amazon.RegionEndpoint AppRegion = Amazon.RegionEndpoint.GetBySystemName(_awsOptions.Region);

            _cloudAuthService = new CloudAuthService(_awsOptions.CognitoPoolId, AppRegion);
            _dbDataService    = new DBDataService(_cloudAuthService.GetAWSCredentials(), AppRegion);
        }
Ejemplo n.º 22
0
 public AwsKinesisClient(Utils.Executor executor, AWSCredentials cred, AWSRegions region, ulong minConnections = 1, ulong maxConnections = 6, ulong connectTimeout = 10000, ulong requestTimeout = 10000, bool single_use_sockets = false)
 {
     this.executor_      = executor;
     this.requestTimeout = requestTimeout;
     this.cred_          = cred;
     this.region_        = MapRegion(region);
     CreateClients((int)maxConnections);
 }
 public static void DeleteArchive(string vaultName, string archiveId, Amazon.RegionEndpoint awsRegion)
 {
     Logger.LogMessage($"Deleting archive '{archiveId}' from {vaultName}...");
     using (var manager = new ArchiveTransferManager(awsRegion))
     {
         manager.DeleteArchive(vaultName, archiveId);
     }
 }
Ejemplo n.º 24
0
        public AmazonS3Client GetAwsS3Client()
        {
            string awsSecretAccessKey = config.GetSection("AWS:AWSSecretKey").Value;
            string awsAccessKeyId     = config.GetSection("AWS:AWSAccessKey").Value;

            Amazon.RegionEndpoint REGION = Amazon.RegionEndpoint.USEast1;

            return(new AmazonS3Client(awsAccessKeyId, awsSecretAccessKey, REGION));
        }
 public FileSystemGlacierProvider(
     string accessKey,
     string secretKey,
     Amazon.RegionEndpoint endPoint,
     string vaultName)
 {
     this.VaultName = vaultName;
     this.Service   = new AmazonGlacierClient(accessKey, secretKey, endPoint);
 }
Ejemplo n.º 26
0
        public DynomoDBUtility(string awsKeyId, string awsKeyAccess, Amazon.RegionEndpoint awsRegion)
        {
            this.KeyId     = awsKeyId;
            this.KeyAccess = awsKeyAccess;
            this.Region    = awsRegion;
            var awsCredentials = new BasicAWSCredentials(this.KeyId, this.KeyAccess);

            DynomoClient = new AmazonDynamoDBClient(awsCredentials, this.Region);
        }
        static void SetupTopicAndQueue(Amazon.RegionEndpoint region)
        {
            long ticks = DateTime.Now.Ticks;

            // Setup SNS topic.
            s_snsClient = new AmazonSimpleNotificationServiceClient(region);
            s_sqsClient = new AmazonSQSClient(region);

            s_topicArn = s_snsClient.CreateTopic(new CreateTopicRequest
            {
                Name = "GlacierDownload-" + ticks
            }).TopicArn;

            WriteLogConsole("topicArn: " + s_topicArn);

            CreateQueueRequest createQueueRequest = new CreateQueueRequest();

            createQueueRequest.QueueName = "GlacierDownload-" + ticks;
            CreateQueueResponse createQueueResponse = s_sqsClient.CreateQueue(createQueueRequest);

            s_queueUrl = createQueueResponse.QueueUrl;

            WriteLogConsole("QueueURL: " + s_queueUrl);

            GetQueueAttributesRequest getQueueAttributesRequest = new GetQueueAttributesRequest();

            getQueueAttributesRequest.AttributeNames = new List <string> {
                "QueueArn"
            };
            getQueueAttributesRequest.QueueUrl = s_queueUrl;

            GetQueueAttributesResponse response = s_sqsClient.GetQueueAttributes(getQueueAttributesRequest);

            s_queueArn = response.QueueARN;
            WriteLogConsole("QueueArn: " + s_queueArn);

            // Setup the Amazon SNS topic to publish to the SQS queue.
            s_snsClient.Subscribe(new SubscribeRequest()
            {
                Protocol = "sqs",
                Endpoint = s_queueArn,
                TopicArn = s_topicArn
            });

            // Add the policy to the queue so SNS can send messages to the queue.
            var policy = SQS_POLICY.Replace("{TopicArn}", s_topicArn).Replace("{QuernArn}", s_queueArn);

            s_sqsClient.SetQueueAttributes(new SetQueueAttributesRequest()
            {
                QueueUrl   = s_queueUrl,
                Attributes = new Dictionary <string, string>
                {
                    { QueueAttributeName.Policy, policy }
                }
            });
        }
Ejemplo n.º 28
0
        public static IEtlPipeline UploadFilesToAmazonS3(this IEtlPipeline pipeline, Amazon.RegionEndpoint regionEndpoint, string bucketName,
                                                         IEnumerable <string> files, Action <IAmazonS3WriterConfiguration> conf)
        {
            var operation = new AmazonS3WriterEtlOperation(regionEndpoint, bucketName, files);

            conf(operation);
            pipeline.Run(operation);

            return(pipeline);
        }
Ejemplo n.º 29
0
        public DynomoDBUtility()
        {
            this.KeyId     = "AKIAR52JXGF333RW2HGL";
            this.KeyAccess = "E5Q17jtWAT1LbRYbBHohxk9WkGV4aOZFFcZF0oBw";
            this.Region    = Amazon.RegionEndpoint.USEast1;

            var awsCredentials = new BasicAWSCredentials(this.KeyId, this.KeyAccess);

            DynomoClient = new AmazonDynamoDBClient(awsCredentials, Region);
        }
        internal RDSFailover(string vpcId, Amazon.RegionEndpoint region = null)
        {
            this.vpcId = vpcId;
            if (region == null)
            {
                region = Amazon.RegionEndpoint.USEast2;
            }

            rdsClient = new AmazonRDSClient(region);
        }
Ejemplo n.º 31
0
 public static void SetConfig(Amazon.RegionEndpoint endpoint)
 {
     CONFIG.Endpoint = endpoint;
 }