From fb9d27111076b4c66c89f21c49f6e381dfc26a97 Mon Sep 17 00:00:00 2001 From: "Pohsiang (John) Hsu" Date: Mon, 12 Feb 2024 10:29:56 -0800 Subject: [PATCH] storage base migration didn't parse encryption options correctly --- migrationTool/StorageOptionsBinder.cs | 18 ++++++++++++++---- migrationTool/contracts/StorageOptions.cs | 4 +--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/migrationTool/StorageOptionsBinder.cs b/migrationTool/StorageOptionsBinder.cs index 2fa908c..4b652e9 100644 --- a/migrationTool/StorageOptionsBinder.cs +++ b/migrationTool/StorageOptionsBinder.cs @@ -109,6 +109,12 @@ This is specific to the cloud you are migrating to. description: "The key vault to store encryption keys." ); + private readonly Option _keyUri = new( + aliases: new[] { "--key-uri" }, + () => "/.clearkeys?kid=${KeyId}", + description: "The key URI to use for requesting the key. This is saved to the manifest." + ); + const int SegmentDurationInSeconds = 2; public StorageOptionsBinder() @@ -154,6 +160,7 @@ public Command GetCommand(string name, string description) command.AddOption(_batchSize); command.AddOption(_encryptContent); command.AddOption(_keyVaultUri); + command.AddOption(_keyUri); return command; } @@ -175,10 +182,13 @@ protected override StorageOptions GetBoundValue(BindingContext bindingContext) bindingContext.ParseResult.GetValueForOption(_breakOutputLease), bindingContext.ParseResult.GetValueForOption(_keepWorkingFolder), SegmentDurationInSeconds, - bindingContext.ParseResult.GetValueForOption(_batchSize), - bindingContext.ParseResult.GetValueForOption(_encryptContent), - bindingContext.ParseResult.GetValueForOption(_keyVaultUri) - ); + bindingContext.ParseResult.GetValueForOption(_batchSize) + ) + { + EncryptContent = bindingContext.ParseResult.GetValueForOption(_encryptContent), + KeyUri = bindingContext.ParseResult.GetValueForOption(_keyUri), + KeyVaultUri = bindingContext.ParseResult.GetValueForOption(_keyVaultUri) + }; } public StorageOptions GetValue(BindingContext bindingContext) => GetBoundValue(bindingContext); diff --git a/migrationTool/contracts/StorageOptions.cs b/migrationTool/contracts/StorageOptions.cs index 353a573..fcafe7e 100644 --- a/migrationTool/contracts/StorageOptions.cs +++ b/migrationTool/contracts/StorageOptions.cs @@ -14,9 +14,7 @@ public record StorageOptions( bool BreakOutputLease, bool KeepWorkingFolder, int SegmentDuration, - int BatchSize, - bool _encryptContent, - Uri? _keyVaultUri) + int BatchSize) : MigratorOptions( AccountName, StoragePath,