db

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: Apache-2.0 Imports: 25 Imported by: 110

Documentation

Index

Constants

View Source
const (
	ACT_CREATE  = "create"
	ACT_DELETE  = "delete"
	ACT_UPDATE  = "update"
	ACT_FETCH   = "fetch"
	ACT_ENABLE  = "enable"
	ACT_DISABLE = "disable"
	ACT_OFFLINE = "offline"
	ACT_ONLINE  = "online"
	ACT_ATTACH  = "attach"
	ACT_DETACH  = "detach"

	ACT_UPDATE_STATUS = "updatestatus"

	ACT_STARTING   = "starting"
	ACT_START      = "start"
	ACT_START_FAIL = "start_fail"

	ACT_STOPPING  = "stopping"
	ACT_STOP      = "stop"
	ACT_STOP_FAIL = "stop_fail"

	ACT_RESIZING    = "resizing"
	ACT_RESIZE      = "resize"
	ACT_RESIZE_FAIL = "resize_fail"

	ACT_MIGRATING    = "migrating"
	ACT_MIGRATE      = "migrate"
	ACT_MIGRATE_FAIL = "migrate_fail"

	ACT_SAVING    = "saving"
	ACT_SAVE      = "save"
	ACT_SAVE_FAIL = "save_fail"

	ACT_SNAPSHOTING          = "snapshoting"
	ACT_SNAPSHOT_STREAM      = "snapshot_stream"
	ACT_SNAPSHOT_DONE        = "snapshot"
	ACT_SNAPSHOT_READY       = "snapshot_ready"
	ACT_SNAPSHOT_SYNC        = "snapshot_sync"
	ACT_SNAPSHOT_FAIL        = "snapshot_fail"
	ACT_SNAPSHOT_DELETING    = "snapshot_deling"
	ACT_SNAPSHOT_DELETE      = "snapshot_del"
	ACT_SNAPSHOT_DELETE_FAIL = "snapshot_del_fail"
	ACT_SNAPSHOT_UNLINK      = "snapshot_unlink"

	ACT_DISK_CLEAN_UP_SNAPSHOTS      = "disk_clean_up_snapshots"
	ACT_DISK_CLEAN_UP_SNAPSHOTS_FAIL = "disk_clean_up_snapshots_fail"

	ACT_ALLOCATING    = "allocating"
	ACT_ALLOCATE      = "allocate"
	ACT_ALLOCATE_FAIL = "alloc_fail"

	ACT_DELOCATING    = "delocating"
	ACT_DELOCATE      = "delocate"
	ACT_DELOCATE_FAIL = "delocate_fail"

	ACT_ISO_PREPARING    = "iso_preparing"
	ACT_ISO_PREPARE_FAIL = "iso_prepare_fail"
	ACT_ISO_ATTACH       = "iso_attach"
	ACT_ISO_DETACH       = "iso_detach"

	ACT_EIP_ATTACH = "eip_attach"
	ACT_EIP_DETACH = "eip_detach"

	ACT_SET_METADATA = "set_meta"
	ACT_DEL_METADATA = "del_meta"

	ACT_REBUILDING_ROOT   = "rebuilding_root"
	ACT_REBUILD_ROOT      = "rebuild_root"
	ACT_REBUILD_ROOT_FAIL = "rebuild_root_fail"

	ACT_CHANGING_FLAVOR    = "changing_flavor"
	ACT_CHANGE_FLAVOR      = "change_flavor"
	ACT_CHANGE_FLAVOR_FAIL = "change_flavor_fail"

	ACT_SYNCING_CONF   = "syncing_conf"
	ACT_SYNC_CONF      = "sync_conf"
	ACT_SYNC_CONF_FAIL = "sync_conf_fail"

	ACT_CHANGE_OWNER = "change_owner"

	ACT_RESERVE_IP = "reserve_ip"
	ACT_RELEASE_IP = "release_ip"

	ACT_CONVERT_START      = "converting"
	ACT_CONVERT_COMPLETE   = "converted"
	ACT_CONVERT_FAIL       = "convert_fail"
	ACT_UNCONVERT_START    = "unconverting"
	ACT_UNCONVERT_COMPLETE = "unconverted"
	ACT_UNCONVERT_FAIL     = "unconvert_fail"

	ACT_SYNC_HOST_START    = "sync_host_start"
	ACT_SYNCING_HOST       = "syncing_host"
	ACT_SYNC_HOST_COMPLETE = "sync_host_end"

	ACT_CACHING_IMAGE      = "caching_image"
	ACT_CACHE_IMAGE_FAIL   = "cache_image_fail"
	ACT_CACHED_IMAGE       = "cached_image"
	ACT_UNCACHING_IMAGE    = "uncaching_image"
	ACT_UNCACHE_IMAGE_FAIL = "uncache_image_fail"
	ACT_UNCACHED_IMAGE     = "uncached_image"

	ACT_SYNC_CLOUD_DISK   = "sync_cloud_disk"
	ACT_SYNC_CLOUD_SERVER = "sync_cloud_server"

	ACT_SPLIT = "net_split"

	ACT_PENDING_DELETE = "pending_delete"
	ACT_CANCEL_DELETE  = "cancel_delete"

	// # isolated device (host)
	ACT_HOST_ATTACH_ISOLATED_DEVICE      = "host_attach_isolated_deivce"
	ACT_HOST_ATTACH_ISOLATED_DEVICE_FAIL = "host_attach_isolated_deivce_fail"
	ACT_HOST_DETACH_ISOLATED_DEVICE      = "host_detach_isolated_deivce"
	ACT_HOST_DETACH_ISOLATED_DEVICE_FAIL = "host_detach_isolated_deivce_fail"

	// # isolated device (guest)
	ACT_GUEST_ATTACH_ISOLATED_DEVICE      = "guest_attach_isolated_deivce"
	ACT_GUEST_ATTACH_ISOLATED_DEVICE_FAIL = "guest_attach_isolated_deivce_fail"
	ACT_GUEST_DETACH_ISOLATED_DEVICE      = "guest_detach_isolated_deivce"
	ACT_GUEST_DETACH_ISOLATED_DEVICE_FAIL = "guest_detach_isolated_deivce_fail"

	ACT_CHANGE_BANDWIDTH = "eip_change_bandwidth"
)
View Source
const (
	SYSTEM_ADMIN_PREFIX = "__sys_"
)

Variables

This section is empty.

Functions

func CanDelete

func CanDelete(model IModel, ctx context.Context) bool

func CheckSync

func CheckSync(autoSync bool) bool

func DeleteModel

func DeleteModel(ctx context.Context, userCred mcclient.TokenCredential, item IModel) error

func DetachJoint

func DetachJoint(ctx context.Context, userCred mcclient.TokenCredential, item IJointModel) error

func EnableGlobalVirtualResourceNamespace

func EnableGlobalVirtualResourceNamespace()

func FetchModelObjects

func FetchModelObjects(modelManager IModelManager, query *sqlchemy.SQuery, targets interface{}) error

func GenerateName

func GenerateName(manager IModelManager, ownerProjId string, hint string) string

func GetObjectIdstr

func GetObjectIdstr(model IModel) string

func InitAllManagers

func InitAllManagers()

func InitManager

func InitManager(initfunc func())

func JointMasterID

func JointMasterID(joint IJointModel) string

func JointModelExtra

func JointModelExtra(jointModel IJointModel, extra *jsonutils.JSONDict) *jsonutils.JSONDict

func JointSlaveID

func JointSlaveID(joint IJointModel) string

func ListItemQueryFilters

func ListItemQueryFilters(manager IModelManager, ctx context.Context, q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error)

func RegisterModelManager

func RegisterModelManager(modelMan IModelManager)

Types

type DBJointModelDispatcher

type DBJointModelDispatcher struct {
	DBModelDispatcher
}

func NewJointModelHandler

func NewJointModelHandler(manager IJointModelManager) *DBJointModelDispatcher

func (*DBJointModelDispatcher) Attach

func (*DBJointModelDispatcher) Detach

func (*DBJointModelDispatcher) Get

func (*DBJointModelDispatcher) JointModelManager

func (dispatcher *DBJointModelDispatcher) JointModelManager() IJointModelManager

func (*DBJointModelDispatcher) ListMasterDescendent

func (dispatcher *DBJointModelDispatcher) ListMasterDescendent(ctx context.Context, idStr string, query jsonutils.JSONObject) (*modules.ListResult, error)

func (*DBJointModelDispatcher) ListSlaveDescendent

func (dispatcher *DBJointModelDispatcher) ListSlaveDescendent(ctx context.Context, idStr string, query jsonutils.JSONObject) (*modules.ListResult, error)

func (*DBJointModelDispatcher) MasterKeywordPlural

func (dispatcher *DBJointModelDispatcher) MasterKeywordPlural() string

func (*DBJointModelDispatcher) SlaveKeywordPlural

func (dispatcher *DBJointModelDispatcher) SlaveKeywordPlural() string

func (*DBJointModelDispatcher) Update

type DBModelDispatcher

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

func NewModelHandler

func NewModelHandler(manager IModelManager) *DBModelDispatcher

func (*DBModelDispatcher) BatchCreate

func (dispatcher *DBModelDispatcher) BatchCreate(ctx context.Context, query jsonutils.JSONObject, data jsonutils.JSONObject, count int, ctxId string) ([]modules.SubmitResult, error)

func (*DBModelDispatcher) ContextKeywordPlural

func (dispatcher *DBModelDispatcher) ContextKeywordPlural() []string

func (*DBModelDispatcher) Create

func (dispatcher *DBModelDispatcher) Create(ctx context.Context, query jsonutils.JSONObject, data jsonutils.JSONObject, ctxId string) (jsonutils.JSONObject, error)

func (*DBModelDispatcher) Delete

func (dispatcher *DBModelDispatcher) Delete(ctx context.Context, idstr string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*DBModelDispatcher) Filter

func (*DBModelDispatcher) Get

func (dispatcher *DBModelDispatcher) Get(ctx context.Context, idStr string, query jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*DBModelDispatcher) GetSpecific

func (dispatcher *DBModelDispatcher) GetSpecific(ctx context.Context, idStr string, spec string, query jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*DBModelDispatcher) Keyword

func (dispatcher *DBModelDispatcher) Keyword() string

func (*DBModelDispatcher) KeywordPlural

func (dispatcher *DBModelDispatcher) KeywordPlural() string

func (*DBModelDispatcher) List

func (dispatcher *DBModelDispatcher) List(ctx context.Context, query jsonutils.JSONObject, ctxId string) (*modules.ListResult, error)

func (*DBModelDispatcher) PerformAction

func (dispatcher *DBModelDispatcher) PerformAction(ctx context.Context, idStr string, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*DBModelDispatcher) PerformClassAction

func (dispatcher *DBModelDispatcher) PerformClassAction(ctx context.Context, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*DBModelDispatcher) Update

func (dispatcher *DBModelDispatcher) Update(ctx context.Context, idStr string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

type IAdminSharableVirtualModel

type IAdminSharableVirtualModel interface {
	ISharableVirtualModel
	GetInfo() []string
}

type IAdminSharableVirtualModelManager

type IAdminSharableVirtualModelManager interface {
	ISharableVirtualModelManager
	GetRecordsSeparator() string
	GetRecordsLimit() int
	ParseInputInfo(data *jsonutils.JSONDict) ([]string, error)
}

type IJointModel

type IJointModel interface {
	IResourceModel

	GetJointModelManager() IJointModelManager
	Master() IStandaloneModel
	Slave() IStandaloneModel

	Detach(ctx context.Context, userCred mcclient.TokenCredential) error
	AllowGetJointDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, item IJointModel) bool
	AllowUpdateJointItem(ctx context.Context, userCred mcclient.TokenCredential, item IJointModel) bool
}

type IJointModelManager

type IJointModelManager interface {
	IResourceModelManager

	GetMasterManager() IStandaloneModelManager
	GetSlaveManager() IStandaloneModelManager

	FetchByIds(masterId string, slaveId string) (IJointModel, error)

	AllowListDescendent(ctx context.Context, userCred mcclient.TokenCredential, model IStandaloneModel, query jsonutils.JSONObject) bool
	AllowAttach(ctx context.Context, userCred mcclient.TokenCredential, master IStandaloneModel, slave IStandaloneModel) bool
}

type IModel

type IModel interface {
	lockman.ILockedObject

	GetName() string

	GetModelManager() IModelManager
	SetModelManager(IModelManager)

	GetShortDesc() *jsonutils.JSONDict

	// list hooks
	GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict

	// get hooks
	AllowGetDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool
	GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict

	// create hooks
	CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data jsonutils.JSONObject) error
	PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data jsonutils.JSONObject)

	// allow perform action
	AllowPerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) bool
	PerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

	// update hooks
	ValidateUpdateCondition(ctx context.Context) error

	AllowUpdateItem(ctx context.Context, userCred mcclient.TokenCredential) bool
	ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
	PreUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)
	PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

	// delete hooks
	AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool
	ValidateDeleteCondition(ctx context.Context) error
	CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error
	PreDelete(ctx context.Context, userCred mcclient.TokenCredential)
	MarkDelete() error
	Delete(ctx context.Context, userCred mcclient.TokenCredential) error
	PostDelete(ctx context.Context, userCred mcclient.TokenCredential)

	GetOwnerProjectId() string
}

func FetchById

func FetchById(manager IModelManager, idStr string) (IModel, error)

func FetchByIdOrName

func FetchByIdOrName(manager IModelManager, userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func FetchByName

func FetchByName(manager IModelManager, userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func NewModelObject

func NewModelObject(modelManager IModelManager) (IModel, error)

type IModelManager

type IModelManager interface {
	lockman.ILockedClass

	GetContextManager() []IModelManager

	// Table() *sqlchemy.STable
	TableSpec() *sqlchemy.STableSpec

	// Keyword() string
	KeywordPlural() string
	Alias() string
	AliasPlural() string

	ValidateName(name string) error

	// list hooks
	AllowListItems(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool
	ValidateListConditions(ctx context.Context, userCred mcclient.TokenCredential, query *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
	ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error)
	CustomizeFilterList(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, retList []jsonutils.JSONObject) ([]jsonutils.JSONObject, error)
	ExtraSearchConditions(ctx context.Context, q *sqlchemy.SQuery, like string) []sqlchemy.ICondition

	// fetch hook
	Query(val ...string) *sqlchemy.SQuery

	FilterById(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery
	FilterByNotId(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery
	FilterByName(q *sqlchemy.SQuery, name string) *sqlchemy.SQuery
	FilterByOwner(q *sqlchemy.SQuery, owner string) *sqlchemy.SQuery

	GetOwnerId(userCred mcclient.IIdentityProvider) string

	// RawFetchById(idStr string) (IModel, error)
	FetchById(idStr string) (IModel, error)
	FetchByName(userCred mcclient.IIdentityProvider, idStr string) (IModel, error)
	FetchByIdOrName(userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

	// create hooks
	AllowCreateItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool
	ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
	OnCreateComplete(ctx context.Context, items []IModel, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

	// allow perform action
	AllowPerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) bool
	PerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

	DoCreate(ctx context.Context, userCred mcclient.TokenCredential, kwargs jsonutils.JSONObject, data jsonutils.JSONObject, realManager IModelManager) (IModel, error)

	InitializeData() error
}

func GetModelManager

func GetModelManager(keyword string) IModelManager

type IResourceModel

type IResourceModel interface {
	IModel
}

type IResourceModelManager

type IResourceModelManager interface {
	IModelManager
}

type ISharableVirtualModel

type ISharableVirtualModel interface {
	IVirtualModel
	IsSharable() bool
}

type ISharableVirtualModelManager

type ISharableVirtualModelManager interface {
	IVirtualModelManager
}

type IStandaloneModel

type IStandaloneModel interface {
	IResourceModel
}

func JointMaster

func JointMaster(joint IJointModel) IStandaloneModel

func JointSlave

func JointSlave(joint IJointModel) IStandaloneModel

type IStandaloneModelManager

type IStandaloneModelManager interface {
	IResourceModelManager

	FetchByExternalId(idStr string) (IStandaloneModel, error)
}

type IVirtualModel

type IVirtualModel interface {
	IStandaloneModel

	IsOwner(userCred mcclient.TokenCredential) bool
	IsAdmin(userCred mcclient.TokenCredential) bool
}

type IVirtualModelManager

type IVirtualModelManager interface {
	IStandaloneModelManager
}

type SAdminSharableVirtualResourceBase

type SAdminSharableVirtualResourceBase struct {
	SSharableVirtualResourceBase
	Records string `charset:"ascii" list:"user" create:"optional" update:"user"`
}

func (*SAdminSharableVirtualResourceBase) AddInfo

func (*SAdminSharableVirtualResourceBase) RemoveInfo

func (*SAdminSharableVirtualResourceBase) SetInfo

type SAdminSharableVirtualResourceBaseManager

type SAdminSharableVirtualResourceBaseManager struct {
	SSharableVirtualResourceBaseManager
	RecordsSeparator string
	RecordsLimit     int
}

func NewAdminSharableVirtualResourceBaseManager

func NewAdminSharableVirtualResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SAdminSharableVirtualResourceBaseManager

func (*SAdminSharableVirtualResourceBaseManager) ValidateCreateData

type SEnabledStatusStandaloneResourceBase

type SEnabledStatusStandaloneResourceBase struct {
	SStatusStandaloneResourceBase

	Enabled bool `nullable:"false" default:"false" list:"user" create:"optional"` // = Column(Boolean, nullable=False, default=False)
}

func (*SEnabledStatusStandaloneResourceBase) AllowPerformDisable

func (*SEnabledStatusStandaloneResourceBase) AllowPerformEnable

func (*SEnabledStatusStandaloneResourceBase) PerformDisable

func (*SEnabledStatusStandaloneResourceBase) PerformEnable

type SEnabledStatusStandaloneResourceBaseManager

type SEnabledStatusStandaloneResourceBaseManager struct {
	SStatusStandaloneResourceBaseManager
}

func NewEnabledStatusStandaloneResourceBaseManager

func NewEnabledStatusStandaloneResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SEnabledStatusStandaloneResourceBaseManager

type SJointResourceBase

type SJointResourceBase struct {
	SResourceBase

	RowId int64 `primary:"true" auto_increment:"true"`
}

func (*SJointResourceBase) AllowGetJointDetails

func (self *SJointResourceBase) AllowGetJointDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, item IJointModel) bool

func (*SJointResourceBase) AllowUpdateJointItem

func (self *SJointResourceBase) AllowUpdateJointItem(ctx context.Context, userCred mcclient.TokenCredential, item IJointModel) bool

func (*SJointResourceBase) GetJointModelManager

func (joint *SJointResourceBase) GetJointModelManager() IJointModelManager

func (*SJointResourceBase) Master

func (joint *SJointResourceBase) Master() IStandaloneModel

func (*SJointResourceBase) Slave

func (joint *SJointResourceBase) Slave() IStandaloneModel

type SJointResourceBaseManager

type SJointResourceBaseManager struct {
	SResourceBaseManager
	// contains filtered or unexported fields
}

func NewJointResourceBaseManager

func NewJointResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string, master IStandaloneModelManager, slave IStandaloneModelManager) SJointResourceBaseManager

func (*SJointResourceBaseManager) AllowAttach

func (manager *SJointResourceBaseManager) AllowAttach(ctx context.Context, userCred mcclient.TokenCredential, master IStandaloneModel, slave IStandaloneModel) bool

func (*SJointResourceBaseManager) AllowListDescendent

func (manager *SJointResourceBaseManager) AllowListDescendent(ctx context.Context, userCred mcclient.TokenCredential, model IStandaloneModel, query jsonutils.JSONObject) bool

func (*SJointResourceBaseManager) FetchByIds

func (manager *SJointResourceBaseManager) FetchByIds(masterId string, slaveId string) (IJointModel, error)

func (*SJointResourceBaseManager) GetMasterManager

func (manager *SJointResourceBaseManager) GetMasterManager() IStandaloneModelManager

func (*SJointResourceBaseManager) GetSlaveManager

func (manager *SJointResourceBaseManager) GetSlaveManager() IStandaloneModelManager

func (*SJointResourceBaseManager) MasterField

func (*SJointResourceBaseManager) SlaveField

type SKeystoneCacheObject

type SKeystoneCacheObject struct {
	SStandaloneResourceBase

	DomainId string `width:"128" charset:"ascii" nullable:"true"`
	Domain   string `width:"128" charset:"utf8" nullable:"true"`
}

func NewKeystoneCacheObject

func NewKeystoneCacheObject(id string, name string, domainId string, domain string) SKeystoneCacheObject

type SKeystoneCacheObjectManager

type SKeystoneCacheObjectManager struct {
	SStandaloneResourceBaseManager
}

func NewKeystoneCacheObjectManager

func NewKeystoneCacheObjectManager(dt interface{}, tableName string, keyword string, keywordPlural string) SKeystoneCacheObjectManager

func (*SKeystoneCacheObjectManager) BatchFetchNames

func (manager *SKeystoneCacheObjectManager) BatchFetchNames(idStrs []string) []string

type SMetadata

type SMetadata struct {
	SModelBase

	Id        string    `width:"128" charset:"ascii" primary:"true"` // = Column(VARCHAR(128, charset='ascii'), primary_key=True)
	Key       string    `width:"64" charset:"ascii" primary:"true"`  // = Column(VARCHAR(64, charset='ascii'),  primary_key=True)
	Value     string    `charset:"utf8"`                             // = Column(TEXT(charset='utf8'), nullable=True)
	UpdatedAt time.Time `nullable:"false" updated_at:"true"`         // = Column(DateTime, default=get_utcnow, nullable=False, onupdate=get_utcnow)
}

func (*SMetadata) GetId

func (m *SMetadata) GetId() string

func (*SMetadata) GetModelManager

func (m *SMetadata) GetModelManager() IModelManager

func (*SMetadata) GetName

func (m *SMetadata) GetName() string

type SMetadataManager

type SMetadataManager struct {
	SModelBaseManager
}
var Metadata *SMetadataManager

func (*SMetadataManager) GetAll

func (manager *SMetadataManager) GetAll(obj IModel, keys []string, userCred mcclient.TokenCredential) (map[string]string, error)

func (*SMetadataManager) GetJsonValue

func (manager *SMetadataManager) GetJsonValue(model IModel, key string, userCred mcclient.TokenCredential) jsonutils.JSONObject

func (*SMetadataManager) GetStringValue

func (manager *SMetadataManager) GetStringValue(model IModel, key string, userCred mcclient.TokenCredential) string

func (*SMetadataManager) GetSysadminKey

func (manager *SMetadataManager) GetSysadminKey(key string) string

func (*SMetadataManager) IsSystemAdminKey

func (manager *SMetadataManager) IsSystemAdminKey(key string) bool

func (*SMetadataManager) RemoveAll

func (manager *SMetadataManager) RemoveAll(ctx context.Context, model IModel, userCred mcclient.TokenCredential) error

func (*SMetadataManager) SetAll

func (manager *SMetadataManager) SetAll(ctx context.Context, obj IModel, store map[string]interface{}, userCred mcclient.TokenCredential) error

func (*SMetadataManager) SetValue

func (manager *SMetadataManager) SetValue(ctx context.Context, obj IModel, key string, value interface{}, userCred mcclient.TokenCredential) error

type SModelBase

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

func (*SModelBase) AllowDeleteItem

func (model *SModelBase) AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

delete hooks

func (*SModelBase) AllowGetDetails

func (model *SModelBase) AllowGetDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

get hooks

func (*SModelBase) AllowPerformAction

func (model *SModelBase) AllowPerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SModelBase) AllowUpdateItem

func (model *SModelBase) AllowUpdateItem(ctx context.Context, userCred mcclient.TokenCredential) bool

update hooks

func (*SModelBase) CustomizeCreate

func (model *SModelBase) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data jsonutils.JSONObject) error

create hooks

func (*SModelBase) CustomizeDelete

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

func (*SModelBase) Delete

func (model *SModelBase) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SModelBase) GetCustomizeColumns

func (model *SModelBase) GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict

list hooks

func (*SModelBase) GetExtraDetails

func (model *SModelBase) GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict

func (*SModelBase) GetId

func (model *SModelBase) GetId() string

func (*SModelBase) GetModelManager

func (model *SModelBase) GetModelManager() IModelManager

func (*SModelBase) GetName

func (model *SModelBase) GetName() string

func (*SModelBase) GetOwnerProjectId

func (model *SModelBase) GetOwnerProjectId() string

func (*SModelBase) GetShortDesc

func (model *SModelBase) GetShortDesc() *jsonutils.JSONDict

func (*SModelBase) Keyword

func (model *SModelBase) Keyword() string

func (*SModelBase) MarkDelete

func (model *SModelBase) MarkDelete() error

func (*SModelBase) PerformAction

func (model *SModelBase) PerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SModelBase) PostCreate

func (model *SModelBase) PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SModelBase) PostDelete

func (model *SModelBase) PostDelete(ctx context.Context, userCred mcclient.TokenCredential)

func (*SModelBase) PostUpdate

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

func (*SModelBase) PreDelete

func (model *SModelBase) PreDelete(ctx context.Context, userCred mcclient.TokenCredential)

func (*SModelBase) PreUpdate

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

func (*SModelBase) SetModelManager

func (model *SModelBase) SetModelManager(man IModelManager)

func (*SModelBase) ValidateDeleteCondition

func (model *SModelBase) ValidateDeleteCondition(ctx context.Context) error

func (*SModelBase) ValidateUpdateCondition

func (model *SModelBase) ValidateUpdateCondition(ctx context.Context) error

func (*SModelBase) ValidateUpdateData

func (model *SModelBase) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

type SModelBaseManager

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

func NewModelBaseManager

func NewModelBaseManager(model interface{}, tableName string, keyword string, keywordPlural string) SModelBaseManager

func (*SModelBaseManager) Alias

func (manager *SModelBaseManager) Alias() string

func (*SModelBaseManager) AliasPlural

func (manager *SModelBaseManager) AliasPlural() string

func (*SModelBaseManager) AllowCreateItem

func (manager *SModelBaseManager) AllowCreateItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

create hooks

func (*SModelBaseManager) AllowListItems

func (manager *SModelBaseManager) AllowListItems(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

list hooks

func (*SModelBaseManager) AllowPerformAction

func (manager *SModelBaseManager) AllowPerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SModelBaseManager) CustomizeFilterList

func (manager *SModelBaseManager) CustomizeFilterList(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, retList []jsonutils.JSONObject) ([]jsonutils.JSONObject, error)

func (*SModelBaseManager) DoCreate

func (manager *SModelBaseManager) DoCreate(ctx context.Context, userCred mcclient.TokenCredential, kwargs jsonutils.JSONObject, data jsonutils.JSONObject, realManager IModelManager) (IModel, error)

func (*SModelBaseManager) ExtraSearchConditions

func (manager *SModelBaseManager) ExtraSearchConditions(ctx context.Context, q *sqlchemy.SQuery, like string) []sqlchemy.ICondition

func (*SModelBaseManager) FetchById

func (manager *SModelBaseManager) FetchById(idStr string) (IModel, error)

func (*SModelBaseManager) FetchByIdOrName

func (manager *SModelBaseManager) FetchByIdOrName(userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SModelBaseManager) FetchByName

func (manager *SModelBaseManager) FetchByName(userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SModelBaseManager) FilterById

func (manager *SModelBaseManager) FilterById(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery

func (*SModelBaseManager) FilterByName

func (manager *SModelBaseManager) FilterByName(q *sqlchemy.SQuery, name string) *sqlchemy.SQuery

func (*SModelBaseManager) FilterByNotId

func (manager *SModelBaseManager) FilterByNotId(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery

func (*SModelBaseManager) FilterByOwner

func (manager *SModelBaseManager) FilterByOwner(q *sqlchemy.SQuery, owner string) *sqlchemy.SQuery

func (*SModelBaseManager) GetContextManager

func (manager *SModelBaseManager) GetContextManager() []IModelManager

func (*SModelBaseManager) GetOwnerId

func (manager *SModelBaseManager) GetOwnerId(userCred mcclient.IIdentityProvider) string

func (*SModelBaseManager) InitializeData

func (manager *SModelBaseManager) InitializeData() error

func (*SModelBaseManager) Keyword

func (manager *SModelBaseManager) Keyword() string

func (*SModelBaseManager) KeywordPlural

func (manager *SModelBaseManager) KeywordPlural() string

func (*SModelBaseManager) ListItemFilter

func (manager *SModelBaseManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error)

func (*SModelBaseManager) OnCreateComplete

func (manager *SModelBaseManager) OnCreateComplete(ctx context.Context, items []IModel, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SModelBaseManager) PerformAction

func (manager *SModelBaseManager) PerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SModelBaseManager) Query

func (manager *SModelBaseManager) Query(fieldNames ...string) *sqlchemy.SQuery

func (*SModelBaseManager) SetAlias

func (manager *SModelBaseManager) SetAlias(alias string, aliasPlural string)

func (*SModelBaseManager) TableSpec

func (manager *SModelBaseManager) TableSpec() *sqlchemy.STableSpec

func (*SModelBaseManager) ValidateCreateData

func (manager *SModelBaseManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

func (*SModelBaseManager) ValidateListConditions

func (manager *SModelBaseManager) ValidateListConditions(ctx context.Context, userCred mcclient.TokenCredential, query *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

func (*SModelBaseManager) ValidateName

func (manager *SModelBaseManager) ValidateName(name string) error

type SOpsLog

type SOpsLog struct {
	SModelBase

	Id        int64  `primary:"true" auto_increment:"true" list:"user"`         // = Column(BigInteger, primary_key=True)
	ObjType   string `width:"40" charset:"ascii" nullable:"false" list:"user"`  // = Column(VARCHAR(40, charset='ascii'), nullable=False)
	ObjId     string `width:"128" charset:"ascii" nullable:"false" list:"user"` //  = Column(VARCHAR(ID_LENGTH, charset='ascii'), nullable=False)
	ObjName   string `width:"128" charset:"utf8" nullable:"false" list:"user"`  //= Column(VARCHAR(128, charset='utf8'), nullable=False)
	Action    string `width:"32" charset:"ascii" nullable:"false" list:"user"`  //= Column(VARCHAR(32, charset='ascii'), nullable=False)
	Notes     string `width:"1024" charset:"utf8" list:"user"`                  // = Column(VARCHAR(1024, charset='utf8'))
	ProjectId string `name:"tenant_id" width:"128" charset:"ascii" list:"user"` // = Column(VARCHAR(ID_LENGTH, charset='ascii'))
	Project   string `name:"tenant" width:"128" charset:"utf8" list:"user"`     // tenant    = Column(VARCHAR(128, charset='utf8'))
	UserId    string `width:"128" charset:"ascii" list:"user"`                  // = Column(VARCHAR(ID_LENGTH, charset='ascii'))
	User      string `width:"128" charset:"utf8" list:"user"`                   // = Column(VARCHAR(128, charset='utf8'))
	DomainId  string `width:"128" charset:"ascii" list:"user"`
	Domain    string `width:"128" charset:"utf8" list:"user"`
	Roles     string `width:"64" charset:"ascii" list:"user"` // = Column(VARCHAR(64, charset='ascii'))
	// billing_type = Column(VARCHAR(64, charset='ascii'), nullable=True)
	OpsTime        time.Time `nullable:"false" list:"user"`                                   // = Column(DateTime, nullable=False)
	OwnerProjectId string    `name:"owner_tenant_id" width:"128" charset:"ascii" list:"user"` // = Column(VARCHAR(ID_LENGTH, charset='ascii'))

}

func (*SOpsLog) AllowDeleteItem

func (self *SOpsLog) AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SOpsLog) AllowGetDetails

func (self *SOpsLog) AllowGetDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SOpsLog) AllowUpdateItem

func (self *SOpsLog) AllowUpdateItem(ctx context.Context, userCred mcclient.TokenCredential) bool

func (*SOpsLog) GetId

func (opslog *SOpsLog) GetId() string

func (*SOpsLog) GetModelManager

func (opslog *SOpsLog) GetModelManager() IModelManager

func (*SOpsLog) GetName

func (opslog *SOpsLog) GetName() string

func (*SOpsLog) ValidateDeleteCondition

func (self *SOpsLog) ValidateDeleteCondition(ctx context.Context) error

type SOpsLogManager

type SOpsLogManager struct {
	SModelBaseManager
}
var OpsLog *SOpsLogManager

func (*SOpsLogManager) AllowCreateItem

func (manager *SOpsLogManager) AllowCreateItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SOpsLogManager) AllowListItems

func (manager *SOpsLogManager) AllowListItems(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SOpsLogManager) FilterById

func (self *SOpsLogManager) FilterById(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery

func (*SOpsLogManager) FilterByName

func (self *SOpsLogManager) FilterByName(q *sqlchemy.SQuery, name string) *sqlchemy.SQuery

func (*SOpsLogManager) FilterByNotId

func (self *SOpsLogManager) FilterByNotId(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery

func (*SOpsLogManager) FilterByOwner

func (self *SOpsLogManager) FilterByOwner(q *sqlchemy.SQuery, owner string) *sqlchemy.SQuery

func (*SOpsLogManager) ListItemFilter

func (manager *SOpsLogManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error)

func (*SOpsLogManager) LogAttachEvent

func (manager *SOpsLogManager) LogAttachEvent(m1, m2 IModel, userCred mcclient.TokenCredential, notes jsonutils.JSONObject)

func (*SOpsLogManager) LogDetachEvent

func (manager *SOpsLogManager) LogDetachEvent(m1, m2 IModel, userCred mcclient.TokenCredential, notes jsonutils.JSONObject)

func (*SOpsLogManager) LogEvent

func (manager *SOpsLogManager) LogEvent(model IModel, action string, notes interface{}, userCred mcclient.TokenCredential)

func (*SOpsLogManager) SetKeyword

func (manager *SOpsLogManager) SetKeyword(kw, kwPlural string) *SOpsLogManager

func (*SOpsLogManager) SyncOwner

func (manager *SOpsLogManager) SyncOwner(m IModel, former *STenant, userCred mcclient.TokenCredential)

type SResourceBase

type SResourceBase struct {
	SModelBase

	CreatedAt     time.Time `nullable:"false" created_at:"true" get:"user" list:"user"`
	UpdatedAt     time.Time `nullable:"false" updated_at:"true" list:"user"`
	UpdateVersion int       `default:"0" nullable:"false" auto_version:"true" list:"user"`
	DeletedAt     time.Time ``
	Deleted       bool      `nullable:"false" default:"false"`
}

func (*SResourceBase) Delete

func (model *SResourceBase) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SResourceBase) MarkDelete

func (model *SResourceBase) MarkDelete() error

func (*SResourceBase) ResourceModelManager

func (model *SResourceBase) ResourceModelManager() IResourceModelManager

type SResourceBaseManager

type SResourceBaseManager struct {
	SModelBaseManager
}

func NewResourceBaseManager

func NewResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SResourceBaseManager

func (*SResourceBaseManager) DoCreate

func (manager *SResourceBaseManager) DoCreate(ctx context.Context, userCred mcclient.TokenCredential, kwargs jsonutils.JSONObject, data jsonutils.JSONObject, realManager IModelManager) (IModel, error)

func (*SResourceBaseManager) Query

func (manager *SResourceBaseManager) Query(fields ...string) *sqlchemy.SQuery

func (*SResourceBaseManager) RawQuery

func (manager *SResourceBaseManager) RawQuery(fields ...string) *sqlchemy.SQuery

type SSharableVirtualResourceBase

type SSharableVirtualResourceBase struct {
	SVirtualResourceBase

	IsPublic bool `default:"false" nullable:"false" list:"user"`
}

func (*SSharableVirtualResourceBase) AllowGetDetails

func (model *SSharableVirtualResourceBase) AllowGetDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SSharableVirtualResourceBase) AllowPerformPrivate

func (model *SSharableVirtualResourceBase) AllowPerformPrivate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SSharableVirtualResourceBase) AllowPerformPublic

func (model *SSharableVirtualResourceBase) AllowPerformPublic(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SSharableVirtualResourceBase) IsSharable

func (model *SSharableVirtualResourceBase) IsSharable() bool

func (*SSharableVirtualResourceBase) PerformPrivate

func (*SSharableVirtualResourceBase) PerformPublic

type SSharableVirtualResourceBaseManager

type SSharableVirtualResourceBaseManager struct {
	SVirtualResourceBaseManager
}

func NewSharableVirtualResourceBaseManager

func NewSharableVirtualResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SSharableVirtualResourceBaseManager

func (*SSharableVirtualResourceBaseManager) FilterByOwner

func (manager *SSharableVirtualResourceBaseManager) FilterByOwner(q *sqlchemy.SQuery, owner string) *sqlchemy.SQuery

type SStandaloneResourceBase

type SStandaloneResourceBase struct {
	SResourceBase

	Id         string `width:"128" charset:"ascii" primary:"true" list:"user"`
	Name       string `width:"128" charset:"utf8" nullable:"false" index:"true" list:"user" update:"user" create:"required"`
	ExternalId string `width:"256" charset:"utf8" index:"true" list:"admin" create:"admin_optional"`

	Description string `width:"256" charset:"utf8" get:"user" list:"user" update:"user" create:"optional"`

	IsEmulated bool `nullable:"false" default:"false" list:"admin" update:"true" create:"admin_optional"`
}

func (*SStandaloneResourceBase) AllowGetDetailsMetadata

func (model *SStandaloneResourceBase) AllowGetDetailsMetadata(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SStandaloneResourceBase) AllowPerformMetadata

func (model *SStandaloneResourceBase) AllowPerformMetadata(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SStandaloneResourceBase) BeforeInsert

func (model *SStandaloneResourceBase) BeforeInsert()

func (*SStandaloneResourceBase) Delete

func (*SStandaloneResourceBase) GetAllMetadata

func (model *SStandaloneResourceBase) GetAllMetadata(userCred mcclient.TokenCredential) (map[string]string, error)

func (*SStandaloneResourceBase) GetCustomizeColumns

func (model *SStandaloneResourceBase) GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict

func (*SStandaloneResourceBase) GetDetailsMetadata

func (model *SStandaloneResourceBase) GetDetailsMetadata(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (SStandaloneResourceBase) GetExternalId

func (model SStandaloneResourceBase) GetExternalId() string

func (*SStandaloneResourceBase) GetId

func (model *SStandaloneResourceBase) GetId() string

func (*SStandaloneResourceBase) GetMetadata

func (model *SStandaloneResourceBase) GetMetadata(key string, userCred mcclient.TokenCredential) string

* userCred: optional

func (*SStandaloneResourceBase) GetMetadataJson

func (model *SStandaloneResourceBase) GetMetadataJson(key string, userCred mcclient.TokenCredential) jsonutils.JSONObject

func (*SStandaloneResourceBase) GetName

func (model *SStandaloneResourceBase) GetName() string

func (*SStandaloneResourceBase) GetShortDesc

func (model *SStandaloneResourceBase) GetShortDesc() *jsonutils.JSONDict

func (*SStandaloneResourceBase) PerformMetadata

func (*SStandaloneResourceBase) PostCreate

func (model *SStandaloneResourceBase) PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SStandaloneResourceBase) PostDelete

func (model *SStandaloneResourceBase) PostDelete(ctx context.Context, userCred mcclient.TokenCredential)

func (*SStandaloneResourceBase) PostUpdate

func (*SStandaloneResourceBase) RemoveAllMetadata

func (model *SStandaloneResourceBase) RemoveAllMetadata(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SStandaloneResourceBase) RemoveMetadata

func (model *SStandaloneResourceBase) RemoveMetadata(ctx context.Context, key string, userCred mcclient.TokenCredential) error

func (*SStandaloneResourceBase) SetAllMetadata

func (model *SStandaloneResourceBase) SetAllMetadata(ctx context.Context, dictstore map[string]interface{}, userCred mcclient.TokenCredential) error

func (*SStandaloneResourceBase) SetExternalId

func (model *SStandaloneResourceBase) SetExternalId(idstr string) error

func (*SStandaloneResourceBase) SetMetadata

func (model *SStandaloneResourceBase) SetMetadata(ctx context.Context, key string, value interface{}, userCred mcclient.TokenCredential) error

func (*SStandaloneResourceBase) StandaloneModelManager

func (model *SStandaloneResourceBase) StandaloneModelManager() IStandaloneModelManager

type SStandaloneResourceBaseManager

type SStandaloneResourceBaseManager struct {
	SResourceBaseManager
	NameRequireAscii bool
	NameLength       int
}

func NewStandaloneResourceBaseManager

func NewStandaloneResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SStandaloneResourceBaseManager

func (*SStandaloneResourceBaseManager) FetchByExternalId

func (manager *SStandaloneResourceBaseManager) FetchByExternalId(idStr string) (IStandaloneModel, error)

func (*SStandaloneResourceBaseManager) FetchById

func (manager *SStandaloneResourceBaseManager) FetchById(idStr string) (IModel, error)

func (*SStandaloneResourceBaseManager) FetchByIdOrName

func (manager *SStandaloneResourceBaseManager) FetchByIdOrName(userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SStandaloneResourceBaseManager) FetchByName

func (manager *SStandaloneResourceBaseManager) FetchByName(userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SStandaloneResourceBaseManager) FilterById

func (manager *SStandaloneResourceBaseManager) FilterById(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery

func (*SStandaloneResourceBaseManager) FilterByName

func (manager *SStandaloneResourceBaseManager) FilterByName(q *sqlchemy.SQuery, name string) *sqlchemy.SQuery

func (*SStandaloneResourceBaseManager) FilterByNotId

func (manager *SStandaloneResourceBaseManager) FilterByNotId(q *sqlchemy.SQuery, idStr string) *sqlchemy.SQuery

func (*SStandaloneResourceBaseManager) ListItemFilter

func (*SStandaloneResourceBaseManager) ValidateName

func (manager *SStandaloneResourceBaseManager) ValidateName(name string) error

type SStatusStandaloneResourceBase

type SStatusStandaloneResourceBase struct {
	SStandaloneResourceBase

	Status string `width:"36" charset:"ascii" nullable:"false" default:"init" list:"user" create:"optional"`
}

func (*SStatusStandaloneResourceBase) AllowPerformStatus

func (model *SStatusStandaloneResourceBase) AllowPerformStatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SStatusStandaloneResourceBase) PerformStatus

func (*SStatusStandaloneResourceBase) SetStatus

func (model *SStatusStandaloneResourceBase) SetStatus(userCred mcclient.TokenCredential, status string, reason string) error

type SStatusStandaloneResourceBaseManager

type SStatusStandaloneResourceBaseManager struct {
	SStandaloneResourceBaseManager
}

func NewStatusStandaloneResourceBaseManager

func NewStatusStandaloneResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SStatusStandaloneResourceBaseManager

type STenant

type STenant struct {
	SKeystoneCacheObject
}

func NewTenant

func NewTenant(idStr string, name string) STenant

func (*STenant) GetModelManager

func (tenant *STenant) GetModelManager() IModelManager

type STenantCacheManager

type STenantCacheManager struct {
	SKeystoneCacheObjectManager
}
var TenantCacheManager *STenantCacheManager

func (*STenantCacheManager) FetchTenantById

func (manager *STenantCacheManager) FetchTenantById(ctx context.Context, idStr string) (*STenant, error)

func (*STenantCacheManager) FetchTenantByIdOrName

func (manager *STenantCacheManager) FetchTenantByIdOrName(ctx context.Context, idStr string) (*STenant, error)

func (*STenantCacheManager) FetchTenantByName

func (manager *STenantCacheManager) FetchTenantByName(ctx context.Context, idStr string) (*STenant, error)

func (*STenantCacheManager) Save

func (manager *STenantCacheManager) Save(ctx context.Context, idStr string, name string, domainId string, domain string) (*STenant, error)

type SUser

type SUser struct {
	SKeystoneCacheObject
}

func (*SUser) GetModelManager

func (user *SUser) GetModelManager() IModelManager

type SUserCacheManager

type SUserCacheManager struct {
	SKeystoneCacheObjectManager
}
var UserCacheManager *SUserCacheManager

func (*SUserCacheManager) FetchUserById

func (manager *SUserCacheManager) FetchUserById(idStr string) (*SUser, error)

func (*SUserCacheManager) FetchUserByIdOrName

func (manager *SUserCacheManager) FetchUserByIdOrName(idStr string) (*SUser, error)

func (*SUserCacheManager) FetchUserByName

func (manager *SUserCacheManager) FetchUserByName(idStr string) (*SUser, error)

func (*SUserCacheManager) Save

func (manager *SUserCacheManager) Save(ctx context.Context, idStr string, name string, domainId string, domain string) (*SUser, error)

type SVirtualJointResourceBase

type SVirtualJointResourceBase struct {
	SJointResourceBase
}

func (*SVirtualJointResourceBase) AllowGetDetails

func (self *SVirtualJointResourceBase) AllowGetDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SVirtualJointResourceBase) AllowUpdateItem

func (self *SVirtualJointResourceBase) AllowUpdateItem(ctx context.Context, userCred mcclient.TokenCredential) bool

type SVirtualJointResourceBaseManager

type SVirtualJointResourceBaseManager struct {
	SJointResourceBaseManager
}

func NewVirtualJointResourceBaseManager

func NewVirtualJointResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string, master IVirtualModelManager, slave IVirtualModelManager) SVirtualJointResourceBaseManager

func (*SVirtualJointResourceBaseManager) AllowAttach

func (*SVirtualJointResourceBaseManager) AllowListDescendent

func (manager *SVirtualJointResourceBaseManager) AllowListDescendent(ctx context.Context, userCred mcclient.TokenCredential, master IStandaloneModel, query jsonutils.JSONObject) bool

func (*SVirtualJointResourceBaseManager) AllowListItems

func (manager *SVirtualJointResourceBaseManager) AllowListItems(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SVirtualJointResourceBaseManager) ListItemFilter

type SVirtualResourceBase

type SVirtualResourceBase struct {
	SStatusStandaloneResourceBase

	ProjectId string `name:"tenant_id" width:"128" charset:"ascii" nullable:"false" index:"true" list:"admin"`

	IsSystem bool `nullable:"true" default:"false" list:"admin" create:"optional"`

	PendingDeletedAt time.Time ``
	PendingDeleted   bool      `nullable:"false" default:"false" index:"true" get:"admin"`
}

func (*SVirtualResourceBase) AllowDeleteItem

func (model *SVirtualResourceBase) AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SVirtualResourceBase) AllowGetDetails

func (model *SVirtualResourceBase) AllowGetDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SVirtualResourceBase) AllowGetDetailsMetadata

func (model *SVirtualResourceBase) AllowGetDetailsMetadata(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SVirtualResourceBase) AllowPerformCancelDelete

func (model *SVirtualResourceBase) AllowPerformCancelDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SVirtualResourceBase) AllowPerformChangeOwner

func (model *SVirtualResourceBase) AllowPerformChangeOwner(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SVirtualResourceBase) AllowPerformMetadata

func (model *SVirtualResourceBase) AllowPerformMetadata(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SVirtualResourceBase) AllowUpdateItem

func (model *SVirtualResourceBase) AllowUpdateItem(ctx context.Context, userCred mcclient.TokenCredential) bool

func (*SVirtualResourceBase) CancelPendingDelete

func (model *SVirtualResourceBase) CancelPendingDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SVirtualResourceBase) CustomizeCreate

func (model *SVirtualResourceBase) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SVirtualResourceBase) Delete

func (model *SVirtualResourceBase) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SVirtualResourceBase) DoCancelPendingDelete

func (model *SVirtualResourceBase) DoCancelPendingDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SVirtualResourceBase) DoPendingDelete

func (model *SVirtualResourceBase) DoPendingDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SVirtualResourceBase) GetCustomizeColumns

func (model *SVirtualResourceBase) GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict

func (*SVirtualResourceBase) GetExtraDetails

func (model *SVirtualResourceBase) GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict

func (*SVirtualResourceBase) GetOwnerProjectId

func (model *SVirtualResourceBase) GetOwnerProjectId() string

func (*SVirtualResourceBase) GetTenantCache

func (model *SVirtualResourceBase) GetTenantCache(ctx context.Context) (*STenant, error)

func (*SVirtualResourceBase) IsAdmin

func (model *SVirtualResourceBase) IsAdmin(userCred mcclient.TokenCredential) bool

func (*SVirtualResourceBase) IsOwner

func (model *SVirtualResourceBase) IsOwner(userCred mcclient.TokenCredential) bool

func (*SVirtualResourceBase) PendingDelete

func (model *SVirtualResourceBase) PendingDelete() error

func (*SVirtualResourceBase) PerformCancelDelete

func (*SVirtualResourceBase) PerformChangeOwner

func (*SVirtualResourceBase) VirtualModelManager

func (model *SVirtualResourceBase) VirtualModelManager() IVirtualModelManager

type SVirtualResourceBaseManager

type SVirtualResourceBaseManager struct {
	SStatusStandaloneResourceBaseManager
}

func NewVirtualResourceBaseManager

func NewVirtualResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SVirtualResourceBaseManager

func (*SVirtualResourceBaseManager) AllowCreateItem

func (manager *SVirtualResourceBaseManager) AllowCreateItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SVirtualResourceBaseManager) AllowListItems

func (manager *SVirtualResourceBaseManager) AllowListItems(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

func (*SVirtualResourceBaseManager) FetchByIdOrName

func (manager *SVirtualResourceBaseManager) FetchByIdOrName(userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SVirtualResourceBaseManager) FetchByName

func (manager *SVirtualResourceBaseManager) FetchByName(userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SVirtualResourceBaseManager) FilterByOwner

func (manager *SVirtualResourceBaseManager) FilterByOwner(q *sqlchemy.SQuery, owner string) *sqlchemy.SQuery

func (*SVirtualResourceBaseManager) GetOwnerId

func (manager *SVirtualResourceBaseManager) GetOwnerId(userCred mcclient.IIdentityProvider) string

func (*SVirtualResourceBaseManager) ListItemFilter

func (*SVirtualResourceBaseManager) ValidateCreateData

func (manager *SVirtualResourceBaseManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerProjId string, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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