Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage base migration didn't parse encryption options correctly #236

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions migrationTool/StorageOptionsBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string?> _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()
Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions migrationTool/contracts/StorageOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public record StorageOptions(
bool BreakOutputLease,
bool KeepWorkingFolder,
int SegmentDuration,
int BatchSize,
bool _encryptContent,
Uri? _keyVaultUri)
int BatchSize)
: MigratorOptions(
AccountName,
StoragePath,
Expand Down
Loading