Add install instructions and update top level dependancies. (#42)

2 files changed
tree: 838fac01449a479b973d0b7f5606a6f4b6508e53
  1. .github/
  2. airflow/
  3. dev/
  4. license-templates/
  5. .asf.yaml
  6. .gitignore
  7. .pre-commit-config.yaml
  8. .rat-excludes
  9. CHANGELOG.md
  10. client_test.go
  11. go.mod
  12. go.sum
  13. LICENSE
  14. README.md
README.md

Airflow Go client

Go Airflow OpenAPI client generated from openapi spec.

Install

go get github.com/apache/airflow-client-go/airflow@latest

Usage

package main

import (
	"context"
	"fmt"
	"github.com/apache/airflow-client-go/airflow"
)

func main() {
	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()
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println(variable)
	}
}

See README for full client API documentation.