/// <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 ApplicationUpgradeDescription GetFromJsonProperties(JsonReader reader)
        {
            var name = default(string);
            var targetApplicationTypeVersion = default(string);
            var parameters         = default(IReadOnlyDictionary <string, string>);
            var upgradeKind        = default(UpgradeKind?);
            var rollingUpgradeMode = default(UpgradeMode?);
            var upgradeReplicaSetCheckTimeoutInSeconds = default(long?);
            var forceRestart                        = default(bool?);
            var sortOrder                           = default(UpgradeSortOrder?);
            var monitoringPolicy                    = default(MonitoringPolicyDescription);
            var applicationHealthPolicy             = default(ApplicationHealthPolicy);
            var instanceCloseDelayDurationInSeconds = default(long?);
            var managedApplicationIdentity          = default(ManagedApplicationIdentityDescription);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    name = reader.ReadValueAsString();
                }
                else if (string.Compare("TargetApplicationTypeVersion", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    targetApplicationTypeVersion = reader.ReadValueAsString();
                }
                else if (string.Compare("Parameters", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    parameters = ApplicationParametersConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeKind", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeKind = UpgradeKindConverter.Deserialize(reader);
                }
                else if (string.Compare("RollingUpgradeMode", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    rollingUpgradeMode = UpgradeModeConverter.Deserialize(reader);
                }
                else if (string.Compare("UpgradeReplicaSetCheckTimeoutInSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    upgradeReplicaSetCheckTimeoutInSeconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("ForceRestart", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    forceRestart = reader.ReadValueAsBool();
                }
                else if (string.Compare("SortOrder", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    sortOrder = UpgradeSortOrderConverter.Deserialize(reader);
                }
                else if (string.Compare("MonitoringPolicy", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    monitoringPolicy = MonitoringPolicyDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationHealthPolicy", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationHealthPolicy = ApplicationHealthPolicyConverter.Deserialize(reader);
                }
                else if (string.Compare("InstanceCloseDelayDurationInSeconds", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    instanceCloseDelayDurationInSeconds = reader.ReadValueAsLong();
                }
                else if (string.Compare("ManagedApplicationIdentity", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    managedApplicationIdentity = ManagedApplicationIdentityDescriptionConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new ApplicationUpgradeDescription(
                       name: name,
                       targetApplicationTypeVersion: targetApplicationTypeVersion,
                       parameters: parameters,
                       upgradeKind: upgradeKind,
                       rollingUpgradeMode: rollingUpgradeMode,
                       upgradeReplicaSetCheckTimeoutInSeconds: upgradeReplicaSetCheckTimeoutInSeconds,
                       forceRestart: forceRestart,
                       sortOrder: sortOrder,
                       monitoringPolicy: monitoringPolicy,
                       applicationHealthPolicy: applicationHealthPolicy,
                       instanceCloseDelayDurationInSeconds: instanceCloseDelayDurationInSeconds,
                       managedApplicationIdentity: managedApplicationIdentity));
        }
Пример #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 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?);
            var managedApplicationIdentity = default(ManagedApplicationIdentityDescription);
            var applicationMetadata        = default(ApplicationMetadata);

            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 = 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("Status", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    status = ApplicationStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("Parameters", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    parameters = ApplicationParametersConverter.Deserialize(reader);
                }
                else if (string.Compare("HealthState", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    healthState = HealthStateConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationDefinitionKind", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationDefinitionKind = ApplicationDefinitionKindConverter.Deserialize(reader);
                }
                else if (string.Compare("ManagedApplicationIdentity", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    managedApplicationIdentity = ManagedApplicationIdentityDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("ApplicationMetadata", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    applicationMetadata = ApplicationMetadataConverter.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,
                       managedApplicationIdentity: managedApplicationIdentity,
                       applicationMetadata: applicationMetadata));
        }