A small sling wrapper for The Foreman API in Golang
package main
import (
"fmt"
"github.com/dudemcbacon/go-theforeman"
)
func main() {
config := &theforeman.Config{
BaseURL: "http://foreman.mgmt.nweacolo.pvt/api/",
Username: "api-user",
Password: "snip",
}
foreman := theforeman.NewClient(config, nil)
names, _, _ := foreman.EnvironmentsService.ListEnvironmentNames(nil)
for _, name := range names {
fmt.Println(name)
}
}