MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / PromptForMachinePolicy

Function PromptForMachinePolicy

pkg/machinescommon/machinepolicy.go:48–59  ·  view source on GitHub ↗
(opts *CreateTargetMachinePolicyOptions, flags *CreateTargetMachinePolicyFlags)

Source from the content-addressed store, hash-verified

46}
47
48func PromptForMachinePolicy(opts *CreateTargetMachinePolicyOptions, flags *CreateTargetMachinePolicyFlags) error {
49 if flags.MachinePolicy.Value == "" {
50 selectedOption, err := selectors.Select(opts.Ask, "Select the machine policy to use", opts.GetAllMachinePoliciesCallback, func(p *machines.MachinePolicy) string { return p.Name })
51 if err != nil {
52 return err
53 }
54
55 flags.MachinePolicy.Value = selectedOption.Name
56 }
57
58 return nil
59}
60
61func getAllMachinePolicies(client client.Client) ([]*machines.MachinePolicy, error) {
62 res, err := client.MachinePolicies.GetAll()

Callers 4

TestNoFlag_ShouldPromptFunction · 0.92
PromptMissingFunction · 0.92
PromptMissingFunction · 0.92

Calls 1

SelectFunction · 0.92