/// <summary> /// <para> /// Uploads the specified file to Amazon Glacier for archival storage in the /// specified vault in the specified user's account. For small archives, this /// method uploads the archive directly to Glacier. For larger archives, /// this method uses Glacier's multipart upload API to split the upload /// into multiple parts for better error recovery if any errors are /// encountered while streaming the data to Amazon Glacier. /// </para> /// </summary> /// <param name="vaultName">The name of the vault to download the archive from.</param> /// <param name="archiveDescription">A description for the archive.</param> /// <param name="filepath">The file path to the file to upload.</param> /// <param name="options">Additional options that can be used for the upload.</param> /// <returns>The results of the upload including the archive ID.</returns> public UploadResult Upload(string vaultName, string archiveDescription, string filepath, UploadOptions options) { FileInfo fi = new FileInfo(filepath); BaseUploadCommand command; if (fi.Length > MULTIPART_UPLOAD_SIZE_THRESHOLD) command = new MultipartUploadCommand(this, vaultName, archiveDescription, filepath, options); else command = new SinglepartUploadCommand(this, vaultName, archiveDescription, filepath, options); command.Execute(); return command.UploadResult; }
/// <summary> /// <para> /// Uploads the specified file to Amazon Glacier for archival storage in the /// specified vault in the specified user's account. For small archives, this /// method uploads the archive directly to Glacier. For larger archives, /// this method uses Glacier's multipart upload API to split the upload /// into multiple parts for better error recovery if any errors are /// encountered while streaming the data to Amazon Glacier. /// </para> /// </summary> /// <param name="vaultName">The name of the vault to download the archive from.</param> /// <param name="archiveDescription">A description for the archive.</param> /// <param name="filepath">The file path to the file to upload.</param> /// <param name="options">Additional options that can be used for the upload.</param> /// <returns>The results of the upload including the archive ID.</returns> public async Task<UploadResult> UploadAsync(string vaultName, string archiveDescription, string filepath, UploadOptions options) { FileInfo fi = new FileInfo(filepath); BaseUploadCommand command; if (fi.Length > MULTIPART_UPLOAD_SIZE_THRESHOLD) command = new MultipartUploadCommand(this, vaultName, archiveDescription, filepath, options); else command = new SinglepartUploadCommand(this, vaultName, archiveDescription, filepath, options); await command.ExecuteAsync().ConfigureAwait(false); return command.UploadResult; }