models

package
v0.3.10-0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NOTIFY_RECEIVED = "received"  // Received a task about sending a notification
	NOTIFY_SENT     = "sent"      // Nofity module has sent notification, but result unkown
	NOTIFY_OK       = "sent_ok"   // Notification was sent successfully
	NOTIFY_FAIL     = "sent_fail" // That sent a notification is failed
	NOTIFY_REMOVED  = "removed"
)
View Source
const (
	DefaultResourceCreateDelete    = "resource create or delete"
	DefaultResourceChangeConfig    = "resource change config"
	DefaultResourceUpdate          = "resource update"
	DefaultResourceReleaseDue1Day  = "resource release due 1 day"
	DefaultResourceReleaseDue3Day  = "resource release due 3 day"
	DefaultResourceReleaseDue30Day = "resource release due 30 day"
	DefaultScheduledTaskExecute    = "scheduled task execute"
	DefaultScalingPolicyExecute    = "scaling policy execute"
	DefaultSnapshotPolicyExecute   = "snapshot policy execute"
	DefaultResourceOperationFailed = "resource operation failed"
	DefaultResourceSync            = "resource sync"
	DefaultSystemExceptionEvent    = "system exception event"
	DefaultChecksumTestFailed      = "checksum test failed"
	DefaultUserLock                = "user lock"
	DefaultActionLogExceedCount    = "action log exceed count"
)
View Source
const (
	CONTACTTYPE_ALL = "all"
)
View Source
const (
	ReceiverIdDefault = "default"
)
View Source
const (
	SendByContact = "send_by_contact"
)

Variables

View Source
var (
	ErrContactNotFound = errors.New("Contact Not Found")
	ErrVeritying       = errors.New("During the verification process, please do not try again")

	ErrDial         = errors.New("Dial Failed")
	ErrGetConfig    = errors.New("Get Config Failed")
	ErrUpdateConfig = errors.New("Update Config Failed")
)
View Source
var (
	PersonalConfigContactTypes = []string{
		api.EMAIL,
		api.MOBILE,
		api.DINGTALK,
		api.FEISHU,
		api.WORKWX,
	}
	RobotContactTypes = []string{
		api.FEISHU_ROBOT,
		api.DINGTALK_ROBOT,
		api.WORKWX_ROBOT,
	}
	SystemConfigContactTypes = append(
		RobotContactTypes,
		api.WEBCONSOLE,
		api.WEBHOOK,
	)
)
View Source
var ErrVerifyFrequently = errors.Wrap(httperrors.ErrTooManyRequests, "Send validation messages too frequently")
View Source
var LaxMobileRegexp = regexp.MustCompile(`[0-9]{6,14}`)
View Source
var NotifyService notifyv2.INotifyService

Functions

func InitDB

func InitDB() error

func InitEmailQueue

func InitEmailQueue()

func InitEventLog

func InitEventLog()

Types

type IReceiver

type IReceiver interface {
	IsEnabled() bool
	GetDomainId() string
	IsEnabledContactType(string) (bool, error)
	IsVerifiedContactType(string) (bool, error)
	GetContact(string) (string, error)
	GetTemplateLang(context.Context) (string, error)
}

type SCompanyInfo

type SCompanyInfo struct {
	LoginLogoFormat string `json:"login_logo_format"`
	Copyright       string `json:"copyright"`
	Name            string `json:"name"`
}

type SConfig

type SConfig struct {
	db.SStandaloneResourceBase
	db.SDomainizedResourceBase

	Type        string               `width:"15" nullable:"false" create:"required" get:"domain" list:"domain" index:"true"`
	Content     jsonutils.JSONObject `nullable:"false" create:"required" update:"domain" get:"domain" list:"domain"`
	Attribution string               `width:"8" nullable:"false" default:"system" get:"domain" list:"domain" create:"optional"`
}

func (*SConfig) Config

func (self *SConfig) Config() notifyv2.SConfig

func (*SConfig) CustomizeCreate

func (c *SConfig) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SConfig) CustomizeDelete

func (c *SConfig) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SConfig) Delete

func (c *SConfig) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SConfig) PostCreate

func (*SConfig) PostUpdate

func (c *SConfig) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SConfig) PreDelete

func (c *SConfig) PreDelete(ctx context.Context, userCred mcclient.TokenCredential)

func (*SConfig) RealDelete

func (c *SConfig) RealDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SConfig) StartRepullSubcontactTask

func (c *SConfig) StartRepullSubcontactTask(ctx context.Context, userCred mcclient.TokenCredential, del bool) error

func (*SConfig) ValidateUpdateData

func (c *SConfig) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ConfigUpdateInput) (api.ConfigUpdateInput, error)

type SConfigManager

var ConfigManager *SConfigManager

func (*SConfigManager) BatchCheckConfig

func (self *SConfigManager) BatchCheckConfig(contactType string, domainIds []string) ([]bool, error)

func (*SConfigManager) Config

func (self *SConfigManager) Config(contactType, domainId string, attribution string) (*SConfig, error)

func (*SConfigManager) Configs

func (self *SConfigManager) Configs(contactType string) ([]SConfig, error)

Fetch all SConfig struct which type is contactType.

func (*SConfigManager) FetchCustomizeColumns

func (cm *SConfigManager) FetchCustomizeColumns(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
	objs []interface{},
	fields stringutils2.SSortedStrings,
	isList bool,
) []api.ConfigDetails

func (*SConfigManager) FilterByOwner

func (*SConfigManager) GetConfigs

func (self *SConfigManager) GetConfigs(contactType string) ([]notifyv2.SConfig, error)

func (*SConfigManager) HasSystemConfig

func (self *SConfigManager) HasSystemConfig(contactType string) (bool, error)

func (*SConfigManager) InitializeData

func (self *SConfigManager) InitializeData() error

func (*SConfigManager) ListItemExportKeys

func (manager *SConfigManager) ListItemExportKeys(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, keys stringutils2.SSortedStrings) (*sqlchemy.SQuery, error)

func (*SConfigManager) ListItemFilter

func (self *SConfigManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, input api.ConfigListInput) (*sqlchemy.SQuery, error)

func (*SConfigManager) OrderByExtraFields

func (cm *SConfigManager) OrderByExtraFields(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query api.ConfigListInput) (*sqlchemy.SQuery, error)

func (*SConfigManager) PerformValidate

func (*SConfigManager) QueryDistinctExtraField

func (cm *SConfigManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SConfigManager) ResourceScope

func (cm *SConfigManager) ResourceScope() rbacutils.TRbacScope

func (*SConfigManager) SetConfig

func (self *SConfigManager) SetConfig(contactType string, config notifyv2.SConfig) error

func (*SConfigManager) ValidateCreateData

type SContact

type SContact struct {
	SReceiverBase
	// contains filtered or unexported fields
}

func (*SContact) GetContact

func (s *SContact) GetContact(_ string) (string, error)

type SEmailQueue

type SEmailQueue struct {
	db.SLogBase

	RecvAt time.Time `nullable:"false" created_at:"true" index:"true" get:"user" list:"user" json:"recv_at"`

	Dest    string `width:"256" charset:"ascii" nullable:"false" list:"user" create:"admin_required"`
	Subject string `width:"256" charset:"utf8" nullable:"false" list:"user" create:"admin_required"`

	SessionId string `width:"256" charset:"utf8" nullable:"false" list:"user" create:"admin_optional"`

	Content jsonutils.JSONObject `length:"long" charset:"utf8" nullable:"false" list:"user" create:"admin_required"`

	ProjectId string `width:"128" charset:"ascii" list:"user" create:"admin_optional" index:"true"`
	Project   string `width:"128" charset:"utf8" list:"user" create:"admin_optional"`

	ProjectDomainId string `name:"project_domain_id" default:"default" width:"128" charset:"ascii" list:"user" create:"admin_optional"`
	ProjectDomain   string `name:"project_domain" default:"Default" width:"128" charset:"utf8" list:"user" create:"admin_optional"`

	UserId   string `width:"128" charset:"ascii" list:"user" create:"admin_required"`
	User     string `width:"128" charset:"utf8" list:"user" create:"admin_required"`
	DomainId string `width:"128" charset:"ascii" list:"user" create:"admin_optional"`
	Domain   string `width:"128" charset:"utf8" list:"user" create:"admin_optional"`
	Roles    string `width:"64" charset:"utf8" list:"user" create:"admin_optional"`
}

func (*SEmailQueue) Dump

func (eq *SEmailQueue) Dump() string

func (*SEmailQueue) GetRecordTime

func (e *SEmailQueue) GetRecordTime() time.Time

func (*SEmailQueue) PerformSend

func (*SEmailQueue) PostCreate

func (eq *SEmailQueue) PostCreate(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	ownerId mcclient.IIdentityProvider,
	query jsonutils.JSONObject,
	data jsonutils.JSONObject,
)

func (*SEmailQueue) Run

func (eq *SEmailQueue) Run()

type SEmailQueueManager

type SEmailQueueManager struct {
	db.SLogBaseManager
}
var EmailQueueManager *SEmailQueueManager

func (*SEmailQueueManager) FetchCustomizeColumns

func (manager *SEmailQueueManager) FetchCustomizeColumns(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
	objs []interface{},
	fields stringutils2.SSortedStrings,
	isList bool,
) []api.EmailQueueDetails

func (*SEmailQueueManager) ListItemFilter

func (manager *SEmailQueueManager) ListItemFilter(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	query api.EmailQueueListInput,
) (*sqlchemy.SQuery, error)

宿主机/物理机列表

func (*SEmailQueueManager) ValidateCreateData

type SEmailQueueStatus

type SEmailQueueStatus struct {
	db.SModelBase

	Id int64 `primary:"true" list:"user"`

	SentAt time.Time `list:"user"`

	Status string `width:"16" charset:"ascii" default:"queued" list:"user"`

	Results string `list:"user" charset:"utf8"`
}

type SEmailQueueStatusManager

type SEmailQueueStatusManager struct {
	db.SModelBaseManager
}
var EmailQueueStatusManager *SEmailQueueStatusManager

type SEvent

type SEvent struct {
	db.SLogBase

	// 资源创建时间
	CreatedAt time.Time `nullable:"false" created_at:"true" index:"true" get:"user" list:"user" json:"created_at"`

	Message     string
	Event       string `width:"64" nullable:"true"`
	AdvanceDays int
	TopicId     string `width:"128" nullable:"true" index:"true"`
}

func (*SEvent) GetRecordTime

func (e *SEvent) GetRecordTime() time.Time

type SEventDisplay

type SEventDisplay struct {
	ResourceTypeDisplay string
	ActionDisplay       string
	AdvanceDays         int
	// contains filtered or unexported fields
}

type SEventManager

type SEventManager struct {
	db.SLogBaseManager
}
var EventManager *SEventManager

func (*SEventManager) CreateEvent

func (e *SEventManager) CreateEvent(ctx context.Context, event, topicId, message string, advanceDays int) (*SEvent, error)

func (*SEventManager) GetEvent

func (e *SEventManager) GetEvent(id string) (*SEvent, error)

type SLocalTemplateManager

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

templateDir = "/opt/yunion/share/local-templates"

var LocalTemplateManager *SLocalTemplateManager

func (*SLocalTemplateManager) FillWithTemplate

func (lt *SLocalTemplateManager) FillWithTemplate(ctx context.Context, lang string, no notifyv2.SNotification) (params rpcapi.SendParams, err error)

type SNotification

type SNotification struct {
	db.SStatusStandaloneResourceBase

	ContactType string `width:"16" nullable:"false" create:"required" list:"user" get:"user" index:"true"`
	// swagger:ignore
	Topic    string `width:"128" nullable:"true" create:"required" search:"user"`
	Priority string `width:"16" nullable:"true" create:"optional" list:"user" get:"user"`
	// swagger:ignore
	Message    string    `create:"required"`
	ReceivedAt time.Time `nullable:"true" list:"user" get:"user"`
	EventId    string    `width:"128" nullable:"true"`
	SendTimes  int
	Tag        string `width:"16" nullable:"true" index:"true" create:"optional"`
}

func (*SNotification) AddOne

func (n *SNotification) AddOne() error

func (*SNotification) CustomizeCreate

func (*SNotification) Notification

func (n *SNotification) Notification() (notifyv2.SNotification, error)

func (*SNotification) PostCreate

func (*SNotification) ReceiveDetails

func (n *SNotification) ReceiveDetails(userCred mcclient.TokenCredential, scope string) ([]api.ReceiveDetail, error)

func (*SNotification) ReceiverNotificationsNotOK

func (n *SNotification) ReceiverNotificationsNotOK() ([]SReceiverNotification, error)

func (*SNotification) TemplateStore

func (n *SNotification) TemplateStore() notifyv2.ITemplateStore

type SNotificationManager

type SNotificationManager struct {
	db.SStatusStandaloneResourceBaseManager
}
var NotificationManager *SNotificationManager

func (*SNotificationManager) FetchCustomizeColumns

func (nm *SNotificationManager) FetchCustomizeColumns(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
	objs []interface{},
	fields stringutils2.SSortedStrings,
	isList bool,
) []api.NotificationDetails

func (*SNotificationManager) FetchOwnerId

func (*SNotificationManager) FilterByOwner

func (*SNotificationManager) InitializeData

func (self *SNotificationManager) InitializeData() error

func (*SNotificationManager) ListItemFilter

通知消息列表

func (*SNotificationManager) NamespaceScope

func (nm *SNotificationManager) NamespaceScope() rbacutils.TRbacScope

func (*SNotificationManager) PerformEventNotify

TODO: support project and domain

func (*SNotificationManager) ReSend

func (nm *SNotificationManager) ReSend(ctx context.Context, userCred mcclient.TokenCredential, isStart bool)

func (*SNotificationManager) ResourceScope

func (nm *SNotificationManager) ResourceScope() rbacutils.TRbacScope

type SReceiver

type SReceiver struct {
	db.SStatusStandaloneResourceBase
	db.SDomainizedResourceBase
	db.SEnabledResourceBase

	Email string `width:"128" nullable:"false" create:"optional" update:"user" get:"user" list:"user"`
	// swagger:ignore
	Mobile string `width:"32" nullable:"false" create:"optional"`
	Lang   string `width:"8" charset:"ascii" nullable:"false" list:"user" update:"user"`

	// swagger:ignore
	EnabledEmail tristate.TriState `default:"false" update:"user"`
	// swagger:ignore
	VerifiedEmail tristate.TriState `default:"false" update:"user"`

	// swagger:ignore
	EnabledMobile tristate.TriState `default:"false" update:"user"`
	// swagger:ignore
	VerifiedMobile tristate.TriState `default:"false" update:"user"`
	// contains filtered or unexported fields
}

func (*SReceiver) CustomizeCreate

func (r *SReceiver) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SReceiver) Delete

func (r *SReceiver) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SReceiver) GetContact

func (r *SReceiver) GetContact(cType string) (string, error)

func (*SReceiver) GetDomainId

func (r *SReceiver) GetDomainId() string

func (*SReceiver) GetEnabledContactTypes

func (r *SReceiver) GetEnabledContactTypes() ([]string, error)

func (*SReceiver) GetTemplateLang

func (r *SReceiver) GetTemplateLang(ctx context.Context) (string, error)

func (*SReceiver) GetVerifiedContactTypes

func (r *SReceiver) GetVerifiedContactTypes() ([]string, error)

func (*SReceiver) IsEnabled

func (r *SReceiver) IsEnabled() bool

func (*SReceiver) IsEnabledContactType

func (r *SReceiver) IsEnabledContactType(ct string) (bool, error)

func (*SReceiver) IsOwner

func (r *SReceiver) IsOwner(userCred mcclient.TokenCredential) bool

func (*SReceiver) IsVerifiedContactType

func (r *SReceiver) IsVerifiedContactType(ct string) (bool, error)

func (*SReceiver) MarkContactTypeUnVerified

func (r *SReceiver) MarkContactTypeUnVerified(contactType string, note string) error

func (*SReceiver) MarkContactTypeVerified

func (r *SReceiver) MarkContactTypeVerified(contactType string) error

func (*SReceiver) PerformDisable

func (*SReceiver) PerformEnable

func (*SReceiver) PerformEnableContactType

func (*SReceiver) PerformTriggerVerify

func (*SReceiver) PerformVerify

func (*SReceiver) PostCreate

func (*SReceiver) PostUpdate

func (r *SReceiver) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SReceiver) PreUpdate

func (r *SReceiver) PreUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SReceiver) PullCache

func (r *SReceiver) PullCache(force bool) error

func (*SReceiver) PushCache

func (r *SReceiver) PushCache(ctx context.Context) error

func (*SReceiver) SetContact

func (r *SReceiver) SetContact(cType string, contact string) error

func (*SReceiver) SetEnabledContactTypes

func (r *SReceiver) SetEnabledContactTypes(contactTypes []string) error

func (*SReceiver) SetVerifiedContactTypes

func (r *SReceiver) SetVerifiedContactTypes(contactTypes []string) error

func (*SReceiver) StartSubcontactPullTask

func (r *SReceiver) StartSubcontactPullTask(ctx context.Context, userCred mcclient.TokenCredential, params *jsonutils.JSONDict, parentTaskId string) error

func (*SReceiver) Sync

func (r *SReceiver) Sync(ctx context.Context) error

func (*SReceiver) ValidateUpdateData

type SReceiverBase

type SReceiverBase struct {
}

func (SReceiverBase) GetDomainId

func (s SReceiverBase) GetDomainId() string

func (SReceiverBase) GetTemplateLang

func (s SReceiverBase) GetTemplateLang(ctx context.Context) (string, error)

func (SReceiverBase) IsEnabled

func (s SReceiverBase) IsEnabled() bool

func (SReceiverBase) IsEnabledContactType

func (s SReceiverBase) IsEnabledContactType(_ string) (bool, error)

func (SReceiverBase) IsVerifiedContactType

func (s SReceiverBase) IsVerifiedContactType(_ string) (bool, error)

type SReceiverManager

var ReceiverManager *SReceiverManager

func (*SReceiverManager) CreateByInsertOrUpdate

func (rm *SReceiverManager) CreateByInsertOrUpdate() bool

func (*SReceiverManager) EnabledContactFilter

func (rm *SReceiverManager) EnabledContactFilter(contactType string, q *sqlchemy.SQuery) *sqlchemy.SQuery

func (*SReceiverManager) FetchByIDs

func (rm *SReceiverManager) FetchByIDs(ctx context.Context, ids ...string) ([]SReceiver, error)

func (*SReceiverManager) FetchByIdOrNames

func (rm *SReceiverManager) FetchByIdOrNames(ctx context.Context, idOrNames ...string) ([]SReceiver, error)

func (*SReceiverManager) FetchCustomizeColumns

func (rm *SReceiverManager) FetchCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, objs []interface{}, fields stringutils2.SSortedStrings, isList bool) []api.ReceiverDetails

func (*SReceiverManager) FetchOwnerId

func (*SReceiverManager) FilterByOwner

func (*SReceiverManager) InitializeData

func (rm *SReceiverManager) InitializeData() error

func (*SReceiverManager) ListItemFilter

func (*SReceiverManager) OnAdd

func (rm *SReceiverManager) OnAdd(obj *jsonutils.JSONDict)

Implemente interface EventHandler

func (*SReceiverManager) OnDelete

func (rm *SReceiverManager) OnDelete(obj *jsonutils.JSONDict)

func (*SReceiverManager) OnUpdate

func (rm *SReceiverManager) OnUpdate(oldObj, newObj *jsonutils.JSONDict)

func (*SReceiverManager) OrderByExtraFields

func (rm *SReceiverManager) OrderByExtraFields(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query api.ReceiverListInput) (*sqlchemy.SQuery, error)

func (*SReceiverManager) PerformIntellijGet

func (*SReceiverManager) QueryDistinctExtraField

func (rm *SReceiverManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SReceiverManager) ResourceScope

func (rm *SReceiverManager) ResourceScope() rbacutils.TRbacScope

func (*SReceiverManager) StartWatchUserInKeystone

func (rm *SReceiverManager) StartWatchUserInKeystone() error

func (*SReceiverManager) ValidateCreateData

func (*SReceiverManager) VerifiedContactFilter

func (rm *SReceiverManager) VerifiedContactFilter(contactType string, q *sqlchemy.SQuery) *sqlchemy.SQuery

type SReceiverNotification

type SReceiverNotification struct {
	db.SJointResourceBase

	ReceiverID     string `width:"128" charset:"ascii" nullable:"false" index:"true"`
	NotificationID string `width:"128" charset:"ascii" nullable:"false" index:"true"`
	// ignore if ReceiverID is not empty or default
	Contact      string `width:"128" index:"true"`
	ReceiverType string `width:"16"`
	SendAt       time.Time
	SendBy       string `width:"128"`
	Status       string `width:"36" charset:"ascii"`
	FailedReason string `width:"1024"`
}

+onecloud:swagger-gen-ignore

func (*SReceiverNotification) AfterSend

func (rn *SReceiverNotification) AfterSend(ctx context.Context, success bool, reason string) error

func (*SReceiverNotification) BeforeSend

func (rn *SReceiverNotification) BeforeSend(ctx context.Context, sendTime time.Time) error

func (*SReceiverNotification) Receiver

func (rn *SReceiverNotification) Receiver() (IReceiver, error)

type SReceiverNotificationManager

type SReceiverNotificationManager struct {
	db.SJointResourceBaseManager
}
var ReceiverNotificationManager *SReceiverNotificationManager

func (*SReceiverNotificationManager) Create

func (rnm *SReceiverNotificationManager) Create(ctx context.Context, userCred mcclient.TokenCredential, receiverID, notificationID string) (*SReceiverNotification, error)

func (*SReceiverNotificationManager) CreateContact

func (rnm *SReceiverNotificationManager) CreateContact(ctx context.Context, userCred mcclient.TokenCredential, contact, notificationID string) (*SReceiverNotification, error)

func (*SReceiverNotificationManager) CreateRobot

func (rnm *SReceiverNotificationManager) CreateRobot(ctx context.Context, userCred mcclient.TokenCredential, RobotID, notificationID string) (*SReceiverNotification, error)

func (*SReceiverNotificationManager) GetMasterFieldName

func (rnm *SReceiverNotificationManager) GetMasterFieldName() string

func (*SReceiverNotificationManager) GetSlaveFieldName

func (rnm *SReceiverNotificationManager) GetSlaveFieldName() string

func (*SReceiverNotificationManager) InitializeData

func (self *SReceiverNotificationManager) InitializeData() error

func (*SReceiverNotificationManager) SetHandlerProcessTimeout

func (rnm *SReceiverNotificationManager) SetHandlerProcessTimeout(info *appsrv.SHandlerInfo, r *http.Request) time.Duration

type SRobot

type SRobot struct {
	db.SSharableVirtualResourceBase
	db.SEnabledResourceBase

	Type    string `width:"16" nullable:"false" create:"required" get:"user" list:"user" index:"true"`
	Address string `nullable:"false" create:"required" update:"user" get:"user" list:"user"`
	Lang    string `width:"16" nullable:"false" create:"required" update:"user" get:"user" list:"user"`
}

func (*SRobot) CustomizeCreate

func (r *SRobot) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SRobot) GetContact

func (r *SRobot) GetContact(ctype string) (string, error)

func (*SRobot) GetDomainId

func (r *SRobot) GetDomainId() string

func (*SRobot) GetTemplateLang

func (r *SRobot) GetTemplateLang(ctx context.Context) (string, error)

func (*SRobot) IsEnabled

func (r *SRobot) IsEnabled() bool

func (*SRobot) IsEnabledContactType

func (r *SRobot) IsEnabledContactType(ctype string) (bool, error)

func (*SRobot) IsVerifiedContactType

func (r *SRobot) IsVerifiedContactType(ctype string) (bool, error)

func (*SRobot) PerformDisable

func (*SRobot) PerformEnable

func (*SRobot) PostDelete

func (r *SRobot) PostDelete(ctx context.Context, userCred mcclient.TokenCredential)

func (*SRobot) Receiver

func (r *SRobot) Receiver() *rpcapi.SReceiver

func (*SRobot) ValidateUpdateData

func (r *SRobot) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.RobotUpdateInput) (api.RobotUpdateInput, error)

type SRobotManager

var RobotManager *SRobotManager

func (*SRobotManager) FetchByIdOrNames

func (rm *SRobotManager) FetchByIdOrNames(ctx context.Context, idOrNames ...string) ([]SRobot, error)

func (*SRobotManager) FetchCustomizeColumns

func (rm *SRobotManager) FetchCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, objs []interface{}, fields stringutils2.SSortedStrings, isList bool) []api.RobotDetails

func (*SRobotManager) InitializeData

func (rm *SRobotManager) InitializeData() error

func (*SRobotManager) ListItemFilter

func (rm *SRobotManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, input api.RobotListInput) (*sqlchemy.SQuery, error)

func (*SRobotManager) ValidateCreateData

type SSubContact

type SSubContact struct {
	db.SStandaloneResourceBase

	// id of receiver user
	ReceiverID        string            `width:"128" nullable:"false" index:"true"`
	Type              string            `width:"16" nullable:"false" index:"true"`
	Contact           string            `width:"128" nullable:"false"`
	ParentContactType string            `width:"16" nullable:"false"`
	Enabled           tristate.TriState `default:"false"`
	Verified          tristate.TriState `default:"false"`
	VerifiedNote      string            `width:"1024"`
}

+onecloud:swagger-gen-ignore

func (*SSubContact) Disable

func (sc *SSubContact) Disable() error

func (*SSubContact) Disverify

func (sc *SSubContact) Disverify() error

func (*SSubContact) Enable

func (sc *SSubContact) Enable() error

func (*SSubContact) Update

func (sc *SSubContact) Update(contact *string, enabled *bool, verified *bool) error

func (*SSubContact) Verify

func (sc *SSubContact) Verify() error

type SSubContactManager

type SSubContactManager struct {
	db.SStandaloneResourceBaseManager
}
var SubContactManager *SSubContactManager

type SSubscriber

type SSubscriber struct {
	db.SStandaloneAnonResourceBase
	db.SEnabledResourceBase

	TopicID                 string `width:"128" charset:"ascii" nullable:"false" index:"true" get:"user" list:"user" create:"required"`
	Type                    string `width:"16" charset:"ascii" nullable:"false" index:"true" get:"user" list:"user" create:"required"`
	Identification          string `width:"128" charset:"ascii" nullable:"false" index:"true"`
	RoleScope               string `width:"8" charset:"ascii" nullable:"false" get:"user" list:"user" create:"optional"`
	ResourceScope           string `width:"8" charset:"ascii" nullable:"false" get:"user" list:"user" create:"required"`
	ResourceAttributionId   string `width:"128" charset:"ascii" nullable:"false" get:"user" list:"user" create:"optional"`
	ResourceAttributionName string `width:"128" charset:"utf8" list:"user" create:"optional"`
	Scope                   string `width:"128" charset:"ascii" nullable:"false" create:"required"`
	DomainId                string `width:"128" charset:"ascii" nullable:"false" create:"optional"`
}

func (*SSubscriber) CustomizeCreate

func (*SSubscriber) CustomizeDelete

func (s *SSubscriber) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SSubscriber) PerformChange

func (*SSubscriber) PerformDisable

func (*SSubscriber) PerformEnable

func (*SSubscriber) PerformSetReceiver

func (*SSubscriber) PostCreate

func (*SSubscriber) SetReceivers

func (sr *SSubscriber) SetReceivers(ctx context.Context, receiverIds []string) error

type SSubscriberDis

type SSubscriberDis struct {
	SSubscriber
	ReceiverName string `json:"receiver_name"`
	RoleName     string `json:"role_name"`
}

type SSubscriberManager

var SubscriberManager *SSubscriberManager

func (*SSubscriberManager) FetchCustomizeColumns

func (sm *SSubscriberManager) FetchCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, objs []interface{}, fields stringutils2.SSortedStrings, isList bool) []api.SubscriberDetails

func (*SSubscriberManager) ListItemFilter

func (*SSubscriberManager) QueryDistinctExtraField

func (sm *SSubscriberManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SSubscriberManager) ValidateCreateData

type SSubscriberReceiver

type SSubscriberReceiver struct {
	db.SJointResourceBase
	SubscriberId string `width:"36" charset:"ascii" nullable:"false" index:"true"`
	ReceiverId   string `width:"128" charset:"ascii" nullable:"false" index:"true"`
}

type SSubscriberReceiverManager

type SSubscriberReceiverManager struct {
	db.SJointResourceBaseManager
}
var SubscriberReceiverManager *SSubscriberReceiverManager

func (*SSubscriberReceiverManager) GetMasterFieldName

func (srm *SSubscriberReceiverManager) GetMasterFieldName() string

func (*SSubscriberReceiverManager) GetSlaveFieldName

func (srm *SSubscriberReceiverManager) GetSlaveFieldName() string

type STemplate

type STemplate struct {
	db.SStandaloneAnonResourceBase

	ContactType string `width:"16" nullable:"false" create:"required" update:"user" list:"user"`
	Topic       string `width:"20" nullable:"false" create:"required" update:"user" list:"user"`

	// title | content | remote
	TemplateType string `width:"10" nullable:"false" create:"required" update:"user" list:"user"`
	Content      string `length:"text" nullable:"false" create:"required" get:"user" list:"user" update:"user"`
	Lang         string `width:"8" charset:"ascii" nullable:"false" list:"user" update:"user" create:"optional"`
	Example      string `nullable:"true" create:"optional" get:"user" list:"user" update:"user"`
}

func (*STemplate) Execute

func (tm *STemplate) Execute(str string) (string, error)

func (*STemplate) ValidateUpdateData

type STemplateManager

type STemplateManager struct {
	db.SStandaloneAnonResourceBaseManager
}
var TemplateManager *STemplateManager

func (*STemplateManager) FillWithTemplate

func (tm *STemplateManager) FillWithTemplate(ctx context.Context, lang string, no notifyv2.SNotification) (params apis.SendParams, err error)

FillWithTemplate will return the title and content generated by corresponding template. Local cache about common template will be considered in case of performance issues.

func (*STemplateManager) GetCompanyInfo

func (tm *STemplateManager) GetCompanyInfo(ctx context.Context) (SCompanyInfo, error)

func (*STemplateManager) GetEmailUrl

func (tm *STemplateManager) GetEmailUrl() string

func (*STemplateManager) InitializeData

func (tm *STemplateManager) InitializeData() error

func (*STemplateManager) ListItemFilter

func (*STemplateManager) PerformSave

func (*STemplateManager) ValidateCreateData

type STopic

type STopic struct {
	db.SStandaloneResourceBase
	db.SEnabledResourceBase

	Type              string `width:"20" nullable:"false" create:"required" update:"user" list:"user"`
	Resources         uint64 `nullable:"false"`
	Actions           uint32 `nullable:"false"`
	Results           uint8  `nullable:"false"`
	AdvanceDays       int    `nullable:"false"`
	WebconsoleDisable tristate.TriState
}

func (*STopic) PerformDisable

func (*STopic) PreCheckPerformAction

func (t *STopic) PreCheckPerformAction(
	ctx context.Context, userCred mcclient.TokenCredential,
	action string, query jsonutils.JSONObject, data jsonutils.JSONObject,
) error

func (*STopic) ValidateDeleteCondition

func (ss *STopic) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error

func (*STopic) ValidateUpdateData

func (ss *STopic) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input jsonutils.JSONObject) (jsonutils.JSONObject, error)

type STopicManager

var TopicManager *STopicManager

func (*STopicManager) FetchCustomizeColumns

func (sm *STopicManager) FetchCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, objs []interface{}, fields stringutils2.SSortedStrings, isList bool) []notify.TopicDetails

func (*STopicManager) InitializeData

func (sm *STopicManager) InitializeData() error

func (*STopicManager) ListItemFilter

func (sm *STopicManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, input notify.TopicListInput) (*sqlchemy.SQuery, error)

func (*STopicManager) TopicByEvent

func (sm *STopicManager) TopicByEvent(eventStr string, advanceDays int) (*STopic, error)

func (*STopicManager) TopicsByEvent

func (sm *STopicManager) TopicsByEvent(eventStr string, advanceDays int) ([]STopic, error)

func (*STopicManager) ValidateCreateData

type SVerification

type SVerification struct {
	db.SStandaloneResourceBase

	ReceiverId  string `width:"128" nullable:"false"`
	ContactType string `width:"16" nullable:"false"`
	Token       string `width:"200" nullable:"false"`
}

+onecloud:swagger-gen-ignore

type SVerificationManager

type SVerificationManager struct {
	db.SStandaloneResourceBaseManager
}
var VerificationManager *SVerificationManager

func (*SVerificationManager) Create

func (vm *SVerificationManager) Create(ctx context.Context, receiverId, contactType string) (*SVerification, error)

func (*SVerificationManager) Get

func (vm *SVerificationManager) Get(receiverId, contactType string) (*SVerification, error)

Jump to

Keyboard shortcuts

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