Closed blairlearn closed 3 weeks ago
RetentionPeriod
BucketName
Region
web.config
Instead of creating a job to clean up old documents, set an 'Expires' header with a suitable offset and let AWS do the work.
CTSPrintRequestHandler
GenerateCachedPage()
GetCachedContent()
${generatePrintURL}
PrintCacheManager::Save()
mailto:
PrintCacheManager
Save()
Key
trialIDs
searchCriteria
PutObjectRequest()
Replace the body of the method with code along the lines of
// Create a client AmazonS3Client client = new AmazonS3Client(); // Preserve metadata MetadataCollection metadata = new MetadataCollection(); Add("trial-id-list", trialIDString); Add("search-criteria", searchCriteriaString) // Create a PutObject request PutObjectRequest request = new PutObjectRequest { BucketName = "bucket-name", Key = "public-guid-like-what-we-have-now", ContentBody = "Big blob of HTML", ContentType = "text/html", Metadata = metadata }; // Put object PutObjectResponse response = client.PutObject(request);
AmazonS3Client
GetPage()
GetObject()
GetObjectRequest
Convert response to string. Something like
// Create a client AmazonS3Client client = new AmazonS3Client(); // Create a GetObject request GetObjectRequest request = new GetObjectRequest { BucketName = "bucket-name", Key = "public-guid-like-what-we-have-now" }; // Issue request and remember to dispose of the response using (GetObjectResponse response = client.GetObject(request)) { using (StreamReader reader = new StreamReader(response.ResponseStream)) { string contents = reader.ReadToEnd(); } }
CreatePrintIdDataTable()
ESTIMATE TBD
Refactor to replace MS SQL Server with an S3 bucket
RetentionPeriod
- (integer) The number of days from generation before the document is deleted.BucketName
- The name of the bucket where generated pages are stored.Region
??? - Not clear if this is needed separately, or just part of the bucket name. (I think the latter)web.config
.Clean up expired documents
Instead of creating a job to clean up old documents, set an 'Expires' header with a suitable offset and let AWS do the work.
Code Changes
RetentionPeriod
- (integer) The number of days from generation before the document is deleted.BucketName
- The name of the bucket where generated pages are stored.CTSPrintRequestHandler
GenerateCachedPage()
GetCachedContent()
${generatePrintURL}
in the document body with the reference URL.PrintCacheManager::Save()
GetCachedContent()
GenerateCachedPage()
.mailto:
link. (This is now part of the page template.)PrintCacheManager
Save()
Key
parameter.trialIDs
list andsearchCriteria
object to strings.trialIDs
list andsearchCriteria
object as metadata viaPutObjectRequest()
callReplace the body of the method with code along the lines of
AmazonS3Client
constructor come from a configuration file.GetPage()
GetObject()
/GetObjectRequest
to retrieve the document.Convert response to string. Something like
AmazonS3Client
constructor come from a configuration file.CreatePrintIdDataTable()
Resources:
Prerequisites
Sub-Tasks
Notes