Esempio n. 1
0
        /// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
        /// <returns>The object Value.</returns>
        internal static VolumeProperties GetFromJsonProperties(JsonReader reader)
        {
            var description         = default(string);
            var azureFileParameters = default(VolumeProviderParametersAzureFile);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("description", propName, StringComparison.Ordinal) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("azureFileParameters", propName, StringComparison.Ordinal) == 0)
                {
                    azureFileParameters = VolumeProviderParametersAzureFileConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new VolumeProperties(
                       description: description,
                       azureFileParameters: azureFileParameters));
        }
        /// <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 VolumeProperties GetFromJsonProperties(JsonReader reader)
        {
            var description         = default(string);
            var status              = default(ResourceStatus?);
            var statusDetails       = default(string);
            var azureFileParameters = default(VolumeProviderParametersAzureFile);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("description", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    description = reader.ReadValueAsString();
                }
                else if (string.Compare("status", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    status = ResourceStatusConverter.Deserialize(reader);
                }
                else if (string.Compare("statusDetails", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    statusDetails = reader.ReadValueAsString();
                }
                else if (string.Compare("azureFileParameters", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    azureFileParameters = VolumeProviderParametersAzureFileConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            var volumeProperties = new VolumeProperties(
                description: description,
                azureFileParameters: azureFileParameters);

            volumeProperties.Status        = status;
            volumeProperties.StatusDetails = statusDetails;
            return(volumeProperties);
        }