sentry

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://sentry.io/api/"
	APIVersion     = "0"
)

Variables

This section is empty.

Functions

func Bool added in v1.1.0

func Bool(v bool) *bool

Bool returns a pointer to the bool value.

Types

type APIError

type APIError map[string]interface{}

APIError represents a Sentry API Error response

func (APIError) Empty

func (e APIError) Empty() bool

Empty returns true if empty.

func (APIError) Error

func (e APIError) Error() string

type Avatar added in v1.3.0

type Avatar struct {
	UUID *string `json:"avatarUuid"`
	Type string  `json:"avatarType"`
}

Avatar represents an avatar.

type Client

type Client struct {
	Organizations  *OrganizationService
	Teams          *TeamService
	Projects       *ProjectService
	ProjectKeys    *ProjectKeyService
	ProjectPlugins *ProjectPluginService
	Rules          *RuleService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client, baseURL *url.URL, token string) *Client

NewClient returns a new Sentry API client. If a nil httpClient is given, the http.DefaultClient will be used. If a nil baseURL is given, the DefaultBaseURL will be used.

type CreateOrganizationParams

type CreateOrganizationParams struct {
	Name       string `json:"name,omitempty"`
	Slug       string `json:"slug,omitempty"`
	AgreeTerms *bool  `json:"agreeTerms,omitempty"`
}

CreateOrganizationParams are the parameters for OrganizationService.Create.

type CreateProjectKeyParams

type CreateProjectKeyParams struct {
	Name      string               `json:"name,omitempty"`
	RateLimit *ProjectKeyRateLimit `json:"rateLimit,omitempty"`
}

CreateProjectKeyParams are the parameters for ProjectKeyService.Create.

type CreateProjectParams

type CreateProjectParams struct {
	Name     string `json:"name,omitempty"`
	Slug     string `json:"slug,omitempty"`
	Platform string `json:"platform,omitempty"`
}

CreateProjectParams are the parameters for ProjectService.Create.

type CreateRuleActionParams added in v1.3.0

type CreateRuleActionParams struct {
	ID        string `json:"id"`
	Tags      string `json:"tags"`
	Channel   string `json:"channel"`
	Workspace string `json:"workspace"`
}

CreateRuleActionParams models the actions when creating the action for the rule.

type CreateRuleConditionParams added in v1.3.0

type CreateRuleConditionParams struct {
	ID       string `json:"id"`
	Value    int    `json:"value"`
	Interval string `json:"interval"`
}

CreateRuleConditionParams models the conditions when creating the action for the rule.

type CreateRuleParams added in v1.3.0

type CreateRuleParams struct {
	ActionMatch string                       `json:"actionMatch"`
	Environment string                       `json:"environment,omitempty"`
	Frequency   int                          `json:"frequency"`
	Name        string                       `json:"name"`
	Conditions  []*CreateRuleConditionParams `json:"conditions"`
	Actions     []*CreateRuleActionParams    `json:"actions"`
}

CreateRuleParams are the parameters for RuleService.Create.

type CreateTeamParams

type CreateTeamParams struct {
	Name string `json:"name,omitempty"`
	Slug string `json:"slug,omitempty"`
}

CreateTeamParams are the parameters for TeamService.Create.

type ListOrganizationParams

type ListOrganizationParams struct {
	Cursor string `url:"cursor,omitempty"`
}

ListOrganizationParams are the parameters for OrganizationService.List.

type Organization

type Organization struct {
	ID             string             `json:"id"`
	Slug           string             `json:"slug"`
	Status         OrganizationStatus `json:"status"`
	Name           string             `json:"name"`
	DateCreated    time.Time          `json:"dateCreated"`
	IsEarlyAdopter bool               `json:"isEarlyAdopter"`
	Avatar         Avatar             `json:"avatar"`

	Quota OrganizationQuota `json:"quota"`

	IsDefault            bool                        `json:"isDefault"`
	DefaultRole          string                      `json:"defaultRole"`
	AvailableRoles       []OrganizationAvailableRole `json:"availableRoles"`
	OpenMembership       bool                        `json:"openMembership"`
	Require2FA           bool                        `json:"require2FA"`
	AllowSharedIssues    bool                        `json:"allowSharedIssues"`
	EnhancedPrivacy      bool                        `json:"enhancedPrivacy"`
	DataScrubber         bool                        `json:"dataScrubber"`
	DataScrubberDefaults bool                        `json:"dataScrubberDefaults"`
	SensitiveFields      []string                    `json:"sensitiveFields"`
	SafeFields           []string                    `json:"safeFields"`
	ScrubIPAddresses     bool                        `json:"scrubIPAddresses"`

	Access                []string `json:"access"`
	Features              []string `json:"features"`
	PendingAccessRequests int      `json:"pendingAccessRequests"`

	AccountRateLimit int `json:"accountRateLimit"`
	ProjectRateLimit int `json:"projectRateLimit"`

	Teams    []Team           `json:"teams"`
	Projects []ProjectSummary `json:"projects"`
}

Organization represents a Sentry organization. Based on https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/organization.py

type OrganizationAvailableRole

type OrganizationAvailableRole struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

OrganizationAvailableRole represents a Sentry organization's available role.

type OrganizationQuota

type OrganizationQuota struct {
	MaxRate         int `json:"maxRate"`
	MaxRateInterval int `json:"maxRateInterval"`
	AccountLimit    int `json:"accountLimit"`
	ProjectLimit    int `json:"projectLimit"`
}

OrganizationQuota represents a Sentry organization's quota.

type OrganizationService

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

OrganizationService provides methods for accessing Sentry organization API endpoints. https://docs.sentry.io/api/organizations/

func (*OrganizationService) Create

Create a new Sentry organization. https://docs.sentry.io/api/organizations/post-organization-index/

func (*OrganizationService) Delete

func (s *OrganizationService) Delete(slug string) (*http.Response, error)

Delete a Sentry organization.

func (*OrganizationService) Get

Get a Sentry organization. https://docs.sentry.io/api/organizations/get-organization-details/

func (*OrganizationService) List

List organizations available to the authenticated session. https://docs.sentry.io/api/organizations/get-organization-index/

func (*OrganizationService) Update

Update a Sentry organization. https://docs.sentry.io/api/organizations/put-organization-details/

type OrganizationStatus added in v1.3.0

type OrganizationStatus struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

OrganizationStatus represents a Sentry organization's status.

type Project

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

	IsPublic     bool   `json:"isPublic"`
	IsBookmarked bool   `json:"isBookmarked"`
	Color        string `json:"color"`

	DateCreated time.Time `json:"dateCreated"`
	FirstEvent  time.Time `json:"firstEvent"`

	Features []string `json:"features"`
	Status   string   `json:"status"`
	Platform string   `json:"platform"`

	IsInternal bool `json:"isInternal"`
	IsMember   bool `json:"isMember"`
	HasAccess  bool `json:"hasAccess"`

	Avatar Avatar `json:"avatar"`

	// TODO: latestRelease
	Options map[string]interface{} `json:"options"`

	DigestsMinDelay      int      `json:"digestsMinDelay"`
	DigestsMaxDelay      int      `json:"digestsMaxDelay"`
	SubjectPrefix        string   `json:"subjectPrefix"`
	AllowedDomains       []string `json:"allowedDomains"`
	ResolveAge           int      `json:"resolveAge"`
	DataScrubber         bool     `json:"dataScrubber"`
	DataScrubberDefaults bool     `json:"dataScrubberDefaults"`
	SafeFields           []string `json:"safeFields"`
	SensitiveFields      []string `json:"sensitiveFields"`
	SubjectTemplate      string   `json:"subjectTemplate"`
	SecurityToken        string   `json:"securityToken"`
	SecurityTokenHeader  *string  `json:"securityTokenHeader"`
	VerifySSL            bool     `json:"verifySSL"`
	ScrubIPAddresses     bool     `json:"scrubIPAddresses"`
	ScrapeJavaScript     bool     `json:"scrapeJavaScript"`

	Organization Organization `json:"organization"`
	// TODO: plugins
	// TODO: platforms
	ProcessingIssues int `json:"processingIssues"`

	Team  Team   `json:"team"`
	Teams []Team `json:"teams"`
}

Project represents a Sentry project. https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/project.py

type ProjectKey

type ProjectKey struct {
	ID          string               `json:"id"`
	Name        string               `json:"name"`
	Label       string               `json:"label"`
	Public      string               `json:"public"`
	Secret      string               `json:"secret"`
	ProjectID   int                  `json:"projectId"`
	IsActive    bool                 `json:"isActive"`
	RateLimit   *ProjectKeyRateLimit `json:"rateLimit"`
	DSN         ProjectKeyDSN        `json:"dsn"`
	DateCreated time.Time            `json:"dateCreated"`
}

ProjectKey represents a client key bound to a project. https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/project_key.py

type ProjectKeyDSN

type ProjectKeyDSN struct {
	Secret   string `json:"secret"`
	Public   string `json:"public"`
	CSP      string `json:"csp"`
	Security string `json:"security"`
	Minidump string `json:"minidump"`
	CDN      string `json:"cdn"`
}

ProjectKeyDSN represents a project key's DSN.

type ProjectKeyRateLimit

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

ProjectKeyRateLimit represents a project key's rate limit.

type ProjectKeyService

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

ProjectKeyService provides methods for accessing Sentry project client key API endpoints. https://docs.sentry.io/api/projects/

func (*ProjectKeyService) Create

func (s *ProjectKeyService) Create(organizationSlug string, projectSlug string, params *CreateProjectKeyParams) (*ProjectKey, *http.Response, error)

Create a new client key bound to a project. https://docs.sentry.io/api/projects/post-project-keys/

func (*ProjectKeyService) Delete

func (s *ProjectKeyService) Delete(organizationSlug string, projectSlug string, keyID string) (*http.Response, error)

Delete a project. https://docs.sentry.io/api/projects/delete-project-details/

func (*ProjectKeyService) List

func (s *ProjectKeyService) List(organizationSlug string, projectSlug string) ([]ProjectKey, *http.Response, error)

List client keys bound to a project. https://docs.sentry.io/api/projects/get-project-keys/

func (*ProjectKeyService) Update

func (s *ProjectKeyService) Update(organizationSlug string, projectSlug string, keyID string, params *UpdateProjectKeyParams) (*ProjectKey, *http.Response, error)

Update a client key. https://docs.sentry.io/api/projects/put-project-key-details/

type ProjectPlugin

type ProjectPlugin struct {
	ID         string                 `json:"id"`
	Name       string                 `json:"name"`
	Type       string                 `json:"type"`
	CanDisable bool                   `json:"canDisable"`
	IsTestable bool                   `json:"isTestable"`
	Metadata   map[string]interface{} `json:"metadata"`
	Contexts   []string               `json:"contexts"`
	Status     string                 `json:"status"`
	Assets     []ProjectPluginAsset   `json:"assets"`
	Doc        string                 `json:"doc"`
	Config     []ProjectPluginConfig  `json:"config"`
}

ProjectPlugin represents a plugin bound to a project. Based on https://github.com/getsentry/sentry/blob/96bc1c63df5ec73fe12c136ada11561bf52f1ec9/src/sentry/api/serializers/models/plugin.py#L11.

type ProjectPluginAsset

type ProjectPluginAsset struct {
	URL string `json:"url"`
}

ProjectPlugin represents an asset of a plugin.

type ProjectPluginConfig

type ProjectPluginConfig struct {
	Name         string          `json:"name"`
	Label        string          `json:"label"`
	Type         string          `json:"type"`
	Required     bool            `json:"required"`
	Help         string          `json:"help"`
	Placeholder  string          `json:"placeholder"`
	Choices      json.RawMessage `json:"choices"`
	ReadOnly     bool            `json:"readonly"`
	DefaultValue interface{}     `json:"defaultValue"`
	Value        interface{}     `json:"value"`
}

ProjectPluginConfig represents the configuration of a plugin. Based on https://github.com/getsentry/sentry/blob/96bc1c63df5ec73fe12c136ada11561bf52f1ec9/src/sentry/api/serializers/models/plugin.py#L62-L94.

type ProjectPluginService

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

ProjectPluginService provides methods for accessing Sentry project plugin API endpoints.

func (*ProjectPluginService) Disable

func (s *ProjectPluginService) Disable(organizationSlug string, projectSlug string, id string) (*http.Response, error)

Disable a project plugin.

func (*ProjectPluginService) Enable

func (s *ProjectPluginService) Enable(organizationSlug string, projectSlug string, id string) (*http.Response, error)

Enable a project plugin.

func (*ProjectPluginService) Get

func (s *ProjectPluginService) Get(organizationSlug string, projectSlug string, id string) (*ProjectPlugin, *http.Response, error)

Get details of a project plugin.

func (*ProjectPluginService) List

func (s *ProjectPluginService) List(organizationSlug string, projectSlug string) ([]ProjectPlugin, *http.Response, error)

List plugins bound to a project.

func (*ProjectPluginService) Update

func (s *ProjectPluginService) Update(organizationSlug string, projectSlug string, id string, params UpdateProjectPluginParams) (*ProjectPlugin, *http.Response, error)

Update settings for a given team. https://docs.sentry.io/api/teams/put-team-details/

type ProjectService

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

ProjectService provides methods for accessing Sentry project API endpoints. https://docs.sentry.io/api/projects/

func (*ProjectService) Create

func (s *ProjectService) Create(organizationSlug string, teamSlug string, params *CreateProjectParams) (*Project, *http.Response, error)

Create a new project bound to a team. https://docs.sentry.io/api/teams/post-team-project-index/

func (*ProjectService) Delete

func (s *ProjectService) Delete(organizationSlug string, slug string) (*http.Response, error)

Delete a project. https://docs.sentry.io/api/projects/delete-project-details/

func (*ProjectService) Get

func (s *ProjectService) Get(organizationSlug string, slug string) (*Project, *http.Response, error)

Get details on an individual project. https://docs.sentry.io/api/projects/get-project-details/

func (*ProjectService) List

func (s *ProjectService) List() ([]Project, *http.Response, error)

List projects available. https://docs.sentry.io/api/projects/get-project-index/

func (*ProjectService) Update

func (s *ProjectService) Update(organizationSlug string, slug string, params *UpdateProjectParams) (*Project, *http.Response, error)

Update various attributes and configurable settings for a given project. https://docs.sentry.io/api/projects/put-project-details/

type ProjectSummary added in v1.3.0

type ProjectSummary struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Slug         string `json:"slug"`
	IsBookmarked bool   `json:"isBookmarked"`
	IsMember     bool   `json:"isMember"`
	HasAccess    bool   `json:"hasAccess"`

	DateCreated time.Time `json:"dateCreated"`
	FirstEvent  time.Time `json:"firstEvent"`

	Platform  *string  `json:"platform"`
	Platforms []string `json:"platforms"`

	Team  *ProjectSummaryTeam  `json:"team"`
	Teams []ProjectSummaryTeam `json:"teams"`
}

ProjectSummary represents the summary of a Sentry project. https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/project.py#L258

type ProjectSummaryTeam added in v1.3.0

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

ProjectSummaryTeam represents a team in a ProjectSummary. https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/project.py#L223

type Rule added in v1.3.0

type Rule struct {
	ID          string          `json:"id"`
	ActionMatch string          `json:"actionMatch"`
	Environment string          `json:"environment"`
	Frequency   int             `json:"frequency"`
	Name        string          `json:"name"`
	Conditions  []RuleCondition `json:"conditions"`
	Actions     []RuleAction    `json:"actions"`
	Created     time.Time       `json:"dateCreated"`
}

Rule represents an alert rule configured for this project. https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/rule.py

type RuleAction added in v1.3.0

type RuleAction struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Tags      string `json:"tags"`
	ChannelID string `json:"channel_id"`
	Channel   string `json:"channel"`
	Workspace string `json:"workspace"`
}

RuleAction represents the actions will be taken for each rule based on its conditions. https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/rule.py

type RuleCondition added in v1.3.0

type RuleCondition struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Value    string `json:"value"`
	Interval string `json:"interval"`
}

RuleCondition represents the conditions for each rule. https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/rule.py

type RuleService added in v1.3.0

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

ProjectKeyService provides methods for accessing Sentry project client key API endpoints. https://docs.sentry.io/api/projects/

func (*RuleService) Create added in v1.3.0

func (s *RuleService) Create(organizationSlug string, projectSlug string, params *CreateRuleParams) (*Rule, *http.Response, error)

Create a new alert rule bound to a project.

func (*RuleService) Delete added in v1.3.0

func (s *RuleService) Delete(organizationSlug string, projectSlug string, ruleID string) (*http.Response, error)

Delete a rule.

func (*RuleService) List added in v1.3.0

func (s *RuleService) List(organizationSlug string, projectSlug string) ([]Rule, *http.Response, error)

List alert rules configured for a project.

func (*RuleService) Update added in v1.3.0

func (s *RuleService) Update(organizationSlug string, projectSlug string, ruleID string, params *Rule) (*Rule, *http.Response, error)

Update a rule.

type Team

type Team struct {
	ID          string    `json:"id"`
	Slug        string    `json:"slug"`
	Name        string    `json:"name"`
	DateCreated time.Time `json:"dateCreated"`
	IsMember    bool      `json:"isMember"`
	HasAccess   bool      `json:"hasAccess"`
	IsPending   bool      `json:"isPending"`
	Avatar      Avatar    `json:"avatar"`
}

Team represents a Sentry team that is bound to an organization. https://github.com/getsentry/sentry/blob/9.0.0/src/sentry/api/serializers/models/team.py#L48

type TeamService

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

TeamService provides methods for accessing Sentry team API endpoints. https://docs.sentry.io/api/teams/

func (*TeamService) Create

func (s *TeamService) Create(organizationSlug string, params *CreateTeamParams) (*Team, *http.Response, error)

Create a new Sentry team bound to an organization. https://docs.sentry.io/api/teams/post-organization-teams/

func (*TeamService) Delete

func (s *TeamService) Delete(organizationSlug string, slug string) (*http.Response, error)

Delete a team. https://docs.sentry.io/api/teams/delete-team-details/

func (*TeamService) Get

func (s *TeamService) Get(organizationSlug string, slug string) (*Team, *http.Response, error)

Get details on an individual team of an organization. https://docs.sentry.io/api/teams/get-team-details/

func (*TeamService) List

func (s *TeamService) List(organizationSlug string) ([]Team, *http.Response, error)

List returns a list of teams bound to an organization. https://docs.sentry.io/api/teams/get-organization-teams/

func (*TeamService) Update

func (s *TeamService) Update(organizationSlug string, slug string, params *UpdateTeamParams) (*Team, *http.Response, error)

Update settings for a given team. https://docs.sentry.io/api/teams/put-team-details/

type UpdateOrganizationParams

type UpdateOrganizationParams struct {
	Name string `json:"name,omitempty"`
	Slug string `json:"slug,omitempty"`
}

UpdateOrganizationParams are the parameters for OrganizationService.Update.

type UpdateProjectKeyParams

type UpdateProjectKeyParams struct {
	Name      string               `json:"name,omitempty"`
	RateLimit *ProjectKeyRateLimit `json:"rateLimit,omitempty"`
}

UpdateProjectKeyParams are the parameters for ProjectKeyService.Update.

type UpdateProjectParams

type UpdateProjectParams struct {
	Name            string                 `json:"name,omitempty"`
	Slug            string                 `json:"slug,omitempty"`
	Platform        string                 `json:"platform,omitempty"`
	IsBookmarked    *bool                  `json:"isBookmarked,omitempty"`
	DigestsMinDelay *int                   `json:"digestsMinDelay,omitempty"`
	DigestsMaxDelay *int                   `json:"digestsMaxDelay,omitempty"`
	Options         map[string]interface{} `json:"options,omitempty"`
	AllowedDomains  []string               `json:"allowedDomains,omitempty"`
}

UpdateProjectParams are the parameters for ProjectService.Update.

type UpdateProjectPluginParams

type UpdateProjectPluginParams map[string]interface{}

UpdateTeamParams are the parameters for TeamService.Update.

type UpdateTeamParams

type UpdateTeamParams struct {
	Name string `json:"name,omitempty"`
	Slug string `json:"slug,omitempty"`
}

UpdateTeamParams are the parameters for TeamService.Update.

Jump to

Keyboard shortcuts

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