public void Init() { _config = new AwsS3ClientConfig { Endpoint = AwsTestHelpers.AWS, Bucket = "bucket", RootPath = "root/path", PrivateKey = "private", PublicKey = "public", }; _hostInfo = DreamTestHelper.CreateRandomPortHost(); }
public void Setup() { _config = new AwsS3ClientConfig { Endpoint = AwsTestHelpers.AWS, Bucket = "bucket", Delimiter = "/", RootPath = "root/path", PrivateKey = "private", PublicKey = "public", Timeout = TimeSpan.FromSeconds(30) }; _client = new AwsS3Client(_config, TaskTimerFactory.Current); MockPlug.DeregisterAll(); }
//--- Methods --- protected override Yield Start(XDoc config, ILifetimeScope container, Result result) { yield return(Coroutine.Invoke(base.Start, config, new Result())); // are we a private storage service? _private = config["sid"].Contents == "sid://mindtouch.com/2010/10/dream/s3.storage.private"; _log.DebugFormat("storage is {0}", _private ? "private" : "public"); // is the root blocked from access? _privateRoot = config["private-root"].AsBool.GetValueOrDefault(); _log.DebugFormat("storage root is {0}accessible", _privateRoot ? "not " : ""); // set up S3 client var s3Config = new AwsS3ClientConfig() { Endpoint = AwsEndpoint.GetEndpoint(config["endpoint"].AsText) ?? AwsEndpoint.Default, Bucket = config["bucket"].AsText, Delimiter = "/", RootPath = config["folder"].AsText, PrivateKey = config["privatekey"].AsText, PublicKey = config["publickey"].AsText, Timeout = TimeSpan.FromSeconds(config["timeout"].AsDouble ?? DEFAULT_S3_TIMEOUT) }; if (string.IsNullOrEmpty(s3Config.Bucket)) { throw new ArgumentException("missing configuration parameter 'bucket'"); } if (string.IsNullOrEmpty(s3Config.PrivateKey)) { throw new ArgumentException("missing configuration parameter 'privatekey'"); } if (string.IsNullOrEmpty(s3Config.PublicKey)) { throw new ArgumentException("missing configuration parameter 'publickey'"); } _s3Client = container.Resolve <IAwsS3Client>(TypedParameter.From(s3Config)); result.Return(); }
public static string[] RootedPath(this AwsS3ClientConfig config, params string[] path) { return(ArrayUtil.Concat(new[] { config.Bucket }, config.RootPath.Split('/'), path)); }