github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/machine/e2e/config_set.go (about)

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