/// <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 PartitionBackupEntity GetFromJsonProperties(JsonReader reader)
        {
            var serviceName = default(ServiceName);
            var partitionId = default(PartitionId);

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

            return(new PartitionBackupEntity(
                       serviceName: serviceName,
                       partitionId: partitionId));
        }
Ejemplo 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 ServiceNameInfo GetFromJsonProperties(JsonReader reader)
        {
            var id   = default(string);
            var name = default(ServiceName);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Id", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    id = reader.ReadValueAsString();
                }
                else if (string.Compare("Name", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    name = ServiceNameConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ServiceNameInfo(
                       id: id,
                       name: name));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
        /// <returns>The object Value.</returns>
        internal static ServiceHealthState GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var serviceName           = default(ServiceName);

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

            return(new ServiceHealthState(
                       aggregatedHealthState: aggregatedHealthState,
                       serviceName: serviceName));
        }
        /// <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 ServiceCorrelationDescription GetFromJsonProperties(JsonReader reader)
        {
            var scheme      = default(ServiceCorrelationScheme?);
            var serviceName = default(ServiceName);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Scheme", propName, StringComparison.Ordinal) == 0)
                {
                    scheme = ServiceCorrelationSchemeConverter.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 ServiceCorrelationDescription(
                       scheme: scheme,
                       serviceName: serviceName));
        }
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 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));
        }
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 UnplacedReplicaInformation GetFromJsonProperties(JsonReader reader)
        {
            var serviceName            = default(ServiceName);
            var partitionId            = default(PartitionId);
            var unplacedReplicaDetails = default(IEnumerable <string>);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ServiceName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionId = PartitionIdConverter.Deserialize(reader);
                }
                else if (string.Compare("UnplacedReplicaDetails", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    unplacedReplicaDetails = reader.ReadList(JsonReaderExtensions.ReadValueAsString);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new UnplacedReplicaInformation(
                       serviceName: serviceName,
                       partitionId: partitionId,
                       unplacedReplicaDetails: unplacedReplicaDetails));
        }
Ejemplo n.º 7
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 DeployedStatelessServiceInstanceDetailInfo GetFromJsonProperties(JsonReader reader)
        {
            var serviceName                         = default(ServiceName);
            var partitionId                         = default(PartitionId);
            var currentServiceOperation             = default(ServiceOperationName?);
            var currentServiceOperationStartTimeUtc = default(DateTime?);
            var reportedLoad                        = default(IEnumerable <LoadMetricReportInfo>);
            var instanceId = default(ReplicaId);
            var deployedServiceReplicaQueryResult = default(DeployedStatelessServiceInstanceInfo);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ServiceName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionId", propName, StringComparison.Ordinal) == 0)
                {
                    partitionId = PartitionIdConverter.Deserialize(reader);
                }
                else if (string.Compare("CurrentServiceOperation", propName, StringComparison.Ordinal) == 0)
                {
                    currentServiceOperation = ServiceOperationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("CurrentServiceOperationStartTimeUtc", propName, StringComparison.Ordinal) == 0)
                {
                    currentServiceOperationStartTimeUtc = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("ReportedLoad", propName, StringComparison.Ordinal) == 0)
                {
                    reportedLoad = reader.ReadList(LoadMetricReportInfoConverter.Deserialize);
                }
                else if (string.Compare("InstanceId", propName, StringComparison.Ordinal) == 0)
                {
                    instanceId = ReplicaIdConverter.Deserialize(reader);
                }
                else if (string.Compare("DeployedServiceReplicaQueryResult", propName, StringComparison.Ordinal) == 0)
                {
                    deployedServiceReplicaQueryResult = DeployedStatelessServiceInstanceInfoConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedStatelessServiceInstanceDetailInfo(
                       serviceName: serviceName,
                       partitionId: partitionId,
                       currentServiceOperation: currentServiceOperation,
                       currentServiceOperationStartTimeUtc: currentServiceOperationStartTimeUtc,
                       reportedLoad: reportedLoad,
                       instanceId: instanceId,
                       deployedServiceReplicaQueryResult: deployedServiceReplicaQueryResult));
        }
Ejemplo n.º 8
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 ServiceHealth GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var healthEvents          = default(IEnumerable <HealthEvent>);
            var unhealthyEvaluations  = default(IEnumerable <HealthEvaluationWrapper>);
            var healthStatistics      = default(HealthStatistics);
            var name = default(ServiceName);
            var partitionHealthStates = default(IEnumerable <PartitionHealthState>);

            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 = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionHealthStates", propName, StringComparison.Ordinal) == 0)
                {
                    partitionHealthStates = reader.ReadList(PartitionHealthStateConverter.Deserialize);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ServiceHealth(
                       aggregatedHealthState: aggregatedHealthState,
                       healthEvents: healthEvents,
                       unhealthyEvaluations: unhealthyEvaluations,
                       healthStatistics: healthStatistics,
                       name: name,
                       partitionHealthStates: partitionHealthStates));
        }
        /// <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 ServiceFromTemplateDescription GetFromJsonProperties(JsonReader reader)
        {
            var applicationName              = default(ApplicationName);
            var serviceName                  = default(ServiceName);
            var serviceTypeName              = default(string);
            var initializationData           = default(byte[]);
            var servicePackageActivationMode = default(ServicePackageActivationMode?);
            var serviceDnsName               = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ApplicationName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceTypeName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceTypeName = reader.ReadValueAsString();
                }
                else if (string.Compare("InitializationData", propName, StringComparison.Ordinal) == 0)
                {
                    initializationData = ByteArrayConverter.Deserialize(reader);
                }
                else if (string.Compare("ServicePackageActivationMode", propName, StringComparison.Ordinal) == 0)
                {
                    servicePackageActivationMode = ServicePackageActivationModeConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceDnsName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceDnsName = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ServiceFromTemplateDescription(
                       applicationName: applicationName,
                       serviceName: serviceName,
                       serviceTypeName: serviceTypeName,
                       initializationData: initializationData,
                       servicePackageActivationMode: servicePackageActivationMode,
                       serviceDnsName: serviceDnsName));
        }
Ejemplo n.º 11
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 PartitionBackupConfigurationInfo GetFromJsonProperties(JsonReader reader)
        {
            var policyName          = default(string);
            var policyInheritedFrom = default(BackupPolicyScope?);
            var suspensionInfo      = default(BackupSuspensionInfo);
            var serviceName         = default(ServiceName);
            var partitionId         = default(PartitionId);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("PolicyName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    policyName = reader.ReadValueAsString();
                }
                else if (string.Compare("PolicyInheritedFrom", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    policyInheritedFrom = BackupPolicyScopeConverter.Deserialize(reader);
                }
                else if (string.Compare("SuspensionInfo", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    suspensionInfo = BackupSuspensionInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionId = PartitionIdConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new PartitionBackupConfigurationInfo(
                       policyName: policyName,
                       policyInheritedFrom: policyInheritedFrom,
                       suspensionInfo: suspensionInfo,
                       serviceName: serviceName,
                       partitionId: partitionId));
        }
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 ResolvedServicePartition GetFromJsonProperties(JsonReader reader)
        {
            var name = default(ServiceName);
            var partitionInformation = default(PartitionInformation);
            var endpoints            = default(IEnumerable <ResolvedServiceEndpoint>);
            var version = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionInformation", propName, StringComparison.Ordinal) == 0)
                {
                    partitionInformation = PartitionInformationConverter.Deserialize(reader);
                }
                else if (string.Compare("Endpoints", propName, StringComparison.Ordinal) == 0)
                {
                    endpoints = reader.ReadList(ResolvedServiceEndpointConverter.Deserialize);
                }
                else if (string.Compare("Version", propName, StringComparison.Ordinal) == 0)
                {
                    version = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ResolvedServicePartition(
                       name: name,
                       partitionInformation: partitionInformation,
                       endpoints: endpoints,
                       version: version));
        }
Ejemplo n.º 13
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 ServiceHealthEvaluation GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var description           = default(string);
            var serviceName           = default(ServiceName);
            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("ServiceName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("UnhealthyEvaluations", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ServiceHealthEvaluation(
                       aggregatedHealthState: aggregatedHealthState,
                       description: description,
                       serviceName: serviceName,
                       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 StatelessServiceDescription GetFromJsonProperties(JsonReader reader)
        {
            var applicationName              = default(ApplicationName);
            var serviceName                  = default(ServiceName);
            var serviceTypeName              = default(string);
            var initializationData           = default(byte[]);
            var partitionDescription         = default(PartitionSchemeDescription);
            var placementConstraints         = default(string);
            var correlationScheme            = default(IEnumerable <ServiceCorrelationDescription>);
            var serviceLoadMetrics           = default(IEnumerable <ServiceLoadMetricDescription>);
            var servicePlacementPolicies     = default(IEnumerable <ServicePlacementPolicyDescription>);
            var defaultMoveCost              = default(MoveCost?);
            var isDefaultMoveCostSpecified   = default(bool?);
            var servicePackageActivationMode = default(ServicePackageActivationMode?);
            var serviceDnsName               = default(string);
            var scalingPolicies              = default(IEnumerable <ScalingPolicyDescription>);
            var instanceCount                = default(int?);
            var minInstanceCount             = default(int?);
            var minInstancePercentage        = default(int?);
            var flags = default(int?);
            var instanceCloseDelayDurationSeconds = default(long?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ApplicationName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceTypeName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceTypeName = reader.ReadValueAsString();
                }
                else if (string.Compare("InitializationData", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    initializationData = ByteArrayConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionDescription", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionDescription = PartitionSchemeDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("PlacementConstraints", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    placementConstraints = reader.ReadValueAsString();
                }
                else if (string.Compare("CorrelationScheme", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    correlationScheme = reader.ReadList(ServiceCorrelationDescriptionConverter.Deserialize);
                }
                else if (string.Compare("ServiceLoadMetrics", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceLoadMetrics = reader.ReadList(ServiceLoadMetricDescriptionConverter.Deserialize);
                }
                else if (string.Compare("ServicePlacementPolicies", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    servicePlacementPolicies = reader.ReadList(ServicePlacementPolicyDescriptionConverter.Deserialize);
                }
                else if (string.Compare("DefaultMoveCost", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    defaultMoveCost = MoveCostConverter.Deserialize(reader);
                }
                else if (string.Compare("IsDefaultMoveCostSpecified", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    isDefaultMoveCostSpecified = reader.ReadValueAsBool();
                }
                else if (string.Compare("ServicePackageActivationMode", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    servicePackageActivationMode = ServicePackageActivationModeConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceDnsName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceDnsName = reader.ReadValueAsString();
                }
                else if (string.Compare("ScalingPolicies", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    scalingPolicies = reader.ReadList(ScalingPolicyDescriptionConverter.Deserialize);
                }
                else if (string.Compare("InstanceCount", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    instanceCount = reader.ReadValueAsInt();
                }
                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 if (string.Compare("Flags", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    flags = reader.ReadValueAsInt();
                }
                else if (string.Compare("InstanceCloseDelayDurationSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    instanceCloseDelayDurationSeconds = reader.ReadValueAsLong();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StatelessServiceDescription(
                       applicationName: applicationName,
                       serviceName: serviceName,
                       serviceTypeName: serviceTypeName,
                       initializationData: initializationData,
                       partitionDescription: partitionDescription,
                       placementConstraints: placementConstraints,
                       correlationScheme: correlationScheme,
                       serviceLoadMetrics: serviceLoadMetrics,
                       servicePlacementPolicies: servicePlacementPolicies,
                       defaultMoveCost: defaultMoveCost,
                       isDefaultMoveCostSpecified: isDefaultMoveCostSpecified,
                       servicePackageActivationMode: servicePackageActivationMode,
                       serviceDnsName: serviceDnsName,
                       scalingPolicies: scalingPolicies,
                       instanceCount: instanceCount,
                       minInstanceCount: minInstanceCount,
                       minInstancePercentage: minInstancePercentage,
                       flags: flags,
                       instanceCloseDelayDurationSeconds: instanceCloseDelayDurationSeconds));
        }
        /// <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 StatefulServiceDescription GetFromJsonProperties(JsonReader reader)
        {
            var applicationName              = default(ApplicationName);
            var serviceName                  = default(ServiceName);
            var serviceTypeName              = default(string);
            var initializationData           = default(byte[]);
            var partitionDescription         = default(PartitionSchemeDescription);
            var placementConstraints         = default(string);
            var correlationScheme            = default(IEnumerable <ServiceCorrelationDescription>);
            var serviceLoadMetrics           = default(IEnumerable <ServiceLoadMetricDescription>);
            var servicePlacementPolicies     = default(IEnumerable <ServicePlacementPolicyDescription>);
            var defaultMoveCost              = default(MoveCost?);
            var isDefaultMoveCostSpecified   = default(bool?);
            var servicePackageActivationMode = default(ServicePackageActivationMode?);
            var serviceDnsName               = default(string);
            var scalingPolicies              = default(IEnumerable <ScalingPolicyDescription>);
            var targetReplicaSetSize         = default(int?);
            var minReplicaSetSize            = default(int?);
            var hasPersistedState            = default(bool?);
            var flags = default(int?);
            var replicaRestartWaitDurationSeconds = default(long?);
            var quorumLossWaitDurationSeconds     = default(long?);
            var standByReplicaKeepDurationSeconds = default(long?);
            var servicePlacementTimeLimitSeconds  = default(long?);
            var dropSourceReplicaOnMove           = default(bool?);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ApplicationName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceTypeName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceTypeName = reader.ReadValueAsString();
                }
                else if (string.Compare("InitializationData", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    initializationData = ByteArrayConverter.Deserialize(reader);
                }
                else if (string.Compare("PartitionDescription", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    partitionDescription = PartitionSchemeDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("PlacementConstraints", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    placementConstraints = reader.ReadValueAsString();
                }
                else if (string.Compare("CorrelationScheme", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    correlationScheme = reader.ReadList(ServiceCorrelationDescriptionConverter.Deserialize);
                }
                else if (string.Compare("ServiceLoadMetrics", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceLoadMetrics = reader.ReadList(ServiceLoadMetricDescriptionConverter.Deserialize);
                }
                else if (string.Compare("ServicePlacementPolicies", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    servicePlacementPolicies = reader.ReadList(ServicePlacementPolicyDescriptionConverter.Deserialize);
                }
                else if (string.Compare("DefaultMoveCost", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    defaultMoveCost = MoveCostConverter.Deserialize(reader);
                }
                else if (string.Compare("IsDefaultMoveCostSpecified", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    isDefaultMoveCostSpecified = reader.ReadValueAsBool();
                }
                else if (string.Compare("ServicePackageActivationMode", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    servicePackageActivationMode = ServicePackageActivationModeConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceDnsName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceDnsName = reader.ReadValueAsString();
                }
                else if (string.Compare("ScalingPolicies", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    scalingPolicies = reader.ReadList(ScalingPolicyDescriptionConverter.Deserialize);
                }
                else if (string.Compare("TargetReplicaSetSize", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    targetReplicaSetSize = reader.ReadValueAsInt();
                }
                else if (string.Compare("MinReplicaSetSize", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    minReplicaSetSize = reader.ReadValueAsInt();
                }
                else if (string.Compare("HasPersistedState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    hasPersistedState = reader.ReadValueAsBool();
                }
                else if (string.Compare("Flags", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    flags = reader.ReadValueAsInt();
                }
                else if (string.Compare("ReplicaRestartWaitDurationSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    replicaRestartWaitDurationSeconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("QuorumLossWaitDurationSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    quorumLossWaitDurationSeconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("StandByReplicaKeepDurationSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    standByReplicaKeepDurationSeconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("ServicePlacementTimeLimitSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    servicePlacementTimeLimitSeconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("DropSourceReplicaOnMove", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    dropSourceReplicaOnMove = reader.ReadValueAsBool();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new StatefulServiceDescription(
                       applicationName: applicationName,
                       serviceName: serviceName,
                       serviceTypeName: serviceTypeName,
                       initializationData: initializationData,
                       partitionDescription: partitionDescription,
                       placementConstraints: placementConstraints,
                       correlationScheme: correlationScheme,
                       serviceLoadMetrics: serviceLoadMetrics,
                       servicePlacementPolicies: servicePlacementPolicies,
                       defaultMoveCost: defaultMoveCost,
                       isDefaultMoveCostSpecified: isDefaultMoveCostSpecified,
                       servicePackageActivationMode: servicePackageActivationMode,
                       serviceDnsName: serviceDnsName,
                       scalingPolicies: scalingPolicies,
                       targetReplicaSetSize: targetReplicaSetSize,
                       minReplicaSetSize: minReplicaSetSize,
                       hasPersistedState: hasPersistedState,
                       flags: flags,
                       replicaRestartWaitDurationSeconds: replicaRestartWaitDurationSeconds,
                       quorumLossWaitDurationSeconds: quorumLossWaitDurationSeconds,
                       standByReplicaKeepDurationSeconds: standByReplicaKeepDurationSeconds,
                       servicePlacementTimeLimitSeconds: servicePlacementTimeLimitSeconds,
                       dropSourceReplicaOnMove: dropSourceReplicaOnMove));
        }
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 DeployedStatefulServiceReplicaInfo GetFromJsonProperties(JsonReader reader)
        {
            var serviceName                = default(ServiceName);
            var serviceTypeName            = default(string);
            var serviceManifestName        = default(string);
            var codePackageName            = default(string);
            var partitionId                = default(PartitionId);
            var replicaStatus              = default(ReplicaStatus?);
            var address                    = default(string);
            var servicePackageActivationId = default(string);
            var hostProcessId              = default(string);
            var replicaId                  = default(ReplicaId);
            var replicaRole                = default(ReplicaRole?);
            var reconfigurationInformation = default(ReconfigurationInformation);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("ServiceName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceName = ServiceNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceTypeName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceTypeName = reader.ReadValueAsString();
                }
                else if (string.Compare("ServiceManifestName", propName, StringComparison.Ordinal) == 0)
                {
                    serviceManifestName = reader.ReadValueAsString();
                }
                else if (string.Compare("CodePackageName", propName, StringComparison.Ordinal) == 0)
                {
                    codePackageName = reader.ReadValueAsString();
                }
                else if (string.Compare("PartitionId", propName, StringComparison.Ordinal) == 0)
                {
                    partitionId = PartitionIdConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaStatus", propName, StringComparison.Ordinal) == 0)
                {
                    replicaStatus = ReplicaStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("Address", propName, StringComparison.Ordinal) == 0)
                {
                    address = reader.ReadValueAsString();
                }
                else if (string.Compare("ServicePackageActivationId", propName, StringComparison.Ordinal) == 0)
                {
                    servicePackageActivationId = reader.ReadValueAsString();
                }
                else if (string.Compare("HostProcessId", propName, StringComparison.Ordinal) == 0)
                {
                    hostProcessId = reader.ReadValueAsString();
                }
                else if (string.Compare("ReplicaId", propName, StringComparison.Ordinal) == 0)
                {
                    replicaId = ReplicaIdConverter.Deserialize(reader);
                }
                else if (string.Compare("ReplicaRole", propName, StringComparison.Ordinal) == 0)
                {
                    replicaRole = ReplicaRoleConverter.Deserialize(reader);
                }
                else if (string.Compare("ReconfigurationInformation", propName, StringComparison.Ordinal) == 0)
                {
                    reconfigurationInformation = ReconfigurationInformationConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedStatefulServiceReplicaInfo(
                       serviceName: serviceName,
                       serviceTypeName: serviceTypeName,
                       serviceManifestName: serviceManifestName,
                       codePackageName: codePackageName,
                       partitionId: partitionId,
                       replicaStatus: replicaStatus,
                       address: address,
                       servicePackageActivationId: servicePackageActivationId,
                       hostProcessId: hostProcessId,
                       replicaId: replicaId,
                       replicaRole: replicaRole,
                       reconfigurationInformation: reconfigurationInformation));
        }