internal static void Validate(FabricUpgradeDescription description) { Requires.Argument <UpgradePolicyDescription>( "UpgradePolicyDescription", description.UpgradePolicyDescription).NotNull(); description.UpgradePolicyDescription.Validate(); }
internal static unsafe FabricUpgradeDescription FromNative(IntPtr descriptionPtr) { if (descriptionPtr == IntPtr.Zero) { return(null); } var castedPtr = (NativeTypes.FABRIC_UPGRADE_DESCRIPTION *)descriptionPtr; var description = new FabricUpgradeDescription(); description.TargetCodeVersion = NativeTypes.FromNativeString(castedPtr->CodeVersion); description.TargetConfigVersion = NativeTypes.FromNativeString(castedPtr->ConfigVersion); if (castedPtr->UpgradeKind == NativeTypes.FABRIC_UPGRADE_KIND.FABRIC_UPGRADE_KIND_ROLLING && castedPtr->UpgradePolicyDescription != IntPtr.Zero) { RollingUpgradePolicyDescription policy = null; var castedPolicyPtr = (NativeTypes.FABRIC_ROLLING_UPGRADE_POLICY_DESCRIPTION *)castedPtr->UpgradePolicyDescription; if (castedPolicyPtr->RollingUpgradeMode == NativeTypes.FABRIC_ROLLING_UPGRADE_MODE.FABRIC_ROLLING_UPGRADE_MODE_MONITORED) { policy = MonitoredRollingFabricUpgradePolicyDescription.FromNative(castedPtr->UpgradePolicyDescription); } else { policy = RollingUpgradePolicyDescription.FromNative(castedPtr->UpgradePolicyDescription); } description.UpgradePolicyDescription = policy; } return(description); }