sentry

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sentry provides a client to access https://sentry.io/api and sentry instances apis.

Index

Constants

View Source
const (
	// DefaultHost is the default host that is used
	DefaultHost = "https://sentry.io"
	// DefaultEndpoint is the entry point for the api
	DefaultEndpoint = "/api/0/"
	// DefaultTimeout is the default timeout and is set to 60 seconds
	DefaultTimeout = time.Duration(60) * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Detail     string `json:"detail,omitempty"`
	StatusCode int    `json:"-"`
}

APIError is used when the api returns back a non 200 response

func (APIError) Error

func (s APIError) Error() string

Error is the interface needed to transfor to a error type

type Client

type Client struct {
	AuthToken  string
	Endpoint   string
	HTTPClient *http.Client
}

Client is used to talk to a sentry endpoint. Needs a auth token. If no endpoint this defaults to https://sentry.io/api/0/

func NewClient

func NewClient(authtoken string, endpoint *string, timeout *int) (*Client, error)

NewClient takes a auth token a optional endpoint and optional timeout and will return back a client and error

func (*Client) CreateDeploy

func (c *Client) CreateDeploy(oslug string, r NewDeploy) error

func (*Client) CreateProject

func (c *Client) CreateProject(oslug string, pslug string) (Project, error)

func (*Client) CreateRelease

func (c *Client) CreateRelease(oslug string, r NewRelease) (Release, error)

func (*Client) GetProject

func (c *Client) GetProject(oslug string, pslug string) (Project, error)

type NewDeploy

type NewDeploy struct {
	Environment  string     `json:"environment"`
	Name         string     `json:"name,omitempty"`
	URL          string     `json:"url,omitempty"`
	DateStarted  *time.Time `json:"dateStarted,omitempty"`
	DateFinished *time.Time `json:"dateFinished,omitempty"`
	Version      string
}

type NewRelease

type NewRelease struct {
	Projects []string `json:"projects"`
	Version  string   `json:"version"`
	Ref      string   `json:"ref"`
	Refs     []Ref    `json:"refs,omitempty"`
}

type Project

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

type Ref

type Ref struct {
	Repository     string `json:"repository,omitempty"`
	Commit         string `json:"commit,omitempty"`
	PreviousCommit string `json:"previousCommit,omitempty"`
}

type Release

type Release struct {
	Projects     []Project  `json:"projects,omitempty"`
	DateCreated  *time.Time `json:"dateCreated,omitempty"`
	DateReleased *time.Time `json:"dateReleased,omitempty"`
	Ref          *string    `json:"ref,omitempty"`
	Version      *string    `json:"version"`
}

Jump to

Keyboard shortcuts

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