services

package
v0.0.0-...-ca24b28 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrganizationEndorsement     = `You received this message because you belong to the "{{.Organization}}" organization.`
	OrganizationRoleEndorsement = `You received this message because you are an {{.OrganizationRole}} in the "{{.Organization}}" organization.`
)
View Source
const EmailEndorsement = "This message was sent directly to your email address."
View Source
const EveryoneEndorsement = "This message was sent to everyone."
View Source
const ScopeEndorsement = "You received this message because you have the {{.Scope}} scope."
View Source
const SpaceEndorsement = `You received this message because you belong to the "{{.Space}}" space in the "{{.Organization}}" organization.`
View Source
const StatusQueued = "queued"
View Source
const UserEndorsement = "This message was sent directly to you."

Variables

This section is empty.

Functions

func CCErrorFor

func CCErrorFor(err error) error

Types

type AllUsers

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

func NewAllUsers

func NewAllUsers(uaa uaaAllUsers) AllUsers

func (AllUsers) AllUserGUIDs

func (allUsers AllUsers) AllUserGUIDs(token string) ([]string, error)

type CCDownError

type CCDownError struct {
	Err error
}

func (CCDownError) Error

func (e CCDownError) Error() string

type CCNotFoundError

type CCNotFoundError struct {
	Err error
}

func (CCNotFoundError) Error

func (e CCNotFoundError) Error() string

type ClientMap

type ClientMap map[string]Kind

type ClientMissingError

type ClientMissingError struct {
	Err error
}

func (ClientMissingError) Error

func (e ClientMissingError) Error() string

type ClientsMap

type ClientsMap map[string]ClientMap

type ClientsRepo

type ClientsRepo interface {
	Find(connection models.ConnectionInterface, clientID string) (models.Client, error)
	FindAll(connection models.ConnectionInterface) ([]models.Client, error)
	FindAllByTemplateID(connection models.ConnectionInterface, templateID string) ([]models.Client, error)
	Update(connection models.ConnectionInterface, client models.Client) (models.Client, error)
	Upsert(connection models.ConnectionInterface, client models.Client) (models.Client, error)
}

type ConnectionInterface

type ConnectionInterface interface {
	models.ConnectionInterface
}

type CriticalKindError

type CriticalKindError struct {
	Err error
}

func (CriticalKindError) Error

func (e CriticalKindError) Error() string

type DatabaseInterface

type DatabaseInterface interface {
	models.DatabaseInterface
}

type DefaultScopeError

type DefaultScopeError struct{}

func (DefaultScopeError) Error

func (d DefaultScopeError) Error() string

type Delivery

type Delivery struct {
	MessageID       string
	Options         Options
	UserGUID        string
	Email           string
	Space           cf.CloudControllerSpace
	Organization    cf.CloudControllerOrganization
	ClientID        string
	UAAHost         string
	Scope           string
	VCAPRequestID   string
	RequestReceived time.Time
}

type Dispatch

type Dispatch struct {
	JobType    string
	GUID       string
	Role       string
	Connection ConnectionInterface
	UAAHost    string
	TemplateID string
	CampaignID string

	VCAPRequest DispatchVCAPRequest
	Message     DispatchMessage
	Kind        DispatchKind
	Client      DispatchClient
}

type DispatchClient

type DispatchClient struct {
	ID          string
	Description string
}

type DispatchKind

type DispatchKind struct {
	ID          string
	Description string
}

type DispatchMessage

type DispatchMessage struct {
	To      string
	ReplyTo string
	Subject string
	Text    string
	HTML    HTML
}

type DispatchVCAPRequest

type DispatchVCAPRequest struct {
	ID          string
	ReceiptTime time.Time
}

type EmailStrategy

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

func NewEmailStrategy

func NewEmailStrategy(enqueuer enqueuer) EmailStrategy

func (EmailStrategy) Dispatch

func (strategy EmailStrategy) Dispatch(dispatch Dispatch) ([]Response, error)

type Enqueuer

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

func NewEnqueuer

func NewEnqueuer(queue queueInterface, messagesRepo messagesRepoUpserter, gobbleInitializer gobbleInitializer) Enqueuer

func (Enqueuer) Enqueue

func (enqueuer Enqueuer) Enqueue(
	conn ConnectionInterface,
	users []User,
	options Options,
	space cf.CloudControllerSpace,
	organization cf.CloudControllerOrganization,
	clientID,
	uaaHost,
	scope,
	vcapRequestID string,
	reqReceived time.Time) ([]Response, error)

type EveryoneStrategy

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

func NewEveryoneStrategy

func NewEveryoneStrategy(tokenLoader loadsTokens, allUsers allUserGUIDsGetter, enqueuer enqueuer) EveryoneStrategy

func (EveryoneStrategy) Dispatch

func (strategy EveryoneStrategy) Dispatch(dispatch Dispatch) ([]Response, error)

type FindsUserIDs

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

func NewFindsUserIDs

func NewFindsUserIDs(cc cloudController, uaa uaaUsersGUIDsByScope) FindsUserIDs

func (FindsUserIDs) UserIDsBelongingToOrganization

func (finder FindsUserIDs) UserIDsBelongingToOrganization(orgGUID, role, token string) ([]string, error)

func (FindsUserIDs) UserIDsBelongingToScope

func (finder FindsUserIDs) UserIDsBelongingToScope(token, scope string) ([]string, error)

func (FindsUserIDs) UserIDsBelongingToSpace

func (finder FindsUserIDs) UserIDsBelongingToSpace(spaceGUID, token string) ([]string, error)

type GlobalUnsubscribesRepo

type GlobalUnsubscribesRepo interface {
	Get(connection models.ConnectionInterface, userGUID string) (bool, error)
	Set(connection models.ConnectionInterface, userGUID string, unsubscribe bool) error
}

type HTML

type HTML struct {
	BodyContent    string
	BodyAttributes string
	Head           string
	Doctype        string
}

type Kind

type Kind struct {
	Email             *bool  `json:"email"`
	KindDescription   string `json:"kind_description"`
	SourceDescription string `json:"source_description"`
}

type KindMissingError

type KindMissingError struct {
	Err error
}

func (KindMissingError) Error

func (e KindMissingError) Error() string

type KindsRepo

type KindsRepo interface {
	Find(connection models.ConnectionInterface, kindID string, clientID string) (models.Kind, error)
	FindAll(connection models.ConnectionInterface) ([]models.Kind, error)
	FindAllByTemplateID(connection models.ConnectionInterface, templateID string) ([]models.Kind, error)
	Trim(connection models.ConnectionInterface, clientID string, kindIDs []string) (int, error)
	Update(connection models.ConnectionInterface, kind models.Kind) (models.Kind, error)
	Upsert(connection models.ConnectionInterface, kind models.Kind) (models.Kind, error)
}

type Message

type Message struct {
	Status string
}

type MessageFinder

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

func NewMessageFinder

func NewMessageFinder(repo messagesRepoFinder) MessageFinder

func (MessageFinder) Find

func (finder MessageFinder) Find(database DatabaseInterface, messageID string) (Message, error)

type MissingKindOrClientError

type MissingKindOrClientError struct {
	Err error
}

func (MissingKindOrClientError) Error

func (e MissingKindOrClientError) Error() string

type NotificationsFinder

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

func NewNotificationsFinder

func NewNotificationsFinder(clientsRepo ClientsRepo, kindsRepo KindsRepo) NotificationsFinder

func (NotificationsFinder) AllClientsAndNotifications

func (finder NotificationsFinder) AllClientsAndNotifications(database DatabaseInterface) ([]models.Client, []models.Kind, error)

func (NotificationsFinder) ClientAndKind

func (finder NotificationsFinder) ClientAndKind(database DatabaseInterface, clientID, kindID string) (models.Client, models.Kind, error)

type NotificationsUpdater

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

func NewNotificationsUpdater

func NewNotificationsUpdater(kindsRepo KindsRepo) NotificationsUpdater

func (NotificationsUpdater) Update

func (updater NotificationsUpdater) Update(database DatabaseInterface, notification models.Kind) error

type Options

type Options struct {
	ReplyTo           string
	Subject           string
	KindDescription   string
	SourceDescription string
	Text              string
	HTML              HTML
	KindID            string
	To                string
	Role              string
	Endorsement       string
	TemplateID        string
}

type OrganizationLoader

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

func NewOrganizationLoader

func NewOrganizationLoader(cc cloudController) OrganizationLoader

func (OrganizationLoader) Load

func (loader OrganizationLoader) Load(orgGUID string, token string) (cf.CloudControllerOrganization, error)

type OrganizationStrategy

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

func NewOrganizationStrategy

func NewOrganizationStrategy(tokenLoader loadsTokens, organizationLoader loadsOrganizations, findsUserIDs orgUserIDFinder, queue enqueuer) OrganizationStrategy

func (OrganizationStrategy) Dispatch

func (strategy OrganizationStrategy) Dispatch(dispatch Dispatch) ([]Response, error)

type PreferenceUpdater

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

func NewPreferenceUpdater

func NewPreferenceUpdater(globalUnsubscribesRepo GlobalUnsubscribesRepo, unsubscribesRepo UnsubscribesRepo, kindsRepo KindsRepo) PreferenceUpdater

func (PreferenceUpdater) Update

func (updater PreferenceUpdater) Update(conn ConnectionInterface, preferences []models.Preference, globalUnsubscribe bool, userID string) error

type PreferencesBuilder

type PreferencesBuilder struct {
	GlobalUnsubscribe bool       `json:"global_unsubscribe"`
	Clients           ClientsMap `json:"clients"`
}

func NewPreferencesBuilder

func NewPreferencesBuilder() PreferencesBuilder

func (PreferencesBuilder) Add

func (pref PreferencesBuilder) Add(preference models.Preference)

func (PreferencesBuilder) ToPreferences

func (pref PreferencesBuilder) ToPreferences() ([]models.Preference, error)

type PreferencesFinder

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

func NewPreferencesFinder

func NewPreferencesFinder(preferencesRepo PreferencesRepo, globalUnsubscribesRepo GlobalUnsubscribesRepo) *PreferencesFinder

func (PreferencesFinder) Find

func (finder PreferencesFinder) Find(database DatabaseInterface, userGUID string) (PreferencesBuilder, error)

type PreferencesRepo

type PreferencesRepo interface {
	FindNonCriticalPreferences(connection models.ConnectionInterface, userGUID string) ([]models.Preference, error)
}

type Registrar

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

func NewRegistrar

func NewRegistrar(clientsRepo ClientsRepo, kindsRepo KindsRepo) Registrar

func (Registrar) Prune

func (registrar Registrar) Prune(conn ConnectionInterface, client models.Client, kinds []models.Kind) error

func (Registrar) Register

func (registrar Registrar) Register(conn ConnectionInterface, client models.Client, kinds []models.Kind) error

type Response

type Response struct {
	Status         string `json:"status"`
	Recipient      string `json:"recipient"`
	NotificationID string `json:"notification_id"`
	VCAPRequestID  string `json:"vcap_request_id"`
}

type SpaceLoader

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

func NewSpaceLoader

func NewSpaceLoader(cc cloudController) SpaceLoader

func (SpaceLoader) Load

func (loader SpaceLoader) Load(spaceGUID string, token string) (cf.CloudControllerSpace, error)

type SpaceStrategy

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

func NewSpaceStrategy

func NewSpaceStrategy(tokenLoader loadsTokens, spaceLoader loadsSpaces, organizationLoader loadsOrganizations, findsUserIDs spaceUserIDFinder, enqueuer enqueuer) SpaceStrategy

func (SpaceStrategy) Dispatch

func (strategy SpaceStrategy) Dispatch(dispatch Dispatch) ([]Response, error)

type TemplateFinder

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

func NewTemplateFinder

func NewTemplateFinder(templatesRepo TemplatesRepo) TemplateFinder

func (TemplateFinder) FindByID

func (finder TemplateFinder) FindByID(database DatabaseInterface, templateID string) (models.Template, error)

type TemplateLister

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

func NewTemplateLister

func NewTemplateLister(templatesRepo TemplatesRepo) TemplateLister

func (TemplateLister) List

func (lister TemplateLister) List(database DatabaseInterface) (map[string]TemplateSummary, error)

type TemplateSummary

type TemplateSummary struct {
	Name string `json:"name"`
}

type TemplateUpdater

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

func NewTemplateUpdater

func NewTemplateUpdater(templatesRepo TemplatesRepo) TemplateUpdater

func (TemplateUpdater) Update

func (updater TemplateUpdater) Update(database DatabaseInterface, templateID string, template models.Template) error

type TemplatesRepo

type TemplatesRepo interface {
	Create(connection models.ConnectionInterface, template models.Template) (models.Template, error)
	Destroy(connection models.ConnectionInterface, templateID string) error
	FindByID(connection models.ConnectionInterface, templateID string) (models.Template, error)
	ListIDsAndNames(connection models.ConnectionInterface) ([]models.Template, error)
	Update(connection models.ConnectionInterface, templateID string, template models.Template) (models.Template, error)
}

type UAAScopeStrategy

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

func NewUAAScopeStrategy

func NewUAAScopeStrategy(tokenLoader loadsTokens, findsUserIDs scopeUserIDFinder, enqueuer enqueuer, defaultScopes []string) UAAScopeStrategy

func (UAAScopeStrategy) Dispatch

func (strategy UAAScopeStrategy) Dispatch(dispatch Dispatch) ([]Response, error)

type UnsubscribesRepo

type UnsubscribesRepo interface {
	Set(connection models.ConnectionInterface, userID string, clientID string, kindID string, unsubscribe bool) error
}

type User

type User struct {
	GUID  string
	Email string
}

type UserStrategy

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

func NewUserStrategy

func NewUserStrategy(enqueuer enqueuer) UserStrategy

func (UserStrategy) Dispatch

func (strategy UserStrategy) Dispatch(dispatch Dispatch) ([]Response, error)

Jump to

Keyboard shortcuts

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