/// <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 ApplicationNameInfo GetFromJsonProperties(JsonReader reader)
        {
            var id   = default(string);
            var name = default(ApplicationName);

            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
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationNameInfo(
                       id: id,
                       name: name));
        }
        /// <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 DeployedApplicationHealthState GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var nodeName        = default(NodeName);
            var applicationName = default(ApplicationName);

            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
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedApplicationHealthState(
                       aggregatedHealthState: aggregatedHealthState,
                       nodeName: nodeName,
                       applicationName: applicationName));
        }
Exemple #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 ApplicationHealthPolicyMapItem GetFromJsonProperties(JsonReader reader)
        {
            var key   = default(ApplicationName);
            var value = default(ApplicationHealthPolicy);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Key", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    key = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("Value", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    value = ApplicationHealthPolicyConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationHealthPolicyMapItem(
                       key: key,
                       value: value));
        }
        /// <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));
        }
Exemple #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 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 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));
        }
        /// <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 ApplicationDescription GetFromJsonProperties(JsonReader reader)
        {
            var name                       = default(ApplicationName);
            var typeName                   = default(string);
            var typeVersion                = default(string);
            var parameters                 = default(IReadOnlyDictionary <string, string>);
            var applicationCapacity        = default(ApplicationCapacityDescription);
            var managedApplicationIdentity = default(ManagedApplicationIdentityDescription);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    name = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("TypeName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    typeName = reader.ReadValueAsString();
                }
                else if (string.Compare("TypeVersion", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    typeVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("ParameterList", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    parameters = ApplicationParametersConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationCapacity", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationCapacity = ApplicationCapacityDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("ManagedApplicationIdentity", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    managedApplicationIdentity = ManagedApplicationIdentityDescriptionConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationDescription(
                       name: name,
                       typeName: typeName,
                       typeVersion: typeVersion,
                       parameters: parameters,
                       applicationCapacity: applicationCapacity,
                       managedApplicationIdentity: managedApplicationIdentity));
        }
        /// <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.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationTypeName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationTypeName = reader.ReadValueAsString();
                }
                else if (string.Compare("ServiceHealthStateChunks", propName, StringComparison.Ordinal) == 0)
                {
                    serviceHealthStateChunks = ServiceHealthStateChunkListConverter.Deserialize(reader);
                }
                else if (string.Compare("DeployedApplicationHealthStateChunks", propName, StringComparison.Ordinal) == 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));
        }
Exemple #9
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 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.OrdinalIgnoreCase) == 0)
                {
                    aggregatedHealthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("NodeName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    nodeName = NodeNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("ServiceManifestName", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    serviceManifestName = reader.ReadValueAsString();
                }
                else if (string.Compare("ServicePackageActivationId", propName, StringComparison.OrdinalIgnoreCase) == 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));
        }
Exemple #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 DeployedApplicationHealthEvaluation GetFromJsonProperties(JsonReader reader)
        {
            var aggregatedHealthState = default(HealthState?);
            var description           = default(string);
            var nodeName             = default(NodeName);
            var applicationName      = default(ApplicationName);
            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("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("UnhealthyEvaluations", propName, StringComparison.Ordinal) == 0)
                {
                    unhealthyEvaluations = reader.ReadList(HealthEvaluationWrapperConverter.Deserialize);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new DeployedApplicationHealthEvaluation(
                       aggregatedHealthState: aggregatedHealthState,
                       description: description,
                       nodeName: nodeName,
                       applicationName: applicationName,
                       unhealthyEvaluations: unhealthyEvaluations));
        }
Exemple #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 ApplicationBackupEntity GetFromJsonProperties(JsonReader reader)
        {
            var applicationName = default(ApplicationName);

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

            return(new ApplicationBackupEntity(
                       applicationName: applicationName));
        }
        /// <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 ApplicationUpgradeUpdateDescription GetFromJsonProperties(JsonReader reader)
        {
            var name                    = default(ApplicationName);
            var upgradeKind             = default(UpgradeKind?);
            var applicationHealthPolicy = default(ApplicationHealthPolicy);
            var updateDescription       = default(RollingUpgradeUpdateDescription);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    name = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeKind", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeKind = UpgradeKindConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationHealthPolicy", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationHealthPolicy = ApplicationHealthPolicyConverter.Deserialize(reader);
                }
                else if (string.Compare("UpdateDescription", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    updateDescription = RollingUpgradeUpdateDescriptionConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationUpgradeUpdateDescription(
                       name: name,
                       upgradeKind: upgradeKind,
                       applicationHealthPolicy: applicationHealthPolicy,
                       updateDescription: updateDescription));
        }
Exemple #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 ApplicationBackupConfigurationInfo GetFromJsonProperties(JsonReader reader)
        {
            var policyName          = default(string);
            var policyInheritedFrom = default(BackupPolicyScope?);
            var suspensionInfo      = default(BackupSuspensionInfo);
            var applicationName     = default(ApplicationName);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("PolicyName", propName, StringComparison.Ordinal) == 0)
                {
                    policyName = reader.ReadValueAsString();
                }
                else if (string.Compare("PolicyInheritedFrom", propName, StringComparison.Ordinal) == 0)
                {
                    policyInheritedFrom = BackupPolicyScopeConverter.Deserialize(reader);
                }
                else if (string.Compare("SuspensionInfo", propName, StringComparison.Ordinal) == 0)
                {
                    suspensionInfo = BackupSuspensionInfoConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationBackupConfigurationInfo(
                       policyName: policyName,
                       policyInheritedFrom: policyInheritedFrom,
                       suspensionInfo: suspensionInfo,
                       applicationName: applicationName));
        }
Exemple #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 ComposeDeploymentStatusInfo GetFromJsonProperties(JsonReader reader)
        {
            var name            = default(string);
            var applicationName = default(ApplicationName);
            var status          = default(ComposeDeploymentStatus?);
            var statusDetails   = default(string);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = reader.ReadValueAsString();
                }
                else if (string.Compare("ApplicationName", propName, StringComparison.Ordinal) == 0)
                {
                    applicationName = ApplicationNameConverter.Deserialize(reader);
                }
                else if (string.Compare("Status", propName, StringComparison.Ordinal) == 0)
                {
                    status = ComposeDeploymentStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("StatusDetails", propName, StringComparison.Ordinal) == 0)
                {
                    statusDetails = reader.ReadValueAsString();
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ComposeDeploymentStatusInfo(
                       name: name,
                       applicationName: applicationName,
                       status: status,
                       statusDetails: statusDetails));
        }
        /// <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));
        }
Exemple #17
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));
        }
        /// <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 ApplicationInfo GetFromJsonProperties(JsonReader reader)
        {
            var id          = default(string);
            var name        = default(ApplicationName);
            var typeName    = default(string);
            var typeVersion = default(string);
            var status      = default(ApplicationStatus?);
            var parameters  = default(IReadOnlyDictionary <string, string>);
            var healthState = default(HealthState?);
            var applicationDefinitionKind = default(ApplicationDefinitionKind?);

            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("TypeVersion", propName, StringComparison.Ordinal) == 0)
                {
                    typeVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("Status", propName, StringComparison.Ordinal) == 0)
                {
                    status = ApplicationStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("Parameters", propName, StringComparison.Ordinal) == 0)
                {
                    parameters = ApplicationParametersConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthState", propName, StringComparison.Ordinal) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationDefinitionKind", propName, StringComparison.Ordinal) == 0)
                {
                    applicationDefinitionKind = ApplicationDefinitionKindConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationInfo(
                       id: id,
                       name: name,
                       typeName: typeName,
                       typeVersion: typeVersion,
                       status: status,
                       parameters: parameters,
                       healthState: healthState,
                       applicationDefinitionKind: applicationDefinitionKind));
        }