commit | b3eb67a3623e036738e769fb2c23ecdf31f32d19 | [log] [tgz] |
---|---|---|
author | Xiaodong DENG <xddeng@apache.org> | Wed Mar 24 19:30:11 2021 +0100 |
committer | GitHub <noreply@github.com> | Wed Mar 24 11:30:11 2021 -0700 |
tree | 138b45c0c97aad14a8ddabd6e32a0581acea2a5a | |
parent | 424e0742de4c119ed7e5ab7396decca91d2de675 [diff] |
Make sample code self-contained & fix errors inside (#7) - make the sample usage code self-contained - fix a few errors inside: 1. wrong variable name ("cli"); 2. if-else block handling err was wrong
Go Airflow OpenAPI client generated from openapi spec.
package main
import (
"context"
"fmt"
"github.com/apache/airflow-client-go/airflow"
)
func main() {
cli := airflow.NewAPIClient(&airflow.Configuration{
Scheme: "http",
Host: "localhost:8080",
BasePath: "/api/v1",
})
cred := airflow.BasicAuth{
UserName: "username",
Password: "password",
}
ctx := context.WithValue(context.Background(), airflow.ContextBasicAuth, cred)
variable, _, err := cli.VariableApi.GetVariable(ctx, "foo")
if err != nil {
fmt.Println(err)
} else {
fmt.Println(variable)
}
}
See README for full client API documentation.
Go client is versioned using semantic import versioning.
To release a new version 1.x.y
, simply push a new tag to this repo named airflow/v1.x.y
.
Major version upgrade requires changing package import path based on semantic import versioning, which needs to be done manually.