This is a library that implements a client in go for the sentry api. It supports all the endpoints and can do a good bit. For a full reference you can check the godoc link above.
import (
"fmt"
"github.com/GrantStreetGroup/go-sentry-api"
)
// Auth token is always required, secondary is endpoint and third is timeout defaults 60 seconds
client, _:= sentry.NewClient("yourauthtokengoeshere", nil, nil)
// Fetch your organization
org, err := client.GetOrganization("sentry")
if err != nil {
panic(err)
}
// Fetch a project you already made
project, err := client.GetProject(org, "my-project-slug")
if err != nil {
panic(err)
}
// Create a new Client DSN via the API
key, err := client.CreateClientKey(org, project, "example-dsn")
if err != nil {
panic(err)
}
fmt.Printf(key.DSN.Secret)
go get github.com/GrantStreetGroup/go-sentry-api
To run tests you can setup a local sentry instance via docker. There is a
makefile command called make devenv
which will setup all of the containers.
Once complete you can then setup a environment var of SENTRY_AUTHTOKEN
and then run make test
which should go through and create and run all tests aginst localhost:8080
Pull requests, issues and comments welcome. For pull requests:
- Add tests for new features and bug fixes
- Follow the existing style
- Separate unrelated changes into multiple pull requests
Copyright (c) 2017 Atlassian and others. Apache 2.0 licensed, see LICENSE.txt file.