Esempio n. 1
0
        /// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
        /// <returns>The object Value.</returns>
        internal static ClusterUpgradeProgressObject GetFromJsonProperties(JsonReader reader)
        {
            var codeVersion                         = default(string);
            var configVersion                       = default(string);
            var upgradeDomains                      = default(IEnumerable <UpgradeDomainInfo>);
            var upgradeUnits                        = default(IEnumerable <UpgradeUnitInfo>);
            var upgradeState                        = default(UpgradeState?);
            var nextUpgradeDomain                   = default(string);
            var rollingUpgradeMode                  = default(UpgradeMode?);
            var upgradeDescription                  = default(ClusterUpgradeDescriptionObject);
            var upgradeDurationInMilliseconds       = default(string);
            var upgradeDomainDurationInMilliseconds = default(string);
            var unhealthyEvaluations                = default(IEnumerable <HealthEvaluationWrapper>);
            var currentUpgradeDomainProgress        = default(CurrentUpgradeDomainProgressInfo);
            var currentUpgradeUnitsProgress         = default(CurrentUpgradeUnitsProgressInfo);
            var startTimestampUtc                   = default(string);
            var failureTimestampUtc                 = default(string);
            var failureReason                       = default(FailureReason?);
            var upgradeDomainProgressAtFailure      = default(FailedUpgradeDomainProgressObject);
            var isNodeByNode                        = default(bool?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("CodeVersion", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    codeVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("ConfigVersion", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    configVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeDomains", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeDomains = reader.ReadList(UpgradeDomainInfoConverter.Deserialize);
                }
                else if (string.Compare("UpgradeUnits", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeUnits = reader.ReadList(UpgradeUnitInfoConverter.Deserialize);
                }
                else if (string.Compare("UpgradeState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeState = UpgradeStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NextUpgradeDomain", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    nextUpgradeDomain = reader.ReadValueAsString();
                }
                else if (string.Compare("RollingUpgradeMode", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    rollingUpgradeMode = UpgradeModeConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeDescription", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeDescription = ClusterUpgradeDescriptionObjectConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeDurationInMilliseconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeDurationInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeDomainDurationInMilliseconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeDomainDurationInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else if (string.Compare("CurrentUpgradeDomainProgress", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    currentUpgradeDomainProgress = CurrentUpgradeDomainProgressInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("CurrentUpgradeUnitsProgress", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    currentUpgradeUnitsProgress = CurrentUpgradeUnitsProgressInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("StartTimestampUtc", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    startTimestampUtc = reader.ReadValueAsString();
                }
                else if (string.Compare("FailureTimestampUtc", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    failureTimestampUtc = reader.ReadValueAsString();
                }
                else if (string.Compare("FailureReason", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    failureReason = FailureReasonConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeDomainProgressAtFailure", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeDomainProgressAtFailure = FailedUpgradeDomainProgressObjectConverter.Deserialize(reader);
                }
                else if (string.Compare("IsNodeByNode", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    isNodeByNode = reader.ReadValueAsBool();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ClusterUpgradeProgressObject(
                       codeVersion: codeVersion,
                       configVersion: configVersion,
                       upgradeDomains: upgradeDomains,
                       upgradeUnits: upgradeUnits,
                       upgradeState: upgradeState,
                       nextUpgradeDomain: nextUpgradeDomain,
                       rollingUpgradeMode: rollingUpgradeMode,
                       upgradeDescription: upgradeDescription,
                       upgradeDurationInMilliseconds: upgradeDurationInMilliseconds,
                       upgradeDomainDurationInMilliseconds: upgradeDomainDurationInMilliseconds,
                       unhealthyEvaluations: unhealthyEvaluations,
                       currentUpgradeDomainProgress: currentUpgradeDomainProgress,
                       currentUpgradeUnitsProgress: currentUpgradeUnitsProgress,
                       startTimestampUtc: startTimestampUtc,
                       failureTimestampUtc: failureTimestampUtc,
                       failureReason: failureReason,
                       upgradeDomainProgressAtFailure: upgradeDomainProgressAtFailure,
                       isNodeByNode: isNodeByNode));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
        /// <returns>The object Value.</returns>
        internal static ApplicationUpgradeProgressInfo GetFromJsonProperties(JsonReader reader)
        {
            var name     = default(string);
            var typeName = default(string);
            var targetApplicationTypeVersion = default(string);
            var upgradeDomains                      = default(IEnumerable <UpgradeDomainInfo>);
            var upgradeState                        = default(UpgradeState?);
            var nextUpgradeDomain                   = default(string);
            var rollingUpgradeMode                  = default(UpgradeMode?);
            var upgradeDescription                  = default(ApplicationUpgradeDescription);
            var upgradeDurationInMilliseconds       = default(string);
            var upgradeDomainDurationInMilliseconds = default(string);
            var unhealthyEvaluations                = default(IEnumerable <HealthEvaluationWrapper>);
            var currentUpgradeDomainProgress        = default(CurrentUpgradeDomainProgressInfo);
            var startTimestampUtc                   = default(string);
            var failureTimestampUtc                 = default(string);
            var failureReason                       = default(FailureReason?);
            var upgradeDomainProgressAtFailure      = default(FailureUpgradeDomainProgressInfo);
            var upgradeStatusDetails                = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = reader.ReadValueAsString();
                }
                else if (string.Compare("TypeName", propName, StringComparison.Ordinal) == 0)
                {
                    typeName = reader.ReadValueAsString();
                }
                else if (string.Compare("TargetApplicationTypeVersion", propName, StringComparison.Ordinal) == 0)
                {
                    targetApplicationTypeVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeDomains", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDomains = reader.ReadList(UpgradeDomainInfoConverter.Deserialize);
                }
                else if (string.Compare("UpgradeState", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeState = UpgradeStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NextUpgradeDomain", propName, StringComparison.Ordinal) == 0)
                {
                    nextUpgradeDomain = reader.ReadValueAsString();
                }
                else if (string.Compare("RollingUpgradeMode", propName, StringComparison.Ordinal) == 0)
                {
                    rollingUpgradeMode = UpgradeModeConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeDescription", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDescription = ApplicationUpgradeDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeDurationInMilliseconds", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDurationInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeDomainDurationInMilliseconds", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDomainDurationInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else if (string.Compare("CurrentUpgradeDomainProgress", propName, StringComparison.Ordinal) == 0)
                {
                    currentUpgradeDomainProgress = CurrentUpgradeDomainProgressInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("StartTimestampUtc", propName, StringComparison.Ordinal) == 0)
                {
                    startTimestampUtc = reader.ReadValueAsString();
                }
                else if (string.Compare("FailureTimestampUtc", propName, StringComparison.Ordinal) == 0)
                {
                    failureTimestampUtc = reader.ReadValueAsString();
                }
                else if (string.Compare("FailureReason", propName, StringComparison.Ordinal) == 0)
                {
                    failureReason = FailureReasonConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeDomainProgressAtFailure", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDomainProgressAtFailure = FailureUpgradeDomainProgressInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeStatusDetails", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeStatusDetails = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationUpgradeProgressInfo(
                       name: name,
                       typeName: typeName,
                       targetApplicationTypeVersion: targetApplicationTypeVersion,
                       upgradeDomains: upgradeDomains,
                       upgradeState: upgradeState,
                       nextUpgradeDomain: nextUpgradeDomain,
                       rollingUpgradeMode: rollingUpgradeMode,
                       upgradeDescription: upgradeDescription,
                       upgradeDurationInMilliseconds: upgradeDurationInMilliseconds,
                       upgradeDomainDurationInMilliseconds: upgradeDomainDurationInMilliseconds,
                       unhealthyEvaluations: unhealthyEvaluations,
                       currentUpgradeDomainProgress: currentUpgradeDomainProgress,
                       startTimestampUtc: startTimestampUtc,
                       failureTimestampUtc: failureTimestampUtc,
                       failureReason: failureReason,
                       upgradeDomainProgressAtFailure: upgradeDomainProgressAtFailure,
                       upgradeStatusDetails: upgradeStatusDetails));
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
        /// <returns>The object Value.</returns>
        internal static ComposeDeploymentUpgradeProgressInfo GetFromJsonProperties(JsonReader reader)
        {
            var deploymentName       = default(string);
            var applicationName      = default(string);
            var upgradeState         = default(ComposeDeploymentUpgradeState?);
            var upgradeStatusDetails = default(string);
            var upgradeKind          = default(UpgradeKind?);
            var rollingUpgradeMode   = default(UpgradeMode?);
            var forceRestart         = default(bool?);
            var upgradeReplicaSetCheckTimeoutInSeconds = default(long?);
            var monitoringPolicy             = default(MonitoringPolicyDescription);
            var applicationHealthPolicy      = default(ApplicationHealthPolicy);
            var targetApplicationTypeVersion = default(string);
            var upgradeDuration = default(string);
            var currentUpgradeDomainDuration    = default(string);
            var applicationUnhealthyEvaluations = default(IEnumerable <HealthEvaluationWrapper>);
            var currentUpgradeDomainProgress    = default(CurrentUpgradeDomainProgressInfo);
            var startTimestampUtc               = default(string);
            var failureTimestampUtc             = default(string);
            var failureReason                   = default(FailureReason?);
            var upgradeDomainProgressAtFailure  = default(FailureUpgradeDomainProgressInfo);
            var applicationUpgradeStatusDetails = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("DeploymentName", propName, StringComparison.Ordinal) == 0)
                {
                    deploymentName = reader.ReadValueAsString();
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationName = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeState", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeState = ComposeDeploymentUpgradeStateConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeStatusDetails", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeStatusDetails = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeKind", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeKind = UpgradeKindConverter.Deserialize(reader);
                }
                else if (string.Compare("RollingUpgradeMode", propName, StringComparison.Ordinal) == 0)
                {
                    rollingUpgradeMode = UpgradeModeConverter.Deserialize(reader);
                }
                else if (string.Compare("ForceRestart", propName, StringComparison.Ordinal) == 0)
                {
                    forceRestart = reader.ReadValueAsBool();
                }
                else if (string.Compare("UpgradeReplicaSetCheckTimeoutInSeconds", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeReplicaSetCheckTimeoutInSeconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("MonitoringPolicy", propName, StringComparison.Ordinal) == 0)
                {
                    monitoringPolicy = MonitoringPolicyDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationHealthPolicy", propName, StringComparison.Ordinal) == 0)
                {
                    applicationHealthPolicy = ApplicationHealthPolicyConverter.Deserialize(reader);
                }
                else if (string.Compare("TargetApplicationTypeVersion", propName, StringComparison.Ordinal) == 0)
                {
                    targetApplicationTypeVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeDuration", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDuration = reader.ReadValueAsString();
                }
                else if (string.Compare("CurrentUpgradeDomainDuration", propName, StringComparison.Ordinal) == 0)
                {
                    currentUpgradeDomainDuration = reader.ReadValueAsString();
                }
                else if (string.Compare("ApplicationUnhealthyEvaluations", propName, StringComparison.Ordinal) == 0)
                {
                    applicationUnhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else if (string.Compare("CurrentUpgradeDomainProgress", propName, StringComparison.Ordinal) == 0)
                {
                    currentUpgradeDomainProgress = CurrentUpgradeDomainProgressInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("StartTimestampUtc", propName, StringComparison.Ordinal) == 0)
                {
                    startTimestampUtc = reader.ReadValueAsString();
                }
                else if (string.Compare("FailureTimestampUtc", propName, StringComparison.Ordinal) == 0)
                {
                    failureTimestampUtc = reader.ReadValueAsString();
                }
                else if (string.Compare("FailureReason", propName, StringComparison.Ordinal) == 0)
                {
                    failureReason = FailureReasonConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeDomainProgressAtFailure", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDomainProgressAtFailure = FailureUpgradeDomainProgressInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationUpgradeStatusDetails", propName, StringComparison.Ordinal) == 0)
                {
                    applicationUpgradeStatusDetails = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ComposeDeploymentUpgradeProgressInfo(
                       deploymentName: deploymentName,
                       applicationName: applicationName,
                       upgradeState: upgradeState,
                       upgradeStatusDetails: upgradeStatusDetails,
                       upgradeKind: upgradeKind,
                       rollingUpgradeMode: rollingUpgradeMode,
                       forceRestart: forceRestart,
                       upgradeReplicaSetCheckTimeoutInSeconds: upgradeReplicaSetCheckTimeoutInSeconds,
                       monitoringPolicy: monitoringPolicy,
                       applicationHealthPolicy: applicationHealthPolicy,
                       targetApplicationTypeVersion: targetApplicationTypeVersion,
                       upgradeDuration: upgradeDuration,
                       currentUpgradeDomainDuration: currentUpgradeDomainDuration,
                       applicationUnhealthyEvaluations: applicationUnhealthyEvaluations,
                       currentUpgradeDomainProgress: currentUpgradeDomainProgress,
                       startTimestampUtc: startTimestampUtc,
                       failureTimestampUtc: failureTimestampUtc,
                       failureReason: failureReason,
                       upgradeDomainProgressAtFailure: upgradeDomainProgressAtFailure,
                       applicationUpgradeStatusDetails: applicationUpgradeStatusDetails));
        }