MrSaints / go-cabot

[INACTIVE] An idiomatic Go client library for interacting with Arachnys' Cabot API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-cabot

GoDoc

An idiomatic Go client library for interacting with Arachnys' Cabot API.

Cabot is a self-hosted, easily-deployable monitoring, and alerts service - like a lightweight PagerDuty.

TODO

  • Less boilerplate-y
  • Tests (???)
  • More examples

Usage

  1. Download, and install go-cabot/cabot:

    go get github.com/mrsaints/go-cabot/cabot
  2. Import the package into your code:

    import "github.com/mrsaints/go-cabot/cabot"
  3. Construct a Cabot API client:

    auth := cabot.WithBasicAuth("username", "password")
    baseURL := cabot.WithBaseURL("https://your-base-cabot-url/")
    
    // Accepts a variable number of `Option` arguments
    client = cabot.NewClient(auth, baseURL)
  4. Using the newly constructed client, call methods via its respective service:

    // Returns a list of services
    client.Services.List()
    
    // Returns a specific instance using its ID
    client.Instances.Get(1)
    
    // Creates a new ICMP check with "Hello World!" as its name
    check := &cabot.ICMPCheck{cabot.StatusCheck{Name: "Hello World!"}}
    created, _ := client.ICMPChecks.Create(check)
    log.Println(created)

About

[INACTIVE] An idiomatic Go client library for interacting with Arachnys' Cabot API.

License:Other


Languages

Language:Go 100.0%