internal Snapshot(string id, string name, string type, string location, IDictionary <string, string> tags, string managedBy, SnapshotSku sku, DateTimeOffset?timeCreated, OperatingSystemTypes?osType, HyperVGeneration?hyperVGeneration, CreationData creationData, int?diskSizeGB, long?diskSizeBytes, string uniqueId, EncryptionSettingsCollection encryptionSettingsCollection, string provisioningState, bool?incremental, Encryption encryption) : base(id, name, type, location, tags) { ManagedBy = managedBy; Sku = sku; TimeCreated = timeCreated; OsType = osType; HyperVGeneration = hyperVGeneration; CreationData = creationData; DiskSizeGB = diskSizeGB; DiskSizeBytes = diskSizeBytes; UniqueId = uniqueId; EncryptionSettingsCollection = encryptionSettingsCollection; ProvisioningState = provisioningState; Incremental = incremental; Encryption = encryption; }
internal Disk(string id, string name, string type, string location, IDictionary <string, string> tags, string managedBy, IList <string> managedByExtended, DiskSku sku, IList <string> zones, DateTimeOffset?timeCreated, OperatingSystemTypes?osType, HyperVGeneration?hyperVGeneration, CreationData creationData, int?diskSizeGB, long?diskSizeBytes, string uniqueId, EncryptionSettingsCollection encryptionSettingsCollection, string provisioningState, long?diskIopsReadWrite, long?diskMBpsReadWrite, long?diskIopsReadOnly, long?diskMBpsReadOnly, DiskState?diskState, Encryption encryption, int?maxShares, IList <ShareInfoElement> shareInfo) : base(id, name, type, location, tags) { ManagedBy = managedBy; ManagedByExtended = managedByExtended; Sku = sku; Zones = zones; TimeCreated = timeCreated; OsType = osType; HyperVGeneration = hyperVGeneration; CreationData = creationData; DiskSizeGB = diskSizeGB; DiskSizeBytes = diskSizeBytes; UniqueId = uniqueId; EncryptionSettingsCollection = encryptionSettingsCollection; ProvisioningState = provisioningState; DiskIopsReadWrite = diskIopsReadWrite; DiskMBpsReadWrite = diskMBpsReadWrite; DiskIopsReadOnly = diskIopsReadOnly; DiskMBpsReadOnly = diskMBpsReadOnly; DiskState = diskState; Encryption = encryption; MaxShares = maxShares; ShareInfo = shareInfo; }
internal static Disk DeserializeDisk(JsonElement element) { string managedBy = default; IList <string> managedByExtended = default; DiskSku sku = default; IList <string> zones = default; string id = default; string name = default; string type = default; string location = default; IDictionary <string, string> tags = default; DateTimeOffset? timeCreated = default; OperatingSystemTypes?osType = default; HyperVGeneration? hyperVGeneration = default; CreationData creationData = default; int? diskSizeGB = default; long? diskSizeBytes = default; string uniqueId = default; EncryptionSettingsCollection encryptionSettingsCollection = default; string provisioningState = default; long? diskIOPSReadWrite = default; long? diskMBpsReadWrite = default; long? diskIOPSReadOnly = default; long? diskMBpsReadOnly = default; DiskState? diskState = default; Encryption encryption = default; int? maxShares = default; IList <ShareInfoElement> shareInfo = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } managedBy = property.Value.GetString(); continue; } if (property.NameEquals("managedByExtended")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(item.GetString()); } } managedByExtended = array; continue; } if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } sku = DiskSku.DeserializeDiskSku(property.Value); continue; } if (property.NameEquals("zones")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(item.GetString()); } } zones = array; continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = property.Value.GetString(); continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) { dictionary.Add(property0.Name, null); } else { dictionary.Add(property0.Name, property0.Value.GetString()); } } tags = dictionary; continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("timeCreated")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } timeCreated = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("creationData")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } creationData = CreationData.DeserializeCreationData(property0.Value); continue; } if (property0.NameEquals("diskSizeGB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskSizeGB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("diskSizeBytes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("uniqueId")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } uniqueId = property0.Value.GetString(); continue; } if (property0.NameEquals("encryptionSettingsCollection")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } encryptionSettingsCollection = EncryptionSettingsCollection.DeserializeEncryptionSettingsCollection(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("diskIOPSReadWrite")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskIOPSReadWrite = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskMBpsReadWrite")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskMBpsReadWrite = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskIOPSReadOnly")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskIOPSReadOnly = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskMBpsReadOnly")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskMBpsReadOnly = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskState = new DiskState(property0.Value.GetString()); continue; } if (property0.NameEquals("encryption")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } encryption = Encryption.DeserializeEncryption(property0.Value); continue; } if (property0.NameEquals("maxShares")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } maxShares = property0.Value.GetInt32(); continue; } if (property0.NameEquals("shareInfo")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <ShareInfoElement> array = new List <ShareInfoElement>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(ShareInfoElement.DeserializeShareInfoElement(item)); } } shareInfo = array; continue; } } continue; } } return(new Disk(id, name, type, location, tags, managedBy, managedByExtended, sku, zones, timeCreated, osType, hyperVGeneration, creationData, diskSizeGB, diskSizeBytes, uniqueId, encryptionSettingsCollection, provisioningState, diskIOPSReadWrite, diskMBpsReadWrite, diskIOPSReadOnly, diskMBpsReadOnly, diskState, encryption, maxShares, shareInfo)); }
internal static Disk DeserializeDisk(JsonElement element) { Optional <string> managedBy = default; Optional <IReadOnlyList <string> > managedByExtended = default; Optional <DiskSku> sku = default; Optional <IList <string> > zones = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; string location = default; Optional <IDictionary <string, string> > tags = default; Optional <DateTimeOffset> timeCreated = default; Optional <OperatingSystemTypes> osType = default; Optional <HyperVGeneration> hyperVGeneration = default; Optional <CreationData> creationData = default; Optional <int> diskSizeGB = default; Optional <long> diskSizeBytes = default; Optional <string> uniqueId = default; Optional <EncryptionSettingsCollection> encryptionSettingsCollection = default; Optional <string> provisioningState = default; Optional <long> diskIOPSReadWrite = default; Optional <long> diskMBpsReadWrite = default; Optional <long> diskIOPSReadOnly = default; Optional <long> diskMBpsReadOnly = default; Optional <DiskState> diskState = default; Optional <Encryption> encryption = default; Optional <int> maxShares = default; Optional <IReadOnlyList <ShareInfoElement> > shareInfo = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy")) { managedBy = property.Value.GetString(); continue; } if (property.NameEquals("managedByExtended")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } managedByExtended = array; continue; } if (property.NameEquals("sku")) { sku = DiskSku.DeserializeDiskSku(property.Value); continue; } if (property.NameEquals("zones")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } zones = array; continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("timeCreated")) { timeCreated = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("osType")) { osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("creationData")) { creationData = CreationData.DeserializeCreationData(property0.Value); continue; } if (property0.NameEquals("diskSizeGB")) { diskSizeGB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("diskSizeBytes")) { diskSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("uniqueId")) { uniqueId = property0.Value.GetString(); continue; } if (property0.NameEquals("encryptionSettingsCollection")) { encryptionSettingsCollection = EncryptionSettingsCollection.DeserializeEncryptionSettingsCollection(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("diskIOPSReadWrite")) { diskIOPSReadWrite = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskMBpsReadWrite")) { diskMBpsReadWrite = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskIOPSReadOnly")) { diskIOPSReadOnly = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskMBpsReadOnly")) { diskMBpsReadOnly = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskState")) { diskState = new DiskState(property0.Value.GetString()); continue; } if (property0.NameEquals("encryption")) { encryption = Encryption.DeserializeEncryption(property0.Value); continue; } if (property0.NameEquals("maxShares")) { maxShares = property0.Value.GetInt32(); continue; } if (property0.NameEquals("shareInfo")) { List <ShareInfoElement> array = new List <ShareInfoElement>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ShareInfoElement.DeserializeShareInfoElement(item)); } shareInfo = array; continue; } } continue; } } return(new Disk(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), managedBy.Value, Optional.ToList(managedByExtended), sku.Value, Optional.ToList(zones), Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), uniqueId.Value, encryptionSettingsCollection.Value, provisioningState.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(diskIOPSReadOnly), Optional.ToNullable(diskMBpsReadOnly), Optional.ToNullable(diskState), encryption.Value, Optional.ToNullable(maxShares), Optional.ToList(shareInfo))); }
internal static Snapshot DeserializeSnapshot(JsonElement element) { Optional <string> managedBy = default; Optional <SnapshotSku> sku = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; string location = default; Optional <IDictionary <string, string> > tags = default; Optional <DateTimeOffset> timeCreated = default; Optional <OperatingSystemTypes> osType = default; Optional <HyperVGeneration> hyperVGeneration = default; Optional <CreationData> creationData = default; Optional <int> diskSizeGB = default; Optional <long> diskSizeBytes = default; Optional <string> uniqueId = default; Optional <EncryptionSettingsCollection> encryptionSettingsCollection = default; Optional <string> provisioningState = default; Optional <bool> incremental = default; Optional <Encryption> encryption = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy")) { managedBy = property.Value.GetString(); continue; } if (property.NameEquals("sku")) { sku = SnapshotSku.DeserializeSnapshotSku(property.Value); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("timeCreated")) { timeCreated = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("osType")) { osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("creationData")) { creationData = CreationData.DeserializeCreationData(property0.Value); continue; } if (property0.NameEquals("diskSizeGB")) { diskSizeGB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("diskSizeBytes")) { diskSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("uniqueId")) { uniqueId = property0.Value.GetString(); continue; } if (property0.NameEquals("encryptionSettingsCollection")) { encryptionSettingsCollection = EncryptionSettingsCollection.DeserializeEncryptionSettingsCollection(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("incremental")) { incremental = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("encryption")) { encryption = Encryption.DeserializeEncryption(property0.Value); continue; } } continue; } } return(new Snapshot(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), managedBy.Value, sku.Value, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), uniqueId.Value, encryptionSettingsCollection.Value, provisioningState.Value, Optional.ToNullable(incremental), encryption.Value)); }
internal static Snapshot DeserializeSnapshot(JsonElement element) { string managedBy = default; SnapshotSku sku = default; string id = default; string name = default; string type = default; string location = default; IDictionary <string, string> tags = default; DateTimeOffset? timeCreated = default; OperatingSystemTypes?osType = default; HyperVGeneration? hyperVGeneration = default; CreationData creationData = default; int? diskSizeGB = default; long? diskSizeBytes = default; string uniqueId = default; EncryptionSettingsCollection encryptionSettingsCollection = default; string provisioningState = default; bool? incremental = default; Encryption encryption = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } managedBy = property.Value.GetString(); continue; } if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } sku = SnapshotSku.DeserializeSnapshotSku(property.Value); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = property.Value.GetString(); continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) { dictionary.Add(property0.Name, null); } else { dictionary.Add(property0.Name, property0.Value.GetString()); } } tags = dictionary; continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("timeCreated")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } timeCreated = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("creationData")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } creationData = CreationData.DeserializeCreationData(property0.Value); continue; } if (property0.NameEquals("diskSizeGB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskSizeGB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("diskSizeBytes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } diskSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("uniqueId")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } uniqueId = property0.Value.GetString(); continue; } if (property0.NameEquals("encryptionSettingsCollection")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } encryptionSettingsCollection = EncryptionSettingsCollection.DeserializeEncryptionSettingsCollection(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("incremental")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } incremental = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("encryption")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } encryption = Encryption.DeserializeEncryption(property0.Value); continue; } } continue; } } return(new Snapshot(id, name, type, location, tags, managedBy, sku, timeCreated, osType, hyperVGeneration, creationData, diskSizeGB, diskSizeBytes, uniqueId, encryptionSettingsCollection, provisioningState, incremental, encryption)); }