notifications

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignTemplateHandler

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

func NewAssignTemplateHandler

func NewAssignTemplateHandler(assigner assignsTemplates, errWriter errorWriter) AssignTemplateHandler

func (AssignTemplateHandler) ServeHTTP

func (h AssignTemplateHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, context stack.Context)

type Client

type Client struct {
	Name          string                  `json:"name"`
	Template      string                  `json:"template"`
	Notifications map[string]Notification `json:"notifications"`
}

type ClientRegistrationParams

type ClientRegistrationParams struct {
	SourceName    string                           `json:"source_name"`
	Notifications map[string](*NotificationStruct) `json:"notifications"`
}

func NewClientRegistrationParams

func NewClientRegistrationParams(body io.Reader) (ClientRegistrationParams, error)

func (ClientRegistrationParams) Validate

func (clientRegistration ClientRegistrationParams) Validate() error

type DatabaseInterface

type DatabaseInterface interface {
	services.DatabaseInterface
}

type ListHandler

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

func NewListHandler

func NewListHandler(notificationsFinder listsAllClientsAndNotifications, errWriter errorWriter) ListHandler

func (ListHandler) ServeHTTP

func (h ListHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, context stack.Context)

type Notification

type Notification struct {
	Description string `json:"description"`
	Template    string `json:"template"`
	Critical    bool   `json:"critical"`
}

type NotificationStruct

type NotificationStruct struct {
	ID          string
	Description string `json:"description"`
	Critical    bool   `json:"critical"`
}

type NotificationUpdateParams

type NotificationUpdateParams struct {
	Description string `json:"description" validate-required:"true"`
	Critical    bool   `json:"critical"    validate-required:"true"`
	TemplateID  string `json:"template"    validate-required:"true"`
}

func NewNotificationParams

func NewNotificationParams(body io.Reader) (NotificationUpdateParams, error)

func (NotificationUpdateParams) ToModel

func (params NotificationUpdateParams) ToModel(clientID, notificationID string) models.Kind

type NotificationsByClient

type NotificationsByClient map[string]Client

type PutHandler

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

func NewPutHandler

func NewPutHandler(registrar registrar, errWriter errorWriter) PutHandler

func (PutHandler) ServeHTTP

func (h PutHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, context stack.Context)

func (PutHandler) ValidateCriticalScopes

func (h PutHandler) ValidateCriticalScopes(scopes interface{}, kinds []models.Kind, client models.Client) ([]models.Kind, error)

type RegistrationHandler

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

func NewRegistrationHandler

func NewRegistrationHandler(registrar registrar, errWriter errorWriter) RegistrationHandler

func (RegistrationHandler) ServeHTTP

func (h RegistrationHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, context stack.Context)

func (RegistrationHandler) ValidateCriticalScopes

func (h RegistrationHandler) ValidateCriticalScopes(scopes interface{}, kinds []models.Kind, client models.Client) ([]models.Kind, error)

type RegistrationParams

type RegistrationParams struct {
	SourceDescription string        `json:"source_description"`
	Kinds             []models.Kind `json:"kinds"`
	IncludesKinds     bool
}

func NewRegistrationParams

func NewRegistrationParams(body io.ReadCloser) (RegistrationParams, error)

func (RegistrationParams) Validate

func (registration RegistrationParams) Validate() error

type Routes

type Routes struct {
	RequestCounter                   stack.Middleware
	RequestLogging                   stack.Middleware
	DatabaseAllocator                stack.Middleware
	NotificationsWriteAuthenticator  stack.Middleware
	NotificationsManageAuthenticator stack.Middleware

	ErrorWriter          errorWriter
	Registrar            registrar
	TemplateAssigner     assignsTemplates
	NotificationsFinder  listsAllClientsAndNotifications
	NotificationsUpdater notificationsUpdater
}

func (Routes) Register

func (r Routes) Register(m muxer)

type TemplateAssignment

type TemplateAssignment struct {
	Template string `json:"template"`
}

type UpdateHandler

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

func NewUpdateHandler

func NewUpdateHandler(updater notificationsUpdater, errWriter errorWriter) UpdateHandler

func (UpdateHandler) ServeHTTP

func (h UpdateHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, context stack.Context)

Jump to

Keyboard shortcuts

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