MCPcopy Index your code
hub / github.com/cloudfoundry/cli / FetchStacks

Function FetchStacks

integration/helpers/stack.go:22–37  ·  view source on GitHub ↗

FetchStacks returns all the stack names present in the foundation.

()

Source from the content-addressed store, hash-verified

20
21// FetchStacks returns all the stack names present in the foundation.
22func FetchStacks() []string {
23 session := CF("curl", "/v2/stacks")
24
25 Eventually(session).Should(Exit(0))
26
27 var rawStacks ccStacks
28 err := json.Unmarshal(session.Out.Contents(), &rawStacks)
29 Expect(err).ToNot(HaveOccurred())
30
31 var stacks []string
32 for _, stack := range rawStacks.Resources {
33 stacks = append(stacks, stack.Entity.Name)
34 }
35
36 return stacks
37}
38
39// PreferredStack returns the cflinuxfs4 stack name if it present, otherwise cflinuxfs3 is returned.
40func PreferredStack() string {

Calls 1

CFFunction · 0.85

Tested by

no test coverage detected