Go Airflow OpenAPI client generated from openapi spec.
go get github.com/apache/airflow-client-go/airflow@latest
package main
import (
"context""fmt""github.com/apache/airflow-client-go/airflow"
)
funcmain() {
conf:=airflow.NewConfiguration()
conf.Host="localhost:8080"conf.Scheme="http"cli:=airflow.NewAPIClient(conf)
cred:= airflow.BasicAuth{
UserName: "username",
Password: "password",
}
ctx:=context.WithValue(context.Background(), airflow.ContextBasicAuth, cred)
variable, _, err:=cli.VariableApi.GetVariable(ctx, "foo").Execute()
iferr!=nil {
fmt.Println(err)
} else {
fmt.Println(variable)
}
}See README for full client API documentation.