Documentation ¶
Index ¶
- Variables
- func Register(resource Resource, manager modulebase.ResourceManager)
- type Resource
- type ResourceOperation
- type ResourceOperationFail
- type SAction
- func (r SAction) Apply(id string) (success bool, failReason string)
- func (r SAction) List(opts *WrapperListOptions) (map[string]string, error)
- func (r SAction) ResourceOperation(oper ResourceOperation) SAction
- func (r SAction) Session(session *mcclient.ClientSession) SAction
- func (r SAction) Timeout(time time.Duration) SAction
- type SScheduledTask
- func (st *SScheduledTask) Action(ctx context.Context, userCred mcclient.TokenCredential) SAction
- func (st *SScheduledTask) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, ...) error
- func (st *SScheduledTask) Execute(ctx context.Context, userCred mcclient.TokenCredential) (err error)
- func (st *SScheduledTask) ExecuteNotify(ctx context.Context, userCred mcclient.TokenCredential, name string)
- func (st *SScheduledTask) IsExecuted() (bool, error)
- func (st *SScheduledTask) Labels() ([]string, error)
- func (st *SScheduledTask) NewActivity(ctx context.Context, reject bool) (*SScheduledTaskActivity, error)
- func (st *SScheduledTask) PerformDisable(ctx context.Context, userCred mcclient.TokenCredential, ...) (jsonutils.JSONObject, error)
- func (st *SScheduledTask) PerformEnable(ctx context.Context, userCred mcclient.TokenCredential, ...) (jsonutils.JSONObject, error)
- func (st *SScheduledTask) PerformSetLabels(ctx context.Context, userCred mcclient.TokenCredential, ...) (jsonutils.JSONObject, error)
- func (st *SScheduledTask) PerformTrigger(ctx context.Context, userCred mcclient.TokenCredential, ...) (jsonutils.JSONObject, error)
- func (st *SScheduledTask) PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ...)
- func (st *SScheduledTask) ResourceOperation() ResourceOperation
- func (st *SScheduledTask) STLabels() ([]SScheduledTaskLabel, error)
- func (st *SScheduledTask) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error
- type SScheduledTaskActivity
- func (sa *SScheduledTaskActivity) Fail(reason string) error
- func (sa *SScheduledTaskActivity) GetOwnerId() mcclient.IIdentityProvider
- func (sa *SScheduledTaskActivity) PartFail(reason string) error
- func (sa *SScheduledTaskActivity) SetResult(status, reason string) error
- func (sa *SScheduledTaskActivity) Succeed() error
- type SScheduledTaskActivityManager
- func (sam *SScheduledTaskActivityManager) FetchCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, ...) []api.ScheduledTaskActivityDetails
- func (sam *SScheduledTaskActivityManager) FetchOwnerId(ctx context.Context, data jsonutils.JSONObject) (mcclient.IIdentityProvider, error)
- func (sam *SScheduledTaskActivityManager) FileterByOwner(q *sqlchemy.SQuery, owner mcclient.IIdentityProvider, ...) *sqlchemy.SQuery
- func (sam *SScheduledTaskActivityManager) InitializeData() error
- func (sam *SScheduledTaskActivityManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, ...) (*sqlchemy.SQuery, error)
- func (sam *SScheduledTaskActivityManager) NamespaceScope() rbacscope.TRbacScope
- func (sam *SScheduledTaskActivityManager) OrderByExtraFields(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, ...) (*sqlchemy.SQuery, error)
- func (sam *SScheduledTaskActivityManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)
- func (sam *SScheduledTaskActivityManager) ResourceScope() rbacscope.TRbacScope
- type SScheduledTaskLabel
- type SScheduledTaskLabelManager
- type SScheduledTaskManager
- func (stm *SScheduledTaskManager) FetchCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, ...) []api.ScheduledTaskDetails
- func (stm *SScheduledTaskManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, ...) (*sqlchemy.SQuery, error)
- func (stm *SScheduledTaskManager) OrderByExtraFields(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, ...) (*sqlchemy.SQuery, error)
- func (stm *SScheduledTaskManager) Timer(ctx context.Context, userCred mcclient.TokenCredential, isStart bool)
- func (stm *SScheduledTaskManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ...) (api.ScheduledTaskCreateInput, error)
- type STimeScope
- type STimer
- func (st *STimer) CycleTimerDetails() api.CycleTimerDetails
- func (st *STimer) Description(ctx context.Context, createdAt time.Time, zone *time.Location) string
- func (st *STimer) GetMonthDays() []int
- func (st *STimer) GetWeekDays() []int
- func (st *STimer) MonthDaySum(t time.Time) int
- func (st *STimer) SetMonthDays(days []int)
- func (st *STimer) SetWeekDays(days []int)
- func (st *STimer) TimerDetails() api.TimerDetails
- func (st *STimer) Update(now time.Time)
- type WrapperListOptions
Constants ¶
This section is empty.
Variables ¶
var Action = SAction{/* contains filtered or unexported fields */}
Action itself is meaningless, a meaningful Action is generated by calling Resource, Operation, Session and DefaultParams. A example:
Action.ResourceOperation(ServerStart).Session(...).Apply(...)
var Modules = make(map[Resource]modulebase.ResourceManager)
Modules describe the correspondence between Resource and modulebase.ResourceManager, which is equivalent to onecloud resource client.
var (
TIMERLANG = "timerLang"
)
Functions ¶
func Register ¶
func Register(resource Resource, manager modulebase.ResourceManager)
Every Resource should call Register to register their modulebase.ResourceManager.
Types ¶
type Resource ¶
type Resource string
Resoruce describe a onecloud resource, such as:
const ( ResourceServer Resource = api.ST_RESOURCE_SERVER ResourceCloudAccount Resource = api.ST_RESOURCE_CLOUDACCOUNT )
type ResourceOperation ¶
type ResourceOperation struct { Resource Resource Operation string StatusSuccess []string Fail []ResourceOperationFail Params *jsonutils.JSONDict }
ResourceOperation describe the operation for onecloud resource like create, update, delete and so on.
var ( ServerStart ResourceOperation ServerStop ResourceOperation ServerRestart ResourceOperation CloudAccountSync ResourceOperation ResourceOperationMap map[string]ResourceOperation )
type ResourceOperationFail ¶
type SAction ¶
type SAction struct {
// contains filtered or unexported fields
}
SAction encapsulates action to for onecloud resources
func (SAction) ResourceOperation ¶
func (r SAction) ResourceOperation(oper ResourceOperation) SAction
type SScheduledTask ¶
type SScheduledTask struct { db.SVirtualResourceBase db.SEnabledResourceBase ScheduledType string `width:"16" charset:"ascii" create:"required" list:"user" get:"user"` STimer ResourceType string `width:"32" charset:"ascii" create:"required" list:"user" get:"user"` Operation string `width:"32" charset:"ascii" create:"required" list:"user" get:"user"` LabelType string `width:"4" charset:"ascii" create:"required" list:"user" get:"user"` }
func (*SScheduledTask) Action ¶
func (st *SScheduledTask) Action(ctx context.Context, userCred mcclient.TokenCredential) SAction
func (*SScheduledTask) CustomizeDelete ¶
func (st *SScheduledTask) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error
func (*SScheduledTask) Execute ¶
func (st *SScheduledTask) Execute(ctx context.Context, userCred mcclient.TokenCredential) (err error)
func (*SScheduledTask) ExecuteNotify ¶
func (st *SScheduledTask) ExecuteNotify(ctx context.Context, userCred mcclient.TokenCredential, name string)
func (*SScheduledTask) IsExecuted ¶
func (st *SScheduledTask) IsExecuted() (bool, error)
func (*SScheduledTask) Labels ¶
func (st *SScheduledTask) Labels() ([]string, error)
func (*SScheduledTask) NewActivity ¶
func (st *SScheduledTask) NewActivity(ctx context.Context, reject bool) (*SScheduledTaskActivity, error)
func (*SScheduledTask) PerformDisable ¶
func (st *SScheduledTask) PerformDisable(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input apis.PerformDisableInput) (jsonutils.JSONObject, error)
func (*SScheduledTask) PerformEnable ¶
func (st *SScheduledTask) PerformEnable(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input apis.PerformEnableInput) (jsonutils.JSONObject, error)
func (*SScheduledTask) PerformSetLabels ¶
func (st *SScheduledTask) PerformSetLabels(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ScheduledTaskSetLabelsInput) (jsonutils.JSONObject, error)
func (*SScheduledTask) PerformTrigger ¶
func (st *SScheduledTask) PerformTrigger(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ScheduledTaskTriggerInput) (jsonutils.JSONObject, error)
func (*SScheduledTask) PostCreate ¶
func (st *SScheduledTask) PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject)
func (*SScheduledTask) ResourceOperation ¶
func (st *SScheduledTask) ResourceOperation() ResourceOperation
func (*SScheduledTask) STLabels ¶
func (st *SScheduledTask) STLabels() ([]SScheduledTaskLabel, error)
func (*SScheduledTask) ValidateDeleteCondition ¶
func (st *SScheduledTask) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error
type SScheduledTaskActivity ¶
type SScheduledTaskActivity struct { db.SStatusStandaloneResourceBase ScheduledTaskId string `width:"36" charset:"ascii" nullable:"true" list:"user" index:"true"` StartTime time.Time `list:"user"` EndTime time.Time `list:"user"` Reason string `charset:"utf8" list:"user"` }
func (*SScheduledTaskActivity) Fail ¶
func (sa *SScheduledTaskActivity) Fail(reason string) error
func (*SScheduledTaskActivity) GetOwnerId ¶
func (sa *SScheduledTaskActivity) GetOwnerId() mcclient.IIdentityProvider
func (*SScheduledTaskActivity) PartFail ¶
func (sa *SScheduledTaskActivity) PartFail(reason string) error
func (*SScheduledTaskActivity) SetResult ¶
func (sa *SScheduledTaskActivity) SetResult(status, reason string) error
func (*SScheduledTaskActivity) Succeed ¶
func (sa *SScheduledTaskActivity) Succeed() error
type SScheduledTaskActivityManager ¶
type SScheduledTaskActivityManager struct {
db.SStatusStandaloneResourceBaseManager
}
+onecloud:swagger-gen-model-singular=scheduledtaskactivity +onecloud:swagger-gen-model-singular=scheduledtaskactivities
var ScheduledTaskActivityManager *SScheduledTaskActivityManager
func (*SScheduledTaskActivityManager) FetchCustomizeColumns ¶
func (sam *SScheduledTaskActivityManager) FetchCustomizeColumns( ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, objs []interface{}, fields stringutils2.SSortedStrings, isList bool, ) []api.ScheduledTaskActivityDetails
func (*SScheduledTaskActivityManager) FetchOwnerId ¶
func (sam *SScheduledTaskActivityManager) FetchOwnerId(ctx context.Context, data jsonutils.JSONObject) (mcclient.IIdentityProvider, error)
func (*SScheduledTaskActivityManager) FileterByOwner ¶
func (sam *SScheduledTaskActivityManager) FileterByOwner(q *sqlchemy.SQuery, owner mcclient.IIdentityProvider, scope rbacscope.TRbacScope) *sqlchemy.SQuery
func (*SScheduledTaskActivityManager) InitializeData ¶
func (sam *SScheduledTaskActivityManager) InitializeData() error
func (*SScheduledTaskActivityManager) ListItemFilter ¶
func (sam *SScheduledTaskActivityManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, input api.ScheduledTaskActivityListInput) (*sqlchemy.SQuery, error)
func (*SScheduledTaskActivityManager) NamespaceScope ¶
func (sam *SScheduledTaskActivityManager) NamespaceScope() rbacscope.TRbacScope
func (*SScheduledTaskActivityManager) OrderByExtraFields ¶
func (sam *SScheduledTaskActivityManager) OrderByExtraFields(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query api.ScheduledTaskActivityListInput) (*sqlchemy.SQuery, error)
func (*SScheduledTaskActivityManager) QueryDistinctExtraField ¶
func (*SScheduledTaskActivityManager) ResourceScope ¶
func (sam *SScheduledTaskActivityManager) ResourceScope() rbacscope.TRbacScope
type SScheduledTaskLabel ¶
type SScheduledTaskLabel struct { db.SResourceBase ScheduledTaskId string `width:"36" charset:"ascii" nullable:"false" primary:"true"` Label string `width:"64" charset:"utf8" nullable:"false" primary:"true"` }
func (*SScheduledTaskLabel) Detach ¶
func (sl *SScheduledTaskLabel) Detach(ctx context.Context, userCred mcclient.TokenCredential) error
type SScheduledTaskLabelManager ¶
type SScheduledTaskLabelManager struct {
db.SResourceBaseManager
}
var ScheduledTaskLabelManager *SScheduledTaskLabelManager
type SScheduledTaskManager ¶
type SScheduledTaskManager struct { db.SVirtualResourceBaseManager db.SEnabledResourceBaseManager }
+onecloud:swagger-gen-model-singular=scheduledtask +onecloud:swagger-gen-model-singular=scheduledtasks
var ScheduledTaskManager *SScheduledTaskManager
func (*SScheduledTaskManager) FetchCustomizeColumns ¶
func (stm *SScheduledTaskManager) FetchCustomizeColumns( ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, objs []interface{}, fields stringutils2.SSortedStrings, isList bool, ) []api.ScheduledTaskDetails
func (*SScheduledTaskManager) ListItemFilter ¶
func (stm *SScheduledTaskManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, input api.ScheduledTaskListInput) (*sqlchemy.SQuery, error)
func (*SScheduledTaskManager) OrderByExtraFields ¶
func (stm *SScheduledTaskManager) OrderByExtraFields(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query api.ScheduledTaskListInput) (*sqlchemy.SQuery, error)
func (*SScheduledTaskManager) Timer ¶
func (stm *SScheduledTaskManager) Timer(ctx context.Context, userCred mcclient.TokenCredential, isStart bool)
func (*SScheduledTaskManager) ValidateCreateData ¶
func (stm *SScheduledTaskManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, input api.ScheduledTaskCreateInput) (api.ScheduledTaskCreateInput, error)
type STimer ¶
type STimer struct { // Cycle type Type string `width:"8" charset:"ascii"` // 0-59 Minute int `nullable:"false"` // 0-23 Hour int `nullable:"false"` CycleNum int `nullable:"false"` // 0-7 1 is Monday 0 is unlimited WeekDays uint8 `nullable:"false"` // 0-31 0 is unlimited MonthDays uint32 `nullable:"false"` // StartTime represent the start time of this timer StartTime time.Time // EndTime represent deadline of this timer EndTime time.Time // NextTime represent the time timer should bell NextTime time.Time `index:"true"` IsExpired bool }
func (*STimer) CycleTimerDetails ¶
func (st *STimer) CycleTimerDetails() api.CycleTimerDetails
func (*STimer) Description ¶
func (*STimer) GetMonthDays ¶
func (*STimer) GetWeekDays ¶
func (*STimer) MonthDaySum ¶
MonthDaySum calculate the number of month's days
func (*STimer) SetMonthDays ¶
func (*STimer) SetWeekDays ¶
func (*STimer) TimerDetails ¶
func (st *STimer) TimerDetails() api.TimerDetails
type WrapperListOptions ¶
type WrapperListOptions struct {
options.BaseListOptions
}