コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="S3FileSystem"/> class.
 /// </summary>
 /// <param name="options">The provider options.</param>
 /// <param name="rootDirectory">The root directory for the current user.</param>
 public S3FileSystem(S3FileSystemOptions options, string rootDirectory)
 {
     _options = options;
     _client  = new AmazonS3Client(
         options.AwsAccessKeyId,
         options.AwsSecretAccessKey,
         RegionEndpoint.GetBySystemName(options.BucketRegion));
     Root             = new S3DirectoryEntry(rootDirectory, true);
     _transferUtility = new TransferUtility(_client);
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="S3FileSystemProvider"/> class.
        /// </summary>
        /// <param name="options">The provider options.</param>
        /// <param name="accountDirectoryQuery">Interface to query account directories.</param>
        /// <exception cref="ArgumentException">Gets thrown when the S3 credentials weren't set.</exception>
        public S3FileSystemProvider(IOptions <S3FileSystemOptions> options, IAccountDirectoryQuery accountDirectoryQuery)
        {
            _options = options.Value;
            _accountDirectoryQuery = accountDirectoryQuery;

            if (string.IsNullOrEmpty(_options.AwsAccessKeyId) ||
                string.IsNullOrEmpty(_options.AwsSecretAccessKey) ||
                string.IsNullOrEmpty(_options.BucketName) ||
                string.IsNullOrEmpty(_options.BucketRegion))
            {
                throw new ArgumentException("S3 Credentials have not been set correctly");
            }
        }