Documentation ¶
Index ¶
- Variables
- func MapToSubscription(sirenSub *sirenv1beta1.Subscription) models.Subscription
- func MapToSubscriptionList(sirenSubs []*sirenv1beta1.Subscription) []models.Subscription
- func SubscriptionRoutes(siren sirenv1beta1rpc.SirenServiceClient, ...) func(chi.Router)
- type Alert
- type AlertChannelForm
- type AlertSeverity
- type ChannelCriticality
- type ChannelType
- type Handler
- type Policy
- type Rule
- type Service
- func (svc *Service) GetAlertPolicy(ctx context.Context, projectSlug, resource, resourceTag string) (*Policy, error)
- func (svc *Service) GetAlertTemplate(ctx context.Context, urn string) (*Template, error)
- func (svc *Service) GetProjectDataSource(ctx context.Context, projectSlug string) (string, error)
- func (svc *Service) HandleListTemplates() http.HandlerFunc
- func (svc *Service) ListAlertTemplates(ctx context.Context, tag string) ([]Template, error)
- func (svc *Service) ListAlerts(ctx context.Context, projectSlug, resource string) ([]Alert, error)
- func (svc *Service) UpsertAlertPolicy(ctx context.Context, projectSlug string, update Policy) (*Policy, error)
- type SirenReceivers
- type SubscriptionForm
- type SubscriptionService
- func (svc *SubscriptionService) CreateSubscription(ctx context.Context, form SubscriptionForm) (int, error)
- func (svc *SubscriptionService) DeleteSubscription(ctx context.Context, subscriptionID int) error
- func (svc *SubscriptionService) FindSubscription(ctx context.Context, subscriptionID int) (*sirenv1beta1.Subscription, error)
- func (svc *SubscriptionService) GetAlertChannels(ctx context.Context, groupID string) ([]models.AlertChannel, error)
- func (svc *SubscriptionService) GetSubscriptions(ctx context.Context, groupID, resourceID, resourceType string) ([]*sirenv1beta1.Subscription, error)
- func (svc *SubscriptionService) SetAlertChannels(ctx context.Context, userID string, groupID string, forms []AlertChannelForm) ([]models.AlertChannel, error)
- func (svc *SubscriptionService) UpdateSubscription(ctx context.Context, subscriptionID int, form SubscriptionForm) error
- type Template
- type Variable
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidAlertSeverity = errors.New("invalid alert severity") ErrInvalidChannelCriticality = errors.New("invalid channel criticality") ErrSubscriptionNotFound = errors.New("could not find subscription") ErrNoSirenReceiver = errors.New("could not find siren's receiver") ErrMultipleSirenReceiver = errors.New("multiple siren's receivers found") ErrInvalidSirenReceiver = errors.New("invalid siren's receiver type") ErrNoShieldOrg = errors.New("could not find shield's organization") ErrNoShieldProject = errors.New("could not find shield's project") ErrNoShieldGroup = errors.New("could not find shield's group") ErrNoShieldParentSlackReceiver = errors.New("could not find siren's parent slack receiver from shield metadata") ErrNoShieldSirenNamespace = errors.New("could not find siren's namespace id from shield org metadata") ErrInvalidShieldSirenNamespace = errors.New("invalid siren's namespace id from shield org metadata") ErrInvalidShieldParentSlackReceiver = errors.New("invalid siren's parent slack receiver from shield org metadata") )
View Source
var SuppliedVariables = []string{"name", "team", "entity"}
Functions ¶
func MapToSubscription ¶ added in v0.7.9
func MapToSubscription(sirenSub *sirenv1beta1.Subscription) models.Subscription
func MapToSubscriptionList ¶ added in v0.7.9
func MapToSubscriptionList(sirenSubs []*sirenv1beta1.Subscription) []models.Subscription
func SubscriptionRoutes ¶ added in v0.7.9
func SubscriptionRoutes( siren sirenv1beta1rpc.SirenServiceClient, shield shieldv1beta1rpc.ShieldServiceClient, ) func(chi.Router)
Types ¶
type AlertChannelForm ¶ added in v0.7.11
type AlertChannelForm struct { ChannelCriticality ChannelCriticality ChannelName string ChannelType string PagerdutyServiceKey string }
type AlertSeverity ¶ added in v0.7.9
type AlertSeverity string
const ( AlertSeverityInfo AlertSeverity = "INFO" AlertSeverityWarning AlertSeverity = "WARNING" AlertSeverityCritical AlertSeverity = "CRITICAL" )
type ChannelCriticality ¶ added in v0.7.9
type ChannelCriticality string
const ( ChannelCriticalityInfo ChannelCriticality = "INFO" ChannelCriticalityWarning ChannelCriticality = "WARNING" ChannelCriticalityCritical ChannelCriticality = "CRITICAL" )
type ChannelType ¶ added in v0.7.11
type ChannelType string
const ( ChannelTypeSlack ChannelType = "slack_channel" ChannelTypePagerduty ChannelType = "pagerduty" )
type Handler ¶ added in v0.7.9
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶ added in v0.7.9
func NewHandler(subscriptionService *SubscriptionService) *Handler
type Rule ¶
type Rule struct { ID string `json:"id,omitempty"` Template string `json:"template"` Enabled bool `json:"enabled"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Variables []Variable `json:"variables"` }
type Service ¶
type Service struct {
Siren sirenv1beta1grpc.SirenServiceClient
}
func (*Service) GetAlertPolicy ¶
func (*Service) GetAlertTemplate ¶
func (*Service) GetProjectDataSource ¶
func (*Service) HandleListTemplates ¶
func (svc *Service) HandleListTemplates() http.HandlerFunc
func (*Service) ListAlertTemplates ¶
func (*Service) ListAlerts ¶
type SirenReceivers ¶ added in v0.7.11
type SirenReceivers []*sirenv1beta1.Receiver
func (SirenReceivers) Find ¶ added in v0.7.11
func (receivers SirenReceivers) Find(receiverType, severity string) *sirenv1beta1.Receiver
type SubscriptionForm ¶ added in v0.7.9
type SubscriptionForm struct { UserID string AlertSeverity AlertSeverity ProjectID string ChannelCriticality ChannelCriticality GroupID string ResourceID string ResourceType string }
type SubscriptionService ¶ added in v0.7.9
type SubscriptionService struct {
// contains filtered or unexported fields
}
func NewSubscriptionService ¶ added in v0.7.9
func NewSubscriptionService( sirenClient sirenv1beta1grpc.SirenServiceClient, shieldClient shieldv1beta1rpc.ShieldServiceClient, ) *SubscriptionService
func (*SubscriptionService) CreateSubscription ¶ added in v0.7.9
func (svc *SubscriptionService) CreateSubscription(ctx context.Context, form SubscriptionForm) (int, error)
func (*SubscriptionService) DeleteSubscription ¶ added in v0.7.9
func (svc *SubscriptionService) DeleteSubscription(ctx context.Context, subscriptionID int) error
func (*SubscriptionService) FindSubscription ¶ added in v0.7.9
func (svc *SubscriptionService) FindSubscription(ctx context.Context, subscriptionID int) (*sirenv1beta1.Subscription, error)
func (*SubscriptionService) GetAlertChannels ¶ added in v0.7.9
func (svc *SubscriptionService) GetAlertChannels(ctx context.Context, groupID string) ([]models.AlertChannel, error)
func (*SubscriptionService) GetSubscriptions ¶ added in v0.7.9
func (svc *SubscriptionService) GetSubscriptions(ctx context.Context, groupID, resourceID, resourceType string) ([]*sirenv1beta1.Subscription, error)
func (*SubscriptionService) SetAlertChannels ¶ added in v0.7.11
func (svc *SubscriptionService) SetAlertChannels(ctx context.Context, userID string, groupID string, forms []AlertChannelForm) ([]models.AlertChannel, error)
func (*SubscriptionService) UpdateSubscription ¶ added in v0.7.9
func (svc *SubscriptionService) UpdateSubscription(ctx context.Context, subscriptionID int, form SubscriptionForm) error
type Template ¶
type Template struct { ID string `json:"id"` Name string `json:"name"` Body string `json:"body"` Tags []string `json:"tags"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Variables []Variable `json:"variables"` }
Click to show internal directories.
Click to hide internal directories.