internal DedicatedHostUpdate(IDictionary <string, string> tags, int?platformFaultDomain, bool?autoReplaceOnFailure, string hostId, IList <SubResourceReadOnly> virtualMachines, DedicatedHostLicenseTypes?licenseType, DateTimeOffset?provisioningTime, string provisioningState, DedicatedHostInstanceView instanceView) : base(tags) { PlatformFaultDomain = platformFaultDomain; AutoReplaceOnFailure = autoReplaceOnFailure; HostId = hostId; VirtualMachines = virtualMachines; LicenseType = licenseType; ProvisioningTime = provisioningTime; ProvisioningState = provisioningState; InstanceView = instanceView; }
internal DedicatedHost(string id, string name, string type, string location, IDictionary <string, string> tags, Sku sku, int?platformFaultDomain, bool?autoReplaceOnFailure, string hostId, IReadOnlyList <SubResourceReadOnly> virtualMachines, DedicatedHostLicenseTypes?licenseType, DateTimeOffset?provisioningTime, string provisioningState, DedicatedHostInstanceView instanceView) : base(id, name, type, location, tags) { Sku = sku; PlatformFaultDomain = platformFaultDomain; AutoReplaceOnFailure = autoReplaceOnFailure; HostId = hostId; VirtualMachines = virtualMachines; LicenseType = licenseType; ProvisioningTime = provisioningTime; ProvisioningState = provisioningState; InstanceView = instanceView; }
internal static DedicatedHost DeserializeDedicatedHost(JsonElement element) { Sku sku = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; string location = default; Optional <IDictionary <string, string> > tags = default; Optional <int> platformFaultDomain = default; Optional <bool> autoReplaceOnFailure = default; Optional <string> hostId = default; Optional <IReadOnlyList <SubResourceReadOnly> > virtualMachines = default; Optional <DedicatedHostLicenseTypes> licenseType = default; Optional <DateTimeOffset> provisioningTime = default; Optional <string> provisioningState = default; Optional <DedicatedHostInstanceView> instanceView = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) { sku = Sku.DeserializeSku(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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("platformFaultDomain")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } platformFaultDomain = property0.Value.GetInt32(); continue; } if (property0.NameEquals("autoReplaceOnFailure")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } autoReplaceOnFailure = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("hostId")) { hostId = property0.Value.GetString(); continue; } if (property0.NameEquals("virtualMachines")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <SubResourceReadOnly> array = new List <SubResourceReadOnly>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(SubResourceReadOnly.DeserializeSubResourceReadOnly(item)); } virtualMachines = array; continue; } if (property0.NameEquals("licenseType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } licenseType = property0.Value.GetString().ToDedicatedHostLicenseTypes(); continue; } if (property0.NameEquals("provisioningTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("instanceView")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } instanceView = DedicatedHostInstanceView.DeserializeDedicatedHostInstanceView(property0.Value); continue; } } continue; } } return(new DedicatedHost(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), sku, Optional.ToNullable(platformFaultDomain), Optional.ToNullable(autoReplaceOnFailure), hostId.Value, Optional.ToList(virtualMachines), Optional.ToNullable(licenseType), Optional.ToNullable(provisioningTime), provisioningState.Value, instanceView.Value)); }
internal static DedicatedHost DeserializeDedicatedHost(JsonElement element) { Sku sku = default; string id = default; string name = default; string type = default; string location = default; IDictionary <string, string> tags = default; int? platformFaultDomain = default; bool? autoReplaceOnFailure = default; string hostId = default; IList <SubResourceReadOnly> virtualMachines = default; DedicatedHostLicenseTypes? licenseType = default; DateTimeOffset? provisioningTime = default; string provisioningState = default; DedicatedHostInstanceView instanceView = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) { sku = Sku.DeserializeSku(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("platformFaultDomain")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } platformFaultDomain = property0.Value.GetInt32(); continue; } if (property0.NameEquals("autoReplaceOnFailure")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } autoReplaceOnFailure = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("hostId")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } hostId = property0.Value.GetString(); continue; } if (property0.NameEquals("virtualMachines")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <SubResourceReadOnly> array = new List <SubResourceReadOnly>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(SubResourceReadOnly.DeserializeSubResourceReadOnly(item)); } } virtualMachines = array; continue; } if (property0.NameEquals("licenseType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } licenseType = property0.Value.GetString().ToDedicatedHostLicenseTypes(); continue; } if (property0.NameEquals("provisioningTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } provisioningTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("instanceView")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } instanceView = DedicatedHostInstanceView.DeserializeDedicatedHostInstanceView(property0.Value); continue; } } continue; } } return(new DedicatedHost(id, name, type, location, tags, sku, platformFaultDomain, autoReplaceOnFailure, hostId, virtualMachines, licenseType, provisioningTime, provisioningState, instanceView)); }