/// <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 StatefulServiceReplicaHealthState GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var partitionId           = default(PartitionId);
            var replicaId             = default(ReplicaId);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionId = PartitionIdConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    replicaId = ReplicaIdConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StatefulServiceReplicaHealthState(
                       aggregatedHealthState: aggregatedHealthState,
                       partitionId: partitionId,
                       replicaId: replicaId));
        }
        /// <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 DeployedServicePackageHealthStateChunk GetFromJsonProperties(JsonReader reader)
        {
            var healthState                = default(HealthState?);
            var serviceManifestName        = default(string);
            var servicePackageActivationId = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceManifestName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceManifestName = reader.ReadValueAsString();
                }
                else if (string.Compare("ServicePackageActivationId", propName, StringComparison.Ordinal) == 0)
                {
                    servicePackageActivationId = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedServicePackageHealthStateChunk(
                       healthState: healthState,
                       serviceManifestName: serviceManifestName,
                       servicePackageActivationId: servicePackageActivationId));
        }
        /// <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 DeployedApplicationHealthStateChunk GetFromJsonProperties(JsonReader reader)
        {
            var healthState = default(HealthState?);
            var nodeName    = default(string);
            var deployedServicePackageHealthStateChunks = default(DeployedServicePackageHealthStateChunkList);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NodeName", propName, StringComparison.Ordinal) == 0)
                {
                    nodeName = reader.ReadValueAsString();
                }
                else if (string.Compare("DeployedServicePackageHealthStateChunks", propName, StringComparison.Ordinal) == 0)
                {
                    deployedServicePackageHealthStateChunks = DeployedServicePackageHealthStateChunkListConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedApplicationHealthStateChunk(
                       healthState: healthState,
                       nodeName: nodeName,
                       deployedServicePackageHealthStateChunks: deployedServicePackageHealthStateChunks));
        }
Ejemplo n.º 4
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 NodeHealthStateChunk GetFromJsonProperties(JsonReader reader)
        {
            var healthState = default(HealthState?);
            var nodeName    = default(NodeName);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NodeName", propName, StringComparison.Ordinal) == 0)
                {
                    nodeName = NodeNameConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new NodeHealthStateChunk(
                       healthState: healthState,
                       nodeName: nodeName));
        }
Ejemplo n.º 5
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 SystemApplicationHealthEvaluation GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var description           = default(string);
            var unhealthyEvaluations  = default(IEnumerable <HealthEvaluationWrapper>);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.Ordinal) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("Description", propName, StringComparison.Ordinal) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new SystemApplicationHealthEvaluation(
                       aggregatedHealthState: aggregatedHealthState,
                       description: description,
                       unhealthyEvaluations: unhealthyEvaluations));
        }
Ejemplo n.º 6
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 ClusterHealthChunk GetFromJsonProperties(JsonReader reader)
        {
            var healthState                  = default(HealthState?);
            var nodeHealthStateChunks        = default(NodeHealthStateChunkList);
            var applicationHealthStateChunks = default(ApplicationHealthStateChunkList);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NodeHealthStateChunks", propName, StringComparison.Ordinal) == 0)
                {
                    nodeHealthStateChunks = NodeHealthStateChunkListConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationHealthStateChunks", propName, StringComparison.Ordinal) == 0)
                {
                    applicationHealthStateChunks = ApplicationHealthStateChunkListConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ClusterHealthChunk(
                       healthState: healthState,
                       nodeHealthStateChunks: nodeHealthStateChunks,
                       applicationHealthStateChunks: applicationHealthStateChunks));
        }
        /// <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 PartitionHealthStateChunk GetFromJsonProperties(JsonReader reader)
        {
            var healthState = default(HealthState?);
            var partitionId = default(PartitionId);
            var replicaHealthStateChunks = default(ReplicaHealthStateChunkList);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionId", propName, StringComparison.Ordinal) == 0)
                {
                    partitionId = PartitionIdConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaHealthStateChunks", propName, StringComparison.Ordinal) == 0)
                {
                    replicaHealthStateChunks = ReplicaHealthStateChunkListConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new PartitionHealthStateChunk(
                       healthState: healthState,
                       partitionId: partitionId,
                       replicaHealthStateChunks: replicaHealthStateChunks));
        }
        /// <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 ReplicaHealthStateChunk GetFromJsonProperties(JsonReader reader)
        {
            var healthState         = default(HealthState?);
            var replicaOrInstanceId = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaOrInstanceId", propName, StringComparison.Ordinal) == 0)
                {
                    replicaOrInstanceId = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ReplicaHealthStateChunk(
                       healthState: healthState,
                       replicaOrInstanceId: replicaOrInstanceId));
        }
        /// <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 ApplicationHealthState GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var name = default(ApplicationName);

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

            return(new ApplicationHealthState(
                       aggregatedHealthState: aggregatedHealthState,
                       name: name));
        }
Ejemplo n.º 10
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));
        }
        /// <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 ServiceHealthState GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var serviceName           = default(ServiceName);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.Ordinal) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ServiceHealthState(
                       aggregatedHealthState: aggregatedHealthState,
                       serviceName: serviceName));
        }
Ejemplo n.º 12
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 ServiceHealthStateChunk GetFromJsonProperties(JsonReader reader)
        {
            var healthState = default(HealthState?);
            var serviceName = default(ServiceName);
            var partitionHealthStateChunks = default(PartitionHealthStateChunkList);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionHealthStateChunks", propName, StringComparison.Ordinal) == 0)
                {
                    partitionHealthStateChunks = PartitionHealthStateChunkListConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ServiceHealthStateChunk(
                       healthState: healthState,
                       serviceName: serviceName,
                       partitionHealthStateChunks: partitionHealthStateChunks));
        }
        /// <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 ServiceProperties GetFromJsonProperties(JsonReader reader)
        {
            var description         = default(string);
            var replicaCount        = default(int?);
            var autoScalingPolicies = default(IEnumerable <AutoScalingPolicy>);
            var status              = default(ResourceStatus?);
            var statusDetails       = default(string);
            var healthState         = default(HealthState?);
            var unhealthyEvaluation = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("description", propName, StringComparison.Ordinal) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("replicaCount", propName, StringComparison.Ordinal) == 0)
                {
                    replicaCount = reader.ReadValueAsInt();
                }
                else if (string.Compare("autoScalingPolicies", propName, StringComparison.Ordinal) == 0)
                {
                    autoScalingPolicies = reader.ReadList(AutoScalingPolicyConverter.Deserialize);
                }
                else if (string.Compare("status", propName, StringComparison.Ordinal) == 0)
                {
                    status = ResourceStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("statusDetails", propName, StringComparison.Ordinal) == 0)
                {
                    statusDetails = reader.ReadValueAsString();
                }
                else if (string.Compare("healthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("unhealthyEvaluation", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvaluation = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            var serviceProperties = new ServiceProperties(
                description: description,
                replicaCount: replicaCount,
                autoScalingPolicies: autoScalingPolicies);

            serviceProperties.Status              = status;
            serviceProperties.StatusDetails       = statusDetails;
            serviceProperties.HealthState         = healthState;
            serviceProperties.UnhealthyEvaluation = unhealthyEvaluation;
            return(serviceProperties);
        }
Ejemplo n.º 14
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 DeltaNodesCheckHealthEvaluation GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState         = default(HealthState?);
            var description                   = default(string);
            var baselineErrorCount            = default(long?);
            var baselineTotalCount            = default(long?);
            var maxPercentDeltaUnhealthyNodes = default(int?);
            var totalCount           = default(long?);
            var unhealthyEvaluations = default(IEnumerable <HealthEvaluationWrapper>);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.Ordinal) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("Description", propName, StringComparison.Ordinal) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("BaselineErrorCount", propName, StringComparison.Ordinal) == 0)
                {
                    baselineErrorCount = reader.ReadValueAsLong();
                }
                else if (string.Compare("BaselineTotalCount", propName, StringComparison.Ordinal) == 0)
                {
                    baselineTotalCount = reader.ReadValueAsLong();
                }
                else if (string.Compare("MaxPercentDeltaUnhealthyNodes", propName, StringComparison.Ordinal) == 0)
                {
                    maxPercentDeltaUnhealthyNodes = reader.ReadValueAsInt();
                }
                else if (string.Compare("TotalCount", propName, StringComparison.Ordinal) == 0)
                {
                    totalCount = reader.ReadValueAsLong();
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeltaNodesCheckHealthEvaluation(
                       aggregatedHealthState: aggregatedHealthState,
                       description: description,
                       baselineErrorCount: baselineErrorCount,
                       baselineTotalCount: baselineTotalCount,
                       maxPercentDeltaUnhealthyNodes: maxPercentDeltaUnhealthyNodes,
                       totalCount: totalCount,
                       unhealthyEvaluations: unhealthyEvaluations));
        }
        /// <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 StatefulServicePartitionInfo GetFromJsonProperties(JsonReader reader)
        {
            var healthState            = default(HealthState?);
            var partitionStatus        = default(ServicePartitionStatus?);
            var partitionInformation   = default(PartitionInformation);
            var targetReplicaSetSize   = default(long?);
            var minReplicaSetSize      = default(long?);
            var lastQuorumLossDuration = default(TimeSpan?);
            var primaryEpoch           = default(Epoch);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionStatus", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionStatus = ServicePartitionStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionInformation", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionInformation = PartitionInformationConverter.Deserialize(reader);
                }
                else if (string.Compare("TargetReplicaSetSize", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    targetReplicaSetSize = reader.ReadValueAsLong();
                }
                else if (string.Compare("MinReplicaSetSize", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    minReplicaSetSize = reader.ReadValueAsLong();
                }
                else if (string.Compare("LastQuorumLossDuration", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    lastQuorumLossDuration = reader.ReadValueAsTimeSpan();
                }
                else if (string.Compare("PrimaryEpoch", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    primaryEpoch = EpochConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StatefulServicePartitionInfo(
                       healthState: healthState,
                       partitionStatus: partitionStatus,
                       partitionInformation: partitionInformation,
                       targetReplicaSetSize: targetReplicaSetSize,
                       minReplicaSetSize: minReplicaSetSize,
                       lastQuorumLossDuration: lastQuorumLossDuration,
                       primaryEpoch: primaryEpoch));
        }
Ejemplo n.º 16
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 StatelessServiceInfo GetFromJsonProperties(JsonReader reader)
        {
            var id              = default(string);
            var name            = default(ServiceName);
            var typeName        = default(string);
            var manifestVersion = default(string);
            var healthState     = default(HealthState?);
            var serviceStatus   = default(ServiceStatus?);
            var isServiceGroup  = default(bool?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Id", propName, StringComparison.Ordinal) == 0)
                {
                    id = reader.ReadValueAsString();
                }
                else if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("TypeName", propName, StringComparison.Ordinal) == 0)
                {
                    typeName = reader.ReadValueAsString();
                }
                else if (string.Compare("ManifestVersion", propName, StringComparison.Ordinal) == 0)
                {
                    manifestVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceStatus", propName, StringComparison.Ordinal) == 0)
                {
                    serviceStatus = ServiceStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("IsServiceGroup", propName, StringComparison.Ordinal) == 0)
                {
                    isServiceGroup = reader.ReadValueAsBool();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StatelessServiceInfo(
                       id: id,
                       name: name,
                       typeName: typeName,
                       manifestVersion: manifestVersion,
                       healthState: healthState,
                       serviceStatus: serviceStatus,
                       isServiceGroup: isServiceGroup));
        }
        /// <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 HealthInformation GetFromJsonProperties(JsonReader reader)
        {
            var sourceId    = default(string);
            var property    = default(string);
            var healthState = default(HealthState?);
            var timeToLiveInMilliSeconds = default(TimeSpan?);
            var description       = default(string);
            var sequenceNumber    = default(string);
            var removeWhenExpired = default(bool?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("SourceId", propName, StringComparison.Ordinal) == 0)
                {
                    sourceId = reader.ReadValueAsString();
                }
                else if (string.Compare("Property", propName, StringComparison.Ordinal) == 0)
                {
                    property = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("TimeToLiveInMilliSeconds", propName, StringComparison.Ordinal) == 0)
                {
                    timeToLiveInMilliSeconds = reader.ReadValueAsTimeSpan();
                }
                else if (string.Compare("Description", propName, StringComparison.Ordinal) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("SequenceNumber", propName, StringComparison.Ordinal) == 0)
                {
                    sequenceNumber = reader.ReadValueAsString();
                }
                else if (string.Compare("RemoveWhenExpired", propName, StringComparison.Ordinal) == 0)
                {
                    removeWhenExpired = reader.ReadValueAsBool();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new HealthInformation(
                       sourceId: sourceId,
                       property: property,
                       healthState: healthState,
                       timeToLiveInMilliSeconds: timeToLiveInMilliSeconds,
                       description: description,
                       sequenceNumber: sequenceNumber,
                       removeWhenExpired: removeWhenExpired));
        }
Ejemplo n.º 18
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 StatefulServiceReplicaInfo GetFromJsonProperties(JsonReader reader)
        {
            var replicaStatus = default(ReplicaStatus?);
            var healthState   = default(HealthState?);
            var nodeName      = default(NodeName);
            var address       = default(string);
            var lastInBuildDurationInSeconds = default(string);
            var replicaRole = default(ReplicaRole?);
            var replicaId   = default(ReplicaId);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ReplicaStatus", propName, StringComparison.Ordinal) == 0)
                {
                    replicaStatus = ReplicaStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NodeName", propName, StringComparison.Ordinal) == 0)
                {
                    nodeName = NodeNameConverter.Deserialize(reader);
                }
                else if (string.Compare("Address", propName, StringComparison.Ordinal) == 0)
                {
                    address = reader.ReadValueAsString();
                }
                else if (string.Compare("LastInBuildDurationInSeconds", propName, StringComparison.Ordinal) == 0)
                {
                    lastInBuildDurationInSeconds = reader.ReadValueAsString();
                }
                else if (string.Compare("ReplicaRole", propName, StringComparison.Ordinal) == 0)
                {
                    replicaRole = ReplicaRoleConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaId", propName, StringComparison.Ordinal) == 0)
                {
                    replicaId = ReplicaIdConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StatefulServiceReplicaInfo(
                       replicaStatus: replicaStatus,
                       healthState: healthState,
                       nodeName: nodeName,
                       address: address,
                       lastInBuildDurationInSeconds: lastInBuildDurationInSeconds,
                       replicaRole: replicaRole,
                       replicaId: replicaId));
        }
        /// <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 ApplicationHealth GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var healthEvents          = default(IEnumerable <HealthEvent>);
            var unhealthyEvaluations  = default(IEnumerable <HealthEvaluationWrapper>);
            var healthStatistics      = default(HealthStatistics);
            var name = default(ApplicationName);
            var serviceHealthStates             = default(IEnumerable <ServiceHealthState>);
            var deployedApplicationHealthStates = default(IEnumerable <DeployedApplicationHealthState>);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.Ordinal) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthEvents", propName, StringComparison.Ordinal) == 0)
                {
                    healthEvents = reader.ReadList(HealthEventConverter.Deserialize);
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else if (string.Compare("HealthStatistics", propName, StringComparison.Ordinal) == 0)
                {
                    healthStatistics = HealthStatisticsConverter.Deserialize(reader);
                }
                else if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceHealthStates", propName, StringComparison.Ordinal) == 0)
                {
                    serviceHealthStates = reader.ReadList(ServiceHealthStateConverter.Deserialize);
                }
                else if (string.Compare("DeployedApplicationHealthStates", propName, StringComparison.Ordinal) == 0)
                {
                    deployedApplicationHealthStates = reader.ReadList(DeployedApplicationHealthStateConverter.Deserialize);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationHealth(
                       aggregatedHealthState: aggregatedHealthState,
                       healthEvents: healthEvents,
                       unhealthyEvaluations: unhealthyEvaluations,
                       healthStatistics: healthStatistics,
                       name: name,
                       serviceHealthStates: serviceHealthStates,
                       deployedApplicationHealthStates: deployedApplicationHealthStates));
        }
Ejemplo n.º 20
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 DeployedServicePackageHealth GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var healthEvents          = default(IEnumerable <HealthEvent>);
            var unhealthyEvaluations  = default(IEnumerable <HealthEvaluationWrapper>);
            var healthStatistics      = default(HealthStatistics);
            var applicationName       = default(ApplicationName);
            var serviceManifestName   = default(string);
            var nodeName = default(NodeName);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.Ordinal) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthEvents", propName, StringComparison.Ordinal) == 0)
                {
                    healthEvents = reader.ReadList(HealthEventConverter.Deserialize);
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else if (string.Compare("HealthStatistics", propName, StringComparison.Ordinal) == 0)
                {
                    healthStatistics = HealthStatisticsConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceManifestName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceManifestName = reader.ReadValueAsString();
                }
                else if (string.Compare("NodeName", propName, StringComparison.Ordinal) == 0)
                {
                    nodeName = NodeNameConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedServicePackageHealth(
                       aggregatedHealthState: aggregatedHealthState,
                       healthEvents: healthEvents,
                       unhealthyEvaluations: unhealthyEvaluations,
                       healthStatistics: healthStatistics,
                       applicationName: applicationName,
                       serviceManifestName: serviceManifestName,
                       nodeName: nodeName));
        }
        /// <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 UpgradeDomainDeployedApplicationsHealthEvaluation GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var description           = default(string);
            var upgradeDomainName     = default(string);
            var maxPercentUnhealthyDeployedApplications = default(int?);
            var totalCount           = default(long?);
            var unhealthyEvaluations = default(IEnumerable <HealthEvaluationWrapper>);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("Description", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("UpgradeDomainName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeDomainName = reader.ReadValueAsString();
                }
                else if (string.Compare("MaxPercentUnhealthyDeployedApplications", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    maxPercentUnhealthyDeployedApplications = reader.ReadValueAsInt();
                }
                else if (string.Compare("TotalCount", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    totalCount = reader.ReadValueAsLong();
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new UpgradeDomainDeployedApplicationsHealthEvaluation(
                       aggregatedHealthState: aggregatedHealthState,
                       description: description,
                       upgradeDomainName: upgradeDomainName,
                       maxPercentUnhealthyDeployedApplications: maxPercentUnhealthyDeployedApplications,
                       totalCount: totalCount,
                       unhealthyEvaluations: unhealthyEvaluations));
        }
        /// <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 PartitionHealth GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var healthEvents          = default(IEnumerable <HealthEvent>);
            var unhealthyEvaluations  = default(IEnumerable <HealthEvaluationWrapper>);
            var healthStatistics      = default(HealthStatistics);
            var partitionId           = default(PartitionId);
            var replicaHealthStates   = default(IEnumerable <ReplicaHealthState>);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthEvents", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthEvents = reader.ReadList(HealthEventConverter.Deserialize);
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else if (string.Compare("HealthStatistics", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthStatistics = HealthStatisticsConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionId = PartitionIdConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaHealthStates", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    replicaHealthStates = reader.ReadList(ReplicaHealthStateConverter.Deserialize);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new PartitionHealth(
                       aggregatedHealthState: aggregatedHealthState,
                       healthEvents: healthEvents,
                       unhealthyEvaluations: unhealthyEvaluations,
                       healthStatistics: healthStatistics,
                       partitionId: partitionId,
                       replicaHealthStates: replicaHealthStates));
        }
Ejemplo n.º 23
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 StatelessServicePartitionInfo GetFromJsonProperties(JsonReader reader)
        {
            var healthState           = default(HealthState?);
            var partitionStatus       = default(ServicePartitionStatus?);
            var partitionInformation  = default(PartitionInformation);
            var instanceCount         = default(long?);
            var minInstanceCount      = default(int?);
            var minInstancePercentage = default(int?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionStatus", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionStatus = ServicePartitionStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionInformation", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionInformation = PartitionInformationConverter.Deserialize(reader);
                }
                else if (string.Compare("InstanceCount", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    instanceCount = reader.ReadValueAsLong();
                }
                else if (string.Compare("MinInstanceCount", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    minInstanceCount = reader.ReadValueAsInt();
                }
                else if (string.Compare("MinInstancePercentage", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    minInstancePercentage = reader.ReadValueAsInt();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StatelessServicePartitionInfo(
                       healthState: healthState,
                       partitionStatus: partitionStatus,
                       partitionInformation: partitionInformation,
                       instanceCount: instanceCount,
                       minInstanceCount: minInstanceCount,
                       minInstancePercentage: minInstancePercentage));
        }
        /// <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 ApplicationHealthStateChunk GetFromJsonProperties(JsonReader reader)
        {
            var healthState                          = default(HealthState?);
            var applicationName                      = default(ApplicationName);
            var applicationTypeName                  = default(string);
            var serviceHealthStateChunks             = default(ServiceHealthStateChunkList);
            var deployedApplicationHealthStateChunks = default(DeployedApplicationHealthStateChunkList);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("HealthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationTypeName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationTypeName = reader.ReadValueAsString();
                }
                else if (string.Compare("ServiceHealthStateChunks", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceHealthStateChunks = ServiceHealthStateChunkListConverter.Deserialize(reader);
                }
                else if (string.Compare("DeployedApplicationHealthStateChunks", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    deployedApplicationHealthStateChunks = DeployedApplicationHealthStateChunkListConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationHealthStateChunk(
                       healthState: healthState,
                       applicationName: applicationName,
                       applicationTypeName: applicationTypeName,
                       serviceHealthStateChunks: serviceHealthStateChunks,
                       deployedApplicationHealthStateChunks: deployedApplicationHealthStateChunks));
        }
        /// <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 DeployedServicePackageHealthState GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var nodeName                   = default(NodeName);
            var applicationName            = default(ApplicationName);
            var serviceManifestName        = default(string);
            var servicePackageActivationId = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.Ordinal) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NodeName", propName, StringComparison.Ordinal) == 0)
                {
                    nodeName = NodeNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceManifestName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceManifestName = reader.ReadValueAsString();
                }
                else if (string.Compare("ServicePackageActivationId", propName, StringComparison.Ordinal) == 0)
                {
                    servicePackageActivationId = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedServicePackageHealthState(
                       aggregatedHealthState: aggregatedHealthState,
                       nodeName: nodeName,
                       applicationName: applicationName,
                       serviceManifestName: serviceManifestName,
                       servicePackageActivationId: servicePackageActivationId));
        }
        /// <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 EventHealthEvaluation GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState  = default(HealthState?);
            var description            = default(string);
            var considerWarningAsError = default(bool?);
            var unhealthyEvent         = default(HealthEvent);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("AggregatedHealthState", propName, StringComparison.Ordinal) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("Description", propName, StringComparison.Ordinal) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("ConsiderWarningAsError", propName, StringComparison.Ordinal) == 0)
                {
                    considerWarningAsError = reader.ReadValueAsBool();
                }
                else if (string.Compare("UnhealthyEvent", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvent = HealthEventConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new EventHealthEvaluation(
                       aggregatedHealthState: aggregatedHealthState,
                       description: description,
                       considerWarningAsError: considerWarningAsError,
                       unhealthyEvent: unhealthyEvent));
        }
Ejemplo n.º 27
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 ApplicationProperties GetFromJsonProperties(JsonReader reader)
        {
            var description         = default(string);
            var services            = default(IEnumerable <ServiceResourceDescription>);
            var diagnostics         = default(DiagnosticsDescription);
            var debugParams         = default(string);
            var serviceNames        = default(IEnumerable <string>);
            var status              = default(ResourceStatus?);
            var statusDetails       = default(string);
            var healthState         = default(HealthState?);
            var unhealthyEvaluation = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("description", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("services", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    services = reader.ReadList(ServiceResourceDescriptionConverter.Deserialize);
                }
                else if (string.Compare("diagnostics", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    diagnostics = DiagnosticsDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("debugParams", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    debugParams = reader.ReadValueAsString();
                }
                else if (string.Compare("serviceNames", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceNames = reader.ReadList(JsonReaderExtensions.ReadValueAsString);
                }
                else if (string.Compare("status", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    status = ResourceStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("statusDetails", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    statusDetails = reader.ReadValueAsString();
                }
                else if (string.Compare("healthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("unhealthyEvaluation", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    unhealthyEvaluation = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            var applicationProperties = new ApplicationProperties(
                description: description,
                services: services,
                diagnostics: diagnostics,
                debugParams: debugParams);

            applicationProperties.ServiceNames        = serviceNames;
            applicationProperties.Status              = status;
            applicationProperties.StatusDetails       = statusDetails;
            applicationProperties.HealthState         = healthState;
            applicationProperties.UnhealthyEvaluation = unhealthyEvaluation;
            return(applicationProperties);
        }
Ejemplo n.º 28
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 HealthEvent GetFromJsonProperties(JsonReader reader)
        {
            var sourceId    = default(string);
            var property    = default(string);
            var healthState = default(HealthState?);
            var timeToLiveInMilliSeconds = default(TimeSpan?);
            var description              = default(string);
            var sequenceNumber           = default(string);
            var removeWhenExpired        = default(bool?);
            var healthReportId           = default(string);
            var isExpired                = default(bool?);
            var sourceUtcTimestamp       = default(DateTime?);
            var lastModifiedUtcTimestamp = default(DateTime?);
            var lastOkTransitionAt       = default(DateTime?);
            var lastWarningTransitionAt  = default(DateTime?);
            var lastErrorTransitionAt    = default(DateTime?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("SourceId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    sourceId = reader.ReadValueAsString();
                }
                else if (string.Compare("Property", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    property = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("TimeToLiveInMilliSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    timeToLiveInMilliSeconds = reader.ReadValueAsTimeSpan();
                }
                else if (string.Compare("Description", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("SequenceNumber", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    sequenceNumber = reader.ReadValueAsString();
                }
                else if (string.Compare("RemoveWhenExpired", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    removeWhenExpired = reader.ReadValueAsBool();
                }
                else if (string.Compare("HealthReportId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthReportId = reader.ReadValueAsString();
                }
                else if (string.Compare("IsExpired", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    isExpired = reader.ReadValueAsBool();
                }
                else if (string.Compare("SourceUtcTimestamp", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    sourceUtcTimestamp = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("LastModifiedUtcTimestamp", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    lastModifiedUtcTimestamp = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("LastOkTransitionAt", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    lastOkTransitionAt = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("LastWarningTransitionAt", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    lastWarningTransitionAt = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("LastErrorTransitionAt", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    lastErrorTransitionAt = reader.ReadValueAsDateTime();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new HealthEvent(
                       sourceId: sourceId,
                       property: property,
                       healthState: healthState,
                       timeToLiveInMilliSeconds: timeToLiveInMilliSeconds,
                       description: description,
                       sequenceNumber: sequenceNumber,
                       removeWhenExpired: removeWhenExpired,
                       healthReportId: healthReportId,
                       isExpired: isExpired,
                       sourceUtcTimestamp: sourceUtcTimestamp,
                       lastModifiedUtcTimestamp: lastModifiedUtcTimestamp,
                       lastOkTransitionAt: lastOkTransitionAt,
                       lastWarningTransitionAt: lastWarningTransitionAt,
                       lastErrorTransitionAt: lastErrorTransitionAt));
        }
Ejemplo n.º 29
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 DeployedApplicationInfo GetFromJsonProperties(JsonReader reader)
        {
            var id            = default(string);
            var name          = default(ApplicationName);
            var typeName      = default(string);
            var status        = default(DeployedApplicationStatus?);
            var workDirectory = default(string);
            var logDirectory  = default(string);
            var tempDirectory = default(string);
            var healthState   = default(HealthState?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Id", propName, StringComparison.Ordinal) == 0)
                {
                    id = reader.ReadValueAsString();
                }
                else if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("TypeName", propName, StringComparison.Ordinal) == 0)
                {
                    typeName = reader.ReadValueAsString();
                }
                else if (string.Compare("Status", propName, StringComparison.Ordinal) == 0)
                {
                    status = DeployedApplicationStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("WorkDirectory", propName, StringComparison.Ordinal) == 0)
                {
                    workDirectory = reader.ReadValueAsString();
                }
                else if (string.Compare("LogDirectory", propName, StringComparison.Ordinal) == 0)
                {
                    logDirectory = reader.ReadValueAsString();
                }
                else if (string.Compare("TempDirectory", propName, StringComparison.Ordinal) == 0)
                {
                    tempDirectory = reader.ReadValueAsString();
                }
                else if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedApplicationInfo(
                       id: id,
                       name: name,
                       typeName: typeName,
                       status: status,
                       workDirectory: workDirectory,
                       logDirectory: logDirectory,
                       tempDirectory: tempDirectory,
                       healthState: healthState));
        }
Ejemplo n.º 30
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));
        }