Simple client for Cloud Foundry API
config.json
{
"username": "hello@world.io",
"password": "hello-world-123",
"api_endpoint": "https://api.cf.eu12.hana.ondemand.com",
"auth_endpoint": "https://login.cf.eu12.hana.ondemand.com",
"oauth_client_id": "cf",
"oauth_client_secret": ""
}
main.go
package main
import (
"fmt"
"github.com/darmiel/go-cf-client/pkg/cf"
)
func main() {
config, err := cf.LoadConfig()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", config)
req, err := config.GetRequester()
if err != nil {
panic(err)
}
space, err := req.CreateSpace(
// name of the space
"daniel-test-123",
// guid of the organization
"00000000-0000-0000-0000-000000000000",
// more optional options
cf.CreateSpaceOptions{})
if err != nil {
panic(err)
}
fmt.Println("Created Space:", space)
}