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 NodeHealthState GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var name = default(NodeName);
            var id   = default(NodeId);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.Ordinal) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = NodeNameConverter.Deserialize(reader);
                }
                else if (string.Compare("Id", propName, StringComparison.Ordinal) == 0)
                {
                    id = NodeIdConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new NodeHealthState(
                       aggregatedHealthState: aggregatedHealthState,
                       name: name,
                       id: id));
        }
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 NodeInfo GetFromJsonProperties(JsonReader reader)
        {
            var name                = default(NodeName);
            var ipAddressOrFQDN     = default(string);
            var type                = default(string);
            var codeVersion         = default(string);
            var configVersion       = default(string);
            var nodeStatus          = default(NodeStatus?);
            var nodeUpTimeInSeconds = default(string);
            var healthState         = default(HealthState?);
            var isSeedNode          = default(bool?);
            var upgradeDomain       = default(string);
            var faultDomain         = default(string);
            var id                    = default(NodeId);
            var instanceId            = default(string);
            var nodeDeactivationInfo  = default(NodeDeactivationInfo);
            var isStopped             = default(bool?);
            var nodeDownTimeInSeconds = default(string);
            var nodeUpAt              = default(DateTime?);
            var nodeDownAt            = default(DateTime?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = NodeNameConverter.Deserialize(reader);
                }
                else if (string.Compare("IpAddressOrFQDN", propName, StringComparison.Ordinal) == 0)
                {
                    ipAddressOrFQDN = reader.ReadValueAsString();
                }
                else if (string.Compare("Type", propName, StringComparison.Ordinal) == 0)
                {
                    type = reader.ReadValueAsString();
                }
                else 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("NodeStatus", propName, StringComparison.Ordinal) == 0)
                {
                    nodeStatus = NodeStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("NodeUpTimeInSeconds", propName, StringComparison.Ordinal) == 0)
                {
                    nodeUpTimeInSeconds = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("IsSeedNode", propName, StringComparison.Ordinal) == 0)
                {
                    isSeedNode = reader.ReadValueAsBool();
                }
                else if (string.Compare("UpgradeDomain", propName, StringComparison.Ordinal) == 0)
                {
                    upgradeDomain = reader.ReadValueAsString();
                }
                else if (string.Compare("FaultDomain", propName, StringComparison.Ordinal) == 0)
                {
                    faultDomain = reader.ReadValueAsString();
                }
                else if (string.Compare("Id", propName, StringComparison.Ordinal) == 0)
                {
                    id = NodeIdConverter.Deserialize(reader);
                }
                else if (string.Compare("InstanceId", propName, StringComparison.Ordinal) == 0)
                {
                    instanceId = reader.ReadValueAsString();
                }
                else if (string.Compare("NodeDeactivationInfo", propName, StringComparison.Ordinal) == 0)
                {
                    nodeDeactivationInfo = NodeDeactivationInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("IsStopped", propName, StringComparison.Ordinal) == 0)
                {
                    isStopped = reader.ReadValueAsBool();
                }
                else if (string.Compare("NodeDownTimeInSeconds", propName, StringComparison.Ordinal) == 0)
                {
                    nodeDownTimeInSeconds = reader.ReadValueAsString();
                }
                else if (string.Compare("NodeUpAt", propName, StringComparison.Ordinal) == 0)
                {
                    nodeUpAt = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("NodeDownAt", propName, StringComparison.Ordinal) == 0)
                {
                    nodeDownAt = reader.ReadValueAsDateTime();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new NodeInfo(
                       name: name,
                       ipAddressOrFQDN: ipAddressOrFQDN,
                       type: type,
                       codeVersion: codeVersion,
                       configVersion: configVersion,
                       nodeStatus: nodeStatus,
                       nodeUpTimeInSeconds: nodeUpTimeInSeconds,
                       healthState: healthState,
                       isSeedNode: isSeedNode,
                       upgradeDomain: upgradeDomain,
                       faultDomain: faultDomain,
                       id: id,
                       instanceId: instanceId,
                       nodeDeactivationInfo: nodeDeactivationInfo,
                       isStopped: isStopped,
                       nodeDownTimeInSeconds: nodeDownTimeInSeconds,
                       nodeUpAt: nodeUpAt,
                       nodeDownAt: nodeDownAt));
        }
        /// <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 LoadMetricInformation GetFromJsonProperties(JsonReader reader)
        {
            var name                             = default(string);
            var isBalancedBefore                 = default(bool?);
            var isBalancedAfter                  = default(bool?);
            var deviationBefore                  = default(string);
            var deviationAfter                   = default(string);
            var balancingThreshold               = default(string);
            var action                           = default(string);
            var activityThreshold                = default(string);
            var clusterCapacity                  = default(string);
            var clusterLoad                      = default(string);
            var currentClusterLoad               = default(string);
            var clusterRemainingCapacity         = default(string);
            var clusterCapacityRemaining         = default(string);
            var isClusterCapacityViolation       = default(bool?);
            var nodeBufferPercentage             = default(string);
            var clusterBufferedCapacity          = default(string);
            var bufferedClusterCapacityRemaining = default(string);
            var clusterRemainingBufferedCapacity = default(string);
            var minNodeLoadValue                 = default(string);
            var minimumNodeLoad                  = default(string);
            var minNodeLoadNodeId                = default(NodeId);
            var maxNodeLoadValue                 = default(string);
            var maximumNodeLoad                  = default(string);
            var maxNodeLoadNodeId                = default(NodeId);
            var plannedLoadRemoval               = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    name = reader.ReadValueAsString();
                }
                else if (string.Compare("IsBalancedBefore", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    isBalancedBefore = reader.ReadValueAsBool();
                }
                else if (string.Compare("IsBalancedAfter", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    isBalancedAfter = reader.ReadValueAsBool();
                }
                else if (string.Compare("DeviationBefore", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    deviationBefore = reader.ReadValueAsString();
                }
                else if (string.Compare("DeviationAfter", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    deviationAfter = reader.ReadValueAsString();
                }
                else if (string.Compare("BalancingThreshold", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    balancingThreshold = reader.ReadValueAsString();
                }
                else if (string.Compare("Action", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    action = reader.ReadValueAsString();
                }
                else if (string.Compare("ActivityThreshold", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    activityThreshold = reader.ReadValueAsString();
                }
                else if (string.Compare("ClusterCapacity", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    clusterCapacity = reader.ReadValueAsString();
                }
                else if (string.Compare("ClusterLoad", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    clusterLoad = reader.ReadValueAsString();
                }
                else if (string.Compare("CurrentClusterLoad", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    currentClusterLoad = reader.ReadValueAsString();
                }
                else if (string.Compare("ClusterRemainingCapacity", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    clusterRemainingCapacity = reader.ReadValueAsString();
                }
                else if (string.Compare("ClusterCapacityRemaining", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    clusterCapacityRemaining = reader.ReadValueAsString();
                }
                else if (string.Compare("IsClusterCapacityViolation", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    isClusterCapacityViolation = reader.ReadValueAsBool();
                }
                else if (string.Compare("NodeBufferPercentage", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    nodeBufferPercentage = reader.ReadValueAsString();
                }
                else if (string.Compare("ClusterBufferedCapacity", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    clusterBufferedCapacity = reader.ReadValueAsString();
                }
                else if (string.Compare("BufferedClusterCapacityRemaining", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    bufferedClusterCapacityRemaining = reader.ReadValueAsString();
                }
                else if (string.Compare("ClusterRemainingBufferedCapacity", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    clusterRemainingBufferedCapacity = reader.ReadValueAsString();
                }
                else if (string.Compare("MinNodeLoadValue", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    minNodeLoadValue = reader.ReadValueAsString();
                }
                else if (string.Compare("MinimumNodeLoad", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    minimumNodeLoad = reader.ReadValueAsString();
                }
                else if (string.Compare("MinNodeLoadNodeId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    minNodeLoadNodeId = NodeIdConverter.Deserialize(reader);
                }
                else if (string.Compare("MaxNodeLoadValue", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    maxNodeLoadValue = reader.ReadValueAsString();
                }
                else if (string.Compare("MaximumNodeLoad", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    maximumNodeLoad = reader.ReadValueAsString();
                }
                else if (string.Compare("MaxNodeLoadNodeId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    maxNodeLoadNodeId = NodeIdConverter.Deserialize(reader);
                }
                else if (string.Compare("PlannedLoadRemoval", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    plannedLoadRemoval = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new LoadMetricInformation(
                       name: name,
                       isBalancedBefore: isBalancedBefore,
                       isBalancedAfter: isBalancedAfter,
                       deviationBefore: deviationBefore,
                       deviationAfter: deviationAfter,
                       balancingThreshold: balancingThreshold,
                       action: action,
                       activityThreshold: activityThreshold,
                       clusterCapacity: clusterCapacity,
                       clusterLoad: clusterLoad,
                       currentClusterLoad: currentClusterLoad,
                       clusterRemainingCapacity: clusterRemainingCapacity,
                       clusterCapacityRemaining: clusterCapacityRemaining,
                       isClusterCapacityViolation: isClusterCapacityViolation,
                       nodeBufferPercentage: nodeBufferPercentage,
                       clusterBufferedCapacity: clusterBufferedCapacity,
                       bufferedClusterCapacityRemaining: bufferedClusterCapacityRemaining,
                       clusterRemainingBufferedCapacity: clusterRemainingBufferedCapacity,
                       minNodeLoadValue: minNodeLoadValue,
                       minimumNodeLoad: minimumNodeLoad,
                       minNodeLoadNodeId: minNodeLoadNodeId,
                       maxNodeLoadValue: maxNodeLoadValue,
                       maximumNodeLoad: maximumNodeLoad,
                       maxNodeLoadNodeId: maxNodeLoadNodeId,
                       plannedLoadRemoval: plannedLoadRemoval));
        }