ConfigExtensions
public static class ConfigExtensions
1. Methods
1.1. Add(ICollection<Contact>, string, bool)
public static Contact Add(this ICollection<Contact> this, string name, bool isNatural = true)
| Name | Type | Description |
|---|---|---|
this |
ICollection<Contact> |
|
name |
string |
|
isNatural |
bool |
Returns: Contact
1.2. Add(ICollection<User>, Contact, string, Role?)
public static User Add(this ICollection<User> this, Contact contact, string password, Role? role = null)
| Name | Type | Description |
|---|---|---|
this |
ICollection<User> |
|
contact |
Contact |
|
password |
string |
|
role |
Role? |
Returns: User
1.3. Add(ICollection<User>, string, string, Role?)
public static User Add(this ICollection<User> this, string username, string password, Role? role = null)
| Name | Type | Description |
|---|---|---|
this |
ICollection<User> |
|
username |
string |
|
password |
string |
|
role |
Role? |
Returns: User
1.4. GenerateMapFiles(NETSetupConfig, IFileOperator, string)
public static void GenerateMapFiles(this NETSetupConfig config, IFileOperator source, string identifier)
| Name | Type | Description |
|---|---|---|
config |
NETSetupConfig |
|
source |
IFileOperator |
|
identifier |
string |
1.5. GenerateMapFiles(NETSetupConfig, int)
public static void GenerateMapFiles(this NETSetupConfig config, int ticketId)
| Name | Type | Description |
|---|---|---|
config |
NETSetupConfig |
|
ticketId |
int |
1.6. GetComputer(NETSetupConfig, MachineName)
public static Computer GetComputer(this NETSetupConfig this, MachineName name)
| Name | Type | Description |
|---|---|---|
this |
NETSetupConfig |
|
name |
MachineName |
Returns: Computer
1.7. GetComputer<T>(NETSetupConfig, MachineName)
public static T GetComputer<T>(this NETSetupConfig netSetupConfig, MachineName name)
where T : Computer
| Name | Type | Description |
|---|---|---|
netSetupConfig |
NETSetupConfig |
|
name |
MachineName |
Returns: T
1.8. GetComputer<T>(NETSetupConfig, SerialNumber)
public static T GetComputer<T>(this NETSetupConfig this, SerialNumber serialNumber)
where T : Computer
| Name | Type | Description |
|---|---|---|
this |
NETSetupConfig |
|
serialNumber |
SerialNumber |
Returns: T
1.9. GetFirstComputer<T>(NETSetupConfig)
public static T GetFirstComputer<T>(this NETSetupConfig this) where T : Computer
| Name | Type | Description |
|---|---|---|
this |
NETSetupConfig |
Returns: T
1.10. GetFirstUser(NETSetupConfig, Role)
public static User GetFirstUser(this NETSetupConfig this, Role role)
| Name | Type | Description |
|---|---|---|
this |
NETSetupConfig |
|
role |
Role |
Returns: User
1.11. GetGatewayRouter(NETSetupConfig)
Legacy gateway-router fallback for configs predating GatewayIP. A Liberator config carries a MikroTik AP (NETSetupMikrotik : Router ⇒ also IRouter) next to the firewall/gateway router, so filter the L2 AP out to keep SingleOrDefault selecting exactly the gateway. Returns null when no gateway router exists - callers decide how to surface that (throw vs ExitFailure).
public static IRouter? GetGatewayRouter(this NETSetupConfig netSetupConfig)
| Name | Type | Description |
|---|---|---|
netSetupConfig |
NETSetupConfig |
Returns: IRouter?
1.12. GetSoftwareList(NETSetupConfig, ILogger, Computer)
public static List<Software> GetSoftwareList(this NETSetupConfig netSetupConfig, ILogger logger, Computer computer)
| Name | Type | Description |
|---|---|---|
netSetupConfig |
NETSetupConfig |
|
logger |
ILogger |
|
computer |
Computer |
Returns: List<Software>
1.13. GetSoftwareList(NETSetupConfig, ILogger, MachineName)
public static List<Software> GetSoftwareList(this NETSetupConfig netSetupConfig, ILogger logger, MachineName name)
| Name | Type | Description |
|---|---|---|
netSetupConfig |
NETSetupConfig |
|
logger |
ILogger |
|
name |
MachineName |
Returns: List<Software>
1.14. GetWindowsCapabilities(NETSetupConfig, string)
Returns the WindowsCapabilities declared for machineName, or null when the config declares none. Machine names are matched case-insensitively, because a config is hand-written and Windows does not care about the casing of a hostname either.
public static WindowsCapabilities GetWindowsCapabilities(this NETSetupConfig config, string machineName)
| Name | Type | Description |
|---|---|---|
config |
NETSetupConfig |
|
machineName |
string |
Returns: WindowsCapabilities
1.15. IdentifyHost(NETSetupConfig, ISystemHost)
public static Machine IdentifyHost(this NETSetupConfig netSetupConfig, ISystemHost host)
| Name | Type | Description |
|---|---|---|
netSetupConfig |
NETSetupConfig |
|
host |
ISystemHost |
Returns: Machine
1.16. MoveVm(NETSetupConfig, string, SerialNumber, int?)
Re-pins an implicit Liberator VM (added by LiberatorWithWinDCTranslator) onto a different physical host. Use at customer.cs scope right after translator.Translate() when an existing prod VM lives on a slave Power Station instead of the Liberator (e.g. migrating Nextcloud disk-state to its current home). Rewrites the hosted-serial suffix only; OS, IP, users, and ports are preserved.
public static NETSetupConfig MoveVm(this NETSetupConfig config, string deviceName, SerialNumber newHostSerial, int? newVmId = null)
| Name | Type | Description |
|---|---|---|
config |
NETSetupConfig |
|
deviceName |
string |
|
newHostSerial |
SerialNumber |
|
newVmId |
int? |
Optional override for the VMID prefix; defaults to the current VMID. Use when the target host already runs something at the implicit VMID. |
Returns: NETSetupConfig
1.17. OverrideSerialNumber(NETSetupConfig, ISystemHost, MachineName)
public static void OverrideSerialNumber(this NETSetupConfig netSetupConfig, ISystemHost host, MachineName name)
| Name | Type | Description |
|---|---|---|
netSetupConfig |
NETSetupConfig |
|
host |
ISystemHost |
|
name |
MachineName |
1.18. OverrideSerialNumber(NETSetupConfig, ISystemHost, int)
public static void OverrideSerialNumber(this NETSetupConfig netSetupConfig, ISystemHost host, int index)
| Name | Type | Description |
|---|---|---|
netSetupConfig |
NETSetupConfig |
|
host |
ISystemHost |
|
index |
int |
1.19. OverrideSerialNumber(NETSetupConfig, ISystemHost, string)
public static void OverrideSerialNumber(this NETSetupConfig netSetupConfig, ISystemHost host, string name)
| Name | Type | Description |
|---|---|---|
netSetupConfig |
NETSetupConfig |
|
host |
ISystemHost |
|
name |
string |
1.20. SetDisk(NETSetupConfig, string, string)
Sets a machine’s system-disk size in the config so provisioning sizes the VM from the CONFIG instead of the factory fallback. The symmetric twin of SetMemory(NETSetupConfig, string, string), and the reason it exists: a build node whose Docker data alone measures ~48 GB cannot live on the 64 G default - devBuilder04 ran out at 18.3 GB free and no amount of software config could fix that.
IN-MEMORY ONLY - same constraint as SetMemory(NETSetupConfig, string, string). Machine.Hardware is typed IHardware and System.Text.Json cannot deserialize an interface, so a persisted config carrying Hardware throws "Deserialization of interface or abstract types is not supported" and every guest reading it fails. Call it on a config you are about to provision from, never on one you serialize.
public static NETSetupConfig SetDisk(this NETSetupConfig config, string machineName, string size)
| Name | Type | Description |
|---|---|---|
config |
NETSetupConfig |
|
machineName |
string |
Machine in the config to size, e.g. "devBuilder05". |
size |
string |
Disk size parsed by |
Returns: NETSetupConfig
1.21. SetMemory(NETSetupConfig, string, string)
Sets a machine’s RAM in the config so provisioning sizes the VM from the CONFIG instead of the factory fallback (ProxmoxWindowsVmFactory only uses its own default when the machine declares no memory). Lives here because the concrete Hardware / RandomAccessModule types are in osisa.SystemManagement, which customer scripts cannot reference without tripping the CPM version pins.
IN-MEMORY ONLY - call it on a config you are about to provision from, NEVER on one you serialize. Machine.Hardware is typed IHardware and System.Text.Json cannot deserialize an interface, so a persisted config carrying Hardware throws "Deserialization of interface or abstract types is not supported" and every guest reading it fails.
public static NETSetupConfig SetMemory(this NETSetupConfig config, string machineName, string size)
| Name | Type | Description |
|---|---|---|
config |
NETSetupConfig |
|
machineName |
string |
Machine in the config to size, e.g. "devBuilder03". |
size |
string |
Memory size parsed by |
Returns: NETSetupConfig
1.22. SetWindowsCapabilities(NETSetupConfig, string, WindowsCapabilities)
Declares the Windows post-install capabilities for machineName. Unlike SetMemory(NETSetupConfig, string, string) / SetDisk(NETSetupConfig, string, string) this IS persisted to JSON - every field on WindowsCapabilities is a primitive or a plain string collection, so it round-trips. Call it from the customer .cs before serialization.
public static NETSetupConfig SetWindowsCapabilities(this NETSetupConfig config, string machineName, WindowsCapabilities capabilities)
| Name | Type | Description |
|---|---|---|
config |
NETSetupConfig |
|
machineName |
string |
Machine the capabilities apply to, e.g. "devBuilder05". |
capabilities |
WindowsCapabilities |
The capability block to attach. |
Returns: NETSetupConfig
1.23. Update(ICollection<Software>, NETSetupConfig, IEnumerable<SoftwareName>)
public static void Update(this ICollection<Software> this, NETSetupConfig netSetupConfig, IEnumerable<SoftwareName> newSoftwareNames)
| Name | Type | Description |
|---|---|---|
this |
ICollection<Software> |
|
netSetupConfig |
NETSetupConfig |
|
newSoftwareNames |
IEnumerable<SoftwareName> |