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

Commit

Permalink
Provide a default for settings (#2269)
Browse files Browse the repository at this point in the history
  • Loading branch information
tevoinea authored Aug 18, 2022
1 parent e74671b commit ac54c57
Showing 1 changed file with 11 additions and 5 deletions.
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

0 comments on commit ac54c57

Please sign in to comment.