Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Provide a default for vm extension settings #2269

Merged
merged 1 commit into from
Aug 18, 2022
Merged
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
16 changes: 11 additions & 5 deletions src/ApiService/ApiService/onefuzzlib/VmExtensionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public class VMExtensionWrapper {
Publisher.EnsureNotNull("Publisher required for VirtualMachineExtension");
TypeHandlerVersion.EnsureNotNull("TypeHandlerVersion required for VirtualMachineExtension");
AutoUpgradeMinorVersion.EnsureNotNull("AutoUpgradeMinorVersion required for VirtualMachineExtension");
Settings.EnsureNotNull("Settings required for VirtualMachineExtension");

var settings = Settings ?? new BinaryData(new Dictionary<string, string>());
var protectedSettings = ProtectedSettings ?? new BinaryData(new Dictionary<string, string>());

return (Name!, new VirtualMachineExtensionData(Location.Value) {
TypePropertiesType = TypePropertiesType,
Expand All @@ -31,8 +33,8 @@ public class VMExtensionWrapper {
AutoUpgradeMinorVersion = AutoUpgradeMinorVersion,
EnableAutomaticUpgrade = EnableAutomaticUpgrade,
ForceUpdateTag = ForceUpdateTag,
Settings = Settings,
ProtectedSettings = ProtectedSettings
Settings = settings,
ProtectedSettings = protectedSettings
});
}

Expand All @@ -42,6 +44,10 @@ public VirtualMachineScaleSetExtensionData GetAsVirtualMachineScaleSetExtension(
Publisher.EnsureNotNull("Publisher required for VirtualMachineScaleSetExtension");
TypeHandlerVersion.EnsureNotNull("TypeHandlerVersion required for VirtualMachineScaleSetExtension");
AutoUpgradeMinorVersion.EnsureNotNull("AutoUpgradeMinorVersion required for VirtualMachineScaleSetExtension");

var settings = Settings ?? new BinaryData(new Dictionary<string, string>());
var protectedSettings = ProtectedSettings ?? new BinaryData(new Dictionary<string, string>());

return new VirtualMachineScaleSetExtensionData() {
Name = Name,
TypePropertiesType = TypePropertiesType,
Expand All @@ -50,8 +56,8 @@ public VirtualMachineScaleSetExtensionData GetAsVirtualMachineScaleSetExtension(
AutoUpgradeMinorVersion = AutoUpgradeMinorVersion,
EnableAutomaticUpgrade = EnableAutomaticUpgrade,
ForceUpdateTag = ForceUpdateTag,
Settings = Settings,
ProtectedSettings = ProtectedSettings
Settings = settings,
ProtectedSettings = protectedSettings
};
}
}
Expand Down