public static DiskImageImporter FromManifest(AWSCredentials credentials,
RegionEndpoint region,
string bucketName,
string manifestFileKey,
bool resumingUpload)
{
try
{
var importer = new DiskImageImporter(credentials, region, bucketName)
{
ManifestFileKey = manifestFileKey
};
importer.DeserializeManifestFromS3();
if (resumingUpload)
importer.DetermineRemainingUploads();
return importer;
}
catch (XmlException e)
{
throw new DiskImageImporterException(DiskImportErrorStage.ManifestInspection,
"Failed to deserialize the downloaded manifest",
e);
}
catch (Exception e)
{
var msg = string.Format(CultureInfo.InvariantCulture,
"Failed to download the specified manifest from bucket {0} with key {1}",
bucketName,
manifestFileKey);
throw new DiskImageImporterException(DiskImportErrorStage.ManifestInspection, msg, e);
}
}