notify

package
v1.1.51 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 1 module, 3 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

View Source
const (
	Apikeys = "apikeys"
	Oauth   = "oauth"
)

consts

Variables

View Source
var (
	ErrSubscriptionNotification        = agenterrors.Newf(1300, "could not send notification via %s, check SUBSCRIPTION config")
	ErrSubscriptionNoNotifications     = agenterrors.New(1301, "no subscription notification type is configured, check SUBSCRIPTION config")
	ErrSubscriptionData                = agenterrors.New(1302, "error creating notification request")
	ErrSubscriptionBadAuthtype         = agenterrors.Newf(1303, "email template not updated because an invalid authType was supplied: %s. Check central.subscriptions.notifications.smtp.authType")
	ErrSubscriptionNoTemplateForAction = agenterrors.Newf(1304, "no email template found for action %s")
	ErrSubscriptionSendEmail           = agenterrors.New(1305, "error sending email to SMTP server")
)

Errors hit when sending subscription notifications

Functions

func SetSubscriptionConfig

func SetSubscriptionConfig(cfg corecfg.SubscriptionConfig)

SetSubscriptionConfig - Creates the default subscription config

Types

type SubscriptionNotification

type SubscriptionNotification struct {
	CatalogItemID   string                 `json:"catalogItemId"`
	CatalogItemURL  string                 `json:"catalogItemUrl"`
	CatalogItemName string                 `json:"catalogItemName"`
	Action          apic.SubscriptionState `json:"action"`
	Email           string                 `json:"email,omitempty"`
	Message         string                 `json:"message,omitempty"`
	Key             string                 `json:"key,omitempty"`
	ClientID        string                 `json:"clientID,omitempty"`
	ClientSecret    string                 `json:"clientSecret,omitempty"`
	AuthTemplate    string                 `json:"authtemplate,omitempty"`
	IsAPIKey        bool                   `json:"isAPIKey,omitempty"`
	KeyName         string
	KeyLocation     string
	// contains filtered or unexported fields
}

SubscriptionNotification - the struct that is sent to the notification and used to fill in email templates

func NewSubscriptionNotification

func NewSubscriptionNotification(recipient, message string, state apic.SubscriptionState) *SubscriptionNotification

NewSubscriptionNotification - creates a new subscription notification object

func (*SubscriptionNotification) BuildSMTPMessage

func (s *SubscriptionNotification) BuildSMTPMessage(template *corecfg.EmailTemplate) (*strings.Reader, error)

BuildSMTPMessage -

func (*SubscriptionNotification) NotifySubscriber

func (s *SubscriptionNotification) NotifySubscriber(recipient string) error

NotifySubscriber - send a notification to any configured notification type

func (*SubscriptionNotification) SetAPIKeyInfo

func (s *SubscriptionNotification) SetAPIKeyInfo(key, keyName string)

SetAPIKeyInfo - Set the key and header

func (*SubscriptionNotification) SetAPIKeyInfoAndLocation

func (s *SubscriptionNotification) SetAPIKeyInfoAndLocation(key, keyName, keyLocation string)

SetAPIKeyInfoAndLocation - Set the key, name, and location

func (*SubscriptionNotification) SetAuthorizationTemplate

func (s *SubscriptionNotification) SetAuthorizationTemplate(authType string)

SetAuthorizationTemplate - Set the authtemplate in the config central.subscriptions.notifications.smtp.subscribe.body {authtemplate}

func (*SubscriptionNotification) SetCatalogItemInfo

func (s *SubscriptionNotification) SetCatalogItemInfo(catalogID, catalogName, catalogItemURL string)

SetCatalogItemInfo - Set the catalogitem info

func (*SubscriptionNotification) SetOauthInfo

func (s *SubscriptionNotification) SetOauthInfo(clientID, clientSecret string)

SetOauthInfo - Set the id and secret info

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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