Gobizfly is a Go client library for accessing Bizfly API
You can view the client API docs here: https://pkg.go.dev/github.com/bizflycloud/gobizfly
go get github.com/bizflycloud/gobizfly@vX
import "github.com/bizflycloud/gobizfly"
Create a new Bizfly Cloud client, then use the exposed services to access different part of the Bizfly API
Currently, token is the only method of authenticating with the API. You can generate token via username/password or application credential
package main
import (
"github.com/bizflycloud/gobizfly"
"log"
)
func main() {
tok, err := client.Token.Create(ctx, &gobizfly.TokenCreateRequest{Username: username, Password: password, AuthMethod: "password"})
if err != nil {
log.Fatal(err)
}
client.SetKeystoneToken(tok)
}
package main
import (
"context"
"log"
"time"
"github.com/bizflycloud/gobizfly"
)
const (
host = "https://manage.bizflycloud.vn"
username = "foo@bar"
password = "foobar"
)
func main() {
client, err := gobizfly.NewClient(
gobizfly.WithAPIURL(host),
)
if err != nil {
log.Fatal(err)
}
ctx, cancelFunc := context.WithTimeout(context.Background(), time.Second*10)
defer cancelFunc()
tok, err := client.Token.Create(ctx, &gobizfly.TokenCreateRequest{Username: username, Password: password})
if err != nil {
log.Fatal(err)
}
client.SetKeystoneToken(tok)
lbs, err := client.CloudLoadBalancer.List(ctx, &gobizfly.ListOptions{})
if err != nil {
log.Fatal(err)
}
log.Printf("%#v\n", lbs)
}
For details on all the functionality in this library, checkout Gobizfly documentation