/// <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 RestorePartitionDescription GetFromJsonProperties(JsonReader reader)
        {
            var backupId       = default(Guid?);
            var backupLocation = default(string);
            var backupStorage  = default(BackupStorageDescription);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("BackupId", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    backupId = reader.ReadValueAsGuid();
                }
                else if (string.Compare("BackupLocation", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    backupLocation = reader.ReadValueAsString();
                }
                else if (string.Compare("BackupStorage", propName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    backupStorage = BackupStorageDescriptionConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new RestorePartitionDescription(
                       backupId: backupId,
                       backupLocation: backupLocation,
                       backupStorage: backupStorage));
        }
        /// <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 BackupPolicyDescription GetFromJsonProperties(JsonReader reader)
        {
            var name = default(string);
            var autoRestoreOnDataLoss = default(bool?);
            var maxIncrementalBackups = default(int?);
            var schedule        = default(BackupScheduleDescription);
            var storage         = default(BackupStorageDescription);
            var retentionPolicy = default(RetentionPolicyDescription);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("Name", propName, StringComparison.Ordinal) == 0)
                {
                    name = reader.ReadValueAsString();
                }
                else if (string.Compare("AutoRestoreOnDataLoss", propName, StringComparison.Ordinal) == 0)
                {
                    autoRestoreOnDataLoss = reader.ReadValueAsBool();
                }
                else if (string.Compare("MaxIncrementalBackups", propName, StringComparison.Ordinal) == 0)
                {
                    maxIncrementalBackups = reader.ReadValueAsInt();
                }
                else if (string.Compare("Schedule", propName, StringComparison.Ordinal) == 0)
                {
                    schedule = BackupScheduleDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("Storage", propName, StringComparison.Ordinal) == 0)
                {
                    storage = BackupStorageDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("RetentionPolicy", propName, StringComparison.Ordinal) == 0)
                {
                    retentionPolicy = RetentionPolicyDescriptionConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new BackupPolicyDescription(
                       name: name,
                       autoRestoreOnDataLoss: autoRestoreOnDataLoss,
                       maxIncrementalBackups: maxIncrementalBackups,
                       schedule: schedule,
                       storage: storage,
                       retentionPolicy: retentionPolicy));
        }
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 GetBackupByStorageQueryDescription GetFromJsonProperties(JsonReader reader)
        {
            var startDateTimeFilter = default(DateTime?);
            var endDateTimeFilter   = default(DateTime?);
            var latest       = default(bool?);
            var storage      = default(BackupStorageDescription);
            var backupEntity = default(BackupEntity);

            do
            {
                var propName = reader.ReadPropertyName();
                if (string.Compare("StartDateTimeFilter", propName, StringComparison.Ordinal) == 0)
                {
                    startDateTimeFilter = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("EndDateTimeFilter", propName, StringComparison.Ordinal) == 0)
                {
                    endDateTimeFilter = reader.ReadValueAsDateTime();
                }
                else if (string.Compare("Latest", propName, StringComparison.Ordinal) == 0)
                {
                    latest = reader.ReadValueAsBool();
                }
                else if (string.Compare("Storage", propName, StringComparison.Ordinal) == 0)
                {
                    storage = BackupStorageDescriptionConverter.Deserialize(reader);
                }
                else if (string.Compare("BackupEntity", propName, StringComparison.Ordinal) == 0)
                {
                    backupEntity = BackupEntityConverter.Deserialize(reader);
                }
                else
                {
                    reader.SkipPropertyValue();
                }
            }while (reader.TokenType != JsonToken.EndObject);

            return(new GetBackupByStorageQueryDescription(
                       startDateTimeFilter: startDateTimeFilter,
                       endDateTimeFilter: endDateTimeFilter,
                       latest: latest,
                       storage: storage,
                       backupEntity: backupEntity));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the object from Json properties.
        /// </summary>
        /// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
        /// <returns>The object Value.</returns>
        internal static BackupPartitionDescription GetFromJsonProperties(JsonReader reader)
        {
            var backupStorage = default(BackupStorageDescription);

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

            return(new BackupPartitionDescription(
                       backupStorage: backupStorage));
        }