Example #1
0
        public AmazonStorageProvider(AmazonProviderOptions options)
        {
            var S3Config = new AmazonS3Config
            {
                ServiceURL = _serviceUrl
            };

            _bucket   = options.Bucket;
            _s3Client = new AmazonS3Client(options.PublicKey, options.SecretKey, S3Config);
        }
        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);
        }
Example #3
0
        public AmazonStorageProvider(AmazonProviderOptions options)
        {
            _serviceUrl = string.IsNullOrEmpty(options.ServiceUrl) ? DefaultServiceUrl : options.ServiceUrl;
            _bucket     = options.Bucket;
            _serverSideEncryptionMethod = options.ServerSideEncryptionMethod;

            var S3Config = new AmazonS3Config
            {
                ServiceURL = _serviceUrl
            };

            _s3Client = new AmazonS3Client(ReadAwsCredentials(options), S3Config);
        }
Example #4
0
        public AmazonStorageProvider(AmazonProviderOptions options)
        {
            _serviceUrl = string.IsNullOrEmpty(options.ServiceUrl) ? DefaultServiceUrl : options.ServiceUrl;
            _bucket     = options.Bucket;
            _serverSideEncryptionMethod = options.ServerSideEncryptionMethod;
            _chunkedThreshold           = options.ChunkedUploadThreshold;

            var S3Config = new AmazonS3Config
            {
                ServiceURL = _serviceUrl,
                Timeout    = options.Timeout ?? ClientConfig.MaxTimeout,
            };

            _s3Client = new AmazonS3Client(ReadAwsCredentials(options), S3Config);
        }
Example #5
0
        private AWSCredentials ReadAwsCredentials(AmazonProviderOptions options)
        {
            if (!string.IsNullOrWhiteSpace(options.ProfileName))
            {
                var credentialProfileStoreChain = new CredentialProfileStoreChain();
                if (credentialProfileStoreChain.TryGetAWSCredentials(options.ProfileName, out AWSCredentials defaultCredentials))
                {
                    return(defaultCredentials);
                }

                throw new AmazonClientException("Unable to find a default profile in CredentialProfileStoreChain.");
            }

            if (!string.IsNullOrEmpty(options.PublicKey) && !string.IsNullOrWhiteSpace(options.SecretKey))
            {
                return(new BasicAWSCredentials(options.PublicKey, options.SecretKey));
            }

            return(FallbackCredentialsFactory.GetCredentials());
        }