sentry

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sentry provides a thin client for the Sentry REST API. Only the operations required by the operator are implemented.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Body       string
}

APIError represents a Sentry API error response.

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a minimal Sentry API client.

func NewClient

func NewClient(baseURL, token string) *Client

NewClient creates a new Sentry API client. baseURL should be "https://sentry.io" for Sentry Cloud, or your self-hosted URL. token is a Sentry auth token with project:write and project:read scopes.

func (*Client) CreateKey

func (c *Client) CreateKey(ctx context.Context, org, slug, name string) (*DSNKey, error)

CreateKey creates a new DSN key with the given label for a project.

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, org, team, name, slug, platform string) (*Project, error)

CreateProject creates a new project under the given team and returns it.

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, org, slug string) error

DeleteProject deletes a Sentry project.

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, org, slug string) (*Project, error)

GetProject retrieves a project by slug. Returns nil, nil if the project does not exist.

func (*Client) GetProjectDSN

func (c *Client) GetProjectDSN(ctx context.Context, org, slug string) (string, error)

GetProjectDSN returns the public DSN for the first client key of the project.

func (*Client) ListKeys

func (c *Client) ListKeys(ctx context.Context, org, slug string) ([]DSNKey, error)

ListKeys returns all DSN keys for a project.

func (*Client) UpdateKeyRateLimit

func (c *Client) UpdateKeyRateLimit(ctx context.Context, org, slug, keyID string, count, window int) error

UpdateKeyRateLimit sets the rate limit on an existing DSN key. Set count and window to 0 to remove the rate limit.

type DSNKey

type DSNKey struct {
	ID        string    `json:"id"`
	Label     string    `json:"label"`
	DSN       dsnData   `json:"dsn"`
	RateLimit RateLimit `json:"rateLimit"`
}

DSNKey represents a Sentry client key (DSN).

type Project

type Project struct {
	ID   string `json:"id"`
	Slug string `json:"slug"`
	Name string `json:"name"`
}

Project represents a Sentry project.

type RateLimit

type RateLimit struct {
	Count  int `json:"count"`
	Window int `json:"window"`
}

RateLimit represents the rate limit configuration for a DSN key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL