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

Function FindProxy

pkg/machinescommon/proxy.go:65–81  ·  view source on GitHub ↗
(opts *CreateTargetProxyOptions, flags *CreateTargetProxyFlags)

Source from the content-addressed store, hash-verified

63}
64
65func FindProxy(opts *CreateTargetProxyOptions, flags *CreateTargetProxyFlags) (*proxies.Proxy, error) {
66 allProxy, err := opts.Client.Proxies.GetAll()
67 if err != nil {
68 return nil, err
69 }
70 var proxy *proxies.Proxy
71 for _, p := range allProxy {
72 if strings.EqualFold(p.GetID(), flags.Proxy.Value) || strings.EqualFold(p.GetName(), flags.Proxy.Value) {
73 proxy = p
74 break
75 }
76 }
77 if proxy == nil {
78 return nil, fmt.Errorf("cannot find proxy '%s'", flags.Proxy.Value)
79 }
80 return proxy, nil
81}
82
83func getAllProxies(client client.Client) ([]*proxies.Proxy, error) {
84 res, err := client.Proxies.GetAll()

Callers 2

createRunFunction · 0.92
createRunFunction · 0.92

Calls 1

GetNameMethod · 0.65

Tested by

no test coverage detected