示例#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 UpdateClusterUpgradeDescription GetFromJsonProperties(JsonReader reader)
        {
            var upgradeKind                 = default(UpgradeType?);
            var updateDescription           = default(RollingUpgradeUpdateDescription);
            var clusterHealthPolicy         = default(ClusterHealthPolicy);
            var enableDeltaHealthEvaluation = default(bool?);
            var clusterUpgradeHealthPolicy  = default(ClusterUpgradeHealthPolicyObject);
            var applicationHealthPolicyMap  = default(ApplicationHealthPolicies);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("UpgradeKind", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeKind = UpgradeTypeConverter.Deserialize(reader);
                }
                else if (string.Compare("UpdateDescription", propName, StringComparison.Ordinal) == 0)
                {
                    updateDescription = RollingUpgradeUpdateDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("ClusterHealthPolicy", propName, StringComparison.Ordinal) == 0)
                {
                    clusterHealthPolicy = ClusterHealthPolicyConverter.Deserialize(reader);
                }
                else if (string.Compare("EnableDeltaHealthEvaluation", propName, StringComparison.Ordinal) == 0)
                {
                    enableDeltaHealthEvaluation = reader.ReadValueAsBool();
                }
                else if (string.Compare("ClusterUpgradeHealthPolicy", propName, StringComparison.Ordinal) == 0)
                {
                    clusterUpgradeHealthPolicy = ClusterUpgradeHealthPolicyObjectConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationHealthPolicyMap", propName, StringComparison.Ordinal) == 0)
                {
                    applicationHealthPolicyMap = ApplicationHealthPoliciesConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new UpdateClusterUpgradeDescription(
                       upgradeKind: upgradeKind,
                       updateDescription: updateDescription,
                       clusterHealthPolicy: clusterHealthPolicy,
                       enableDeltaHealthEvaluation: enableDeltaHealthEvaluation,
                       clusterUpgradeHealthPolicy: clusterUpgradeHealthPolicy,
                       applicationHealthPolicyMap: applicationHealthPolicyMap));
        }
        /// <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 StartClusterUpgradeDescription GetFromJsonProperties(JsonReader reader)
        {
            var codeVersion        = default(string);
            var configVersion      = default(string);
            var upgradeKind        = default(UpgradeKind?);
            var rollingUpgradeMode = default(UpgradeMode?);
            var upgradeReplicaSetCheckTimeoutInSeconds = default(long?);
            var forceRestart                = default(bool?);
            var monitoringPolicy            = default(MonitoringPolicyDescription);
            var clusterHealthPolicy         = default(ClusterHealthPolicy);
            var enableDeltaHealthEvaluation = default(bool?);
            var clusterUpgradeHealthPolicy  = default(ClusterUpgradeHealthPolicyObject);
            var applicationHealthPolicyMap  = default(ApplicationHealthPolicies);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("CodeVersion", propName, StringComparison.Ordinal) == 0)
                {
                    codeVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("ConfigVersion", propName, StringComparison.Ordinal) == 0)
                {
                    configVersion = 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("UpgradeReplicaSetCheckTimeoutInSeconds", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeReplicaSetCheckTimeoutInSeconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("ForceRestart", propName, StringComparison.Ordinal) == 0)
                {
                    forceRestart = reader.ReadValueAsBool();
                }
                else if (string.Compare("MonitoringPolicy", propName, StringComparison.Ordinal) == 0)
                {
                    monitoringPolicy = MonitoringPolicyDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("ClusterHealthPolicy", propName, StringComparison.Ordinal) == 0)
                {
                    clusterHealthPolicy = ClusterHealthPolicyConverter.Deserialize(reader);
                }
                else if (string.Compare("EnableDeltaHealthEvaluation", propName, StringComparison.Ordinal) == 0)
                {
                    enableDeltaHealthEvaluation = reader.ReadValueAsBool();
                }
                else if (string.Compare("ClusterUpgradeHealthPolicy", propName, StringComparison.Ordinal) == 0)
                {
                    clusterUpgradeHealthPolicy = ClusterUpgradeHealthPolicyObjectConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationHealthPolicyMap", propName, StringComparison.Ordinal) == 0)
                {
                    applicationHealthPolicyMap = ApplicationHealthPoliciesConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StartClusterUpgradeDescription(
                       codeVersion: codeVersion,
                       configVersion: configVersion,
                       upgradeKind: upgradeKind,
                       rollingUpgradeMode: rollingUpgradeMode,
                       upgradeReplicaSetCheckTimeoutInSeconds: upgradeReplicaSetCheckTimeoutInSeconds,
                       forceRestart: forceRestart,
                       monitoringPolicy: monitoringPolicy,
                       clusterHealthPolicy: clusterHealthPolicy,
                       enableDeltaHealthEvaluation: enableDeltaHealthEvaluation,
                       clusterUpgradeHealthPolicy: clusterUpgradeHealthPolicy,
                       applicationHealthPolicyMap: applicationHealthPolicyMap));
        }