internal AmlComputeProperties(OSType?osType, string vmSize, VmPriority?vmPriority, VirtualMachineImage virtualMachineImage, bool?isolatedNetwork, ScaleSettings scaleSettings, UserAccountCredentials userAccountCredentials, ResourceId subnet, RemoteLoginPortPublicAccess?remoteLoginPortPublicAccess, AllocationState?allocationState, DateTimeOffset?allocationStateTransitionOn, IReadOnlyList <ErrorResponse> errors, int?currentNodeCount, int?targetNodeCount, NodeStateCounts nodeStateCounts, bool?enableNodePublicIP, IDictionary <string, BinaryData> propertyBag) { OSType = osType; VmSize = vmSize; VmPriority = vmPriority; VirtualMachineImage = virtualMachineImage; IsolatedNetwork = isolatedNetwork; ScaleSettings = scaleSettings; UserAccountCredentials = userAccountCredentials; Subnet = subnet; RemoteLoginPortPublicAccess = remoteLoginPortPublicAccess; AllocationState = allocationState; AllocationStateTransitionOn = allocationStateTransitionOn; Errors = errors; CurrentNodeCount = currentNodeCount; TargetNodeCount = targetNodeCount; NodeStateCounts = nodeStateCounts; EnableNodePublicIP = enableNodePublicIP; PropertyBag = propertyBag; }
internal static AmlComputeProperties DeserializeAmlComputeProperties(JsonElement element) { Optional <OSType> osType = default; Optional <string> vmSize = default; Optional <VmPriority> vmPriority = default; Optional <VirtualMachineImage> virtualMachineImage = default; Optional <bool> isolatedNetwork = default; Optional <ScaleSettings> scaleSettings = default; Optional <UserAccountCredentials> userAccountCredentials = default; Optional <ResourceId> subnet = default; Optional <RemoteLoginPortPublicAccess> remoteLoginPortPublicAccess = default; Optional <AllocationState> allocationState = default; Optional <DateTimeOffset> allocationStateTransitionTime = default; Optional <IReadOnlyList <ErrorResponse> > errors = default; Optional <int> currentNodeCount = default; Optional <int> targetNodeCount = default; Optional <NodeStateCounts> nodeStateCounts = default; Optional <bool> enableNodePublicIp = default; Optional <IDictionary <string, BinaryData> > propertyBag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osType")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } osType = new OSType(property.Value.GetString()); continue; } if (property.NameEquals("vmSize")) { vmSize = property.Value.GetString(); continue; } if (property.NameEquals("vmPriority")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } vmPriority = new VmPriority(property.Value.GetString()); continue; } if (property.NameEquals("virtualMachineImage")) { if (property.Value.ValueKind == JsonValueKind.Null) { virtualMachineImage = null; continue; } virtualMachineImage = VirtualMachineImage.DeserializeVirtualMachineImage(property.Value); continue; } if (property.NameEquals("isolatedNetwork")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } isolatedNetwork = property.Value.GetBoolean(); continue; } if (property.NameEquals("scaleSettings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } scaleSettings = ScaleSettings.DeserializeScaleSettings(property.Value); continue; } if (property.NameEquals("userAccountCredentials")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } userAccountCredentials = UserAccountCredentials.DeserializeUserAccountCredentials(property.Value); continue; } if (property.NameEquals("subnet")) { if (property.Value.ValueKind == JsonValueKind.Null) { subnet = null; continue; } subnet = ResourceId.DeserializeResourceId(property.Value); continue; } if (property.NameEquals("remoteLoginPortPublicAccess")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } remoteLoginPortPublicAccess = new RemoteLoginPortPublicAccess(property.Value.GetString()); continue; } if (property.NameEquals("allocationState")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } allocationState = new AllocationState(property.Value.GetString()); continue; } if (property.NameEquals("allocationStateTransitionTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } allocationStateTransitionTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("errors")) { if (property.Value.ValueKind == JsonValueKind.Null) { errors = null; continue; } List <ErrorResponse> array = new List <ErrorResponse>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item)); } errors = array; continue; } if (property.NameEquals("currentNodeCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } currentNodeCount = property.Value.GetInt32(); continue; } if (property.NameEquals("targetNodeCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } targetNodeCount = property.Value.GetInt32(); continue; } if (property.NameEquals("nodeStateCounts")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } nodeStateCounts = NodeStateCounts.DeserializeNodeStateCounts(property.Value); continue; } if (property.NameEquals("enableNodePublicIp")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enableNodePublicIp = property.Value.GetBoolean(); continue; } if (property.NameEquals("propertyBag")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, BinaryData> dictionary = new Dictionary <string, BinaryData>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } propertyBag = dictionary; continue; } } return(new AmlComputeProperties(Optional.ToNullable(osType), vmSize.Value, Optional.ToNullable(vmPriority), virtualMachineImage.Value, Optional.ToNullable(isolatedNetwork), scaleSettings.Value, userAccountCredentials.Value, subnet.Value, Optional.ToNullable(remoteLoginPortPublicAccess), Optional.ToNullable(allocationState), Optional.ToNullable(allocationStateTransitionTime), Optional.ToList(errors), Optional.ToNullable(currentNodeCount), Optional.ToNullable(targetNodeCount), nodeStateCounts.Value, Optional.ToNullable(enableNodePublicIp), Optional.ToDictionary(propertyBag))); }