notifications

package
v0.3.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDestinationNotFound     = xerror.NotFound(xerror.AlertDestination)
	ErrDestinationSlugTaken    = xerror.AlreadyExists(xerror.AlertDestination)
	ErrDestinationInvalidInput = xerror.InvalidInput(xerror.AlertDestination)
	ErrAlertPolicyNotFound     = xerror.NotFound(xerror.AlertPolicy)
	ErrAlertPolicySlugTaken    = xerror.AlreadyExists(xerror.AlertPolicy)
	ErrAlertPolicyInvalidInput = xerror.InvalidInput(xerror.AlertPolicy)
	ErrRecordNotFound          = xerror.NotFound(xerror.Notification)
	ErrRecordSlugTaken         = xerror.AlreadyExists(xerror.Notification)
	ErrRecordInvalidInput      = xerror.InvalidInput(xerror.Notification)
	ErrDeliveryNotFound        = xerror.NotFound(xerror.Notification)
	ErrDeliveryInvalidInput    = xerror.InvalidInput(xerror.Notification)
)

Functions

This section is empty.

Types

type AcknowledgeRecordParams

type AcknowledgeRecordParams struct {
	OrgSlug        slug.Slug
	RecordSlug     slug.Slug
	AcknowledgedAt time.Time
}

type AlertDeliveryAttempt

type AlertDeliveryAttempt struct {
	OrgSlug                  slug.Slug
	Slug                     slug.Slug
	NotificationRecordSlug   slug.Slug
	AlertPolicySlug          *slug.Slug
	DestinationSlug          *slug.Slug
	DestinationName          *string
	DestinationType          model.AlertDestinationType
	Status                   model.AlertDeliveryAttemptStatus
	ProviderAttempt          int
	JobKind                  string
	JobQueue                 string
	JobState                 string
	ProviderResponseMetadata json.RawMessage
	ErrorCategory            *string
	ErrorMessage             *string
	QueuedAt                 time.Time
	SentAt                   *time.Time
	FailedAt                 *time.Time
	CreatedAt                time.Time
	UpdatedAt                time.Time
}

type AlertDestination

type AlertDestination struct {
	OrgSlug         slug.Slug
	Slug            slug.Slug
	Name            string
	Type            model.AlertDestinationType
	NonSecretConfig json.RawMessage
	Enabled         bool
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

type AlertPolicy

type AlertPolicy struct {
	OrgSlug          slug.Slug
	Slug             slug.Slug
	Name             string
	Scope            model.AlertPolicyScope
	ProjectSlug      *slug.Slug
	EnvironmentSlug  *slug.Slug
	NotificationType *model.NotificationType
	Severity         *model.NotificationSeverity
	LifecycleState   *model.NotificationLifecycleState
	SourceKind       *model.EventEntityType
	SourceAction     *model.EventAction
	SourceRef        *slug.Slug
	DestinationSlugs []slug.Slug
	Enabled          bool
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

type BindAlertPolicyDestinationParams

type BindAlertPolicyDestinationParams struct {
	OrgSlug         slug.Slug
	AlertPolicySlug slug.Slug
	DestinationSlug slug.Slug
}

type ClaimConnectionDeliveryParams

type ClaimConnectionDeliveryParams struct {
	OrgSlug, RecordSlug, DestinationSlug, AlertPolicySlug, AttemptSlug slug.Slug
	Now, LeaseUntil                                                    time.Time
}

type ConnectionDeliveryClaim

type ConnectionDeliveryClaim struct {
	Slug                     slug.Slug
	ProviderAttempt          int
	Status                   model.AlertDeliveryAttemptStatus
	JobState                 string
	LeaseUntil, RetryAfterAt *time.Time
	Acquired                 bool
}

type CreateAlertDeliveryAttemptParams

type CreateAlertDeliveryAttemptParams struct {
	OrgSlug                  slug.Slug
	Slug                     slug.Slug
	NotificationRecordSlug   slug.Slug
	AlertPolicySlug          slug.Slug
	DestinationSlug          slug.Slug
	DestinationType          model.AlertDestinationType
	Status                   model.AlertDeliveryAttemptStatus
	ProviderAttempt          int
	JobKind                  string
	JobQueue                 string
	JobState                 string
	ProviderResponseMetadata json.RawMessage
	QueuedAt                 time.Time
}

type CreateAlertDestinationParams

type CreateAlertDestinationParams struct {
	OrgSlug         slug.Slug
	Slug            slug.Slug
	Name            string
	Type            model.AlertDestinationType
	NonSecretConfig json.RawMessage
	Enabled         bool
}

type CreateAlertPolicyParams

type CreateAlertPolicyParams struct {
	OrgSlug          slug.Slug
	Slug             slug.Slug
	Name             string
	Scope            model.AlertPolicyScope
	ProjectSlug      *slug.Slug
	EnvironmentSlug  *slug.Slug
	NotificationType *model.NotificationType
	Severity         *model.NotificationSeverity
	LifecycleState   *model.NotificationLifecycleState
	SourceKind       *model.EventEntityType
	SourceAction     *model.EventAction
	SourceRef        *slug.Slug
	Enabled          bool
}

type DeliveryTarget

type DeliveryTarget struct {
	OrgSlug          slug.Slug
	OrganizationName string
	RecordSlug       slug.Slug
	AlertPolicySlug  slug.Slug
	DestinationSlug  slug.Slug
	DestinationName  string
	DestinationType  model.AlertDestinationType
	NonSecretConfig  json.RawMessage
	NotificationType model.NotificationType
	Severity         model.NotificationSeverity
	SourceEntityType model.EventEntityType
	SourceAction     model.EventAction
	SourceRefs       json.RawMessage
	SafeMetadata     json.RawMessage
	OccurrenceCount  int
}

type DeliveryWork

type DeliveryWork struct {
	OrganizationName string
	OrgSlug          slug.Slug
	RecordSlug       slug.Slug
	AlertPolicySlug  slug.Slug
	DestinationSlug  slug.Slug
	DestinationName  string
	DestinationType  model.AlertDestinationType
	NonSecretConfig  json.RawMessage
	NotificationType model.NotificationType
	Severity         model.NotificationSeverity
	SourceEntityType model.EventEntityType
	SourceAction     model.EventAction
	SourceRefs       json.RawMessage
	SafeMetadata     json.RawMessage
	OccurrenceCount  int
}

type FindDeliveryWorkParams

type FindDeliveryWorkParams struct {
	OrgSlug         slug.Slug
	RecordSlug      slug.Slug
	DestinationSlug slug.Slug
	AlertPolicySlug slug.Slug
}

type FinishConnectionDeliveryParams

type FinishConnectionDeliveryParams struct {
	OrgSlug, AttemptSlug        slug.Slug
	ProviderAttempt             int
	Status                      model.AlertDeliveryAttemptStatus
	JobState                    string
	ErrorCategory, ErrorMessage *string
	RetryAfterAt                *time.Time
	Now                         time.Time
	ProviderResponseMetadata    json.RawMessage
}

type ListRecordFilters

type ListRecordFilters struct {
	LifecycleState   *model.NotificationLifecycleState
	NotificationType *model.NotificationType
	Severity         *model.NotificationSeverity
	SourceKind       *model.EventEntityType
	SourceAction     *model.EventAction
	SourceRef        *slug.Slug
	IncludeResolved  bool
}

type MarkAlertDeliveryAttemptFailedParams

type MarkAlertDeliveryAttemptFailedParams struct {
	OrgSlug                  slug.Slug
	AttemptSlug              slug.Slug
	ProviderAttempt          int
	JobState                 string
	ProviderResponseMetadata json.RawMessage
	ErrorCategory            *string
	ErrorMessage             *string
	FailedAt                 time.Time
}

type MarkAlertDeliveryAttemptSentParams

type MarkAlertDeliveryAttemptSentParams struct {
	OrgSlug                  slug.Slug
	AttemptSlug              slug.Slug
	ProviderAttempt          int
	JobState                 string
	ProviderResponseMetadata json.RawMessage
	SentAt                   time.Time
}

type Record

type Record struct {
	OrgSlug           slug.Slug
	Slug              slug.Slug
	ProjectSlug       *slug.Slug
	EnvironmentSlug   *slug.Slug
	NotificationType  model.NotificationType
	Severity          model.NotificationSeverity
	LifecycleState    model.NotificationLifecycleState
	DedupeFingerprint string
	SourceEventSlug   *slug.Slug
	SourceEntityType  model.EventEntityType
	SourceAction      model.EventAction
	SourceRefs        json.RawMessage
	SafeMetadata      json.RawMessage
	FirstSeenAt       time.Time
	LastSeenAt        time.Time
	OccurrenceCount   int
	LastOccurrenceAt  time.Time
	DispatchSummary   json.RawMessage
	AcknowledgedAt    *time.Time
	ResolvedAt        *time.Time
	CreatedAt         time.Time
	UpdatedAt         time.Time
}

type Repository

type Repository interface {
	ClaimConnectionDelivery(context.Context, postgres.DBTX, ClaimConnectionDeliveryParams) (ConnectionDeliveryClaim, error)
	FinishConnectionDelivery(context.Context, postgres.DBTX, FinishConnectionDeliveryParams) error
	CreateAlertDestination(
		ctx context.Context,
		tx postgres.DBTX,
		params CreateAlertDestinationParams,
	) (*AlertDestination, error)
	ListAlertDestinationsByOrganization(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		req model.ListRequest,
	) ([]*AlertDestination, error)
	FindAlertDestinationBySlug(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		destinationSlug slug.Slug,
	) (*AlertDestination, error)
	UpdateAlertDestination(
		ctx context.Context,
		tx postgres.DBTX,
		params UpdateAlertDestinationParams,
	) (*AlertDestination, error)
	DeleteAlertDestination(ctx context.Context, tx postgres.DBTX, orgSlug, destinationSlug slug.Slug) error
	CreateAlertPolicy(ctx context.Context, tx postgres.DBTX, params CreateAlertPolicyParams) (*AlertPolicy, error)
	ListAlertPoliciesByOrganization(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		req model.ListRequest,
	) ([]*AlertPolicy, error)
	FindAlertPolicyBySlug(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		policySlug slug.Slug,
	) (*AlertPolicy, error)
	UpdateAlertPolicy(ctx context.Context, tx postgres.DBTX, params UpdateAlertPolicyParams) (*AlertPolicy, error)
	ClearAlertPolicyDestinations(ctx context.Context, tx postgres.DBTX, orgSlug, policySlug slug.Slug) error
	BindAlertPolicyDestination(ctx context.Context, tx postgres.DBTX, params BindAlertPolicyDestinationParams) error
	DeleteAlertPolicy(ctx context.Context, tx postgres.DBTX, orgSlug, policySlug slug.Slug) error
	UpsertRecord(ctx context.Context, tx postgres.DBTX, params UpsertRecordParams) (*Record, error)
	ListRecordsByOrganization(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		filters ListRecordFilters,
		req model.ListRequest,
	) ([]*Record, error)
	FindRecordBySlug(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		recordSlug slug.Slug,
	) (*Record, error)
	AcknowledgeRecord(ctx context.Context, tx postgres.DBTX, params AcknowledgeRecordParams) (*Record, error)
	ResolveRecord(ctx context.Context, tx postgres.DBTX, params ResolveRecordParams) (*Record, error)
	ListDeliveryTargetsForRecord(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		recordSlug slug.Slug,
	) ([]DeliveryTarget, error)
	FindDeliveryWork(
		ctx context.Context,
		tx postgres.DBTX,
		params FindDeliveryWorkParams,
	) (*DeliveryWork, error)
	CreateAlertDeliveryAttempt(
		ctx context.Context,
		tx postgres.DBTX,
		params CreateAlertDeliveryAttemptParams,
	) (*AlertDeliveryAttempt, error)
	ListAlertDeliveryAttemptsForRecord(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		recordSlug slug.Slug,
		req model.ListRequest,
	) ([]*AlertDeliveryAttempt, error)
	ListRecentAlertDeliveryAttemptsForRecords(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		recordSlugs []slug.Slug,
		limitPerRecord int,
	) ([]*AlertDeliveryAttempt, error)
	MarkAlertDeliveryAttemptSent(
		ctx context.Context,
		tx postgres.DBTX,
		params MarkAlertDeliveryAttemptSentParams,
	) (*AlertDeliveryAttempt, error)
	MarkAlertDeliveryAttemptFailed(
		ctx context.Context,
		tx postgres.DBTX,
		params MarkAlertDeliveryAttemptFailedParams,
	) (*AlertDeliveryAttempt, error)
	UpdateRecordDispatchSummary(
		ctx context.Context,
		tx postgres.DBTX,
		params UpdateRecordDispatchSummaryParams,
	) (*Record, error)
}

func New

func New() Repository

New creates a notification repository backed by SQLC queries.

type ResolveRecordParams

type ResolveRecordParams struct {
	OrgSlug    slug.Slug
	RecordSlug slug.Slug
	ResolvedAt time.Time
}

type UpdateAlertDestinationParams

type UpdateAlertDestinationParams struct {
	OrgSlug         slug.Slug
	Slug            slug.Slug
	Name            string
	Type            model.AlertDestinationType
	NonSecretConfig json.RawMessage
	Enabled         bool
}

type UpdateAlertPolicyParams

type UpdateAlertPolicyParams struct {
	OrgSlug          slug.Slug
	Slug             slug.Slug
	Name             string
	Scope            model.AlertPolicyScope
	ProjectSlug      *slug.Slug
	EnvironmentSlug  *slug.Slug
	NotificationType *model.NotificationType
	Severity         *model.NotificationSeverity
	LifecycleState   *model.NotificationLifecycleState
	SourceKind       *model.EventEntityType
	SourceAction     *model.EventAction
	SourceRef        *slug.Slug
	Enabled          bool
}

type UpdateRecordDispatchSummaryParams

type UpdateRecordDispatchSummaryParams struct {
	OrgSlug         slug.Slug
	RecordSlug      slug.Slug
	DestinationSlug slug.Slug
	Status          model.NotificationDispatchStatus
	QueuedAt        time.Time
	JobKind         string
	JobQueue        string
	JobState        string
}

type UpsertRecordParams

type UpsertRecordParams struct {
	OrgSlug           slug.Slug
	Slug              slug.Slug
	ProjectSlug       *slug.Slug
	EnvironmentSlug   *slug.Slug
	NotificationType  model.NotificationType
	Severity          model.NotificationSeverity
	LifecycleState    model.NotificationLifecycleState
	DedupeFingerprint string
	SourceEventSlug   *slug.Slug
	SourceEntityType  model.EventEntityType
	SourceAction      model.EventAction
	SourceRefs        json.RawMessage
	SafeMetadata      json.RawMessage
	ObservedAt        time.Time
}

Jump to

Keyboard shortcuts

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