blob: b310ab1b9e6941a974d8d82c49806672f83403b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package e2e
import (
"strconv"
)
type setMachine struct {
cpus *uint
diskSize *uint
memory *uint
cmd []string
}
func (i *setMachine) buildCmd(m *machineTestBuilder) []string {
cmd := []string{"machine", "set"}
if i.cpus != nil {
cmd = append(cmd, "--cpus", strconv.Itoa(int(*i.cpus)))
}
if i.diskSize != nil {
cmd = append(cmd, "--disk-size", strconv.Itoa(int(*i.diskSize)))
}
if i.memory != nil {
cmd = append(cmd, "--memory", strconv.Itoa(int(*i.memory)))
}
cmd = append(cmd, m.name)
i.cmd = cmd
return cmd
}
func (i *setMachine) withCPUs(num uint) *setMachine {
i.cpus = &num
return i
}
func (i *setMachine) withDiskSize(size uint) *setMachine {
i.diskSize = &size
return i
}
func (i *setMachine) withMemory(num uint) *setMachine {
i.memory = &num
return i
}
|