Configuration for Amazon S3 Client.
Esempio n. 1
3
File: S3.cs Progetto: teo-mateo/sdc
        private static S3File UploadImage(string key, Stream inputStream)
        {
            var s3Config = new AmazonS3Config() { ServiceURL = "http://" + _s3_bucket_region };
            using (var cli = new AmazonS3Client(
                _s3_access_key,
                _s3_secret_access_key,
                s3Config))
            {
                PutObjectRequest req = new PutObjectRequest()
                {
                    BucketName = _s3_bucket_name,
                    ContentType = "image/jpg",
                    InputStream = inputStream,
                    Key = key,
                    CannedACL = S3CannedACL.PublicRead
                };

                var response = cli.PutObject(req);
                if (response.HttpStatusCode != System.Net.HttpStatusCode.OK)
                {
                    throw new Exception("s3: upload failed.");
                }
                else
                {
                    return new S3File()
                    {
                        Key = key,
                        Url = HttpUtility.HtmlEncode(
                            String.Format("http://{0}.{1}/{2}", _s3_bucket_name, _s3_bucket_region, key))
                    };
                }
            }
        }
		public Attachment GetStream(FileInfo file)
		{
			var bucketInfo = CreateBucketInfo(file.URL);
			var awsCredentials = new BasicAWSCredentials(McmModuleConfiguration.Aws.AccessKey, McmModuleConfiguration.Aws.SecretKey);
			var s3Config = new AmazonS3Config
			{
				ServiceURL = bucketInfo.ServiceURL
			};

			using (var client = Amazon.AWSClientFactory.CreateAmazonS3Client(awsCredentials, s3Config))
			{
				try
				{
					var request = new Amazon.S3.Model.GetObjectRequest
					{
						BucketName = bucketInfo.Bucketname,
						Key = bucketInfo.Key,
					};

					var response = client.GetObject(request);

					return new Attachment
					{
						FileName = file.OriginalFilename,
						ContentType = file.MimeType,
						Disposable = response,
						Stream = response.ResponseStream
					};
				}
				catch (System.Exception e)
				{
					throw new UnhandledException(string.Format("bucket: {0}, key: {1}, service_url: {2}", bucketInfo.Bucketname, bucketInfo.Key, bucketInfo.ServiceURL), e);
				}
			}
		}
Esempio n. 3
0
        public S3Reader2(NameValueCollection args )
        {
            s3config = new AmazonS3Config();

            buckets = args["buckets"];
            vpath = args["prefix"];

            asVpp = NameValueCollectionExtensions.Get(args, "vpp", true);

            Region = args["region"] ?? "us-east-1";

            s3config.UseHttp = !NameValueCollectionExtensions.Get(args, "useSsl", false);

            if (!string.IsNullOrEmpty(args["accessKeyId"]) && !string.IsNullOrEmpty(args["secretAccessKey"])) {
                S3Client = new AmazonS3Client(args["accessKeyId"], args["secretAccessKey"], s3config);
            } else {

                S3Client = new AmazonS3Client(null, s3config);
            }

            includeModifiedDate = NameValueCollectionExtensions.Get(args, "includeModifiedDate", includeModifiedDate);

            includeModifiedDate = NameValueCollectionExtensions.Get(args, "checkForModifiedFiles", includeModifiedDate);

            RequireImageExtension = NameValueCollectionExtensions.Get(args, "requireImageExtension", RequireImageExtension);
            UntrustedData = NameValueCollectionExtensions.Get(args, "untrustedData", UntrustedData);
            CacheUnmodifiedFiles = NameValueCollectionExtensions.Get(args, "cacheUnmodifiedFiles", CacheUnmodifiedFiles);
        }
Esempio n. 4
0
            public S3(string accessKeyId, string secretAccessKey, string serviceUrl)
            {
                Amazon.S3.AmazonS3Config s3Config = new Amazon.S3.AmazonS3Config();
                s3Config.ServiceURL = serviceUrl;

                this.S3Client = new Amazon.S3.AmazonS3Client(accessKeyId, secretAccessKey, s3Config);
            }
Esempio n. 5
0
        Amazon.S3.AmazonS3Client createS3Client(string overrideEndPoint = null)
        {
            var awsRegion = Amazon.RegionEndpoint.GetBySystemName(_uploadConfig.region);

            if (string.IsNullOrWhiteSpace(_uploadConfig.customEndpoint))
            {
                return(new Amazon.S3.AmazonS3Client(_uploadConfig.accesskey, _uploadConfig.secretkey, awsRegion));
            }
            else
            {
                var customRegion = new Amazon.S3.AmazonS3Config
                {
                    RegionEndpoint = awsRegion,
                    ServiceURL     = _uploadConfig.customEndpoint,
                    ForcePathStyle = true,
                    UseHttp        = _uploadConfig.endPointHttp
                };

                if (!string.IsNullOrWhiteSpace(overrideEndPoint))
                {
                    customRegion.ServiceURL = overrideEndPoint;
                }


                return(new Amazon.S3.AmazonS3Client(_uploadConfig.accesskey, _uploadConfig.secretkey, customRegion));
            }
        }
Esempio n. 6
0
 public S3FileSystem(IPsCmdletLogger logger, string accessKey, string secret, AmazonS3Config config)
 {
     Logger = logger ?? new TraceLogger();
     S3Client = new AmazonS3Client(accessKey, secret, config);
     TransferUtility = new TransferUtility(S3Client);
     FileLoader = (fileFullName) => new FileWrap().Open(fileFullName, FileMode.Open, FileAccess.ReadWrite);
 }
        private IAmazonS3 GetAmazonS3Client(AWSS3Labs.Web.Configuration.AmazonS3Config config)
        {
            var credentials = GetAwsCredentials(config);

            RegionEndpoint region = null;

            if (!string.IsNullOrEmpty(config.Region))
            {
                region = RegionEndpoint.GetBySystemName(config.Region);

                if (region.DisplayName == "Unknown")
                {
                    region = FallbackRegionFactory.GetRegionEndpoint();
                }
            }


            if (string.IsNullOrEmpty(_serviceUrl))
            {
                return(new AmazonS3Client(credentials, region));
            }
            else
            {
                var s3Config = new Amazon.S3.AmazonS3Config
                {
                    ServiceURL     = _serviceUrl,
                    RegionEndpoint = region
                };

                return(new AmazonS3Client(credentials, s3Config));
            }
        }
Esempio n. 8
0
        public static bool CreateFileFromStream(Stream InputStream, string FileName, string _bucketName = "doc2xml")
        {
            bool _saved=false;
            try
            {

                IAmazonS3 client;
                AmazonS3Config objCon = new AmazonS3Config() ;
                objCon.RegionEndpoint = RegionEndpoint.USEast1;
                using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(_awsAccessKey, _awsSecretKey,objCon))
                {
                    var request = new PutObjectRequest()
                    {
                        BucketName = _bucketName,
                        CannedACL = S3CannedACL.PublicRead,//PERMISSION TO FILE PUBLIC ACCESIBLE
                        Key = string.Format("{0}", FileName),
                        InputStream = InputStream//SEND THE FILE STREAM
                    };

                    client.PutObject(request);
                    _saved = true;
                }
            }
            catch (Exception ex)
            {
                ex.ToString();

            }
            return _saved;
        }
Esempio n. 9
0
 public NewsMethods()
 {
     accessKeyID = "AKIAIWFK6YSYC34OEFJQ";
     secretAccessKeyID = "STxTfkHrJTRcwFmrKAsN7eelCs81BhLiPlnIjdkq";
     config = new AmazonS3Config();
     config.ServiceURL = "s3.amazonaws.com";
 }
Esempio n. 10
0
        public S3Reader(NameValueCollection args )
        {
            var S3Config = new AmazonS3Config();

            buckets = args["buckets"];
            vpath = args["prefix"];

            asVpp = NameValueCollectionExtensions.Get(args, "vpp", true);

            S3Config.CommunicationProtocol = NameValueCollectionExtensions.Get(args, "useSsl", false) ? Amazon.S3.Model.Protocol.HTTPS : Amazon.S3.Model.Protocol.HTTP;
            S3Config.UseSecureStringForAwsSecretKey = false;

            if (!string.IsNullOrEmpty(args["accessKeyId"]) && !string.IsNullOrEmpty(args["secretAccessKey"])) {
                S3Client = new AmazonS3Client(args["accessKeyId"], args["secretAccessKey"], S3Config);
            } else {

                S3Client = new AmazonS3Client(null,S3Config);
            }

            includeModifiedDate = NameValueCollectionExtensions.Get(args, "includeModifiedDate", includeModifiedDate);

            includeModifiedDate = NameValueCollectionExtensions.Get(args, "checkForModifiedFiles", includeModifiedDate);

            RequireImageExtension = NameValueCollectionExtensions.Get(args, "requireImageExtension", RequireImageExtension);
            UntrustedData = NameValueCollectionExtensions.Get(args, "untrustedData", UntrustedData);
            CacheUnmodifiedFiles = NameValueCollectionExtensions.Get(args, "cacheUnmodifiedFiles", CacheUnmodifiedFiles);
        }
Esempio n. 11
0
        internal S3ClientCache(AWSCredentials credentials, AmazonS3Config config)
        {
            this.credentials = credentials;
            this.config = config;

            this.clientsByRegion = new Dictionary<string,AmazonS3Client>(StringComparer.OrdinalIgnoreCase);
            this.transferUtilitiesByRegion = new Dictionary<string,TransferUtility>(StringComparer.OrdinalIgnoreCase);
        }
Esempio n. 12
0
 public static AmazonS3 InitS3Client()
 {
     string accessKeyID = WebConfig.Get("awsaccesskey");
     string secretAccessKeyID = WebConfig.Get("awssecretkey");
     AmazonS3Config config = new AmazonS3Config();
     config.CommunicationProtocol = Protocol.HTTP;
     return Amazon.AWSClientFactory.CreateAmazonS3Client(accessKeyID.Trim(), secretAccessKeyID.Trim(), config);
 }
Esempio n. 13
0
        private static AmazonS3 CreateS3Client()
        {
            var config = new AmazonS3Config()
                      .WithCommunicationProtocol(Protocoll)
                      .WithServiceURL(ServiceUrl);

              var client = AWSClientFactory.CreateAmazonS3Client(AwsAccessKey, AwsSecretAccessKey, config);
              return client;
        }
Esempio n. 14
0
        public CraneChatS3Uploader()
        {
            m_CloudFrontRoot = new Uri(ConfigurationManager.AppSettings["CloudFrontRoot"]);
            m_BucketName = ConfigurationManager.AppSettings["BucketName"];

            AmazonS3Config s3Config = new AmazonS3Config().WithServiceURL(ConfigurationManager.AppSettings["S3ServiceURL"].ToString());
            AmazonS3 s3Client = AWSClientFactory.CreateAmazonS3Client(s3Config);
            m_s3transferUtility = new TransferUtility(s3Client);
        }
Esempio n. 15
0
        public AmazonS3(string keyId, string secretKey, Database db)
            : base(db)
        {
            s3Config = new AmazonS3Config();
            s3Config.ServiceURL = "s3.amazonaws.com";
            s3Config.CommunicationProtocol = Protocol.HTTPS;

            client = AWSClientFactory.CreateAmazonS3Client(keyId, secretKey, s3Config);
        }
Esempio n. 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AmazonS3Helper" /> class using the specified credentials.
        /// </summary>
        /// <param name="keyPublic">The public Amazon S3 key.</param>
        /// <param name="keySecret">The secret Amazon S3 key.</param>
        public AmazonS3Helper(String keyPublic, String keySecret, String bucket)
        {
            _keyPublic = keyPublic;
            _keySecret = keySecret;
            _bucket = bucket;
            ValidateConfiguration();

            var s3Config = new AmazonS3Config { RegionEndpoint = RegionEndpoint.USEast1 };
            _client = AWSClientFactory.CreateAmazonS3Client(keyPublic, _keySecret, s3Config);
        }
 internal static S3RequestEventArgs Create(S3Request request, AmazonS3Config config)
 {
     S3RequestEventArgs args = new S3RequestEventArgs
     {
         OriginalRequest = request,
         Headers = request.Headers,
         ServiceURL = config.ServiceURL
     };
     return args;
 }
Esempio n. 18
0
 //[Fact]
 public void CreateClientUsingProxy()
 {
     var config = new AmazonS3Config
     {
         ProxyCredentials = new NetworkCredential("1", "1"),
         RegionEndpoint = RegionEndpoint.USEast1
     };
     config.SetWebProxy(new WebProxy("http://localhost:8888/"));
     client = new AmazonS3Client(config);
     ListBuckets();
 }
Esempio n. 19
0
 private static IAmazonS3 GetAmazonCleint()
 {
     BUCKET_NAME = Startup.Configuration["AWS:BucketName"];
     AWS_ACCESS_KEY = Startup.Configuration["AWS:AccessKey"];
     AWS_SECRET_KEY = Startup.Configuration["AWS:SecretKey"];
     AmazonS3Config config = new AmazonS3Config() { };
     config.RegionEndpoint = RegionEndpoint.EUCentral1;
     Amazon.S3.IAmazonS3 client = AWSClientFactory.CreateAmazonS3Client(AWS_ACCESS_KEY, AWS_SECRET_KEY, config);
     AWSConfigs.S3UseSignatureVersion4 = true;
     return client;
 }
Esempio n. 20
0
        public S3StorageProvider(IOrchardServices services)
        {
            Services = services;
            _S3Config = new AmazonS3Config()
            {
                ServiceURL = "s3.amazonaws.com",
                CommunicationProtocol = Amazon.S3.Model.Protocol.HTTP,
            };

            T = NullLocalizer.Instance;
        }
        public AmazonStorageProvider(AmazonProviderOptions options)
        {
            _serviceUrl = options.ServiceUrl ?? DefaultServiceUrl;
            _bucket = options.Bucket;

            var S3Config = new AmazonS3Config
            {
                ServiceURL = _serviceUrl            
            };

            _s3Client = new AmazonS3Client(options.PublicKey, options.SecretKey, S3Config);
        }
Esempio n. 22
0
        private Amazon.S3.AmazonS3Client GetAwsS3Client(IConfigProvider configProvider)
        {
            var accessKey       = configProvider.AWSAccessKey;
            var secretAccessKey = configProvider.AWSSecretAccessKey;
            var s3Bucket        = configProvider.AWSS3Bucket;
            var serviceUrl      = configProvider.AWSS3ServiceUrl;

            Amazon.S3.AmazonS3Config s3Config = new Amazon.S3.AmazonS3Config();
            s3Config.ServiceURL = serviceUrl;

            return(new Amazon.S3.AmazonS3Client(accessKey, secretAccessKey, s3Config));
        }
Esempio n. 23
0
        /// <summary>
        /// Uses the AWS SDK for .NET to talk to Tier 3 Object Storage
        /// </summary>
        private static void UseAwsSdk()
        {
            Console.WriteLine(":: Calling Tier 3 Object Storage from AWS SDK for .NET ::");
            Console.WriteLine();

            //create configuration that points to different URL
            AmazonS3Config config = new AmazonS3Config()
            {
                ServiceURL = "ca.tier3.io"
            };

            AmazonS3Client client = new AmazonS3Client(adminAccessKey, adminAccessSecret, config);

            /*
             * List buckets
             */
            Console.WriteLine("ACTION: List all the buckets");
            ListBucketsResponse resp = client.ListBuckets();

            foreach (S3Bucket bucket in resp.Buckets)
            {
                Console.WriteLine("-" + bucket.BucketName);
            }

            Console.WriteLine();

            /*
             * List objects in a single bucket
             */
            Console.WriteLine("ACTION: Enter the name of a bucket to open: ");
            string inputbucket = Console.ReadLine();

            ListObjectsRequest objReq = new ListObjectsRequest() { BucketName = inputbucket };
            ListObjectsResponse objResp = client.ListObjects(objReq);

            foreach (S3Object obj in objResp.S3Objects)
            {
                Console.WriteLine("-" + obj.Key);
            }

            /*
             * Upload object to bucket
             */
            //Console.Write("Type [Enter] to upload an object to the opened bucket");
            //Console.ReadLine();

            //PutObjectRequest putReq = new PutObjectRequest() { BucketName = inputbucket, FilePath = @"C:\image.png", ContentType = "image/png" };
            //PutObjectResponse putResp = client.PutObject(putReq);

            //Console.WriteLine("Object uploaded.");
            Console.ReadLine();
        }
Esempio n. 24
0
 public BloomS3Client(string bucketName)
 {
     _bucketName = bucketName;
     _s3Config = new AmazonS3Config { ServiceURL = "https://s3.amazonaws.com" };
     var proxy = new ProxyManager();
     if (!string.IsNullOrEmpty(proxy.Hostname))
     {
         _s3Config.ProxyHost = proxy.Hostname;
         _s3Config.ProxyPort = proxy.Port;
         if (!string.IsNullOrEmpty(proxy.Username))
             _s3Config.ProxyCredentials = new NetworkCredential(proxy.Username, proxy.Password);
     }
 }
Esempio n. 25
0
        private void buttonGetFile_Click(object sender, EventArgs e)
        {
            try
            {
                var config = new AmazonS3Config
                {
                    RegionEndpoint = Amazon.RegionEndpoint.APSoutheast2
                };

                if (this.checkBoxUseProxy.Checked)
                {
                    var proxy = new WebProxy(this.textBoxProxy.Text, int.Parse(this.textBoxProxyPort.Text)) { BypassList = new string[] { textBoxProxyBypass.Text } };
                    WebRequest.DefaultWebProxy = proxy;
                }

                AmazonS3Client amazonS3Client = null;
                if (this.checkBoxUseKeySecret.Checked && this.checkBoxUseToken.Checked == false)
                {
                    amazonS3Client = new AmazonS3Client(this.textBoxKey.Text, this.textBoxSecret.Text, config);
                }
                else if (this.checkBoxUseKeySecret.Checked && this.checkBoxUseToken.Checked)
                {
                    amazonS3Client = new AmazonS3Client(this.textBoxKey.Text, this.textBoxSecret.Text, this.textBoxToken.Text, config);
                }
                else
                {
                    amazonS3Client = new AmazonS3Client(config);
                }

                //textBoxOutput.Text = JsonConvert.SerializeObject(amazonS3Client.Config);

                var request = new GetObjectRequest
                {
                    BucketName = this.textBoxBucket.Text,
                    Key = this.textBoxFile.Text
                };

                using (GetObjectResponse response = amazonS3Client.GetObject(request))
                {
                    using (var reader = new StreamReader(response.ResponseStream))
                    {
                        this.textBoxOutput.Text = reader.ReadToEnd();
                    }
                }
            }
            catch (Exception ex)
            {
                this.textBoxOutput.Text = ex.ToString();
            }
        }
Esempio n. 26
0
 //Fact]
 public void WebProxyPrecedenceSetting()
 {
     var config = new AmazonS3Config
     {
         ProxyHost = "127.0.0.1",
         ProxyPort = 0,
         ProxyCredentials = new NetworkCredential("1", "1"),
         RegionEndpoint = RegionEndpoint.USEast1,
         UseHttp = true
     };
     var customProxy = new WebProxy("http://localhost:8888/");
     config.SetWebProxy(customProxy);
     Assert.Equal(customProxy, config.GetWebProxy()); 
 }
        public string Save(string fileName, Stream fileStream)
        {
            AmazonS3Config S3Config = new AmazonS3Config()
            {
                ServiceURL = "s3.amazonaws.com",
                CommunicationProtocol = Amazon.S3.Model.Protocol.HTTP,
            };

            using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(
                    accessKeyID, secretAccessKeyID, S3Config ))
                {
                    return UploadToAmazon(fileName, fileStream);
                }
        }
Esempio n. 28
0
        public void TestSomeRegionsResolveV4Signing()
        {
            foreach (var testRegion in testRegions)
            {
                var config = new AmazonS3Config
                {
                    RegionEndpoint = testRegion,
                    UseDualstackEndpoint = true,
                    SignatureVersion = "4"
                };

                executeSomeBucketOperations(config);
            }
        }
Esempio n. 29
0
        public S3Wrapper(string awsID, string awsKey, string locationConstraint, string servername, string storageClass, bool useSSL)
        {
            AmazonS3Config cfg = new AmazonS3Config();

            cfg.UseHttp = !useSSL;
            cfg.ServiceURL = (useSSL ? "https://" : "http://") + servername;
            cfg.UserAgent = "Duplicati v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + " S3 client with AWS SDK v" + cfg.GetType().Assembly.GetName().Version.ToString();
            cfg.BufferSize = (int)Duplicati.Library.Utility.Utility.DEFAULT_BUFFER_SIZE;

            m_client = new Amazon.S3.AmazonS3Client(awsID, awsKey, cfg);

            m_locationConstraint = locationConstraint;
            m_storageClass = storageClass;
        }
Esempio n. 30
0
        public void Get_S3_Client_Sets_Credentails_And_Config() {
            var s3Config = new AmazonS3Config() {
                RegionEndpoint = Amazon.RegionEndpoint.USEast1,
            };
            
            var mockCredentials = new Mock<AWSCredentials>();

            var config = new AmazonS3CabinetConfig(ValidBucketName, s3Config, mockCredentials.Object);

            var client = factory.GetS3Client(config) as AmazonS3Client;

            Assert.NotNull(client);
            Assert.Equal(s3Config, client.Config);
        }
Esempio n. 31
0
        public void SetTopicConfigurationTests()
        {
            var s3Config = new AmazonS3Config();
            using (var s3Client = new AmazonS3Client(s3Config))
            using (var snsClient = new AmazonSimpleNotificationServiceClient())
            {
                var snsCreateResponse = snsClient.CreateTopic("events-test-" + DateTime.Now.Ticks);
                var bucketName = S3TestUtils.CreateBucket(s3Client);

                try
                {
                    snsClient.AuthorizeS3ToPublish(snsCreateResponse.TopicArn, bucketName);

                    PutBucketNotificationRequest putRequest = new PutBucketNotificationRequest
                    {
                        BucketName = bucketName,
                        TopicConfigurations = new List<TopicConfiguration>
                        {
                            new TopicConfiguration
                            {
                                Id = "the-topic-test",
                                Topic = snsCreateResponse.TopicArn,
                                Events = new List<EventType>{EventType.ObjectCreatedPut}
                            }
                        }
                    };

                    s3Client.PutBucketNotification(putRequest);

                    var getResponse = s3Client.GetBucketNotification(bucketName);

                    Assert.AreEqual(1, getResponse.TopicConfigurations.Count);
                    Assert.AreEqual(1, getResponse.TopicConfigurations[0].Events.Count);
                    Assert.AreEqual(EventType.ObjectCreatedPut, getResponse.TopicConfigurations[0].Events[0]);

#pragma warning disable 618
                    Assert.AreEqual("s3:ObjectCreated:Put", getResponse.TopicConfigurations[0].Event);
#pragma warning restore 618
                    Assert.AreEqual("the-topic-test", getResponse.TopicConfigurations[0].Id);
                    Assert.AreEqual(snsCreateResponse.TopicArn, getResponse.TopicConfigurations[0].Topic);

                }
                finally
                {
                    snsClient.DeleteTopic(snsCreateResponse.TopicArn);
                    AmazonS3Util.DeleteS3BucketWithObjects(s3Client, bucketName);
                }
            }
        }
Esempio n. 32
0
 //[Fact]
 public void HostPortPrecedenceSetting()
 {
     var customProxy = new WebProxy("http://localhost:8889/");
     var config = new AmazonS3Config();
     config.SetWebProxy(customProxy);
     config.ProxyHost = "127.0.0.1";
     config.ProxyPort = 8888;
     config.ProxyCredentials = new NetworkCredential("1", "1");
     config.RegionEndpoint = RegionEndpoint.USEast1;
     
     var setProxy = new WebProxy(config.ProxyHost, config.ProxyPort);
     config.SetWebProxy(setProxy);
     var c = config.GetWebProxy();
     Assert.Equal(setProxy, config.GetWebProxy());
 }
Esempio n. 33
0
        public S3Wrapper(string awsID, string awsKey, string locationConstraint, string servername, bool useRRS, bool useSSL)
        {
            AmazonS3Config cfg = new AmazonS3Config();

            cfg.CommunicationProtocol = useSSL ? Amazon.S3.Model.Protocol.HTTPS : Amazon.S3.Model.Protocol.HTTP;
            cfg.ServiceURL = servername;
            cfg.UserAgent = "Duplicati v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + " S3 client with AWS SDK v" + cfg.GetType().Assembly.GetName().Version.ToString();
            cfg.UseSecureStringForAwsSecretKey = false;
            cfg.BufferSize = (int)Duplicati.Library.Utility.Utility.DEFAULT_BUFFER_SIZE;

            m_client = new Amazon.S3.AmazonS3Client(awsID, awsKey, cfg);

            m_locationConstraint = locationConstraint;
            m_useRRS = useRRS;
        }
Esempio n. 34
-1
 public S3()
 {
     ConfigHandler ch = new ConfigHandler();
     Crypto crypto = new Crypto();
     var accessKey = crypto.DecryptString(ch.GetConfig("S3accessKey"));
     var secretKey = crypto.DecryptString(ch.GetConfig("S3secretKey"));
     String url = ch.GetConfig("S3url");
     _bucket = ch.GetConfig("S3Bucket");
     var config = new AmazonS3Config {ServiceURL = url};
     _client = AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey, config) as AmazonS3Client;
 }