Commit 0fe813e0 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Sprint/2021-07' into 'master'

Sprint/2021 07

See merge request !7
parents cdeb9301 a5db019d
......@@ -255,5 +255,55 @@ public ResourceTypeWaterbutlerRdsS3(string name, IConfiguration gConfig, Resourc
{
await _rdsS3EcsManager.SetBucketQuota(options["bucketname"], quota);
}
public override async Task<Uri> GetEntryDownloadUrl(string key, string version = null, Dictionary<string, string> options = null)
{
return await Task.Run(() =>
{
var amazonConfig = new AmazonS3Config
{
ServiceURL = options["endpoint"],
ForcePathStyle = true
};
using (var client = new AmazonS3Client(_accessKey, _secretKey, amazonConfig))
{
var presignedUrl = client.GetPreSignedURL(new GetPreSignedUrlRequest()
{
BucketName = options["bucketname"],
Key = key,
Verb = HttpVerb.GET,
Protocol = Protocol.HTTP,
// For now, expiry of a day is set, but this might be up to debate
Expires = DateTime.UtcNow.AddHours(24)
});
return new Uri(presignedUrl);
}
});
}
public override async Task<Uri> GetEntryStoreUrl(string key, string version = null, Dictionary<string, string> options = null)
{
return await Task.Run(() =>
{
var amazonConfig = new AmazonS3Config
{
ServiceURL = options["endpoint"],
ForcePathStyle = true
};
using (var client = new AmazonS3Client(_accessKey, _secretKey, amazonConfig))
{
var presignedUrl = client.GetPreSignedURL(new GetPreSignedUrlRequest()
{
BucketName = options["bucketname"],
Key = key,
Verb = HttpVerb.PUT,
Protocol = Protocol.HTTP,
// For now, expiry of a day is set, but this might be up to debate
Expires = DateTime.UtcNow.AddHours(24)
});
return new Uri(presignedUrl);
}
});
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment