messagehandlers

package
v0.0.0-...-3e85251 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextMessageType int = 1 // just returning a text message.
	FileMessageType int = 2 // File
)

Variables

This section is empty.

Functions

func ProcessMessageResponse

func ProcessMessageResponse(msg MessageResponse, channel string, api *slack.Client, rtm *slack.RTM) error

Types

type AzureCostsConfig

type AzureCostsConfig struct {
	SubscriptionID   string `json:"SubscriptionID"`
	TenantID         string `json:"TenantID"`
	ClientID         string `json:"ClientID"`
	ClientSecret     string `json:"ClientSecret"`
	Subscriptions    []string
	AllowedUsersList []string
}

type AzureCostsMessageHandler

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

AzureCostMessageHandler gets the costs from Azure Billing API.

func NewAzureCostMessageHandler

func NewAzureCostMessageHandler() *AzureCostsMessageHandler

func (*AzureCostsMessageHandler) ParseMessage

func (ss *AzureCostsMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type AzureShutdownConfig

type AzureShutdownConfig struct {
	SubscriptionID   string `json:"SubscriptionID"`
	TenantID         string `json:"TenantID"`
	ClientID         string `json:"ClientID"`
	ClientSecret     string `json:"ClientSecret"`
	AllowedUsersList []string
}

type AzureShutdownMessageHandler

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

AzureCostMessageHandler gets the costs from Azure Billing API.

func NewAzureShutdownMessageHandler

func NewAzureShutdownMessageHandler() *AzureShutdownMessageHandler

func (*AzureShutdownMessageHandler) ParseMessage

func (as *AzureShutdownMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type AzureStatusMessageHandler

type AzureStatusMessageHandler struct {
	AIHelper *helper.AppInsightsHelper
	AMHelper *helper.AzureMonitorHelper
	// contains filtered or unexported fields
}

ServerStatusMessageHandler stores status about server (test, stage, prod etc) status

func NewAzureStatusMessageHandler

func NewAzureStatusMessageHandler() *AzureStatusMessageHandler

func (*AzureStatusMessageHandler) GetStat

func (ss *AzureStatusMessageHandler) GetStat(f func(string, int, chan string), env string, minutes int, ch chan string)

func (*AzureStatusMessageHandler) ParseMessage

func (ss *AzureStatusMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type AzureStorageMessageHandler

type AzureStorageMessageHandler struct {
	Configuration config.Config
	// contains filtered or unexported fields
}

AzureStorageMessageHandler checks for SG messages.

func NewAzureStorageMessageHandler

func NewAzureStorageMessageHandler(configFilePath string) *AzureStorageMessageHandler

func (*AzureStorageMessageHandler) ParseMessage

func (sg *AzureStorageMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type BaseMessageResponse

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

func (BaseMessageResponse) GetMessageResponseType

func (bm BaseMessageResponse) GetMessageResponseType() int

type DBConfig

type DBConfig struct {
	ExportSubscriptionID   string `json:"ExportSubscriptionID"`
	ImportSubscriptionID   string `json:"ImportSubscriptionID"`
	TenantID               string `json:"TenantID"`
	ClientID               string `json:"ClientID"`
	ClientSecret           string `json:"ClientSecret"`
	ExportResourceGroup    string `json:"ExportResourceGroup"`
	ImportResourceGroup    string `json:"ImportResourceGroup"`
	StorageKey             string `json:"StorageKey"`
	StorageURL             string `json:"StorageURL"`
	SqlExportAdminLogin    string `json:"SqlExportAdminLogin"`
	SqlExportAdminPassword string `json:"SqlExportAdminPassword"`
	SqlImportAdminLogin    string `json:"SqlImportAdminLogin"`
	SqlImportAdminPassword string `json:"SqlImportAdminPassword"`
	AllowedUsers           string `json:"AllowedUsers"`
	BackupPrefix           string `json:"BackupPrefix"`
	ExportServerName       string `json:"ExportServerName"`
	ImportServerName       string `json:"ImportServerName"`
	DatabaseName           string `json:"DatabaseName"`
	ImportStorageKey       string `json:"DatabaseName"`

	AllowedUsersList []string
}

type DatabaseBackupMessageHandler

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

func NewDatabaseBackupMessageHandler

func NewDatabaseBackupMessageHandler() *DatabaseBackupMessageHandler

func (*DatabaseBackupMessageHandler) ParseMessage

func (ss *DatabaseBackupMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type FileDetails

type FileDetails struct {
	Title    string
	FileName string
	Contents []byte
	FileType string // default to "txt" ??
}

type FileMessageResponse

type FileMessageResponse struct {
	BaseMessageResponse
	Details []FileDetails
}

func NewFileMessageResponse

func NewFileMessageResponse(details []FileDetails) FileMessageResponse

func NewSingleFileMessageResponse

func NewSingleFileMessageResponse(fileName string, title string, contents []byte) FileMessageResponse

type MessageHandler

type MessageHandler interface {

	// ParseMessage takes a message, determines what to do
	// return the text that should go to the user.
	ParseMessage(msg string, user string) (MessageResponse, error)
}

MessageHandler takes a message, parses it and determines what it should do. Returns the MessageResponse (which could be text, or a file?) that should be returned to the user.

type MessageResponse

type MessageResponse interface {
	GetMessageResponseType() int
}

type MiscMessageHandler

type MiscMessageHandler struct {
}

MiscMessageHandler misc rubbish

func NewMiscMessageHandler

func NewMiscMessageHandler() *MiscMessageHandler

func (*MiscMessageHandler) ParseMessage

func (sg *MiscMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type SendgridMessageHandler

type SendgridMessageHandler struct {
	Handler *helper.SendgridHandler
}

SendgridMessageHandler checks for SG messages.

func NewSendgridMessageHandler

func NewSendgridMessageHandler() *SendgridMessageHandler

func (*SendgridMessageHandler) ParseMessage

func (sg *SendgridMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type ServerStatusMessageHandler

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

ServerStatusMessageHandler stores status about server (test, stage, prod etc) status

func NewServerStatusMessageHandler

func NewServerStatusMessageHandler() *ServerStatusMessageHandler

func (*ServerStatusMessageHandler) ParseMessage

func (ss *ServerStatusMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type ServiceBusMessageHandler

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

ServiceBusMessageHandler snooping

func NewServiceBusMessageHandler

func NewServiceBusMessageHandler() *ServiceBusMessageHandler

func (*ServiceBusMessageHandler) ParseMessage

func (sb *ServiceBusMessageHandler) ParseMessage(msg string, user string) (MessageResponse, error)

ParseMessage takes a message, determines what to do return the text that should go to the user.

type TextMessageResponse

type TextMessageResponse struct {
	BaseMessageResponse
	Message string
}

func NewTextMessageResponse

func NewTextMessageResponse(msg string) TextMessageResponse

Jump to

Keyboard shortcuts

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