コード例 #1
0
        private static IAmazonS3 GetS3Client(string awsRegion, string awsSecretAccessKeyId, string awsSecretAccessKey)
        {
            if (string.IsNullOrEmpty(awsRegion))
            {
                Devon4NetLogger.Fatal("No region provided to create the S3 client");
                throw new ArgumentException("No region provided to create the S3 client");
            }

            if (string.IsNullOrEmpty(awsSecretAccessKeyId))
            {
                Devon4NetLogger.Fatal("No awsSecretAccessKeyId provided to create the S3 client");
                throw new ArgumentException("No awsSecretAccessKeyId provided to create the S3 client");
            }

            if (string.IsNullOrEmpty(awsSecretAccessKey))
            {
                Devon4NetLogger.Fatal("No awsSecretAccessKey provided to create the S3 client");
                throw new ArgumentException("No awsSecretAccessKey provided to create the S3 client");
            }

            var region = RegionEndpoint.GetBySystemName(awsRegion);

            return(new AmazonS3Client(awsSecretAccessKeyId, awsSecretAccessKey, region));
        }