notify

package
v1.1.41 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 4

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