internal static VirtualMachineSecrets DeserializeVirtualMachineSecrets(JsonElement element) { Optional <VirtualMachineSshCredentials> administratorAccount = default; ComputeType computeType = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("administratorAccount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } administratorAccount = VirtualMachineSshCredentials.DeserializeVirtualMachineSshCredentials(property.Value); continue; } if (property.NameEquals("computeType")) { computeType = new ComputeType(property.Value.GetString()); continue; } } return(new VirtualMachineSecrets(computeType, administratorAccount.Value)); }
internal static VirtualMachineProperties DeserializeVirtualMachineProperties(JsonElement element) { Optional <string> virtualMachineSize = default; Optional <int> sshPort = default; Optional <string> address = default; Optional <VirtualMachineSshCredentials> administratorAccount = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("virtualMachineSize")) { virtualMachineSize = property.Value.GetString(); continue; } if (property.NameEquals("sshPort")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sshPort = property.Value.GetInt32(); continue; } if (property.NameEquals("address")) { address = property.Value.GetString(); continue; } if (property.NameEquals("administratorAccount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } administratorAccount = VirtualMachineSshCredentials.DeserializeVirtualMachineSshCredentials(property.Value); continue; } } return(new VirtualMachineProperties(virtualMachineSize.Value, Optional.ToNullable(sshPort), address.Value, administratorAccount.Value)); }