github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/orbiter/kinds/providers/cs/destroy.go (about) 1 package cs 2 3 import "github.com/caos/orbos/internal/helpers" 4 5 func destroy(context *context, current *Current) error { 6 7 _, delFuncs, _, err := queryFloatingIPs(context, nil, current) 8 9 pools, err := context.machinesService.ListPools() 10 if err != nil { 11 return err 12 } 13 for idx := range pools { 14 pool := pools[idx] 15 machines, err := context.machinesService.List(pool) 16 if err != nil { 17 return err 18 } 19 for idx := range machines { 20 machine := machines[idx] 21 delFuncs = append(delFuncs, func() error { 22 remove, err := machine.Destroy() 23 if err != nil { 24 return err 25 } 26 return remove() 27 }) 28 } 29 } 30 return helpers.Fanout(delFuncs)() 31 }