This is a Go client for interacting with the AWX API. AWX is an open-source project that provides a web-based user interface, REST API, and task engine built on top of Ansible.
To install the AWX Go client, use go get:
go get github.com/sapcc/go-awxHere is a basic example of how to use the AWX Go client:
package main
import (
"fmt"
"log"
awx "github.com/sapcc/go-awx"
)
func main() {
client, err := awx.NewClient(awx.Options{
Endpoint: "https://your-awx.cloud/api/v2",
Username: "username",
Password: "password",
Token: "token",
})
if err != nil {
log.Fatalf("Failed to create AWX client: %v", err)
}
input := ListJobsInput{ID: "1"}
jobs := JobList{}
err = client.List(context.Background(), awx.ObjectKey{Resource: "jobs"}, &jobs, nil)
if err != nil {
log.Fatalf("Failed to list inventories: %v", err)
}
for _, job := range jobs.Results {
fmt.Printf("job: %s\n", job.Name)
}
}- List inventories
- Create, update, and delete inventories
- List job templates
- Launch job templates
- And more...
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.