event

package
v0.0.0-...-72c2bb7 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Add Webhook results
	WebhookTempTableKey     = "event_webhook_add_temp"
	WebhookTempTableColumns = []string{"organization_id", "scan_group_id", "notification_id", "webhook_id", "type_id", "last_attempt_timestamp", "last_attempt_status"}
	WebhookTempTable        = `` /* 253-byte string literal not displayed */

	TempToWebhook = `` /* 377-byte string literal not displayed */

	// Add Events
	AddTempTableKey     = "event_add_temp"
	AddTempTableColumns = []string{"organization_id", "scan_group_id", "type_id", "event_timestamp", "event_data", "event_data_json"}
	AddTempTable        = `` /* 228-byte string literal not displayed */

	AddTempToAdd = `` /* 422-byte string literal not displayed */

	SubscriptionsTempTableKey     = "event_subs_temp"
	SubscriptionsTempTableColumns = []string{"organization_id", "user_id", "type_id", "subscribed_since", "subscribed"}
	SubscriptionsTempTable        = `` /* 216-byte string literal not displayed */

	SubscriptionsTempToSubscriptions = `` /* 411-byte string literal not displayed */

	MarkReadTempTableKey     = "event_read_temp"
	MarkReadTempTableColumns = []string{"organization_id", "user_id", "notification_id"}
	MarkReadTempTable        = `` /* 153-byte string literal not displayed */

	MarkReadTempToMarkRead = `` /* 224-byte string literal not displayed */

)

Functions

This section is empty.

Types

type Service

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

Service for interfacing with postgresql/rds

func New

func New(authorizer auth.Authorizer, hooks webhooks.Webhooker) *Service

New returns an empty Service

func (*Service) Add

func (s *Service) Add(ctx context.Context, userContext am.UserContext, events []*am.Event) error

Add events

func (*Service) Get

func (s *Service) Get(ctx context.Context, userContext am.UserContext, filter *am.EventFilter) ([]*am.Event, error)

func (*Service) GetSettings

func (s *Service) GetSettings(ctx context.Context, userContext am.UserContext) (*am.UserEventSettings, error)

func (*Service) GetWebhookEvents

func (s *Service) GetWebhookEvents(ctx context.Context, userContext am.UserContext) ([]*am.WebhookEvent, error)

func (*Service) GetWebhooks

func (s *Service) GetWebhooks(ctx context.Context, userContext am.UserContext) ([]*am.WebhookEventSettings, error)

func (*Service) Init

func (s *Service) Init(config []byte) error

Init by parsing the config and initializing the database pool

func (*Service) IsAuthorized

func (s *Service) IsAuthorized(ctx context.Context, userContext am.UserContext, resource, action string) bool

IsAuthorized checks if an action is allowed by a particular user

func (*Service) MarkRead

func (s *Service) MarkRead(ctx context.Context, userContext am.UserContext, notificationIDs []int64) error

MarkRead events

func (*Service) NotifyComplete

func (s *Service) NotifyComplete(ctx context.Context, userContext am.UserContext, startTime int64, groupID int) error

NotifyComplete that a scan group has completed

func (*Service) UpdateSettings

func (s *Service) UpdateSettings(ctx context.Context, userContext am.UserContext, settings *am.UserEventSettings) error

UpdateSettings for user

func (*Service) UpdateWebhooks

func (s *Service) UpdateWebhooks(ctx context.Context, userContext am.UserContext, webhook *am.WebhookEventSettings) (err error)

UpdateWebhooks or insert new (uniqueness on org,groupid,name)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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