LxcCommand.Builder
Fluent builder for LxcCommand.
public sealed class LxcCommand.Builder
1. Methods
1.1. Build()
Builds the immutable LxcCommand. Throws when no subcommand selected.
public LxcCommand Build()
Returns: LxcCommand
1.2. Create()
Creates a new builder.
public static LxcCommand.Builder Create()
Returns: LxcCommand.Builder
1.3. WithCores(int)
Adds --cores <n>.
public LxcCommand.Builder WithCores(int n)
| Name | Type | Description |
|---|---|---|
n |
int |
Returns: LxcCommand.Builder
1.4. WithCreate(int, string)
Selects pct create <ctid> <templatePath>. Required (one of the With* subcommand methods MUST be called before Build()).
public LxcCommand.Builder WithCreate(int ctid, string templatePath)
| Name | Type | Description |
|---|---|---|
ctid |
int |
|
templatePath |
string |
Returns: LxcCommand.Builder
1.5. WithDestroy(int)
Selects pct destroy <ctid>.
public LxcCommand.Builder WithDestroy(int ctid)
| Name | Type | Description |
|---|---|---|
ctid |
int |
Returns: LxcCommand.Builder
1.6. WithExec(int, string)
Selects pct exec <ctid> -- /bin/sh -c <shellCmd>. shellCmd is passed as a single argv token; the receiving shell sees it verbatim.
public LxcCommand.Builder WithExec(int ctid, string shellCmd)
| Name | Type | Description |
|---|---|---|
ctid |
int |
|
shellCmd |
string |
Returns: LxcCommand.Builder
1.7. WithFeatures(string)
Adds --features <features> (e.g. "nesting=1").
public LxcCommand.Builder WithFeatures(string features)
| Name | Type | Description |
|---|---|---|
features |
string |
Returns: LxcCommand.Builder
1.8. WithHostname(string)
Adds --hostname <hostname> (two argv tokens; never one).
public LxcCommand.Builder WithHostname(string hostname)
| Name | Type | Description |
|---|---|---|
hostname |
string |
Returns: LxcCommand.Builder
1.9. WithMemory(int)
Adds --memory <mb>.
public LxcCommand.Builder WithMemory(int mb)
| Name | Type | Description |
|---|---|---|
mb |
int |
Returns: LxcCommand.Builder
1.10. WithNet(int, string, string)
Adds --net<id> name=eth0,bridge=<bridge>,ip=<ip>.
public LxcCommand.Builder WithNet(int id, string bridge, string ip)
| Name | Type | Description |
|---|---|---|
id |
int |
|
bridge |
string |
|
ip |
string |
Returns: LxcCommand.Builder
1.11. WithOsType(string)
Adds --ostype <type> (e.g. "debian").
public LxcCommand.Builder WithOsType(string type)
| Name | Type | Description |
|---|---|---|
type |
string |
Returns: LxcCommand.Builder
1.12. WithPassword(string)
Adds --password <pw>.
public LxcCommand.Builder WithPassword(string pw)
| Name | Type | Description |
|---|---|---|
pw |
string |
Returns: LxcCommand.Builder
1.13. WithRootfs(string, int)
Adds --rootfs <storage>:<diskGb>.
public LxcCommand.Builder WithRootfs(string storage, int diskGb)
| Name | Type | Description |
|---|---|---|
storage |
string |
|
diskGb |
int |
Returns: LxcCommand.Builder
1.14. WithSet(int)
Selects pct set <ctid>. Combine with With* options to mutate config.
public LxcCommand.Builder WithSet(int ctid)
| Name | Type | Description |
|---|---|---|
ctid |
int |
Returns: LxcCommand.Builder
1.15. WithSshKey(AbsolutePath)
Adds --ssh-public-keys <keyFile>.
public LxcCommand.Builder WithSshKey(AbsolutePath keyFile)
| Name | Type | Description |
|---|---|---|
keyFile |
AbsolutePath |
Returns: LxcCommand.Builder
1.16. WithStart(int)
Selects pct start <ctid>.
public LxcCommand.Builder WithStart(int ctid)
| Name | Type | Description |
|---|---|---|
ctid |
int |
Returns: LxcCommand.Builder
1.17. WithStatus(int)
Selects pct status <ctid>.
public LxcCommand.Builder WithStatus(int ctid)
| Name | Type | Description |
|---|---|---|
ctid |
int |
Returns: LxcCommand.Builder
1.18. WithStop(int)
Selects pct stop <ctid>.
public LxcCommand.Builder WithStop(int ctid)
| Name | Type | Description |
|---|---|---|
ctid |
int |
Returns: LxcCommand.Builder
1.19. WithUnprivileged(bool)
Adds --unprivileged 1 when true; omitted when false.
public LxcCommand.Builder WithUnprivileged(bool yes)
| Name | Type | Description |
|---|---|---|
yes |
bool |
Returns: LxcCommand.Builder