/// <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 MonitoringPolicyDescription GetFromJsonProperties(JsonReader reader)
        {
            var failureAction = default(FailureAction?);
            var healthCheckWaitDurationInMilliseconds   = default(string);
            var healthCheckStableDurationInMilliseconds = default(string);
            var healthCheckRetryTimeoutInMilliseconds   = default(string);
            var upgradeTimeoutInMilliseconds            = default(string);
            var upgradeDomainTimeoutInMilliseconds      = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("FailureAction", propName, StringComparison.Ordinal) == 0)
                {
                    failureAction = FailureActionConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthCheckWaitDurationInMilliseconds", propName, StringComparison.Ordinal) == 0)
                {
                    healthCheckWaitDurationInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthCheckStableDurationInMilliseconds", propName, StringComparison.Ordinal) == 0)
                {
                    healthCheckStableDurationInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthCheckRetryTimeoutInMilliseconds", propName, StringComparison.Ordinal) == 0)
                {
                    healthCheckRetryTimeoutInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeTimeoutInMilliseconds", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeTimeoutInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeDomainTimeoutInMilliseconds", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDomainTimeoutInMilliseconds = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new MonitoringPolicyDescription(
                       failureAction: failureAction,
                       healthCheckWaitDurationInMilliseconds: healthCheckWaitDurationInMilliseconds,
                       healthCheckStableDurationInMilliseconds: healthCheckStableDurationInMilliseconds,
                       healthCheckRetryTimeoutInMilliseconds: healthCheckRetryTimeoutInMilliseconds,
                       upgradeTimeoutInMilliseconds: upgradeTimeoutInMilliseconds,
                       upgradeDomainTimeoutInMilliseconds: upgradeDomainTimeoutInMilliseconds));
        }
コード例 #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 RollingUpgradeUpdateDescription GetFromJsonProperties(JsonReader reader)
        {
            var rollingUpgradeMode = default(UpgradeMode?);
            var forceRestart       = default(bool?);
            var replicaSetCheckTimeoutInMilliseconds = default(long?);
            var failureAction = default(FailureAction?);
            var healthCheckWaitDurationInMilliseconds   = default(string);
            var healthCheckStableDurationInMilliseconds = default(string);
            var healthCheckRetryTimeoutInMilliseconds   = default(string);
            var upgradeTimeoutInMilliseconds            = default(string);
            var upgradeDomainTimeoutInMilliseconds      = default(string);
            var instanceCloseDelayDurationInSeconds     = default(long?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("RollingUpgradeMode", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    rollingUpgradeMode = UpgradeModeConverter.Deserialize(reader);
                }
                else if (string.Compare("ForceRestart", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    forceRestart = reader.ReadValueAsBool();
                }
                else if (string.Compare("ReplicaSetCheckTimeoutInMilliseconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    replicaSetCheckTimeoutInMilliseconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("FailureAction", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    failureAction = FailureActionConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthCheckWaitDurationInMilliseconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthCheckWaitDurationInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthCheckStableDurationInMilliseconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthCheckStableDurationInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthCheckRetryTimeoutInMilliseconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthCheckRetryTimeoutInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeTimeoutInMilliseconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeTimeoutInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeDomainTimeoutInMilliseconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeDomainTimeoutInMilliseconds = reader.ReadValueAsString();
                }
                else if (string.Compare("InstanceCloseDelayDurationInSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    instanceCloseDelayDurationInSeconds = reader.ReadValueAsLong();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new RollingUpgradeUpdateDescription(
                       rollingUpgradeMode: rollingUpgradeMode,
                       forceRestart: forceRestart,
                       replicaSetCheckTimeoutInMilliseconds: replicaSetCheckTimeoutInMilliseconds,
                       failureAction: failureAction,
                       healthCheckWaitDurationInMilliseconds: healthCheckWaitDurationInMilliseconds,
                       healthCheckStableDurationInMilliseconds: healthCheckStableDurationInMilliseconds,
                       healthCheckRetryTimeoutInMilliseconds: healthCheckRetryTimeoutInMilliseconds,
                       upgradeTimeoutInMilliseconds: upgradeTimeoutInMilliseconds,
                       upgradeDomainTimeoutInMilliseconds: upgradeDomainTimeoutInMilliseconds,
                       instanceCloseDelayDurationInSeconds: instanceCloseDelayDurationInSeconds));
        }