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)
Table 1. Parameters
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)
Table 2. Parameters
Name Type Description

ctid

int

templatePath

string

Returns: LxcCommand.Builder

1.5. WithDestroy(int)

Selects pct destroy <ctid>.

public LxcCommand.Builder WithDestroy(int ctid)
Table 3. Parameters
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)
Table 4. Parameters
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)
Table 5. Parameters
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)
Table 6. Parameters
Name Type Description

hostname

string

Returns: LxcCommand.Builder

1.9. WithMemory(int)

Adds --memory <mb>.

public LxcCommand.Builder WithMemory(int mb)
Table 7. Parameters
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)
Table 8. Parameters
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)
Table 9. Parameters
Name Type Description

type

string

Returns: LxcCommand.Builder

1.12. WithPassword(string)

Adds --password <pw>.

public LxcCommand.Builder WithPassword(string pw)
Table 10. Parameters
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)
Table 11. Parameters
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)
Table 12. Parameters
Name Type Description

ctid

int

Returns: LxcCommand.Builder

1.15. WithSshKey(AbsolutePath)

Adds --ssh-public-keys <keyFile>.

public LxcCommand.Builder WithSshKey(AbsolutePath keyFile)
Table 13. Parameters
Name Type Description

keyFile

AbsolutePath

Returns: LxcCommand.Builder

1.16. WithStart(int)

Selects pct start <ctid>.

public LxcCommand.Builder WithStart(int ctid)
Table 14. Parameters
Name Type Description

ctid

int

Returns: LxcCommand.Builder

1.17. WithStatus(int)

Selects pct status <ctid>.

public LxcCommand.Builder WithStatus(int ctid)
Table 15. Parameters
Name Type Description

ctid

int

Returns: LxcCommand.Builder

1.18. WithStop(int)

Selects pct stop <ctid>.

public LxcCommand.Builder WithStop(int ctid)
Table 16. Parameters
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)
Table 17. Parameters
Name Type Description

yes

bool

Returns: LxcCommand.Builder