Documentation ¶
Overview ¶
Package notifications sends notifications for run state transitions and workspace events.
Index ¶
- Constants
- Variables
- type Config
- type CreateConfigOptions
- type Destination
- type GenericPayload
- type Notifier
- type NotifierOptions
- type Options
- type Service
- func (s *Service) AddHandlers(r *mux.Router)
- func (s *Service) Create(ctx context.Context, workspaceID resource.ID, opts CreateConfigOptions) (*Config, error)
- func (s *Service) Delete(ctx context.Context, id resource.ID) error
- func (s *Service) Get(ctx context.Context, id resource.ID) (*Config, error)
- func (s *Service) List(ctx context.Context, workspaceID resource.ID) ([]*Config, error)
- func (s *Service) Update(ctx context.Context, id resource.ID, opts UpdateConfigOptions) (*Config, error)
- func (s *Service) Watch(ctx context.Context) (<-chan pubsub.Event[*Config], func())
- type Trigger
- type UpdateConfigOptions
Constants ¶
View Source
const ( DestinationGeneric Destination = "generic" DestinationSlack Destination = "slack" DestinationGCPPubSub Destination = "gcppubsub" // Email type is only accepted in order to pass the `go-tfe` API tests, // which create configs with this type. It otherwise is entirely // unfunctional; no emails are sent. DestinationEmail Destination = "email" TriggerCreated Trigger = "run:created" TriggerPlanning Trigger = "run:planning" TriggerNeedsAttention Trigger = "run:needs_attention" TriggerApplying Trigger = "run:applying" TriggerCompleted Trigger = "run:completed" TriggerErrored Trigger = "run:errored" )
View Source
const LockID int64 = 5577006791947779411
LockID guarantees only one notifier on a cluster is running at any time.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ID resource.ID CreatedAt time.Time UpdatedAt time.Time DestinationType Destination Enabled bool Name string Token string Triggers []Trigger URL *string WorkspaceID resource.ID }
Config represents a Notification Configuration.
type CreateConfigOptions ¶
type CreateConfigOptions struct { // Required: The destination type of the notification configuration DestinationType Destination // Required: Whether the notification configuration should be enabled or not Enabled *bool // Required: The name of the notification configuration Name *string // Optional: The token of the notification configuration Token *string // Optional: The list of run events that will trigger notifications. Triggers []Trigger // Optional: The url of the notification configuration URL *string }
type GenericPayload ¶
type GenericPayload struct { PayloadVersion int NotificationConfigurationID resource.ID RunURL string RunID resource.ID RunMessage string RunCreatedAt time.Time RunCreatedBy string WorkspaceID resource.ID WorkspaceName string OrganizationName string Notifications []genericNotificationPayload }
GenericPayload is the information sent in generic notifications, as documented here:
type Notifier ¶
Notifier relays run events onto interested parties
func NewNotifier ¶
func NewNotifier(opts NotifierOptions) *Notifier
type NotifierOptions ¶
type Service ¶
type Service struct { logr.Logger *authz.Authorizer // contains filtered or unexported fields }
func NewService ¶
func (*Service) AddHandlers ¶ added in v0.2.2
type UpdateConfigOptions ¶
type UpdateConfigOptions struct { // Optional: Whether the notification configuration should be enabled or not Enabled *bool // Optional: The name of the notification configuration Name *string // Optional: The token of the notification configuration Token *string // Optional: The list of run events that will trigger notifications. Triggers []Trigger // Optional: The url of the notification configuration URL *string }
UpdateConfigOptions represents the options for updating a existing notification configuration.
Click to show internal directories.
Click to hide internal directories.