notifyclient

package
v0.3.11-8 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 28 Imported by: 28

Documentation

Index

Constants

View Source
const (
	SYSTEM_ERROR   = "SYSTEM_ERROR"
	SYSTEM_WARNING = "SYSTEM_WARNING"

	SERVER_CREATED       = "SERVER_CREATED"
	SERVER_CREATED_ADMIN = "SERVER_CREATED_ADMIN"
	SERVER_DELETED       = "SERVER_DELETED"
	SERVER_DELETED_ADMIN = "SERVER_DELETED_ADMIN"
	SERVER_REBUILD_ROOT  = "SERVER_REBUILD_ROOT"
	SERVER_CHANGE_FLAVOR = "SERVER_CHANGE_FLAVOR"
	SERVER_PANICKED      = "SERVER_PANICKED"

	IMAGE_ACTIVED = "IMAGE_ACTIVED"

	USER_LOGIN_EXCEPTION = "USER_LOGIN_EXCEPTION"
)

Variables

View Source
var (
	Event SEvent

	ActionCreate         = api.ActionCreate
	ActionDelete         = api.ActionDelete
	ActionUpdate         = api.ActionUpdate
	ActionRebuildRoot    = api.ActionRebuildRoot
	ActionResetPassword  = api.ActionResetPassword
	ActionChangeConfig   = api.ActionChangeConfig
	ActionResize         = api.ActionResize
	ActionExpiredRelease = api.ActionExpiredRelease
	ActionExecute        = api.ActionExecute

	ActionMigrate            = api.ActionMigrate
	ActionCreateBackupServer = api.ActionCreateBackupServer
	ActionDelBackupServer    = api.ActionDelBackupServer
	ActionSyncStatus         = api.ActionSyncStatus
	ActionNetOutOfSync       = api.ActionNetOutOfSync
	ActionMysqlOutOfSync     = api.ActionMysqlOutOfSync
	ActionServiceAbnormal    = api.ActionServiceAbnormal
	ActionServerPanicked     = api.ActionServerPanicked

	ActionPendingDelete = api.ActionPendingDelete

	ActionSyncCreate           = api.ActionSyncCreate
	ActionSyncUpdate           = api.ActionSyncUpdate
	ActionSyncDelete           = api.ActionSyncDelete
	ActionSyncAccountStatus    = api.ActionSyncAccountStatus
	ActionIsolatedDeviceCreate = api.ActionIsolatedDeviceCreate
	ActionIsolatedDeviceUpdate = api.ActionIsolatedDeviceUpdate
	ActionIsolatedDeviceDelete = api.ActionIsolatedDeviceDelete
)
View Source
var (
	AdminSessionGenerator SAdminSessionGenerator = getAdminSesion
	UserLangFetcher       SUserLangFetcher       = getUserLang
)

Functions

func AddNotifyDBHookResources

func AddNotifyDBHookResources(keywordPlurals ...string)

func EventNotify

func EventNotify(ctx context.Context, userCred mcclient.TokenCredential, ep SEventNotifyParam)

func EventNotifyServiceAbnormal

func EventNotifyServiceAbnormal(ctx context.Context, userCred mcclient.TokenCredential, service, method, path string, body jsonutils.JSONObject, err error)

func FetchNotifyAdminRecipients

func FetchNotifyAdminRecipients(ctx context.Context, region string, users []string, groups []string)

func IntelliNotify

func IntelliNotify(ctx context.Context, recipientId []string, isGroup bool, channel npk.TNotifyChannel, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject, createReceiver bool)

IntelliNotify try to create receiver nonexistent if createReceiver is set to true

func Notify

func Notify(recipientId []string, isGroup bool, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject)

func NotifyAllWithoutRobot

func NotifyAllWithoutRobot(recipientId []string, isGroup bool, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject) error

NotifyAllWithoutRobot will send messages via all contacnt type from exclude robot contact type such as dingtalk-robot.

func NotifyAllWithoutRobotWithCtx

func NotifyAllWithoutRobotWithCtx(ctx context.Context, recipientId []string, isGroup bool, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject) error

NotifyAllWithoutRobot will send messages via all contacnt type from exclude robot contact type such as dingtalk-robot.

func NotifyCritical

func NotifyCritical(recipientId []string, isGroup bool, event string, data jsonutils.JSONObject)

func NotifyCriticalWithCtx

func NotifyCriticalWithCtx(ctx context.Context, recipientId []string, isGroup bool, event string, data jsonutils.JSONObject)

func NotifyError

func NotifyError(ctx context.Context, userCred mcclient.TokenCredential, idstr, name, event, reason string)

func NotifyGeneralSystemError

func NotifyGeneralSystemError(data jsonutils.JSONObject)

func NotifyGeneralSystemErrorWithCtx

func NotifyGeneralSystemErrorWithCtx(ctx context.Context, data jsonutils.JSONObject)

func NotifyImportant

func NotifyImportant(recipientId []string, isGroup bool, event string, data jsonutils.JSONObject)

func NotifyImportantWithCtx

func NotifyImportantWithCtx(ctx context.Context, recipientId []string, isGroup bool, event string, data jsonutils.JSONObject)

func NotifyNormal

func NotifyNormal(recipientId []string, isGroup bool, event string, data jsonutils.JSONObject)

func NotifyNormalWithCtx

func NotifyNormalWithCtx(ctx context.Context, recipientId []string, isGroup bool, event string, data jsonutils.JSONObject)

func NotifyRobot

func NotifyRobot(robotIds []string, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject) error

NotifyRobot will send messages via all robot contact type such as dingtalk-robot.

func NotifyRobotWithCtx

func NotifyRobotWithCtx(ctx context.Context, robotIds []string, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject) error

NotifyRobot will send messages via all robot contact type such as dingtalk-robot.

func NotifySystemError

func NotifySystemError(idstr string, name string, event string, reason string)

func NotifySystemErrorWithCtx

func NotifySystemErrorWithCtx(ctx context.Context, idstr string, name string, event string, reason string)

func NotifySystemWarning

func NotifySystemWarning(idstr string, name string, event string, reason string)

func NotifySystemWarningWithCtx

func NotifySystemWarningWithCtx(ctx context.Context, idstr string, name string, event string, reason string)

func NotifyVmIntegrity

func NotifyVmIntegrity(ctx context.Context, name string)

func NotifyWebhook

func NotifyWebhook(ctx context.Context, userCred mcclient.TokenCredential, obj db.IModel, action api.SAction)

func NotifyWithContact

func NotifyWithContact(ctx context.Context, contacts []string, channel npk.TNotifyChannel, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject)

func NotifyWithCtx

func NotifyWithCtx(ctx context.Context, recipientId []string, isGroup bool, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject)

func NotifyWithTag

func NotifyWithTag(ctx context.Context, params SNotifyParams)

func RawNotify

func RawNotify(recipientId []string, isGroup bool, channel npk.TNotifyChannel, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject)

func RawNotifyWithCtx

func RawNotifyWithCtx(ctx context.Context, recipientId []string, isGroup bool, channel npk.TNotifyChannel, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject)

func SystemEventNotify

func SystemEventNotify(ctx context.Context, action api.SAction, resType string, obj *jsonutils.JSONDict)

func SystemExceptionNotify

func SystemExceptionNotify(ctx context.Context, action api.SAction, resType string, obj *jsonutils.JSONDict)

func SystemExceptionNotifyWithResult

func SystemExceptionNotifyWithResult(ctx context.Context, action api.SAction, resType string, result api.SResult, obj *jsonutils.JSONDict)

func SystemNotify

func SystemNotify(priority npk.TNotifyPriority, event string, data jsonutils.JSONObject)

func SystemNotifyWithCtx

func SystemNotifyWithCtx(ctx context.Context, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject)

Types

type SAdminSessionGenerator

type SAdminSessionGenerator func(ctx context.Context, region string) (*mcclient.ClientSession, error)

type SEvent

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

func (SEvent) Action

func (se SEvent) Action() string

func (SEvent) ResourceType

func (se SEvent) ResourceType() string

func (SEvent) String

func (se SEvent) String() string

func (SEvent) WithAction

func (se SEvent) WithAction(a api.SAction) SEvent

func (SEvent) WithResourceType

func (se SEvent) WithResourceType(manager db.IModelManager) SEvent

type SEventMessage

type SEventMessage struct {
	ResourceType    string              `json:"resource_type"`
	Action          string              `json:"action"`
	ResourceDetails *jsonutils.JSONDict `json:"resource_details"`
}

type SEventNotifyParam

type SEventNotifyParam struct {
	Obj                 db.IModel
	ResourceType        string
	Action              api.SAction
	IsFail              bool
	ObjDetailsDecorator func(context.Context, *jsonutils.JSONDict)
	AdvanceDays         int
}

type SNotifyParams

type SNotifyParams struct {
	RecipientId               []string
	IsGroup                   bool
	Priority                  npk.TNotifyPriority
	Event                     string
	Data                      jsonutils.JSONObject
	Tag                       string
	Metadata                  map[string]interface{}
	IgnoreNonexistentReceiver bool
}

type SSystemEventMsg

type SSystemEventMsg struct {
	Id      string
	Name    string
	Event   string
	Reason  string
	Created time.Time
}

type SUserLangFetcher

type SUserLangFetcher func(uids []string) (map[string]string, error)

Jump to

Keyboard shortcuts

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