internal static unsafe RollingUpgradePolicyDescription FromNative(IntPtr policyPtr) { if (policyPtr == IntPtr.Zero) { return(null); } var description = new RollingUpgradePolicyDescription(); description.FromNativeHelper(policyPtr); return(description); }
internal static unsafe ApplicationUpgradeDescription FromNative(IntPtr descriptionPtr) { if (descriptionPtr == IntPtr.Zero) { return(null); } var castedPtr = (NativeTypes.FABRIC_APPLICATION_UPGRADE_DESCRIPTION *)descriptionPtr; var description = new ApplicationUpgradeDescription(); description.ApplicationName = NativeTypes.FromNativeUri(castedPtr->ApplicationName); description.TargetApplicationTypeVersion = NativeTypes.FromNativeString(castedPtr->TargetApplicationTypeVersion); if (castedPtr->ApplicationParameters != IntPtr.Zero) { var castedParamsPtr = (NativeTypes.FABRIC_APPLICATION_PARAMETER_LIST *)castedPtr->ApplicationParameters; var parametersList = ApplicationParameterList.FromNative(castedParamsPtr); description.ApplicationParameters = parametersList.AsNameValueCollection(); } if (castedPtr->UpgradeKind == NativeTypes.FABRIC_APPLICATION_UPGRADE_KIND.FABRIC_APPLICATION_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 = MonitoredRollingApplicationUpgradePolicyDescription.FromNative(castedPtr->UpgradePolicyDescription); } else { policy = RollingUpgradePolicyDescription.FromNative(castedPtr->UpgradePolicyDescription); } description.UpgradePolicyDescription = policy; } return(description); }
internal static unsafe ComposeDeploymentUpgradeDescriptionWrapper FromNative(IntPtr descriptionPtr) { if (descriptionPtr == IntPtr.Zero) { return(null); } var castedPtr = (NativeTypes.FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_DESCRIPTION *)descriptionPtr; // Mandatory if (castedPtr->UpgradePolicyDescription == IntPtr.Zero) { return(null); } 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 = MonitoredRollingApplicationUpgradePolicyDescription.FromNative(castedPtr->UpgradePolicyDescription); } else { policy = RollingUpgradePolicyDescription.FromNative(castedPtr->UpgradePolicyDescription); } var result = new ComposeDeploymentUpgradeDescriptionWrapper( NativeTypes.FromNativeString(castedPtr->DeploymentName), NativeTypes.FromNativeStringList(castedPtr->ComposeFilePaths).ToArray(), policy ); result.ContainerRegistryUserName = NativeTypes.FromNativeString(castedPtr->ContainerRegistryUserName); result.ContainerRegistryPassword = NativeTypes.FromNativeString(castedPtr->ContainerRegistryPassword); result.IsRegistryPasswordEncrypted = NativeTypes.FromBOOLEAN(castedPtr->IsRegistryPasswordEncrypted); return(result); }
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); }