Go library for StatusPage.io API
package main
import "github.com/yfronto/go-statuspage-api"
const (
apiKey = "....."
pageID = "....."
)
func main() {
c, err := statuspage.NewClient(apiKey, pageID)
if err != nil {
// ...
}
// Do stuff
}// Pretty print all components on a StatusPage
resp, _ := c.GetAllComponents()
for _, component := range resp {
fmt.Printf("%v", &component)
}// Pretty print all component groups on a StatusPage
resp, _ := c.GetAllComponentGroups()
for _, componentGroup := range resp {
fmt.Printf("%v", &componentGroup)
}// Update a component group
newName := "foobar"
newComponents := []string{"gibberish", "gobbledegook"}
group, _ := c.GetComponentGroupByID("baz")
group.Components = newComponents
group.Name = newName
resp, _ := c.UpdateComponentGroup(group)// Delete a component group
func DeleteComponentGroup() {
group, _ := c.GetComponentGroupByID("deadbeef")
err = c.DeleteComponentGroup(group)
}Create a file named .client-testing.json containing your StatusPage API key and page ID. It should look something like this:
{
"apiKey": "foobar",
"pageID": "blahblah"
}Things are still in progress.