db

package
v0.0.0-...-6410feb Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Overview

Copyright 2019 Yunion

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	APP_CONTEXT_KEY_DB_METADATA_MANAGER     = appctx.AppContextKey("db_metadata_manager")
	APP_CONTEXT_KEY_DB_TENANT_CACHE_MANAGER = appctx.AppContextKey("db_tenant_cache_manager")
)
View Source
const (
	MIN_DB_CONN_MAX = 5

	ClickhouseDB = sqlchemy.DBName("clickhouse_db")
)
View Source
const (
	SYSTEM_ADMIN_PREFIX  = "__sys_"
	SYS_TAG_PREFIX       = "__"
	CLOUD_TAG_PREFIX     = dbapi.CLOUD_TAG_PREFIX
	USER_TAG_PREFIX      = dbapi.USER_TAG_PREFIX
	SYS_CLOUD_TAG_PREFIX = dbapi.SYS_CLOUD_TAG_PREFIX
	CLASS_TAG_PREFIX     = dbapi.CLASS_TAG_PREFIX
	SKU_METADAT_KEY      = "md5"

	ORGANIZATION_TAG_PREFIX = dbapi.ORGANIZATION_TAG_PREFIX

	TAG_DELETE_RANGE_ALL = "all"

	OBJECT_TYPE_ID_SEP = "::"

	RE_BILLING_AT = "__re_billing_at"
)
View Source
const (
	COLUMN_RECORD_CHECKSUM = "record_checksum"
	COLUMN_UPDATE_VERSION  = "update_version"
	COLUMN_UPDATED_AT      = "updated_at"
)
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_ATTACH_FAIL = "attach_fail"
	ACT_DETACH_FAIL = "detach_fail"
	ACT_DELETE_FAIL = "delete_fail"

	ACT_CANCEL = "cancel"
	ACT_DONE   = "done"

	ACT_PUBLIC  = "public"
	ACT_PRIVATE = "private"

	ACT_SYNC_UPDATE = "sync_update"
	ACT_SYNC_CREATE = "sync_create"

	ACT_START_CREATE_BACKUP        = "start_create_backup"
	ACT_CREATE_BACKUP              = "create_backup"
	ACT_CREATE_BACKUP_FAILED       = "create_backup_failed"
	ACT_DELETE_BACKUP              = "delete_backup"
	ACT_DELETE_BACKUP_FAILED       = "delete_backup_failed"
	ACT_UPDATE_BACKUP_GUEST_STATUS = "update_backup_guest_status"

	ACT_UPDATE_STATUS       = "updatestatus"
	ACT_STARTING            = "starting"
	ACT_START               = "start"
	ACT_START_FAIL          = "start_fail"
	ACT_BACKUP_START        = "backup_start"
	ACT_BACKUP_START_FAILED = "backup_start_fail"

	ACT_FREEZE      = "freeze"
	ACT_FREEZE_FAIL = "freeze_fail"
	ACT_UNFREEZE    = "unfreeze"

	ACT_RESTARING    = "restarting"
	ACT_RESTART_FAIL = "restart_fail"

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

	ACT_RESUMING    = "resuming"
	ACT_RESUME      = "resume"
	ACT_RESUME_FAIL = "resume_fail"

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

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

	ACT_RESET_CPU_NUMA_PIN = "reset_cpu_numa_pin"

	ACT_VM_CONVERT      = "vm_convert"
	ACT_VM_CONVERTING   = "vm_converting"
	ACT_VM_CONVERT_FAIL = "vm_convert_fail"

	ACT_SPLIT       = "net_split"
	ACT_MERGE       = "net_merge"
	ACT_IP_MAC_BIND = "ip_mac_bind"

	ACT_SAVING            = "saving"
	ACT_SAVE              = "save"
	ACT_SAVE_FAIL         = "save_fail"
	ACT_PROBE             = "probe"
	ACT_PROBE_FAIL        = "probe_fail"
	ACT_IMAGE_DELETE_FAIL = "delete_fail"

	ACT_SWITCHED      = "switched"
	ACT_SWITCH_FAILED = "switch_failed"

	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_FAKE_DELETE          = "snapshot_fake_del"
	ACT_SNAPSHOT_UNLINK               = "snapshot_unlink"
	ACT_APPLY_SNAPSHOT_POLICY         = "apply_snapshot_policy"
	ACT_APPLY_SNAPSHOT_POLICY_FAILED  = "apply_snapshot_policy_failed"
	ACT_CANCEL_SNAPSHOT_POLICY        = "cancel_snapshot_policy"
	ACT_CANCEL_SNAPSHOT_POLICY_FAILED = "cancel_snapshot_policy_failed"
	ACT_VM_SNAPSHOT_AND_CLONE         = "vm_snapshot_and_clone"
	ACT_VM_SNAPSHOT_AND_CLONE_FAILED  = "vm_snapshot_and_clone_failed"

	ACT_VM_RESET_SNAPSHOT        = "instance_reset_snapshot"
	ACT_VM_RESET_SNAPSHOT_FAILED = "instance_reset_snapshot_failed"

	ACT_SNAPSHOT_POLICY_BIND_DISK        = "snapshot_policy_bind_disk"
	ACT_SNAPSHOT_POLICY_BIND_DISK_FAIL   = "snapshot_policy_bind_disk_fail"
	ACT_SNAPSHOT_POLICY_UNBIND_DISK      = "snapshot_policy_unbind_disk"
	ACT_SNAPSHOT_POLICY_UNBIND_DISK_FAIL = "snapshot_policy_unbind_disk_fail"

	ACT_DISK_CLEAN_UP_SNAPSHOTS      = "disk_clean_up_snapshots"
	ACT_DISK_CLEAN_UP_SNAPSHOTS_FAIL = "disk_clean_up_snapshots_fail"
	ACT_DISK_AUTO_SNAPSHOT           = "disk_auto_snapshot"
	ACT_DISK_AUTO_SNAPSHOT_FAIL      = "disk_auto_snapshot_fail"

	ACT_DISK_AUTO_SYNC_SNAPSHOT      = "disk_auto_sync_snapshot"
	ACT_DISK_AUTO_SYNC_SNAPSHOT_FAIL = "disk_auto_sync_snapshot_fail"

	ACT_ALLOCATING           = "allocating"
	ACT_BACKUP_ALLOCATING    = "backup_allocating"
	ACT_ALLOCATE             = "allocate"
	ACT_BACKUP_ALLOCATE      = "backup_allocate"
	ACT_ALLOCATE_FAIL        = "alloc_fail"
	ACT_BACKUP_ALLOCATE_FAIL = "backup_alloc_fail"
	ACT_REW_FAIL             = "renew_fail"

	ACT_SET_AUTO_RENEW      = "set_auto_renew"
	ACT_SET_AUTO_RENEW_FAIL = "set_auto_renew_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_VFD_PREPARING    = "vfd_preparing"
	ACT_VFD_PREPARE_FAIL = "vfd_prepare_fail"
	ACT_VFD_ATTACH       = "vfd_attach"
	ACT_VFD_DETACH       = "vfd_detach"

	ACT_EIP_ATTACH = "eip_attach"
	ACT_EIP_DETACH = "eip_detach"

	ACT_SET_METADATA = "set_meta"
	ACT_DEL_METADATA = "del_meta"

	ACT_VM_DEPLOY      = "deploy"
	ACT_VM_DEPLOY_FAIL = "deploy_fail"

	ACT_SET_USER_PASSWORD      = "set_user_password"
	ACT_SET_USER_PASSWORD_FAIL = "set_user_password_fail"

	ACT_SYNC_OS_INFO      = "sync_os_info"
	ACT_SYNC_OS_INFO_FAIL = "sync_os_info_fail"

	ACT_VM_IO_THROTTLE      = "io_throttle"
	ACT_VM_IO_THROTTLE_FAIL = "io_throttle_fail"

	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_SYNC_STATUS    = "sync_status"

	ACT_CHANGE_OWNER = "change_owner"
	ACT_SYNC_OWNER   = "sync_owner"
	ACT_SYNC_SHARE   = "sync_share"

	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_SYNC_HOST_FAILED    = "sync_host_fail"
	ACT_SYNC_NETWORK        = "sync_network"
	ACT_SYNC_NETWORK_FAILED = "sync_network_failed"

	ACT_SYNC_PROJECT_COMPLETE = "sync_project_end"

	ACT_SYNC_LB_START    = "sync_lb_start"
	ACT_SYNCING_LB       = "syncing_lb"
	ACT_SYNC_LB_COMPLETE = "sync_lb_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_SYNC_CLOUD_SKUS          = "sync_cloud_skus"
	ACT_SYNC_CLOUD_IMAGES        = "sync_cloud_images"
	ACT_SYNC_CLOUD_EIP           = "sync_cloud_eip"
	ACT_SYNC_CLOUD_PROJECT       = "sync_cloud_project"
	ACT_SYNC_CLOUD_ELASTIC_CACHE = "sync_cloud_elastic_cache"

	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_GUEST_SAVE_GUEST_IMAGE            = "guest_save_guest_image"
	ACT_GUEST_SAVE_GUEST_IMAGE_FAIL       = "guest_save_guest_image_fail"

	ACT_GUEST_SRC_CHECK = "guest_src_check"

	ACT_GUEST_CPUSET             = "guest_cpuset"
	ACT_GUEST_CPUSET_FAIL        = "guest_cpuset_fail"
	ACT_GUEST_CPUSET_REMOVE      = "guest_cpuset_remove"
	ACT_GUEST_CPUSET_REMOVE_FAIL = "guest_cpuset_remove_fail"

	ACT_CHANGE_BANDWIDTH = "eip_change_bandwidth"
	ACT_EIP_CONVERT_FAIL = "eip_convert_fail"

	ACT_RENEW = "renew"

	ACT_SCHEDULE = "schedule"

	ACT_RECYCLE_PREPAID      = "recycle_prepaid"
	ACT_UNDO_RECYCLE_PREPAID = "undo_recycle_prepaid"

	ACT_HOST_IMPORT_LIBVIRT_SERVERS      = "host_import_libvirt_servers"
	ACT_HOST_IMPORT_LIBVIRT_SERVERS_FAIL = "host_import_libvirt_servers_fail"
	ACT_GUEST_CREATE_FROM_IMPORT_SUCC    = "guest_create_from_import_succ"
	ACT_GUEST_CREATE_FROM_IMPORT_FAIL    = "guest_create_from_import_fail"
	ACT_GUEST_PANICKED                   = "guest_panicked"
	ACT_HOST_MAINTENANCE                 = "host_maintenance"
	ACT_HOST_DOWN                        = "host_down"

	ACT_UPLOAD_OBJECT  = "upload_obj"
	ACT_DELETE_OBJECT  = "delete_obj"
	ACT_MKDIR          = "mkdir"
	ACT_SET_WEBSITE    = "set_website"
	ACT_DELETE_WEBSITE = "delete_website"
	ACT_SET_CORS       = "set_cors"
	ACT_DELETE_CORS    = "delete_cors"
	ACT_SET_REFERER    = "set_referer"
	ACT_SET_POLICY     = "set_policy"
	ACT_DELETE_POLICY  = "delete_policy"

	ACT_GRANT_PRIVILEGE  = "grant_privilege"
	ACT_REVOKE_PRIVILEGE = "revoke_privilege"
	ACT_SET_PRIVILEGES   = "set_privileges"
	ACT_REBOOT           = "reboot"
	ACT_RESTORE          = "restore"
	ACT_CHANGE_CONFIG    = "change_config"
	ACT_RESET_PASSWORD   = "reset_password"

	ACT_SUBIMAGE_UPDATE_FAIL = "guest_image_subimages_update_fail"

	ACT_FLUSH_INSTANCE      = "flush_instance"
	ACT_FLUSH_INSTANCE_FAIL = "flush_instance_fail"

	ACT_SYNC_VPCS        = "sync_vpcs"
	ACT_SYNC_RECORD_SETS = "sync_record_sets"

	ACT_NETWORK_ADD_VPC             = "network_add_vpc"
	ACT_NETWORK_ADD_VPC_FAILED      = "network_add_vpc_failed"
	ACT_NETWORK_REMOVE_VPC          = "network_remove_vpc"
	ACT_NETWORK_REMOVE_VPC_FAILED   = "network_remove_vpc_failed"
	ACT_NETWORK_MODIFY_ROUTE        = "network_modify_route"
	ACT_NETWORK_MODIFY_ROUTE_FAILED = "network_modify_route_failed"

	ACT_UPDATE_RULE = "update_config"
	ACT_UPDATE_TAGS = "update_tags"

	ACT_UPDATE_MONITOR_RESOURCE_JOINT = "update_monitor_resource_joint"
	ACT_DETACH_MONITOR_RESOURCE_JOINT = "detach_monitor_resource_joint"

	ACT_MERGE_NETWORK        = "merge_network"
	ACT_MERGE_NETWORK_FAILED = "merge_network_failed"

	ACT_RECOVERY      = "recovery"
	ACT_RECOVERY_FAIL = "recovery_fail"
	ACT_PACK          = "pack"
	ACT_PACK_FAIL     = "pack_fail"
	ACT_UNPACK        = "unpack"
	ACT_UNPACK_FAIL   = "unpack_fail"

	ACT_ENCRYPT_START = "encrypt_start"
	ACT_ENCRYPT_FAIL  = "encrypt_fail"
	ACT_ENCRYPT_DONE  = "encrypted"

	ACT_SYNC_TRAFFIC_LIMIT      = "sync_traffic_limit"
	ACT_SYNC_TRAFFIC_LIMIT_FAIL = "sync_traffic_limit_fail"
	ACT_BIND                    = "bind"
	ACT_UNBIND                  = "unbind"

	ACT_START_RESCUE        = "start_rescue"
	ACT_STOP_RESCUE         = "stop_rescue"
	ACT_START_RESCUE_FAILED = "start_rescue_failed"
	ACT_STOP_RESCUE_FAILED  = "stop_rescue_failed"

	ACT_RE_BILLING = "re_billing"
)
View Source
const (
	SharedTargetProject = "project"
	SharedTargetDomain  = "domain"
)
View Source
const (
	DISTINCT_FIELD_SEP = "::"
)
View Source
const (
	MethodNotFoundError = errors.Error("MethodNotFoundError")
)
View Source
const (
	TAG_EXPORT_KEY_PREFIX = "tag:"
)

Variables

View Source
var (
	ErrInconsistentDataType = errors.Error("inconsistent data type")
	ErrQueryOutOfScope      = errors.Error("query scope is out of resource scope")
)
View Source
var (
	ProjectFetchKeys = []string{
		"project_id",
		"tenant_id",
		"project",
		"tenant",
	}
	DomainFetchKeys = []string{
		"project_domain_id",
		"domain_id",
		"project_domain",
	}
)
View Source
var (
	DefaultProjectFetcher  func(ctx context.Context, id string, domainId string) (*STenant, error)
	DefaultDomainFetcher   func(ctx context.Context, id string) (*STenant, error)
	DefaultProjectsFetcher func(ctx context.Context, idList []string, isDomain bool) map[string]STenant
	DefaultDomainQuery     func(fields ...string) *sqlchemy.SQuery
	DefaultProjectQuery    func(fields ...string) *sqlchemy.SQuery
)
View Source
var (
	CancelUsages func(ctx context.Context, userCred mcclient.TokenCredential, usages []IUsage)

	AddUsages func(ctx context.Context, userCred mcclient.TokenCredential, usages []IUsage)

	CancelPendingUsagesInContext func(ctx context.Context, userCred mcclient.TokenCredential) error

	InitPendingUsagesInContext func(ctx context.Context) context.Context
)
View Source
var (
	DefaultRoleFetcher func(ctx context.Context, id string) (*SRole, error)
)
View Source
var (
	DefaultUUIDGenerator = stringutils.UUID4
)
View Source
var (
	DefaultUserFetcher func(ctx context.Context, id string) (*SUser, error)
)

Functions

func AddHistoryDataCleanHandler

func AddHistoryDataCleanHandler(prefix string, app *appsrv.Application)

func AddScopeResourceCountHandler

func AddScopeResourceCountHandler(prefix string, app *appsrv.Application)

func AppDBInit

func AppDBInit(app *appsrv.Application)

func ApplyListItemsGeneralFilters

func ApplyListItemsGeneralFilters(manager IModelManager, q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential, filters []string, filterAny bool) (*sqlchemy.SQuery, error)

func ApplyQueryDistinctExtraField

func ApplyQueryDistinctExtraField(
	q *sqlchemy.SQuery,
	field string,
	managers ...QueryDistinctExtraFieldProvider,
) (*sqlchemy.SQuery, error)

func AutoPurgeSplitable

func AutoPurgeSplitable(ctx context.Context, userCred mcclient.TokenCredential, startRun bool)

func CalculateModelChecksum

func CalculateModelChecksum(dbObj IRecordChecksumModel) (string, error)

func CallCustomizeNotifyHook

func CallCustomizeNotifyHook(ctx context.Context, userCred mcclient.TokenCredential, action string, obj IModel, customizeDetails jsonutils.JSONObject)

func CallStatusChanegdNotifyHook

func CallStatusChanegdNotifyHook(ctx context.Context, userCred mcclient.TokenCredential, oldStatis, newStatus string, obj IModel)

func CallUpdateNotifyHook

func CallUpdateNotifyHook(ctx context.Context, userCred mcclient.TokenCredential, obj IModel)

func CheckRecordChecksumConsistent

func CheckRecordChecksumConsistent(model IModel) error

func CheckSync

func CheckSync(autoSync bool, enableChecksumTables bool, skipInitChecksum bool) bool

func CopyTags

func CopyTags(ctx context.Context, objType string, keys1 []string, values []string, keys2 []string) error

func CurrentTimestamp

func CurrentTimestamp(t time.Time) int64

func CustomizeDelete

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

func DBStatsHandler

func DBStatsHandler(ctx context.Context, w http.ResponseWriter, r *http.Request)

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 EnabledPerformEnable

func EnabledPerformEnable(model IEnabledBase, ctx context.Context, userCred mcclient.TokenCredential, enabled bool) error

func EnsureAppSyncDB

func EnsureAppSyncDB(app *appsrv.Application, opt *common_options.DBOptions, modelInitDBFunc func() error)

func ExpandBatchCreateData

func ExpandBatchCreateData(manager IModelManager, ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data *jsonutils.JSONDict, index int) (*jsonutils.JSONDict, error)

func ExtendListQuery

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

func ExtendQueryWithTag

func ExtendQueryWithTag(ctx context.Context, q *sqlchemy.SQuery, idField string, modelName string, key string, fieldLabel string) *sqlchemy.SQuery

func Fetch

func Fetch(model IModel) error

func FetchCustomizeColumns

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

func FetchDistinctField

func FetchDistinctField(modelManager IModelManager, field string) ([]string, error)

func FetchField

func FetchField(modelMan IModelManager, field string, qCallback func(q *sqlchemy.SQuery) *sqlchemy.SQuery) ([]string, error)

func FetchIdFieldMap

func FetchIdFieldMap(manager IStandaloneModelManager, field string, idMap map[string]string) (map[string]string, error)

func FetchIdFieldMap2

func FetchIdFieldMap2(manager IStandaloneModelManager, field string, ids []string) (map[string]string, error)

func FetchIdNameMap

func FetchIdNameMap(manager IStandaloneModelManager, idMap map[string]string) (map[string]string, error)

func FetchIdNameMap2

func FetchIdNameMap2(manager IStandaloneModelManager, ids []string) (map[string]string, error)

func FetchModelObjects

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

func FetchModelObjectsByIds

func FetchModelObjectsByIds(modelManager IModelManager, fieldName string, ids []string, targets interface{}) error

func FetchOrganizationTags

func FetchOrganizationTags(ctx context.Context, orgIds []string, orgType identityapi.TOrgType) (tagutils.TTagSetList, error)

func FetchQueryDomain

func FetchQueryDomain(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (string, error)

func FetchQueryObjectsByIds

func FetchQueryObjectsByIds(q *sqlchemy.SQuery, fieldName string, ids []string, targets interface{}) error

func FetchStandaloneObjectsByIds

func FetchStandaloneObjectsByIds(modelManager IModelManager, ids []string, targets interface{}) error

func GenerateAlterName

func GenerateAlterName(model IModel, hint string) (string, error)

func GenerateName

func GenerateName(ctx context.Context, manager IModelManager, ownerId mcclient.IIdentityProvider, hint string) (string, error)

func GenerateName2

func GenerateName2(ctx context.Context, manager IModelManager, ownerId mcclient.IIdentityProvider, hint string, model IModel, baseIndex int) (string, error)

func GetDetailFields

func GetDetailFields(manager IModelManager, userCred mcclient.TokenCredential) ([]string, []string)

func GetItemDetails

func GetItemDetails(manager IModelManager, item IModel, ctx context.Context, userCred mcclient.TokenCredential) (jsonutils.JSONObject, error)

func GetLockClassKey

func GetLockClassKey(manager IModelManager, ownerId mcclient.IIdentityProvider) string

func GetModelIdstr

func GetModelIdstr(model IModel) string

func GetPropertyTagValuePairs

func GetPropertyTagValuePairs(
	manager IModelManager,
	tagObjType string,
	tagIdField string,
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
) (jsonutils.JSONObject, error)

func GetPropertyTagValueTree

func GetPropertyTagValueTree(
	manager IModelManager,
	tagObjType string,
	tagIdField string,
	sumField string,
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
) (jsonutils.JSONObject, error)

func GetTagValueCountMap

func GetTagValueCountMap(
	manager IModelManager,
	tagObjType string,
	tagIdField string,
	sumField string,
	keys []string,
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
) ([]map[string]string, error)

func GetVisibleMetadata

func GetVisibleMetadata(ctx context.Context, model IStandaloneModel, userCred mcclient.TokenCredential) (map[string]string, error)

func GlobalModelManagerTables

func GlobalModelManagerTables() map[string]IModelManager

func IOwnerResourceBaseModelGetChangeOwnerCandidateDomains

func IOwnerResourceBaseModelGetChangeOwnerCandidateDomains(model IOwnerResourceBaseModel) (apis.ChangeOwnerCandidateDomainsOutput, error)

func ISharableChangeOwnerCandidateDomainIds

func ISharableChangeOwnerCandidateDomainIds(model ISharableBaseModel) []string

func ISharableMergeChangeOwnerCandidateDomainIds

func ISharableMergeChangeOwnerCandidateDomainIds(model ISharableBaseModel, candidates ...[]string) []string

func ISharableMergeShareRequireDomainIds

func ISharableMergeShareRequireDomainIds(requiredIds ...[]string) []string

func InitAllManagers

func InitAllManagers()

func InitManager

func InitManager(initfunc func())

func InitOpsLog

func InitOpsLog()

func InjectModelsChecksum

func InjectModelsChecksum(man IRecordChecksumModelManager) error

func IsAdminAllowClassPerform

func IsAdminAllowClassPerform(userCred mcclient.TokenCredential, manager IResource, action string) rbacutils.SPolicyResult

func IsAdminAllowCreate

func IsAdminAllowCreate(userCred mcclient.TokenCredential, manager IResource) rbacutils.SPolicyResult

func IsAdminAllowDelete

func IsAdminAllowDelete(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsAdminAllowGet

func IsAdminAllowGet(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsAdminAllowGetSpec

func IsAdminAllowGetSpec(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, spec string) bool

func IsAdminAllowList

func IsAdminAllowList(userCred mcclient.TokenCredential, manager IResource) rbacutils.SPolicyResult

func IsAdminAllowPerform

func IsAdminAllowPerform(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, action string) bool

func IsAdminAllowUpdate

func IsAdminAllowUpdate(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsAdminAllowUpdateSpec

func IsAdminAllowUpdateSpec(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, spec string) bool

func IsAllowClassPerform

func IsAllowClassPerform(scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, manager IResource, action string) rbacutils.SPolicyResult

func IsAllowCreate

func IsAllowCreate(scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, manager IResource) rbacutils.SPolicyResult

func IsAllowDelete

func IsAllowDelete(ctx context.Context, scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, obj IModel) bool

func IsAllowGet

func IsAllowGet(ctx context.Context, scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, obj IModel) bool

func IsAllowGetSpec

func IsAllowGetSpec(ctx context.Context, scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, obj IModel, spec string) bool

func IsAllowList

func IsAllowList(scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, manager IResource) rbacutils.SPolicyResult

func IsAllowPerform

func IsAllowPerform(ctx context.Context, scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, obj IModel, action string) bool

func IsAllowUpdate

func IsAllowUpdate(ctx context.Context, scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, obj IModel) bool

func IsAllowUpdateSpec

func IsAllowUpdateSpec(ctx context.Context, scope rbacscope.TRbacScope, userCred mcclient.TokenCredential, obj IModel, spec string) bool

func IsDomainAllowClassPerform

func IsDomainAllowClassPerform(userCred mcclient.TokenCredential, manager IResource, action string) rbacutils.SPolicyResult

func IsDomainAllowCreate

func IsDomainAllowCreate(userCred mcclient.TokenCredential, manager IResource) rbacutils.SPolicyResult

func IsDomainAllowDelete

func IsDomainAllowDelete(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsDomainAllowGet

func IsDomainAllowGet(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsDomainAllowGetSpec

func IsDomainAllowGetSpec(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, spec string) bool

func IsDomainAllowList

func IsDomainAllowList(userCred mcclient.TokenCredential, manager IResource) rbacutils.SPolicyResult

func IsDomainAllowPerform

func IsDomainAllowPerform(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, action string) bool

func IsDomainAllowUpdate

func IsDomainAllowUpdate(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsDomainAllowUpdateSpec

func IsDomainAllowUpdateSpec(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, spec string) bool

func IsInSameClass

func IsInSameClass(ctx context.Context, cmo1, cmo2 IClassMetadataOwner) (bool, error)

func IsMetadataKeyVisible

func IsMetadataKeyVisible(key string) bool

func IsObjectRbacAllowed

func IsObjectRbacAllowed(ctx context.Context, model IModel, userCred mcclient.TokenCredential, action string, extra ...string) error

func IsProjectAllowClassPerform

func IsProjectAllowClassPerform(userCred mcclient.TokenCredential, manager IResource, action string) rbacutils.SPolicyResult

func IsProjectAllowCreate

func IsProjectAllowCreate(userCred mcclient.TokenCredential, manager IResource) rbacutils.SPolicyResult

func IsProjectAllowDelete

func IsProjectAllowDelete(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsProjectAllowGet

func IsProjectAllowGet(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsProjectAllowGetSpec

func IsProjectAllowGetSpec(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, spec string) bool

func IsProjectAllowList

func IsProjectAllowList(userCred mcclient.TokenCredential, manager IResource) rbacutils.SPolicyResult

func IsProjectAllowPerform

func IsProjectAllowPerform(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, action string) bool

func IsProjectAllowUpdate

func IsProjectAllowUpdate(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) bool

func IsProjectAllowUpdateSpec

func IsProjectAllowUpdateSpec(ctx context.Context, userCred mcclient.TokenCredential, obj IModel, spec string) bool

func JointMasterID

func JointMasterID(joint IJointModel) string

func JointModelExtra

func JointModelExtra(jointModel IJointModel) (string, string)

func JointSlaveID

func JointSlaveID(joint IJointModel) string

func ListItemFilter

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

func ListItemQueryFilters

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

func ListQueryByArchitecture

func ListQueryByArchitecture(q *sqlchemy.SQuery, fieldKey string, archs []string) *sqlchemy.SQuery

func NeedOrderQuery

func NeedOrderQuery(fieldOrders []string) bool

func NewNameValidator

func NewNameValidator(ctx context.Context, manager IModelManager, ownerId mcclient.IIdentityProvider, name string, uniqValues jsonutils.JSONObject) error

func ObjectIdQueryWithPolicyResult

func ObjectIdQueryWithPolicyResult(ctx context.Context, q *sqlchemy.SQuery, manager IModelManager, result rbacutils.SPolicyResult) *sqlchemy.SQuery

func ObjectIdQueryWithTagFilters

func ObjectIdQueryWithTagFilters(ctx context.Context, q *sqlchemy.SQuery, idField string, modelName string, filters tagutils.STagFilters) *sqlchemy.SQuery

func OrderByExtraFields

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

func OrderByFields

func OrderByFields(q *sqlchemy.SQuery, fieldOrders []string, fields []sqlchemy.IQueryField) *sqlchemy.SQuery

func OrderByStandaloneResourceName

func OrderByStandaloneResourceName(q *sqlchemy.SQuery, modelManager IStandaloneModelManager, fieldName string, orderBy string) *sqlchemy.SQuery

func Purge

func Purge(modelManager IModelManager, field string, ids []string, forceDelete bool) error

func Query2List

func Query2List(manager IModelManager, ctx context.Context, userCred mcclient.TokenCredential, q *sqlchemy.SQuery, query jsonutils.JSONObject, delayFetch bool) ([]jsonutils.JSONObject, error)

func RealDeleteModel

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

func RegistUserCredCacheUpdater

func RegistUserCredCacheUpdater()

func RegisterModelManager

func RegisterModelManager(modelMan IModelManager)

func RegisterModelManagerWithKeyword

func RegisterModelManagerWithKeyword(modelMan IModelManager, keyword string)

func RequireSameClass

func RequireSameClass(ctx context.Context, cmo1, cmo2 IClassMetadataOwner) error

func SaveMetadaManagerInContext

func SaveMetadaManagerInContext(ctx context.Context, manager *SMetadataManager) context.Context

func SaveTenantCacheManagerInContext

func SaveTenantCacheManagerInContext(ctx context.Context, manager *STenantCacheManager) context.Context

func SetChecksumTestFailedNotifier

func SetChecksumTestFailedNotifier(notifier func(obj *jsonutils.JSONDict))

func SetCustomizeNotifyHook

func SetCustomizeNotifyHook(f customizeNotifyHookFunc)

func SetExternalId

func SetExternalId(model IExternalizedModel, userCred mcclient.TokenCredential, idStr string) error

func SetStatusChangedNotifyHook

func SetStatusChangedNotifyHook(f statusChangedNotifyHookFunc)

func SetUpdateNotifyHook

func SetUpdateNotifyHook(f updateNotifyHookFunc)

func SharableGetSharedProjects

func SharableGetSharedProjects(model ISharableBaseModel, targetType string) []string

func SharableModelIsSharable

func SharableModelIsSharable(model ISharableBaseModel, reqUsrId mcclient.IIdentityProvider) bool

func SharableModelIsShared

func SharableModelIsShared(model ISharableBaseModel) bool

func SharablePerformPrivate

func SharablePerformPrivate(model ISharableBaseModel, ctx context.Context, userCred mcclient.TokenCredential) error

func StatusBasePerformStatus

func StatusBasePerformStatus(ctx context.Context, model IStatusBaseModel, userCred mcclient.TokenCredential, input apis.PerformStatusInput) error

func StatusBaseSetStatus

func StatusBaseSetStatus(ctx context.Context, model IStatusBaseModel, userCred mcclient.TokenCredential, status string, reason string) error

func TagValueKey

func TagValueKey(idx int) string

func Update

func Update(model IModel, updateFunc func() error) (sqlchemy.UpdateDiffs, error)

func UpdateModelChecksum

func UpdateModelChecksum(dbObj IRecordChecksumModel) error

func UpdateWithLock

func UpdateWithLock(ctx context.Context, model IModel, updateFunc func() error) (sqlchemy.UpdateDiffs, error)

func ValidateCreateData

func ValidateCreateData(funcName string, manager IModelManager, ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

func ValidateCreateDomainId

func ValidateCreateDomainId(domainId string) error

func ValidateDeleteCondition

func ValidateDeleteCondition(model IModel, ctx context.Context, data jsonutils.JSONObject) error

func ValidateUpdateCondition

func ValidateUpdateCondition(model IModel, ctx context.Context) error

func ValidateUpdateData

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

func ValueToError

func ValueToError(out reflect.Value) error

func ValueToJSONDict

func ValueToJSONDict(out reflect.Value) *jsonutils.JSONDict

func ValueToJSONObject

func ValueToJSONObject(out reflect.Value) jsonutils.JSONObject

Types

type AllMetadataOwner

type AllMetadataOwner map[string]string

func (AllMetadataOwner) GetAllClassMetadata

func (w AllMetadataOwner) GetAllClassMetadata() (map[string]string, error)

type Caller

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

func NewCaller

func NewCaller(model interface{}, fName string) *Caller

func (*Caller) Call

func (c *Caller) Call() ([]reflect.Value, error)

func (*Caller) Inputs

func (c *Caller) Inputs(inputs ...interface{}) *Caller

type ClassMetadataOwner

type ClassMetadataOwner map[string]string

func (ClassMetadataOwner) GetAllClassMetadata

func (w ClassMetadataOwner) GetAllClassMetadata() (map[string]string, error)

type CustomizeListFilterFunc

type CustomizeListFilterFunc func(item jsonutils.JSONObject) (bool, error)

type CustomizeListFilters

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

func NewCustomizeListFilters

func NewCustomizeListFilters() *CustomizeListFilters

func (*CustomizeListFilters) Append

func (CustomizeListFilters) DoApply

func (CustomizeListFilters) IsEmpty

func (f CustomizeListFilters) IsEmpty() bool

func (CustomizeListFilters) Len

func (f CustomizeListFilters) Len() int

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) (*printutils.ListResult, error)

func (*DBJointModelDispatcher) ListSlaveDescendent

func (dispatcher *DBJointModelDispatcher) ListSlaveDescendent(ctx context.Context, idStr string, query jsonutils.JSONObject) (*printutils.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, ctxIds []dispatcher.SResourceContext) ([]printutils.SubmitResult, error)

func (*DBModelDispatcher) ContextKeywordPlurals

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

func (*DBModelDispatcher) Create

func (*DBModelDispatcher) CustomizeHandlerInfo

func (dispatcher *DBModelDispatcher) CustomizeHandlerInfo(handler *appsrv.SHandlerInfo)

func (*DBModelDispatcher) Delete

func (*DBModelDispatcher) DeleteSpec

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

func (*DBModelDispatcher) FetchCreateHeaderData

func (dispatcher *DBModelDispatcher) FetchCreateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)

func (*DBModelDispatcher) FetchUpdateHeaderData

func (dispatcher *DBModelDispatcher) FetchUpdateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)

func (*DBModelDispatcher) Filter

func (*DBModelDispatcher) Get

func (dispatcher *DBModelDispatcher) Get(ctx context.Context, idStr string, query jsonutils.JSONObject, isHead bool) (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 (*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 (*DBModelDispatcher) UpdateSpec

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

type FilterByOwnerProvider

type FilterByOwnerProvider interface {
	Keyword() string
	KeywordPlural() string
	FilterByOwner(ctx context.Context, q *sqlchemy.SQuery, man FilterByOwnerProvider, userCred mcclient.TokenCredential, owner mcclient.IIdentityProvider, scope rbacscope.TRbacScope) *sqlchemy.SQuery
}

type IAdminSharableVirtualModel

type IAdminSharableVirtualModel interface {
	ISharableVirtualModel
	GetInfo() []string

	GetIAdminSharableVirtualModel() IAdminSharableVirtualModel
}

type IAdminSharableVirtualModelManager

type IAdminSharableVirtualModelManager interface {
	ISharableVirtualModelManager

	GetIAdminSharableVirtualModelManager() IAdminSharableVirtualModelManager

	GetRecordsSeparator() string
	GetRecordsLimit() int
	ParseInputInfo(data *jsonutils.JSONDict) ([]string, error)
}

type ICacheable

type ICacheable interface {
	GetId() string
}

type IClassMetadataOwner

type IClassMetadataOwner interface {
	GetAllClassMetadata() (map[string]string, error)
}

type IClassMetadataSetter

type IClassMetadataSetter interface {
	// a setter should first be a owner
	IClassMetadataOwner

	SetClassMetadataAll(context.Context, map[string]string, mcclient.TokenCredential) error
}

type IDomainLevelModel

type IDomainLevelModel interface {
	IStandaloneModel

	IsOwner(userCred mcclient.TokenCredential) bool

	SyncCloudDomainId(userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider)

	GetIDomainLevelModel() IDomainLevelModel

	IOwnerResourceBaseModel
}

type IDomainLevelModelManager

type IDomainLevelModelManager interface {
	IStandaloneModelManager

	GetIDomainLevelModelManager() IDomainLevelModelManager
	GetResourceCount() ([]SScopeResourceCount, error)
}

type IEnabledBase

type IEnabledBase interface {
	IModel
	IEnabledBaseInterface
}

type IEnabledBaseInterface

type IEnabledBaseInterface interface {
	SetEnabled(enabled bool)
	GetEnabled() bool
}

type IExternalizedModel

type IExternalizedModel interface {
	IModel

	GetExternalId() string
	SetExternalId(idStr string)
}

func FetchByExternalId

func FetchByExternalId(manager IModelManager, idStr string) (IExternalizedModel, error)

func FetchByExternalIdAndManagerId

func FetchByExternalIdAndManagerId(manager IModelManager, idStr string, filter func(q *sqlchemy.SQuery) *sqlchemy.SQuery) (IExternalizedModel, error)

type IExternalizedModelManager

type IExternalizedModelManager interface {
	IModelManager
	FetchByExternalId(idStr string) IExternalizedModel
}

type IHistoryDataManager

type IHistoryDataManager interface {
	HistoryDataClean(ctx context.Context, timeBefor time.Time) (int, error)
}

type IInfrasModel

type IInfrasModel interface {
	IDomainLevelModel
	ISharableBase

	GetIInfrasModel() IInfrasModel
}

type IInfrasModelManager

type IInfrasModelManager interface {
	IDomainLevelModelManager

	GetIInfrasModelManager() IInfrasModelManager
}

type IJointModel

type IJointModel interface {
	IResourceModel

	GetJointModelManager() IJointModelManager

	GetIJointModel() IJointModel

	Detach(ctx context.Context, userCred mcclient.TokenCredential) error
}

func FetchJointByIds

func FetchJointByIds(manager IJointModelManager, masterId, slaveId string, query jsonutils.JSONObject) (IJointModel, error)

type IJointModelManager

type IJointModelManager interface {
	IResourceModelManager

	GetIJointModelManager() IJointModelManager

	GetMasterManager() IStandaloneModelManager
	GetSlaveManager() IStandaloneModelManager

	GetMasterFieldName() string
	GetSlaveFieldName() string
	// FetchByIds(masterId string, slaveId string, query jsonutils.JSONObject) (IJointModel, error)
	FilterByParams(q *sqlchemy.SQuery, params jsonutils.JSONObject) *sqlchemy.SQuery
}

type IManagedResourceBase

type IManagedResourceBase interface {
	IsManaged() bool
}

type IMetadataBaseModel

type IMetadataBaseModel interface {
	OnMetadataUpdated(ctx context.Context, userCred mcclient.TokenCredential)
}

type IMetadataBaseModelManager

type IMetadataBaseModelManager interface {
	GetMetadataHiddenKeys() []string
}

type IMetadataGetter

type IMetadataGetter interface {
	GetId() string
	Keyword() string
}

type IModel

type IModel interface {
	lockman.ILockedObject
	object.IObject

	GetName() string
	GetUpdateVersion() int
	GetUpdatedAt() time.Time
	GetDeleted() bool

	KeywordPlural() string

	GetModelManager() IModelManager
	SetModelManager(IModelManager, IModel)

	GetIModel() IModel

	GetShortDesc(ctx context.Context) *jsonutils.JSONDict

	// get hooks
	GetExtraDetailsHeaders(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) map[string]string

	// before create hooks
	CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) error
	// after create hooks
	PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject)

	// allow perform action
	PerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)
	PreCheckPerformAction(ctx context.Context, userCred mcclient.TokenCredential, action string, query jsonutils.JSONObject, data 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)

	UpdateInContext(ctx context.Context, userCred mcclient.TokenCredential, ctxObjs []IModel, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

	// delete hooks
	// AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool
	// ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) 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)

	DeleteInContext(ctx context.Context, userCred mcclient.TokenCredential, ctxObjs []IModel, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

	GetOwnerId() mcclient.IIdentityProvider
	GetUniqValues() jsonutils.JSONObject

	IsSharable(reqCred mcclient.IIdentityProvider) bool

	CustomizedGetDetailsBody(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error)
	MarkDeletePreventionOn()
	MarkDeletePreventionOff()

	GetUsages() []IUsage
	GetI18N(ctx context.Context) *jsonutils.JSONDict
}

func FetchById

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

func FetchByIdOrName

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

func FetchByName

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

func FetchIModelObjects

func FetchIModelObjects(modelManager IModelManager, query *sqlchemy.SQuery) ([]IModel, error)

func NewModelObject

func NewModelObject(modelManager IModelManager) (IModel, error)

type IModelI18nBase

type IModelI18nBase interface {
	GetKeyValue() string
	Lookup(tag i18n.Tag) string
}

type IModelI18nEntry

type IModelI18nEntry interface {
	IModelI18nBase
	GetGlobalId() string
	GetObjType() string
	GetObjId() string
	GetKeyName() string
}

type IModelI18nTable

type IModelI18nTable interface {
	GetI18nEntries() map[string]IModelI18nEntry
}

type IModelManager

type IModelManager interface {
	lockman.ILockedClass
	object.IObject

	IsStandaloneManager() bool
	GetContextManagers() [][]IModelManager

	GetIModelManager() IModelManager

	GetMutableInstance(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) IModelManager
	GetImmutableInstance(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) IModelManager

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

	// Keyword() string
	// KeywordPlural() string
	Alias() string
	AliasPlural() string
	SetAlias(alias string, aliasPlural string)

	HasName() bool
	ValidateName(name string) error
	EnableGenerateName() bool

	// 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 dynamic called by dispatcher
	// ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error)
	CustomizeFilterList(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*CustomizeListFilters, error)
	ExtraSearchConditions(ctx context.Context, q *sqlchemy.SQuery, like string) []sqlchemy.ICondition
	GetExportExtraKeys(ctx context.Context, keys stringutils2.SSortedStrings, rowMap map[string]string) *jsonutils.JSONDict
	ListItemExportKeys(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, keys stringutils2.SSortedStrings) (*sqlchemy.SQuery, error)

	NewQuery(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, useRawQuery bool) *sqlchemy.SQuery
	// 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

	FilterByOwnerProvider

	FilterBySystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery
	FilterByHiddenSystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery
	FilterByUniqValues(q *sqlchemy.SQuery, uniqValues jsonutils.JSONObject) *sqlchemy.SQuery

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

	// create hooks
	// AllowCreateItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool
	// BatchCreateValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
	// ValidateCreateData dynamic called by dispatcher
	// ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
	OnCreateComplete(ctx context.Context, items []IModel, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data []jsonutils.JSONObject)
	BatchPreValidate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider,
		query jsonutils.JSONObject, data *jsonutils.JSONDict, count int) error

	OnCreateFailed(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) error

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

	InitializeData() error

	CustomizeHandlerInfo(info *appsrv.SHandlerInfo)
	SetHandlerProcessTimeout(info *appsrv.SHandlerInfo, r *http.Request) time.Duration

	FetchCreateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)
	FetchUpdateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)
	IsCustomizedGetDetailsBody() bool
	ListSkipLog(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool
	GetSkipLog(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

	// fetch owner Id from query when create resource
	FetchOwnerId(ctx context.Context, data jsonutils.JSONObject) (mcclient.IIdentityProvider, error)
	FetchUniqValues(ctx context.Context, data jsonutils.JSONObject) jsonutils.JSONObject

	/* name uniqueness scope, system/domain/project, default is system */
	NamespaceScope() rbacscope.TRbacScope
	ResourceScope() rbacscope.TRbacScope

	// 如果error为非空,说明没有匹配的field,如果为空,说明匹配上了
	QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)
	QueryDistinctExtraFields(q *sqlchemy.SQuery, resource string, fields []string) (*sqlchemy.SQuery, error)

	GetPagingConfig() *SPagingConfig

	GetI18N(ctx context.Context, idstr string, resObj jsonutils.JSONObject) *jsonutils.JSONDict

	GetSplitTable() *splitable.SSplitTableSpec

	CreateByInsertOrUpdate() bool

	CustomizedTotalCount(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, totalQ *sqlchemy.SQuery) (int, jsonutils.JSONObject, error)

	PrepareQueryContext(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) context.Context

	RegisterExtraHook(eh IModelManagerExtraHook)
	GetExtraHook() IModelManagerExtraHook
}

func GetModelManager

func GetModelManager(keyword string) IModelManager

type IModelManagerExtraHook

type IModelManagerExtraHook interface {
	AfterPostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, model IModel, query jsonutils.JSONObject, data jsonutils.JSONObject) error
}

type IOwnerResourceBaseModel

type IOwnerResourceBaseModel interface {
	GetChangeOwnerCandidateDomainIds() []string
	GetChangeOwnerRequiredDomainIds() []string
}

type IPendingDeletable

type IPendingDeletable interface {
	GetPendingDeleted() bool
	GetPendingDeletedAt() time.Time
}

type IRecordChecksumModel

type IRecordChecksumModel interface {
	IModel
	IRecordChecksumResourceBase
}

func IsModelEnableRecordChecksum

func IsModelEnableRecordChecksum(model IModel) (IRecordChecksumModel, bool)

type IRecordChecksumModelManager

type IRecordChecksumModelManager interface {
	IModelManager
	EnableRecordChecksum() bool
	SetEnableRecordChecksum(bool)
}

type IRecordChecksumResourceBase

type IRecordChecksumResourceBase interface {
	GetRecordChecksum() string
	SetRecordChecksum(checksum string)
}

type IResource

type IResource interface {
	KeywordPlural() string
}

type IResourceCountManager

type IResourceCountManager interface {
	GetResourceCount() ([]SScopeResourceCount, error)
	KeywordPlural() string
}

type IResourceModel

type IResourceModel interface {
	IModel

	GetIResourceModel() IResourceModel
}

type IResourceModelManager

type IResourceModelManager interface {
	IModelManager

	GetIResourceModelManager() IResourceModelManager
}

type IScopedResourceManager

type IScopedResourceManager interface {
	KeywordPlural() string
	ResourceScope() rbacscope.TRbacScope
	FetchOwnerId(ctx context.Context, data jsonutils.JSONObject) (mcclient.IIdentityProvider, error)
}

type IScopedResourceModel

type IScopedResourceModel interface {
	IModel

	GetDomainId() string
	GetProjectId() string
	SetResourceScope(domainId, projectId string) error
}

type ISharableBase

type ISharableBase interface {
	SetShare(scoe rbacscope.TRbacScope)
	GetIsPublic() bool
	GetPublicScope() rbacscope.TRbacScope
	GetSharableTargetDomainIds() []string
	GetRequiredSharedDomainIds() []string
	GetSharedDomains() []string
}

type ISharableBaseModel

type ISharableBaseModel interface {
	IStandaloneModel
	ISharableBase
}

type ISharableVirtualModel

type ISharableVirtualModel interface {
	IVirtualModel
	ISharableBase

	GetISharableVirtualModel() ISharableVirtualModel
	GetSharedProjects() []string
}

type ISharableVirtualModelManager

type ISharableVirtualModelManager interface {
	IVirtualModelManager

	GetISharableVirtualModelManager() ISharableVirtualModelManager
}

type IStandaloneModel

type IStandaloneModel interface {
	IResourceModel

	SetName(name string)
	MarkPendingDeleted()
	CancelPendingDeleted()

	StandaloneModelManager() IStandaloneModelManager

	GetIStandaloneModel() IStandaloneModel
	ClearSchedDescCache() error

	GetMetadata(ctx context.Context, key string, userCred mcclient.TokenCredential) string
	GetMetadataJson(ctx context.Context, key string, userCred mcclient.TokenCredential) jsonutils.JSONObject
	SetMetadata(ctx context.Context, key string, value interface{}, userCred mcclient.TokenCredential) error
	SetAllMetadata(ctx context.Context, dictstore map[string]interface{}, userCred mcclient.TokenCredential) error

	SetUserMetadataValues(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential) error
	SetUserMetadataAll(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential) error
	SetCloudMetadataAll(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential, readOnly bool) error
	SetOrganizationMetadataAll(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential) error
	SetSysCloudMetadataAll(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential, readOnly bool) error

	RemoveMetadata(ctx context.Context, key string, userCred mcclient.TokenCredential) error
	RemoveAllMetadata(ctx context.Context, userCred mcclient.TokenCredential) error
	GetAllMetadata(ctx context.Context, userCred mcclient.TokenCredential) (map[string]string, error)
	GetAllClassMetadata() (map[string]string, error)

	IsShared() bool

	IMetadataBaseModel
}

func JointMaster

func JointMaster(joint IJointModel) IStandaloneModel

func JointSlave

func JointSlave(joint IJointModel) IStandaloneModel

type IStandaloneModelManager

type IStandaloneModelManager interface {
	IResourceModelManager

	GetIStandaloneModelManager() IStandaloneModelManager

	IMetadataBaseModelManager
}

type IStatusBase

type IStatusBase interface {
	SetStatusValue(status string)
	GetStatus() string
	SetProgressValue(progress float32)
	GetProgress() float32
}

type IStatusBaseModel

type IStatusBaseModel interface {
	IModel
	IStatusBase
}

type IStatusDomainLevelModel

type IStatusDomainLevelModel interface {
	IDomainLevelModel
	IStatusBase
}

type IStatusInfrasModel

type IStatusInfrasModel interface {
	IInfrasModel
	IStatusBase
}

type IStatusStandaloneModel

type IStatusStandaloneModel interface {
	IStandaloneModel
	IStatusBase
}

type ITableSpec

type ITableSpec interface {
	Name() string
	Columns() []sqlchemy.IColumnSpec
	PrimaryColumns() []sqlchemy.IColumnSpec
	DataType() reflect.Type
	// CreateSQL() string
	Instance() *sqlchemy.STable
	ColumnSpec(name string) sqlchemy.IColumnSpec
	Insert(ctx context.Context, dt interface{}) error
	InsertOrUpdate(ctx context.Context, dt interface{}) error
	Update(ctx context.Context, dt interface{}, doUpdate func() error) (sqlchemy.UpdateDiffs, error)
	Fetch(dt interface{}) error
	// FetchAll(dest interface{}) error
	SyncSQL() []string
	Sync() error
	DropForeignKeySQL() []string
	AddIndex(unique bool, cols ...string) bool
	Increment(ctx context.Context, diff interface{}, target interface{}) error
	Decrement(ctx context.Context, diff interface{}, target interface{}) error

	GetSplitTable() *splitable.SSplitTableSpec

	GetTableSpec() *sqlchemy.STableSpec

	GetDBName() sqlchemy.DBName

	InformUpdate(ctx context.Context, dt interface{}, oldObj *jsonutils.JSONDict)
}

type IUsage

type IUsage interface {
	FetchUsage(ctx context.Context) error
	IsEmpty() bool
}

type IUserModelManager

type IUserModelManager interface {
	IStandaloneModelManager

	GetIUserModelManager() IUserModelManager
	GetResourceCount() ([]SScopeResourceCount, error)
}

type IVirtualModel

type IVirtualModel interface {
	IStandaloneModel
	IPendingDeletable

	IsOwner(userCred mcclient.TokenCredential) bool

	SetProjectSrc(apis.TOwnerSource)
	SyncCloudProjectId(userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider)

	GetIVirtualModel() IVirtualModel

	IOwnerResourceBaseModel
}

type IVirtualModelManager

type IVirtualModelManager interface {
	IStandaloneModelManager

	GetIVirtualModelManager() IVirtualModelManager
	GetResourceCount() ([]SScopeResourceCount, error)
}

type ListItemExportKeysProvider

type ListItemExportKeysProvider interface {
	ListItemExportKeys(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, keys stringutils2.SSortedStrings) (*sqlchemy.SQuery, error)
}

type QueryDistinctExtraFieldProvider

type QueryDistinctExtraFieldProvider interface {
	QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)
}

type SAdminSharableVirtualResourceBase

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

func (*SAdminSharableVirtualResourceBase) AddInfo

func (*SAdminSharableVirtualResourceBase) GetIAdminSharableVirtualModel

func (model *SAdminSharableVirtualResourceBase) GetIAdminSharableVirtualModel() IAdminSharableVirtualModel

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) FetchCustomizeColumns

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

func (*SAdminSharableVirtualResourceBaseManager) GetIAdminSharableVirtualModelManager

func (manager *SAdminSharableVirtualResourceBaseManager) GetIAdminSharableVirtualModelManager() IAdminSharableVirtualModelManager

func (*SAdminSharableVirtualResourceBaseManager) ListItemFilter

func (*SAdminSharableVirtualResourceBaseManager) OrderByExtraFields

func (*SAdminSharableVirtualResourceBaseManager) QueryDistinctExtraFields

func (manager *SAdminSharableVirtualResourceBaseManager) QueryDistinctExtraFields(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SAdminSharableVirtualResourceBaseManager) ValidateRecordsData

type SAutoDeleteResourceBase

type SAutoDeleteResourceBase struct {
	// 是否跟随资源自动删除
	// example: false
	AutoDelete bool `nullable:"false" default:"false" get:"user" update:"user" json:"auto_delete"`
}

+onecloud:model-api-gen

func (*SAutoDeleteResourceBase) SetAutoDelete

func (self *SAutoDeleteResourceBase) SetAutoDelete(model IModel, userCred mcclient.TokenCredential, autoDelete bool) error

type SAutoDeleteResourceBaseManager

type SAutoDeleteResourceBaseManager struct{}

func (*SAutoDeleteResourceBaseManager) ListItemFilter

type SCacheManager

type SCacheManager[T ICacheable] struct {
	// contains filtered or unexported fields
}

func NewCacheManager

func NewCacheManager[T ICacheable](manager IStandaloneModelManager) *SCacheManager[T]

func (*SCacheManager[T]) Delete

func (cm *SCacheManager[T]) Delete(obj *T)

func (*SCacheManager[T]) FetchById

func (cm *SCacheManager[T]) FetchById(id string) (*T, error)

func (*SCacheManager[T]) Invalidate

func (cm *SCacheManager[T]) Invalidate()

func (*SCacheManager[T]) Range

func (cm *SCacheManager[T]) Range(proc func(key interface{}, value interface{}) bool)

func (*SCacheManager[T]) Update

func (cm *SCacheManager[T]) Update(obj *T)

type SCachedTenant

type SCachedTenant struct {
	Id               string            `json:"id"`
	Name             string            `json:"name"`
	DomainId         string            `json:"domain_id"`
	ProjectDomain    string            `json:"project_domain"`
	Metadata         map[string]string `json:"metadata"`
	PendingDeleted   bool              `json:"pending_deleted"`
	PendingDeletedAt time.Time         `json:"pending_deleted_at"`
}

type SCachedUser

type SCachedUser struct {
	SCachedTenant
	Lang string
}

type SCertificateResourceBase

type SCertificateResourceBase struct {
	Certificate string `create:"required" list:"user" update:"user"`
	PrivateKey  string `create:"required" list:"admin" update:"user"`

	// derived attributes
	PublicKeyAlgorithm      string    `create:"optional" list:"user" update:"user"`
	PublicKeyBitLen         int       `create:"optional" list:"user" update:"user"`
	SignatureAlgorithm      string    `create:"optional" list:"user" update:"user"`
	Fingerprint             string    `create:"optional" list:"user" update:"user"`
	NotBefore               time.Time `create:"optional" list:"user" update:"user"`
	NotAfter                time.Time `create:"optional" list:"user" update:"user"`
	CommonName              string    `create:"optional" list:"user" update:"user"`
	SubjectAlternativeNames string    `create:"optional" list:"user" update:"user"`
}

+onecloud:model-api-gen

type SDistinctField

type SDistinctField struct {
	SModelBase

	// 资源类型
	// example: network
	ObjType string `width:"40" charset:"ascii" index:"true" list:"user" get:"user"`

	// 资源组合ID
	// example: obj_type::key::value
	Id string `width:"128" charset:"utf8" primary:"true" list:"user" get:"user"`

	// Distinct Field
	// exmaple: 部门
	Key string `width:"64" charset:"utf8" primary:"true" list:"user" get:"user"`

	// Distinct Value
	// example: 技术部
	Value string `charset:"utf8" list:"user" get:"user"`
}

type SDistinctFieldManager

type SDistinctFieldManager struct {
	SModelBaseManager
}
var DistinctFieldManager *SDistinctFieldManager

func (*SDistinctFieldManager) GetObjectDistinctFields

func (manager *SDistinctFieldManager) GetObjectDistinctFields(objType string) ([]SDistinctField, error)

func (*SDistinctFieldManager) InsertOrUpdate

func (manager *SDistinctFieldManager) InsertOrUpdate(ctx context.Context, modelManager IModelManager, key, value string) error

type SDnsNameValidatorManager

type SDnsNameValidatorManager struct{}

func (*SDnsNameValidatorManager) ValidateName

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

type SDomainLevelResourceBase

type SDomainLevelResourceBase struct {
	SStandaloneResourceBase
	SDomainizedResourceBase

	// 归属Domain信息的来源, local: 本地设置, cloud: 从云上同步过来
	// example: local
	DomainSrc string `width:"10" charset:"ascii" nullable:"true" list:"user" default:"" json:"domain_src"`
}

func (*SDomainLevelResourceBase) CustomizeCreate

func (*SDomainLevelResourceBase) DomainLevelModelManager

func (model *SDomainLevelResourceBase) DomainLevelModelManager() IDomainLevelModelManager

func (*SDomainLevelResourceBase) GetDetailsChangeOwnerCandidateDomains

func (model *SDomainLevelResourceBase) GetDetailsChangeOwnerCandidateDomains(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (apis.ChangeOwnerCandidateDomainsOutput, error)

func (*SDomainLevelResourceBase) GetIDomainLevelModel

func (model *SDomainLevelResourceBase) GetIDomainLevelModel() IDomainLevelModel

func (*SDomainLevelResourceBase) IsOwner

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

func (*SDomainLevelResourceBase) PerformChangeOwner

func (*SDomainLevelResourceBase) SyncCloudDomainId

func (model *SDomainLevelResourceBase) SyncCloudDomainId(userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider)

type SDomainLevelResourceBaseManager

type SDomainLevelResourceBaseManager struct {
	SStandaloneResourceBaseManager
	SDomainizedResourceBaseManager
}

func NewDomainLevelResourceBaseManager

func NewDomainLevelResourceBaseManager(
	dt interface{},
	tableName string,
	keyword string,
	keywordPlural string,
) SDomainLevelResourceBaseManager

func (*SDomainLevelResourceBaseManager) FetchCustomizeColumns

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

func (*SDomainLevelResourceBaseManager) GetIDomainLevelModelManager

func (manager *SDomainLevelResourceBaseManager) GetIDomainLevelModelManager() IDomainLevelModelManager

func (*SDomainLevelResourceBaseManager) GetPropertyDomainTagValuePairs

func (manager *SDomainLevelResourceBaseManager) GetPropertyDomainTagValuePairs(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
) (jsonutils.JSONObject, error)

func (*SDomainLevelResourceBaseManager) GetPropertyDomainTagValueTree

func (manager *SDomainLevelResourceBaseManager) GetPropertyDomainTagValueTree(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
) (jsonutils.JSONObject, error)

func (*SDomainLevelResourceBaseManager) GetResourceCount

func (domainman *SDomainLevelResourceBaseManager) GetResourceCount() ([]SScopeResourceCount, error)

func (*SDomainLevelResourceBaseManager) ListItemExportKeys

func (*SDomainLevelResourceBaseManager) ListItemFilter

func (*SDomainLevelResourceBaseManager) OrderByExtraFields

func (*SDomainLevelResourceBaseManager) QueryDistinctExtraField

func (manager *SDomainLevelResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SDomainizedResourceBase

type SDomainizedResourceBase struct {
	// 域Id
	DomainId string `width:"64" charset:"ascii" default:"default" nullable:"false" index:"true" list:"user" json:"domain_id"`
}

func (*SDomainizedResourceBase) GetChangeOwnerCandidateDomainIds

func (model *SDomainizedResourceBase) GetChangeOwnerCandidateDomainIds() []string

returns candiate domain Id list that the resource can change owner to nil or empty means any domain

func (*SDomainizedResourceBase) GetChangeOwnerRequiredDomainIds

func (model *SDomainizedResourceBase) GetChangeOwnerRequiredDomainIds() []string

func (*SDomainizedResourceBase) GetOwnerId

type SDomainizedResourceBaseManager

type SDomainizedResourceBaseManager struct {
}

func (*SDomainizedResourceBaseManager) FetchCustomizeColumns

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

func (*SDomainizedResourceBaseManager) FetchOwnerId

func (*SDomainizedResourceBaseManager) FilterByOwner

func (*SDomainizedResourceBaseManager) ListItemExportKeys

func (*SDomainizedResourceBaseManager) ListItemFilter

func (*SDomainizedResourceBaseManager) NamespaceScope

func (manager *SDomainizedResourceBaseManager) NamespaceScope() rbacscope.TRbacScope

func (*SDomainizedResourceBaseManager) OrderByExtraFields

func (*SDomainizedResourceBaseManager) QueryDistinctExtraField

func (manager *SDomainizedResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SDomainizedResourceBaseManager) ResourceScope

func (manager *SDomainizedResourceBaseManager) ResourceScope() rbacscope.TRbacScope

type SEmptyExtraHook

type SEmptyExtraHook struct{}

func NewEmptyExtraHook

func NewEmptyExtraHook() *SEmptyExtraHook

func (SEmptyExtraHook) AfterPostCreate

type SEnabledResourceBase

type SEnabledResourceBase struct {
	// 资源是否启用
	Enabled tristate.TriState `default:"false" list:"user" create:"optional"`
}

func (*SEnabledResourceBase) GetEnabled

func (m *SEnabledResourceBase) GetEnabled() bool

func (*SEnabledResourceBase) SetEnabled

func (m *SEnabledResourceBase) SetEnabled(enabled bool)

type SEnabledResourceBaseManager

type SEnabledResourceBaseManager struct{}

func (*SEnabledResourceBaseManager) ListItemFilter

type SEnabledStatusDomainLevelResourceBase

type SEnabledStatusDomainLevelResourceBase struct {
	SStatusDomainLevelResourceBase
	SEnabledResourceBase
}

func (*SEnabledStatusDomainLevelResourceBase) PerformDisable

禁用资源

func (*SEnabledStatusDomainLevelResourceBase) PerformEnable

启用资源

type SEnabledStatusDomainLevelResourceBaseManager

type SEnabledStatusDomainLevelResourceBaseManager struct {
	SStatusDomainLevelResourceBaseManager
	SEnabledResourceBaseManager
}

func NewEnabledStatusDomainLevelResourceBaseManager

func NewEnabledStatusDomainLevelResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SEnabledStatusDomainLevelResourceBaseManager

func (*SEnabledStatusDomainLevelResourceBaseManager) FetchCustomizeColumns

func (*SEnabledStatusDomainLevelResourceBaseManager) ListItemFilter

func (*SEnabledStatusDomainLevelResourceBaseManager) OrderByExtraFields

func (*SEnabledStatusDomainLevelResourceBaseManager) QueryDistinctExtraField

func (manager *SEnabledStatusDomainLevelResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SEnabledStatusInfrasResourceBase

type SEnabledStatusInfrasResourceBase struct {
	SStatusInfrasResourceBase
	SEnabledResourceBase
}

func (*SEnabledStatusInfrasResourceBase) PerformDisable

禁用资源

func (*SEnabledStatusInfrasResourceBase) PerformEnable

启用资源

type SEnabledStatusInfrasResourceBaseManager

type SEnabledStatusInfrasResourceBaseManager struct {
	SStatusInfrasResourceBaseManager
	SEnabledResourceBaseManager
}

func NewEnabledStatusInfrasResourceBaseManager

func NewEnabledStatusInfrasResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SEnabledStatusInfrasResourceBaseManager

func (*SEnabledStatusInfrasResourceBaseManager) FetchCustomizeColumns

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

func (*SEnabledStatusInfrasResourceBaseManager) GetPropertyStatistics

func (*SEnabledStatusInfrasResourceBaseManager) ListItemFilter

func (*SEnabledStatusInfrasResourceBaseManager) OrderByExtraFields

func (*SEnabledStatusInfrasResourceBaseManager) QueryDistinctExtraField

func (manager *SEnabledStatusInfrasResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SEnabledStatusStandaloneResourceBase

type SEnabledStatusStandaloneResourceBase struct {
	SStatusStandaloneResourceBase
	SEnabledResourceBase
}

func (*SEnabledStatusStandaloneResourceBase) PerformDisable

禁用资源

func (*SEnabledStatusStandaloneResourceBase) PerformEnable

启用资源

type SEnabledStatusStandaloneResourceBaseManager

type SEnabledStatusStandaloneResourceBaseManager struct {
	SStatusStandaloneResourceBaseManager
	SEnabledResourceBaseManager
}

func NewEnabledStatusStandaloneResourceBaseManager

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

func (*SEnabledStatusStandaloneResourceBaseManager) FetchCustomizeColumns

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

func (*SEnabledStatusStandaloneResourceBaseManager) ListItemFilter

func (*SEnabledStatusStandaloneResourceBaseManager) OrderByExtraFields

func (*SEnabledStatusStandaloneResourceBaseManager) QueryDistinctExtraField

func (manager *SEnabledStatusStandaloneResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SEncryptedResource

type SEncryptedResource struct {
	// 加密密钥ID
	EncryptKeyId string `width:"32" charset:"ascii" nullable:"true" get:"user" list:"user" create:"optional"`
}

+onecloud:model-api-gen

func (*SEncryptedResource) CustomizeCreate

func (res *SEncryptedResource) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, data jsonutils.JSONObject, nameHint string) error

func (*SEncryptedResource) GetEncryptInfo

func (res *SEncryptedResource) GetEncryptInfo(
	ctx context.Context,
	userCred mcclient.TokenCredential,
) (apis.SEncryptInfo, error)

func (*SEncryptedResource) IsEncrypted

func (res *SEncryptedResource) IsEncrypted() bool

func (*SEncryptedResource) ValidateEncryption

func (res *SEncryptedResource) ValidateEncryption(ctx context.Context, userCred mcclient.TokenCredential) error

type SEncryptedResourceManager

type SEncryptedResourceManager struct {
}

func (*SEncryptedResourceManager) FetchCustomizeColumns

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

func (*SEncryptedResourceManager) ValidateCreateData

type SExternalizedResourceBase

type SExternalizedResourceBase struct {
	// 云上Id, 对应云上资源自身Id
	ExternalId string `width:"256" charset:"utf8" index:"true" list:"user" create:"domain_optional" update:"admin" json:"external_id"`

	// 资源导入时间
	ImportedAt time.Time `nullable:"true" created_at:"true" index:"true" get:"user" list:"user" json:"imported_at"`
	// 资源来源, cloud: 从云上同步下来的资源, local: 从本地创建的资源或资源在本地更改过项目
	Source string `width:"12" charset:"ascii" get:"user" list:"user" create:"optional" json:"source"`
}

+onecloud:model-api-gen

func (*SExternalizedResourceBase) BeforeInsert

func (model *SExternalizedResourceBase) BeforeInsert()

func (SExternalizedResourceBase) GetExternalId

func (model SExternalizedResourceBase) GetExternalId() string

func (*SExternalizedResourceBase) SetExternalId

func (model *SExternalizedResourceBase) SetExternalId(idStr string)

type SExternalizedResourceBaseManager

type SExternalizedResourceBaseManager struct{}

func (*SExternalizedResourceBaseManager) ListItemFilter

type SGetResourceTagValuePairsInput

type SGetResourceTagValuePairsInput struct {
	apis.MetadataBaseFilterInput

	// Return keys only
	KeyOnly *bool `json:"key_only"`

	// Order by key of tags
	OrderByTagKey string `json:"order_by_tag_key"`
}

type SGetResourceTagValueTreeInput

type SGetResourceTagValueTreeInput struct {
	Keys    []string `json:"key"`
	ShowMap *bool    `json:"show_map"`
}

type SHostNameValidatorManager

type SHostNameValidatorManager struct{}

func (*SHostNameValidatorManager) ValidateName

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

type SI18n

type SI18n struct {
	SModelBase

	// 资源类型
	// example: network
	ObjType string `width:"40" charset:"ascii" list:"user" get:"user" primary:"true"`

	// 资源ID
	// example: 87321a70-1ecb-422a-8b0c-c9aa632a46a7
	ObjId string `width:"88" charset:"ascii" list:"user" get:"user" primary:"true"`

	// 资源KEY
	// exmaple: name
	KeyName string `width:"64" charset:"utf8" list:"user" get:"user" primary:"true"`

	// 资源原始值
	// example: 技术部
	KeyValue string `charset:"utf8" list:"user" get:"user"`

	// KeyValue 对应中文翻译
	Cn string `charset:"utf8" list:"user" get:"user"`

	// KeyValue 对应英文翻译
	En string `charset:"utf8" list:"user" get:"user"`
}

func (SI18n) GetExternalId

func (in SI18n) GetExternalId() string

func (*SI18n) Lookup

func (in *SI18n) Lookup(ctx context.Context) string

type SI18nManager

type SI18nManager struct {
	SModelBaseManager
}
var I18nManager *SI18nManager

func (*SI18nManager) GetModelI18N

func (manager *SI18nManager) GetModelI18N(ctx context.Context, model IModel) ([]SI18n, error)

func (*SI18nManager) GetModelKeyI18N

func (manager *SI18nManager) GetModelKeyI18N(ctx context.Context, model IModel, keyName string) ([]SI18n, error)

func (*SI18nManager) SyncI18ns

func (manager *SI18nManager) SyncI18ns(ctx context.Context, userCred mcclient.TokenCredential, model IModel, table IModelI18nTable) error

type SInfrasResourceBase

type SInfrasResourceBase struct {
	SDomainLevelResourceBase
	SSharableBaseResource `"is_public->create":"domain_optional" "public_scope->create":"domain_optional"`
}

func (*SInfrasResourceBase) CustomizeCreate

func (*SInfrasResourceBase) Delete

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

func (*SInfrasResourceBase) GetIInfrasModel

func (model *SInfrasResourceBase) GetIInfrasModel() IInfrasModel

func (*SInfrasResourceBase) GetRequiredSharedDomainIds

func (model *SInfrasResourceBase) GetRequiredSharedDomainIds() []string

func (*SInfrasResourceBase) GetSharableTargetDomainIds

func (model *SInfrasResourceBase) GetSharableTargetDomainIds() []string

func (*SInfrasResourceBase) GetSharedDomains

func (model *SInfrasResourceBase) GetSharedDomains() []string

func (*SInfrasResourceBase) GetSharedInfo

func (model *SInfrasResourceBase) GetSharedInfo() apis.SShareInfo

func (*SInfrasResourceBase) IsSharable

func (model *SInfrasResourceBase) IsSharable(reqUsrId mcclient.IIdentityProvider) bool

func (*SInfrasResourceBase) IsShared

func (model *SInfrasResourceBase) IsShared() bool

func (*SInfrasResourceBase) PerformChangeOwner

func (*SInfrasResourceBase) PerformPrivate

func (*SInfrasResourceBase) PerformPublic

func (*SInfrasResourceBase) SaveSharedInfo

func (model *SInfrasResourceBase) SaveSharedInfo(src apis.TOwnerSource, ctx context.Context, userCred mcclient.TokenCredential, si apis.SShareInfo)

func (*SInfrasResourceBase) SyncShareState

func (model *SInfrasResourceBase) SyncShareState(ctx context.Context, userCred mcclient.TokenCredential, shareInfo apis.SAccountShareInfo)

func (*SInfrasResourceBase) ValidateUpdateData

type SInfrasResourceBaseManager

type SInfrasResourceBaseManager struct {
	SDomainLevelResourceBaseManager
	SSharableBaseResourceManager
}

func NewInfrasResourceBaseManager

func NewInfrasResourceBaseManager(
	dt interface{},
	tableName string,
	keyword string,
	keywordPlural string,
) SInfrasResourceBaseManager

func (*SInfrasResourceBaseManager) FetchCustomizeColumns

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

func (*SInfrasResourceBaseManager) FilterByOwner

func (*SInfrasResourceBaseManager) GetIInfrasModelManager

func (manager *SInfrasResourceBaseManager) GetIInfrasModelManager() IInfrasModelManager

func (*SInfrasResourceBaseManager) ListItemFilter

func (*SInfrasResourceBaseManager) OrderByExtraFields

func (*SInfrasResourceBaseManager) QueryDistinctExtraField

func (manager *SInfrasResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SJointResourceBase

type SJointResourceBase struct {
	SResourceBase

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

func (*SJointResourceBase) GetIJointModel

func (joint *SJointResourceBase) GetIJointModel() IJointModel

func (*SJointResourceBase) GetJointModelManager

func (joint *SJointResourceBase) GetJointModelManager() IJointModelManager

func (*SJointResourceBase) ValidateUpdateData

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) CreateByInsertOrUpdate

func (manager *SJointResourceBaseManager) CreateByInsertOrUpdate() bool

func (*SJointResourceBaseManager) FetchCustomizeColumns

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

func (*SJointResourceBaseManager) FilterByParams

func (manager *SJointResourceBaseManager) FilterByParams(q *sqlchemy.SQuery, params jsonutils.JSONObject) *sqlchemy.SQuery

func (*SJointResourceBaseManager) GetIJointModelManager

func (manager *SJointResourceBaseManager) GetIJointModelManager() IJointModelManager

func (*SJointResourceBaseManager) GetMasterManager

func (manager *SJointResourceBaseManager) GetMasterManager() IStandaloneModelManager

func (*SJointResourceBaseManager) GetSlaveManager

func (manager *SJointResourceBaseManager) GetSlaveManager() IStandaloneModelManager

func (*SJointResourceBaseManager) HistoryDataClean

func (manager *SJointResourceBaseManager) HistoryDataClean(ctx context.Context, timeBefor time.Time) (int, error)

func (*SJointResourceBaseManager) ListItemFilter

func (*SJointResourceBaseManager) NamespaceScope

func (manager *SJointResourceBaseManager) NamespaceScope() rbacscope.TRbacScope

func (*SJointResourceBaseManager) OrderByExtraFields

func (*SJointResourceBaseManager) ResourceScope

func (manager *SJointResourceBaseManager) ResourceScope() rbacscope.TRbacScope

type SKeystoneCacheObject

type SKeystoneCacheObject struct {
	SStandaloneResourceBase
	SPendingDeletedBase

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

	LastCheck time.Time `nullable:"true"`
	Lang      string    `width:"8" charset:"ascii" nullable:"true" list:"domain" update:"domain" create:"domain_optional"`
}

func NewKeystoneCacheObject

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

func (*SKeystoneCacheObject) IsExpired

func (t *SKeystoneCacheObject) IsExpired() bool

type SKeystoneCacheObjectManager

type SKeystoneCacheObjectManager struct {
	SStandaloneResourceBaseManager
}

func NewKeystoneCacheObjectManager

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

type SLogBase

type SLogBase struct {
	SModelBase

	Id int64 `primary:"true" auto_increment:"true" list:"user" clickhouse_partition_by:"toInt64(id/100000000000)"`
}

func (*SLogBase) BeforeInsert

func (opslog *SLogBase) BeforeInsert()

func (*SLogBase) GetId

func (opslog *SLogBase) GetId() string

func (*SLogBase) GetRecordTime

func (lb *SLogBase) GetRecordTime() time.Time

func (*SLogBase) ValidateDeleteCondition

func (self *SLogBase) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error

func (*SLogBase) ValidateUpdateData

func (l *SLogBase) ValidateUpdateData(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
	data jsonutils.JSONObject,
) (jsonutils.JSONObject, error)

type SLogBaseManager

type SLogBaseManager struct {
	SModelBaseManager
}

func NewLogBaseManager

func NewLogBaseManager(model interface{}, table string, keyword, keywordPlural string, timeCol string, useClickHouse bool) SLogBaseManager

func (*SLogBaseManager) CreateByInsertOrUpdate

func (manager *SLogBaseManager) CreateByInsertOrUpdate() bool

func (*SLogBaseManager) FetchById

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

func (*SLogBaseManager) FilterById

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

func (*SLogBaseManager) FilterByName

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

func (*SLogBaseManager) FilterByNotId

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

func (*SLogBaseManager) GetPagingConfig

func (manager *SLogBaseManager) GetPagingConfig() *SPagingConfig

type SMetadata

type SMetadata struct {
	SModelBase

	// 资源类型
	// example: network
	ObjType string `width:"40" charset:"ascii" index:"true" list:"user" get:"user"`

	// 资源ID
	// example: 87321a70-1ecb-422a-8b0c-c9aa632a46a7
	ObjId string `width:"88" charset:"ascii" index:"true" list:"user" get:"user"`

	// 资源组合ID
	// example: network::87321a70-1ecb-422a-8b0c-c9aa632a46a7
	Id string `width:"128" charset:"ascii" primary:"true" list:"user" get:"user"`

	// 标签KEY
	// exmaple: 部门
	Key string `width:"64" charset:"utf8" primary:"true" list:"user" get:"user"`

	// 标签值
	// example: 技术部
	Value string `charset:"utf8" list:"user" get:"user"`

	// 更新时间
	UpdatedAt time.Time `nullable:"false" updated_at:"true"`

	// 是否被删除
	Deleted bool `nullable:"false" default:"false" index:"true"`
}

func (*SMetadata) Delete

func (m *SMetadata) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SMetadata) GetId

func (m *SMetadata) GetId() string

func (*SMetadata) GetName

func (m *SMetadata) GetName() string

func (*SMetadata) MarkDelete

func (m *SMetadata) MarkDelete() error

type SMetadataManager

type SMetadataManager struct {
	SModelBaseManager
}
var Metadata *SMetadataManager

func GetMetadaManagerInContext

func GetMetadaManagerInContext(ctx context.Context) *SMetadataManager

func (*SMetadataManager) GetAll

func (manager *SMetadataManager) GetAll(ctx context.Context, obj IMetadataGetter, keys []string, keyPrefix string, userCred mcclient.TokenCredential) (map[string]string, error)

func (*SMetadataManager) GetJsonValue

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

func (*SMetadataManager) GetPropertyTagValuePairs

func (manager *SMetadataManager) GetPropertyTagValuePairs(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	input apis.MetaGetPropertyTagValuePairsInput,
) (*printutils.ListResult, error)

func (*SMetadataManager) GetStringValue

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

func (*SMetadataManager) GetSysadminKey

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

func (*SMetadataManager) InitializeData

func (manager *SMetadataManager) InitializeData() error

func (*SMetadataManager) ListItemFilter

func (manager *SMetadataManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, input apis.MetadataListInput) (*sqlchemy.SQuery, error)

元数据(标签)列表

func (*SMetadataManager) Query

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

func (*SMetadataManager) RawQuery

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

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, delRange string) error

func (*SMetadataManager) SetAllWithoutDelelte

func (manager *SMetadataManager) SetAllWithoutDelelte(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

func (*SMetadataManager) SetValuesWithLog

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

type SMetadataResourceBaseModelManager

type SMetadataResourceBaseModelManager struct{}

func (*SMetadataResourceBaseModelManager) FetchCustomizeColumns

func (meta *SMetadataResourceBaseModelManager) FetchCustomizeColumns(
	manager IModelManager,
	userCred mcclient.TokenCredential,
	objs []interface{},
	fields stringutils2.SSortedStrings,
) []apis.MetadataResourceInfo

func (*SMetadataResourceBaseModelManager) GetExportExtraKeys

func (meta *SMetadataResourceBaseModelManager) GetExportExtraKeys(keys stringutils2.SSortedStrings, rowMap map[string]string) *jsonutils.JSONDict

func (*SMetadataResourceBaseModelManager) ListItemExportKeys

func (*SMetadataResourceBaseModelManager) ListItemFilter

func (*SMetadataResourceBaseModelManager) OrderByExtraFields

func (*SMetadataResourceBaseModelManager) QueryDistinctExtraField

func (meta *SMetadataResourceBaseModelManager) QueryDistinctExtraField(manager IModelManager, q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SModelBase

type SModelBase struct {
	object.SObject
	// 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) AllowUpdateItem

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

update hooks

func (*SModelBase) CancelPendingDeleted

func (model *SModelBase) CancelPendingDeleted()

func (*SModelBase) CustomizeCreate

func (model *SModelBase) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, 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) CustomizedGetDetailsBody

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

func (*SModelBase) Delete

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

func (*SModelBase) DeleteInContext

func (model *SModelBase) DeleteInContext(ctx context.Context, userCred mcclient.TokenCredential, ctxObjs []IModel, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SModelBase) GetDeleted

func (model *SModelBase) GetDeleted() bool

func (*SModelBase) GetExtraDetailsHeaders

func (model *SModelBase) GetExtraDetailsHeaders(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) map[string]string

func (*SModelBase) GetI18N

func (model *SModelBase) GetI18N(ctx context.Context) *jsonutils.JSONDict

func (*SModelBase) GetIModel

func (model *SModelBase) GetIModel() IModel

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) GetOwnerId

func (model *SModelBase) GetOwnerId() mcclient.IIdentityProvider

func (*SModelBase) GetShortDesc

func (model *SModelBase) GetShortDesc(ctx context.Context) *jsonutils.JSONDict

func (*SModelBase) GetShortDescV2

func (model *SModelBase) GetShortDescV2(ctx context.Context) *apis.ModelBaseShortDescDetail

func (*SModelBase) GetUniqValues

func (model *SModelBase) GetUniqValues() jsonutils.JSONObject

func (*SModelBase) GetUpdateVersion

func (model *SModelBase) GetUpdateVersion() int

func (*SModelBase) GetUpdatedAt

func (model *SModelBase) GetUpdatedAt() time.Time

func (*SModelBase) GetUsages

func (model *SModelBase) GetUsages() []IUsage

func (*SModelBase) IsSharable

func (model *SModelBase) IsSharable(ownerId mcclient.IIdentityProvider) bool

func (SModelBase) Keyword

func (model SModelBase) Keyword() string

func (SModelBase) KeywordPlural

func (model SModelBase) KeywordPlural() string

func (*SModelBase) MarkDelete

func (model *SModelBase) MarkDelete() error

func (*SModelBase) MarkDeletePreventionOff

func (model *SModelBase) MarkDeletePreventionOff()

func (*SModelBase) MarkDeletePreventionOn

func (model *SModelBase) MarkDeletePreventionOn()

func (*SModelBase) MarkPendingDeleted

func (model *SModelBase) MarkPendingDeleted()

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, ownerId mcclient.IIdentityProvider, 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) PreCheckPerformAction

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

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) RecoverUsages

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

func (*SModelBase) SetModelManager

func (model *SModelBase) SetModelManager(man IModelManager, virtual IModel)

func (*SModelBase) UpdateInContext

func (model *SModelBase) UpdateInContext(ctx context.Context, userCred mcclient.TokenCredential, ctxObjs []IModel, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SModelBase) ValidateDeleteCondition

func (model *SModelBase) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error

func (*SModelBase) ValidateUpdateCondition

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

func (*SModelBase) ValidateUpdateData

type SModelBaseManager

type SModelBaseManager struct {
	object.SObject
	// contains filtered or unexported fields
}

func NewModelBaseManager

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

func NewModelBaseManagerWithClickhouseMapping

func NewModelBaseManagerWithClickhouseMapping(manager IModelManager, keyword, keywordPlural string) SModelBaseManager

func NewModelBaseManagerWithDBName

func NewModelBaseManagerWithDBName(model interface{}, tableName string, keyword string, keywordPlural string, dbName sqlchemy.DBName) SModelBaseManager

func NewModelBaseManagerWithSplitable

func NewModelBaseManagerWithSplitable(model interface{}, tableName string, keyword string, keywordPlural string, indexField string, dateField string, maxDuration time.Duration, maxSegments int) SModelBaseManager

func NewModelBaseManagerWithSplitableDBName

func NewModelBaseManagerWithSplitableDBName(model interface{}, tableName string, keyword string, keywordPlural string, indexField string, dateField string, maxDuration time.Duration, maxSegments int, dbName sqlchemy.DBName) 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) BatchCreateValidateCreateData

func (manager *SModelBaseManager) BatchCreateValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

func (*SModelBaseManager) BatchPreValidate

func (manager *SModelBaseManager) BatchPreValidate(
	ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider,
	query jsonutils.JSONObject, data *jsonutils.JSONDict, count int,
) error

func (*SModelBaseManager) CreateByInsertOrUpdate

func (manager *SModelBaseManager) CreateByInsertOrUpdate() bool

func (*SModelBaseManager) CustomizeFilterList

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

func (*SModelBaseManager) CustomizeHandlerInfo

func (manager *SModelBaseManager) CustomizeHandlerInfo(info *appsrv.SHandlerInfo)

func (*SModelBaseManager) CustomizedTotalCount

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

func (*SModelBaseManager) EnableGenerateName

func (manager *SModelBaseManager) EnableGenerateName() bool

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(ctx context.Context, userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SModelBaseManager) FetchByName

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

func (*SModelBaseManager) FetchCreateHeaderData

func (manager *SModelBaseManager) FetchCreateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)

func (*SModelBaseManager) FetchCustomizeColumns

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

func (*SModelBaseManager) FetchOwnerId

func (*SModelBaseManager) FetchUniqValues

func (manager *SModelBaseManager) FetchUniqValues(ctx context.Context, data jsonutils.JSONObject) jsonutils.JSONObject

func (*SModelBaseManager) FetchUpdateHeaderData

func (manager *SModelBaseManager) FetchUpdateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)

func (*SModelBaseManager) FilterByHiddenSystemAttributes

func (manager *SModelBaseManager) FilterByHiddenSystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery

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 (*SModelBaseManager) FilterBySystemAttributes

func (manager *SModelBaseManager) FilterBySystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery

func (*SModelBaseManager) FilterByUniqValues

func (manager *SModelBaseManager) FilterByUniqValues(q *sqlchemy.SQuery, uniqValues jsonutils.JSONObject) *sqlchemy.SQuery

func (*SModelBaseManager) GetContextManagers

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

func (*SModelBaseManager) GetExportExtraKeys

func (manager *SModelBaseManager) GetExportExtraKeys(ctx context.Context, keys stringutils2.SSortedStrings, rowMap map[string]string) *jsonutils.JSONDict

func (*SModelBaseManager) GetExtraHook

func (manager *SModelBaseManager) GetExtraHook() IModelManagerExtraHook

func (*SModelBaseManager) GetI18N

func (manager *SModelBaseManager) GetI18N(ctx context.Context, idstr string, resObj jsonutils.JSONObject) *jsonutils.JSONDict

func (*SModelBaseManager) GetIModelManager

func (manager *SModelBaseManager) GetIModelManager() IModelManager

func (*SModelBaseManager) GetImmutableInstance

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

func (*SModelBaseManager) GetMutableInstance

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

func (*SModelBaseManager) GetPagingConfig

func (manager *SModelBaseManager) GetPagingConfig() *SPagingConfig

func (*SModelBaseManager) GetPropertyDistinctField

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

func (*SModelBaseManager) GetPropertyDistinctFields

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

func (*SModelBaseManager) GetPropertySplitable

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

func (*SModelBaseManager) GetPropertySplitableExport

func (manager *SModelBaseManager) GetPropertySplitableExport(ctx context.Context, userCred mcclient.TokenCredential, input apis.SplitTableExportInput) (jsonutils.JSONObject, error)

func (*SModelBaseManager) GetSkipLog

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

func (*SModelBaseManager) GetSplitTable

func (manager *SModelBaseManager) GetSplitTable() *splitable.SSplitTableSpec

func (*SModelBaseManager) HasName

func (manager *SModelBaseManager) HasName() bool

func (*SModelBaseManager) InitializeData

func (manager *SModelBaseManager) InitializeData() error

func (*SModelBaseManager) IsCustomizedGetDetailsBody

func (manager *SModelBaseManager) IsCustomizedGetDetailsBody() bool

func (*SModelBaseManager) IsStandaloneManager

func (manager *SModelBaseManager) IsStandaloneManager() bool

func (*SModelBaseManager) Keyword

func (manager *SModelBaseManager) Keyword() string

func (*SModelBaseManager) KeywordPlural

func (manager *SModelBaseManager) KeywordPlural() string

func (*SModelBaseManager) ListItemExportKeys

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

func (*SModelBaseManager) ListItemFilter

func (manager *SModelBaseManager) ListItemFilter(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	input apis.ModelBaseListInput,
) (*sqlchemy.SQuery, error)

func (*SModelBaseManager) ListSkipLog

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

func (*SModelBaseManager) NamespaceScope

func (manager *SModelBaseManager) NamespaceScope() rbacscope.TRbacScope

func (*SModelBaseManager) NewQuery

func (manager *SModelBaseManager) NewQuery(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, useRawQuery bool) *sqlchemy.SQuery

func (*SModelBaseManager) OnCreateComplete

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

func (*SModelBaseManager) OnCreateFailed

func (*SModelBaseManager) OrderByExtraFields

func (manager *SModelBaseManager) OrderByExtraFields(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	input apis.ModelBaseListInput,
) (*sqlchemy.SQuery, error)

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) PerformPurgeSplitable

func (manager *SModelBaseManager) PerformPurgeSplitable(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input apis.PurgeSplitTableInput) (jsonutils.JSONObject, error)

func (*SModelBaseManager) PrepareQueryContext

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

func (*SModelBaseManager) Query

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

func (*SModelBaseManager) QueryDistinctExtraField

func (manager *SModelBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SModelBaseManager) QueryDistinctExtraFields

func (manager *SModelBaseManager) QueryDistinctExtraFields(q *sqlchemy.SQuery, resource string, fields []string) (*sqlchemy.SQuery, error)

func (*SModelBaseManager) RawQuery

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

func (*SModelBaseManager) RegisterExtraHook

func (manager *SModelBaseManager) RegisterExtraHook(eh IModelManagerExtraHook)

func (*SModelBaseManager) ResourceScope

func (manager *SModelBaseManager) ResourceScope() rbacscope.TRbacScope

func (*SModelBaseManager) SetAlias

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

func (*SModelBaseManager) SetHandlerProcessTimeout

func (manager *SModelBaseManager) SetHandlerProcessTimeout(info *appsrv.SHandlerInfo, r *http.Request) time.Duration

func (*SModelBaseManager) TableSpec

func (manager *SModelBaseManager) TableSpec() ITableSpec

func (*SModelBaseManager) ValidateCreateData

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 SModelI18nEntry

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

func NewSModelI18nEntry

func NewSModelI18nEntry(keyName string, model IModel, i18nEntry IModelI18nBase) *SModelI18nEntry

func (*SModelI18nEntry) GetGlobalId

func (in *SModelI18nEntry) GetGlobalId() string

func (*SModelI18nEntry) GetKeyName

func (in *SModelI18nEntry) GetKeyName() string

func (*SModelI18nEntry) GetKeyValue

func (in *SModelI18nEntry) GetKeyValue() string

func (*SModelI18nEntry) GetObjId

func (in *SModelI18nEntry) GetObjId() string

func (*SModelI18nEntry) GetObjType

func (in *SModelI18nEntry) GetObjType() string

func (*SModelI18nEntry) Lookup

func (in *SModelI18nEntry) Lookup(tag i18n.Tag) string

type SModelI18nTable

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

func NewSModelI18nTable

func NewSModelI18nTable(i18nEntires []IModelI18nEntry) *SModelI18nTable

func (*SModelI18nTable) GetI18nEntries

func (t *SModelI18nTable) GetI18nEntries() map[string]IModelI18nEntry

type SMultiArchResourceBase

type SMultiArchResourceBase struct {
	// 操作系统 CPU 架构
	// example: x86 arm
	OsArch string `width:"16" charset:"ascii" nullable:"true" list:"user" get:"user" create:"optional" update:"domain"`
}

+onecloud:model-api-gen

type SMultiArchResourceBaseManager

type SMultiArchResourceBaseManager struct{}

func (*SMultiArchResourceBaseManager) ListItemFilter

type SOpsLog

type SOpsLog struct {
	SLogBase

	ObjType string `width:"40" charset:"ascii" nullable:"false" list:"user" create:"required" index:"true"`
	ObjId   string `width:"128" charset:"ascii" nullable:"false" list:"user" create:"required" index:"true"`
	ObjName string `width:"128" charset:"utf8" nullable:"false" list:"user" create:"required"`
	Action  string `width:"32" charset:"utf8" nullable:"false" list:"user" create:"required"`
	Notes   string `charset:"utf8" list:"user" create:"optional"`

	ProjectId string `name:"tenant_id" width:"128" charset:"ascii" list:"user" create:"optional" index:"true"`
	Project   string `name:"tenant" width:"128" charset:"utf8" list:"user" create:"optional"`

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

	UserId   string `width:"128" charset:"ascii" list:"user" create:"required"`
	User     string `width:"128" charset:"utf8" list:"user" create:"required"`
	DomainId string `width:"128" charset:"ascii" list:"user" create:"optional"`
	Domain   string `width:"128" charset:"utf8" list:"user" create:"optional"`
	Roles    string `width:"64" charset:"utf8" list:"user" create:"optional"`

	OpsTime time.Time `nullable:"false" list:"user" clickhouse_ttl:"6m"`

	OwnerDomainId  string `name:"owner_domain_id" default:"default" width:"128" charset:"ascii" list:"user" create:"optional"`
	OwnerProjectId string `name:"owner_tenant_id" width:"128" charset:"ascii" list:"user" create:"optional"`
}

func (*SOpsLog) CustomizeCreate

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

func (*SOpsLog) Dump

func (opslog *SOpsLog) Dump() string

func (*SOpsLog) GetModelManager

func (opslog *SOpsLog) GetModelManager() IModelManager

func (*SOpsLog) GetName

func (opslog *SOpsLog) GetName() string

func (*SOpsLog) GetOwnerId

func (self *SOpsLog) GetOwnerId() mcclient.IIdentityProvider

func (*SOpsLog) GetRecordTime

func (log *SOpsLog) GetRecordTime() time.Time

override

func (*SOpsLog) GetUpdateVersion

func (opslog *SOpsLog) GetUpdateVersion() int

func (*SOpsLog) GetUpdatedAt

func (opslog *SOpsLog) GetUpdatedAt() time.Time

func (*SOpsLog) IsSharable

func (self *SOpsLog) IsSharable(reqCred mcclient.IIdentityProvider) bool

func (*SOpsLog) Run

func (opslog *SOpsLog) Run()

type SOpsLogManager

type SOpsLogManager struct {
	SLogBaseManager
}
var OpsLog *SOpsLogManager

func NewOpsLogManager

func NewOpsLogManager(opslog interface{}, tblName string, keyword, keywordPlural string, timeField string, clickhouse bool) SOpsLogManager

func (*SOpsLogManager) CustomizeHandlerInfo

func (manager *SOpsLogManager) CustomizeHandlerInfo(info *appsrv.SHandlerInfo)

func (*SOpsLogManager) FetchCustomizeColumns

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

func (*SOpsLogManager) FetchOwnerId

func (manager *SOpsLogManager) FetchOwnerId(ctx context.Context, data jsonutils.JSONObject) (mcclient.IIdentityProvider, error)

func (*SOpsLogManager) FilterByOwner

func (*SOpsLogManager) ListItemFilter

func (manager *SOpsLogManager) ListItemFilter(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	input apis.OpsLogListInput,
) (*sqlchemy.SQuery, error)

操作日志列表

func (*SOpsLogManager) LogAttachEvent

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

func (*SOpsLogManager) LogDetachEvent

func (manager *SOpsLogManager) LogDetachEvent(ctx context.Context, 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) LogSyncUpdate

func (manager *SOpsLogManager) LogSyncUpdate(m IModel, uds sqlchemy.UpdateDiffs, userCred mcclient.TokenCredential)

func (*SOpsLogManager) ResourceScope

func (manager *SOpsLogManager) ResourceScope() rbacscope.TRbacScope

func (*SOpsLogManager) SyncOwner

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

func (*SOpsLogManager) ValidateCreateData

type SOwnerId

type SOwnerId struct {
	Domain    string `json:"project_domain"`
	DomainId  string `json:"project_domain_id"`
	Project   string `json:"tenant"`
	ProjectId string `json:"tenant_id"`

	User         string `json:"user"`
	UserId       string `json:"user_id"`
	UserDomain   string `json:"domain"`
	UserDomainId string `json:"domain_id"`
}

func (*SOwnerId) GetDomainId

func (o *SOwnerId) GetDomainId() string

func (*SOwnerId) GetDomainName

func (o *SOwnerId) GetDomainName() string

func (*SOwnerId) GetProjectDomain

func (o *SOwnerId) GetProjectDomain() string

func (*SOwnerId) GetProjectDomainId

func (o *SOwnerId) GetProjectDomainId() string

func (*SOwnerId) GetProjectId

func (o *SOwnerId) GetProjectId() string

func (*SOwnerId) GetProjectName

func (o *SOwnerId) GetProjectName() string

func (*SOwnerId) GetTenantId

func (o *SOwnerId) GetTenantId() string

func (*SOwnerId) GetTenantName

func (o *SOwnerId) GetTenantName() string

func (*SOwnerId) GetUserId

func (o *SOwnerId) GetUserId() string

func (*SOwnerId) GetUserName

func (o *SOwnerId) GetUserName() string

func (SOwnerId) IsValid

func (ownerId SOwnerId) IsValid() bool

type SPagingConfig

type SPagingConfig struct {
	Order        sqlchemy.QueryOrderType
	MarkerFields []string
	DefaultLimit int
}

type SPendingDeletedBase

type SPendingDeletedBase struct {
	// 资源放入回收站时间
	PendingDeletedAt time.Time `json:"pending_deleted_at" list:"user" update:"admin"`
	// 资源是否处于回收站中
	PendingDeleted bool `nullable:"false" default:"false" index:"true" get:"user" list:"user" json:"pending_deleted"`
}

func (*SPendingDeletedBase) CancelPendingDeleted

func (base *SPendingDeletedBase) CancelPendingDeleted()

func (*SPendingDeletedBase) GetPendingDeleted

func (base *SPendingDeletedBase) GetPendingDeleted() bool

GetPendingDeleted implements IPendingDeltable

func (*SPendingDeletedBase) GetPendingDeletedAt

func (base *SPendingDeletedBase) GetPendingDeletedAt() time.Time

GetPendingDeletedAt implements IPendingDeltable

func (*SPendingDeletedBase) MarkCancelPendingDelete

func (base *SPendingDeletedBase) MarkCancelPendingDelete(model IStandaloneModel, ctx context.Context, userCred mcclient.TokenCredential) error

func (*SPendingDeletedBase) MarkPendingDelete

func (base *SPendingDeletedBase) MarkPendingDelete(model IStandaloneModel, ctx context.Context, userCred mcclient.TokenCredential, newName string) error

func (*SPendingDeletedBase) MarkPendingDeleted

func (base *SPendingDeletedBase) MarkPendingDeleted()

type SPendingDeletedBaseManager

type SPendingDeletedBaseManager struct{}

func (*SPendingDeletedBaseManager) FilterBySystemAttributes

type SProjectizedResourceBase

type SProjectizedResourceBase struct {
	SDomainizedResourceBase

	// 项目Id
	ProjectId string `name:"tenant_id" width:"128" charset:"ascii" nullable:"false" index:"true" list:"user" json:"tenant_id"`
}

func (*SProjectizedResourceBase) GetOwnerId

type SProjectizedResourceBaseManager

type SProjectizedResourceBaseManager struct {
	SDomainizedResourceBaseManager
}

func (*SProjectizedResourceBaseManager) FetchCustomizeColumns

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

func (*SProjectizedResourceBaseManager) FetchOwnerId

func (*SProjectizedResourceBaseManager) FilterByOwner

func (*SProjectizedResourceBaseManager) ListItemExportKeys

func (*SProjectizedResourceBaseManager) ListItemFilter

func (*SProjectizedResourceBaseManager) OrderByExtraFields

func (*SProjectizedResourceBaseManager) QueryDistinctExtraField

func (manager *SProjectizedResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SProjectizedResourceBaseManager) ResourceScope

func (manager *SProjectizedResourceBaseManager) ResourceScope() rbacscope.TRbacScope

type SRecordChecksumResourceBase

type SRecordChecksumResourceBase struct {
	RecordChecksum string `width:"256" charset:"ascii" nullable:"true" list:"user" get:"user" json:"record_checksum"`
}

+onecloud:model-api-gen

func (*SRecordChecksumResourceBase) GetRecordChecksum

func (model *SRecordChecksumResourceBase) GetRecordChecksum() string

func (*SRecordChecksumResourceBase) SetRecordChecksum

func (model *SRecordChecksumResourceBase) SetRecordChecksum(checksum string)

type SRecordChecksumResourceBaseManager

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

func NewRecordChecksumResourceBaseManager

func NewRecordChecksumResourceBaseManager() *SRecordChecksumResourceBaseManager

func (*SRecordChecksumResourceBaseManager) EnableRecordChecksum

func (man *SRecordChecksumResourceBaseManager) EnableRecordChecksum() bool

func (*SRecordChecksumResourceBaseManager) SetEnableRecordChecksum

func (man *SRecordChecksumResourceBaseManager) SetEnableRecordChecksum(enable bool)

type SResourceBase

type SResourceBase struct {
	SModelBase

	// 资源创建时间
	CreatedAt time.Time `nullable:"false" created_at:"true" index:"true" get:"user" list:"user" json:"created_at"`
	// 资源更新时间
	UpdatedAt time.Time `nullable:"false" updated_at:"true" list:"user" json:"updated_at"`
	// 资源被更新次数
	UpdateVersion int `default:"0" nullable:"false" auto_version:"true" list:"user" json:"update_version"`
	// 资源删除时间
	DeletedAt time.Time `json:"deleted_at" list:"user"`
	// 资源是否被删除
	Deleted bool `nullable:"false" default:"false" json:"deleted" list:"user"`
}

func (*SResourceBase) Delete

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

func (*SResourceBase) GetDeleted

func (model *SResourceBase) GetDeleted() bool

func (*SResourceBase) GetIResourceModel

func (model *SResourceBase) GetIResourceModel() IResourceModel

func (*SResourceBase) GetShortDesc

func (self *SResourceBase) GetShortDesc(ctx context.Context) *jsonutils.JSONDict

func (*SResourceBase) GetUpdateVersion

func (model *SResourceBase) GetUpdateVersion() int

func (*SResourceBase) GetUpdatedAt

func (model *SResourceBase) GetUpdatedAt() time.Time

func (*SResourceBase) MarkDelete

func (model *SResourceBase) MarkDelete() error

func (*SResourceBase) MarkUnDelete

func (model *SResourceBase) MarkUnDelete() error

func (*SResourceBase) ResourceModelManager

func (model *SResourceBase) ResourceModelManager() IResourceModelManager

func (*SResourceBase) ValidateUpdateData

type SResourceBaseManager

type SResourceBaseManager struct {
	SModelBaseManager
}

func NewResourceBaseManager

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

func (*SResourceBaseManager) FetchCustomizeColumns

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

func (*SResourceBaseManager) GetIResourceModelManager

func (manager *SResourceBaseManager) GetIResourceModelManager() IResourceModelManager

func (*SResourceBaseManager) ListItemFilter

func (manager *SResourceBaseManager) ListItemFilter(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	query apis.ResourceBaseListInput,
) (*sqlchemy.SQuery, error)

func (*SResourceBaseManager) OrderByExtraFields

func (manager *SResourceBaseManager) OrderByExtraFields(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	query apis.ResourceBaseListInput,
) (*sqlchemy.SQuery, error)

func (*SResourceBaseManager) Query

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

func (*SResourceBaseManager) QueryDistinctExtraField

func (manager *SResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SResourceBaseManager) RawQuery

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

func (*SResourceBaseManager) ValidateCreateData

type SRole

type SRole struct {
	SKeystoneCacheObject
}

func (*SRole) GetModelManager

func (role *SRole) GetModelManager() IModelManager

func (*SRole) IsExpired

func (r *SRole) IsExpired() bool

type SRoleCacheManager

type SRoleCacheManager struct {
	SKeystoneCacheObjectManager
	// contains filtered or unexported fields
}
var RoleCacheManager *SRoleCacheManager

func (*SRoleCacheManager) FetchRoleById

func (manager *SRoleCacheManager) FetchRoleById(ctx context.Context, idStr string) (*SRole, error)

func (*SRoleCacheManager) FetchRoleByIdOrName

func (manager *SRoleCacheManager) FetchRoleByIdOrName(ctx context.Context, idStr string) (*SRole, error)

func (*SRoleCacheManager) FetchRoleByName

func (manager *SRoleCacheManager) FetchRoleByName(ctx context.Context, idStr string) (*SRole, error)

func (*SRoleCacheManager) FetchRoleFromKeystone

func (manager *SRoleCacheManager) FetchRoleFromKeystone(ctx context.Context, idStr string) (*SRole, error)

func (*SRoleCacheManager) OnAdd

func (manager *SRoleCacheManager) OnAdd(obj *jsonutils.JSONDict)

func (*SRoleCacheManager) OnDelete

func (manager *SRoleCacheManager) OnDelete(obj *jsonutils.JSONDict)

func (*SRoleCacheManager) OnUpdate

func (manager *SRoleCacheManager) OnUpdate(oldObj, newObj *jsonutils.JSONDict)

func (*SRoleCacheManager) Save

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

func (*SRoleCacheManager) StartWatchRoleInKeystone

func (manager *SRoleCacheManager) StartWatchRoleInKeystone() error

type SScopeResourceCount

type SScopeResourceCount struct {
	TenantId string `json:"tenant_id"`
	DomainId string `json:"domain_id"`
	OwnerId  string `json:"owner_id"`
	ResCount int    `json:"res_count"`
}

func CalculateResourceCount

func CalculateResourceCount(query *sqlchemy.SQuery, field string) ([]SScopeResourceCount, error)

type SScopedResourceBase

type SScopedResourceBase struct {
	SProjectizedResourceBase `"domain_id->default":""`
}

+onecloud:model-api-gen

func (*SScopedResourceBase) CustomizeCreate

func (*SScopedResourceBase) GetDomainId

func (s *SScopedResourceBase) GetDomainId() string

func (*SScopedResourceBase) GetMoreColumns

func (s *SScopedResourceBase) GetMoreColumns(extra *jsonutils.JSONDict) *jsonutils.JSONDict

func (*SScopedResourceBase) GetProjectId

func (s *SScopedResourceBase) GetProjectId() string

func (*SScopedResourceBase) GetResourceScope

func (s *SScopedResourceBase) GetResourceScope() rbacscope.TRbacScope

func (*SScopedResourceBase) IsOwner

func (m *SScopedResourceBase) IsOwner(userCred mcclient.TokenCredential) bool

func (*SScopedResourceBase) SetResourceScope

func (s *SScopedResourceBase) SetResourceScope(domainId, projectId string) error

type SScopedResourceBaseManager

type SScopedResourceBaseManager struct {
	SProjectizedResourceBaseManager
}

func (*SScopedResourceBaseManager) FetchCustomizeColumns

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

func (*SScopedResourceBaseManager) FetchUniqValues

func (*SScopedResourceBaseManager) FilterByOwner

func (*SScopedResourceBaseManager) FilterByScope

func (m *SScopedResourceBaseManager) FilterByScope(q *sqlchemy.SQuery, scope rbacscope.TRbacScope, scopeResId string) *sqlchemy.SQuery

func (*SScopedResourceBaseManager) FilterByUniqValues

func (m *SScopedResourceBaseManager) FilterByUniqValues(q *sqlchemy.SQuery, values jsonutils.JSONObject) *sqlchemy.SQuery

func (*SScopedResourceBaseManager) ListItemFilter

func (*SScopedResourceBaseManager) OrderByExtraFields

type SSharableBaseResource

type SSharableBaseResource struct {
	// 是否共享
	IsPublic bool `default:"false" nullable:"false" list:"user" create:"domain_optional"`
	// 默认共享范围
	PublicScope string `width:"16" charset:"ascii" nullable:"false" default:"system" list:"user" create:"domain_optional"`
	// 共享设置的来源, local: 本地设置, cloud: 从云上同步过来
	// example: local
	PublicSrc string `width:"10" charset:"ascii" nullable:"true" list:"user" json:"public_src"`
}

func (SSharableBaseResource) GetIsPublic

func (m SSharableBaseResource) GetIsPublic() bool

func (SSharableBaseResource) GetPublicScope

func (m SSharableBaseResource) GetPublicScope() rbacscope.TRbacScope

func (*SSharableBaseResource) SetShare

func (m *SSharableBaseResource) SetShare(scope rbacscope.TRbacScope)

type SSharableBaseResourceManager

type SSharableBaseResourceManager struct{}

func (*SSharableBaseResourceManager) FetchCustomizeColumns

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

func (*SSharableBaseResourceManager) ListItemFilter

type SSharableVirtualResourceBase

type SSharableVirtualResourceBase struct {
	SVirtualResourceBase
	SSharableBaseResource `"is_public->create":"optional" "public_scope->create":"optional"`
}

func (*SSharableVirtualResourceBase) CustomizeCreate

func (*SSharableVirtualResourceBase) Delete

func (*SSharableVirtualResourceBase) GetISharableVirtualModel

func (model *SSharableVirtualResourceBase) GetISharableVirtualModel() ISharableVirtualModel

func (*SSharableVirtualResourceBase) GetRequiredSharedDomainIds

func (model *SSharableVirtualResourceBase) GetRequiredSharedDomainIds() []string

func (*SSharableVirtualResourceBase) GetSharableTargetDomainIds

func (model *SSharableVirtualResourceBase) GetSharableTargetDomainIds() []string

func (*SSharableVirtualResourceBase) GetSharedDomains

func (model *SSharableVirtualResourceBase) GetSharedDomains() []string

func (*SSharableVirtualResourceBase) GetSharedInfo

func (model *SSharableVirtualResourceBase) GetSharedInfo() apis.SShareInfo

func (*SSharableVirtualResourceBase) GetSharedProjects

func (model *SSharableVirtualResourceBase) GetSharedProjects() []string

func (*SSharableVirtualResourceBase) IsSharable

func (model *SSharableVirtualResourceBase) IsSharable(reqUsrId mcclient.IIdentityProvider) bool

func (*SSharableVirtualResourceBase) IsShared

func (model *SSharableVirtualResourceBase) IsShared() bool

func (*SSharableVirtualResourceBase) PerformChangeOwner

func (*SSharableVirtualResourceBase) PerformPrivate

func (*SSharableVirtualResourceBase) PerformPublic

func (*SSharableVirtualResourceBase) SaveSharedInfo

func (*SSharableVirtualResourceBase) SyncShareState

func (model *SSharableVirtualResourceBase) SyncShareState(ctx context.Context, userCred mcclient.TokenCredential, shareInfo apis.SAccountShareInfo)

type SSharableVirtualResourceBaseManager

type SSharableVirtualResourceBaseManager struct {
	SVirtualResourceBaseManager
	SSharableBaseResourceManager
}

func NewSharableVirtualResourceBaseManager

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

func (*SSharableVirtualResourceBaseManager) FetchCustomizeColumns

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

func (*SSharableVirtualResourceBaseManager) FilterByOwner

func (*SSharableVirtualResourceBaseManager) GetISharableVirtualModelManager

func (manager *SSharableVirtualResourceBaseManager) GetISharableVirtualModelManager() ISharableVirtualModelManager

func (*SSharableVirtualResourceBaseManager) ListItemFilter

func (*SSharableVirtualResourceBaseManager) OrderByExtraFields

func (*SSharableVirtualResourceBaseManager) QueryDistinctExtraField

func (manager *SSharableVirtualResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SSharedResource

type SSharedResource struct {
	SResourceBase

	Id int64 `primary:"true" auto_increment:"true"`

	ResourceType string `width:"32" charset:"ascii" nullable:"false" json:"resource_type"`
	ResourceId   string `width:"128" charset:"ascii" nullable:"false" index:"true" json:"resource_id"`
	// OwnerProjectId  string `width:"128" charset:"ascii" nullable:"false" index:"true" json:"owner_project_id"`
	TargetProjectId string `width:"128" charset:"ascii" nullable:"false" index:"true" json:"target_project_id"`

	TargetType string `width:"8" charset:"ascii" default:"project" nullable:"false" json:"target_type"`
}

sharing resource between projects/domains

type SSharedResourceManager

type SSharedResourceManager struct {
	SResourceBaseManager
}
var SharedResourceManager *SSharedResourceManager

func (*SSharedResourceManager) CleanModelShares

func (manager *SSharedResourceManager) CleanModelShares(ctx context.Context, userCred mcclient.TokenCredential, model ISharableBaseModel) error

type SStandaloneAnonResourceBase

type SStandaloneAnonResourceBase struct {
	SResourceBase

	// 资源UUID
	Id string `width:"128" charset:"ascii" primary:"true" list:"user" create:"optional" json:"id"`

	// 资源描述信息
	Description string `length:"0" charset:"utf8" get:"user" list:"user" update:"user" create:"optional" json:"description"`

	// 是否是模拟资源, 部分从公有云上同步的资源并不真实存在, 例如宿主机
	// list 接口默认不会返回这类资源,除非显示指定 is_emulate=true 过滤参数
	IsEmulated bool `nullable:"false" default:"false" list:"admin" create:"admin_optional" json:"is_emulated"`
}

func (*SStandaloneAnonResourceBase) AppendDescription

func (model *SStandaloneAnonResourceBase) AppendDescription(userCred mcclient.TokenCredential, msg string) error

func (*SStandaloneAnonResourceBase) BeforeInsert

func (model *SStandaloneAnonResourceBase) BeforeInsert()

func (*SStandaloneAnonResourceBase) ClearSchedDescCache

func (model *SStandaloneAnonResourceBase) ClearSchedDescCache() error

func (*SStandaloneAnonResourceBase) GetAllClassMetadata

func (model *SStandaloneAnonResourceBase) GetAllClassMetadata() (map[string]string, error)

func (*SStandaloneAnonResourceBase) GetAllCloudMetadata

func (model *SStandaloneAnonResourceBase) GetAllCloudMetadata() (map[string]string, error)

func (*SStandaloneAnonResourceBase) GetAllMetadata

func (model *SStandaloneAnonResourceBase) GetAllMetadata(ctx context.Context, userCred mcclient.TokenCredential) (map[string]string, error)

func (*SStandaloneAnonResourceBase) GetAllOrganizationMetadata

func (model *SStandaloneAnonResourceBase) GetAllOrganizationMetadata() (map[string]string, error)

func (*SStandaloneAnonResourceBase) GetAllUserMetadata

func (model *SStandaloneAnonResourceBase) GetAllUserMetadata() (map[string]string, error)

func (*SStandaloneAnonResourceBase) GetDetailsClassMetadata

func (*SStandaloneAnonResourceBase) GetDetailsMetadata

获取资源标签(元数据)

func (*SStandaloneAnonResourceBase) GetDetailsOrgMetadata

func (*SStandaloneAnonResourceBase) GetIStandaloneModel

func (model *SStandaloneAnonResourceBase) GetIStandaloneModel() IStandaloneModel

func (SStandaloneAnonResourceBase) GetId

func (model SStandaloneAnonResourceBase) GetId() string

func (*SStandaloneAnonResourceBase) GetMetadata

func (model *SStandaloneAnonResourceBase) GetMetadata(ctx context.Context, key string, userCred mcclient.TokenCredential) string

* userCred: optional

func (*SStandaloneAnonResourceBase) GetMetadataJson

func (*SStandaloneAnonResourceBase) GetShortDesc

func (model *SStandaloneAnonResourceBase) GetShortDesc(ctx context.Context) *jsonutils.JSONDict

func (*SStandaloneAnonResourceBase) GetShortDescV2

func (*SStandaloneAnonResourceBase) InheritTo

func (*SStandaloneAnonResourceBase) IsInSameClass

func (model *SStandaloneAnonResourceBase) IsInSameClass(ctx context.Context, pModel *SStandaloneAnonResourceBase) (bool, error)

func (*SStandaloneAnonResourceBase) IsShared

func (model *SStandaloneAnonResourceBase) IsShared() bool

func (*SStandaloneAnonResourceBase) OnMetadataUpdated

func (model *SStandaloneAnonResourceBase) OnMetadataUpdated(ctx context.Context, userCred mcclient.TokenCredential)

func (*SStandaloneAnonResourceBase) PerformClassMetadata

更新资源的 class 标签

func (*SStandaloneAnonResourceBase) PerformMetadata

+onecloud:swagger-gen-ignore

func (*SStandaloneAnonResourceBase) PerformSetClassMetadata

全量替换资源的所有 class 标签

func (*SStandaloneAnonResourceBase) PerformSetOrgMetadata

全量替换资源的所有 class 标签

func (*SStandaloneAnonResourceBase) PerformSetUserMetadata

全量替换资源的所有用户标签

func (*SStandaloneAnonResourceBase) PerformUserMetadata

更新资源的用户标签 +onecloud:swagger-gen-ignore

func (*SStandaloneAnonResourceBase) PostCreate

func (*SStandaloneAnonResourceBase) PostUpdate

func (*SStandaloneAnonResourceBase) RemoveAllMetadata

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

func (*SStandaloneAnonResourceBase) RemoveMetadata

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

func (*SStandaloneAnonResourceBase) SetAllMetadata

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

func (*SStandaloneAnonResourceBase) SetClassMetadataAll

func (model *SStandaloneAnonResourceBase) SetClassMetadataAll(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential) error

func (*SStandaloneAnonResourceBase) SetClassMetadataValues

func (model *SStandaloneAnonResourceBase) SetClassMetadataValues(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential) error

func (*SStandaloneAnonResourceBase) SetCloudMetadataAll

func (model *SStandaloneAnonResourceBase) SetCloudMetadataAll(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential, readOnly bool) error

func (*SStandaloneAnonResourceBase) SetMetadata

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

func (*SStandaloneAnonResourceBase) SetOrganizationMetadataAll

func (model *SStandaloneAnonResourceBase) SetOrganizationMetadataAll(ctx context.Context, meta map[string]string, userCred mcclient.TokenCredential) error

func (*SStandaloneAnonResourceBase) SetSysCloudMetadataAll

func (model *SStandaloneAnonResourceBase) SetSysCloudMetadataAll(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential, readOnly bool) error

func (*SStandaloneAnonResourceBase) SetUserMetadataAll

func (model *SStandaloneAnonResourceBase) SetUserMetadataAll(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential) error

func (*SStandaloneAnonResourceBase) SetUserMetadataValues

func (model *SStandaloneAnonResourceBase) SetUserMetadataValues(ctx context.Context, dictstore map[string]string, userCred mcclient.TokenCredential) error

func (*SStandaloneAnonResourceBase) StandaloneModelManager

func (model *SStandaloneAnonResourceBase) StandaloneModelManager() IStandaloneModelManager

func (*SStandaloneAnonResourceBase) TrySaveMetadataInput

func (model *SStandaloneAnonResourceBase) TrySaveMetadataInput(ctx context.Context, userCred mcclient.TokenCredential, data jsonutils.JSONObject)

type SStandaloneAnonResourceBaseManager

type SStandaloneAnonResourceBaseManager struct {
	SResourceBaseManager
	SMetadataResourceBaseModelManager
}

func NewStandaloneAnonResourceBaseManager

func NewStandaloneAnonResourceBaseManager(
	dt interface{},
	tableName string,
	keyword string,
	keywordPlural string,
) SStandaloneAnonResourceBaseManager

func (*SStandaloneAnonResourceBaseManager) CreateByInsertOrUpdate

func (manager *SStandaloneAnonResourceBaseManager) CreateByInsertOrUpdate() bool

func (*SStandaloneAnonResourceBaseManager) FetchById

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

func (*SStandaloneAnonResourceBaseManager) FetchCustomizeColumns

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

func (*SStandaloneAnonResourceBaseManager) FilterByHiddenSystemAttributes

func (manager *SStandaloneAnonResourceBaseManager) FilterByHiddenSystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery

func (*SStandaloneAnonResourceBaseManager) FilterById

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

func (*SStandaloneAnonResourceBaseManager) FilterByName

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

func (*SStandaloneAnonResourceBaseManager) FilterByNotId

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

func (*SStandaloneAnonResourceBaseManager) FilterByOwner

func (*SStandaloneAnonResourceBaseManager) GetExportExtraKeys

func (manager *SStandaloneAnonResourceBaseManager) GetExportExtraKeys(ctx context.Context, keys stringutils2.SSortedStrings, rowMap map[string]string) *jsonutils.JSONDict

func (*SStandaloneAnonResourceBaseManager) GetIStandaloneModelManager

func (manager *SStandaloneAnonResourceBaseManager) GetIStandaloneModelManager() IStandaloneModelManager

func (*SStandaloneAnonResourceBaseManager) GetMetadataHiddenKeys

func (manager *SStandaloneAnonResourceBaseManager) GetMetadataHiddenKeys() []string

func (*SStandaloneAnonResourceBaseManager) GetPropertyTagValuePairs

func (manager *SStandaloneAnonResourceBaseManager) GetPropertyTagValuePairs(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
) (jsonutils.JSONObject, error)

func (*SStandaloneAnonResourceBaseManager) GetPropertyTagValueTree

func (manager *SStandaloneAnonResourceBaseManager) GetPropertyTagValueTree(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
) (jsonutils.JSONObject, error)

func (*SStandaloneAnonResourceBaseManager) HistoryDataClean

func (manager *SStandaloneAnonResourceBaseManager) HistoryDataClean(ctx context.Context, timeBefor time.Time) (int, error)

func (*SStandaloneAnonResourceBaseManager) IsStandaloneManager

func (manager *SStandaloneAnonResourceBaseManager) IsStandaloneManager() bool

func (*SStandaloneAnonResourceBaseManager) ListItemExportKeys

func (*SStandaloneAnonResourceBaseManager) ListItemFilter

func (*SStandaloneAnonResourceBaseManager) OrderByExtraFields

func (*SStandaloneAnonResourceBaseManager) QueryDistinctExtraField

func (manager *SStandaloneAnonResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SStandaloneResourceBase

type SStandaloneResourceBase struct {
	SStandaloneAnonResourceBase

	// 资源名称
	Name string `width:"128" charset:"utf8" nullable:"false" index:"true" list:"user" update:"user" create:"required" json:"name"`
}

func (*SStandaloneResourceBase) GetIStandaloneModel

func (model *SStandaloneResourceBase) GetIStandaloneModel() IStandaloneModel

func (*SStandaloneResourceBase) GetName

func (model *SStandaloneResourceBase) GetName() string

func (*SStandaloneResourceBase) GetShortDesc

func (model *SStandaloneResourceBase) GetShortDesc(ctx context.Context) *jsonutils.JSONDict

func (*SStandaloneResourceBase) GetShortDescV2

func (*SStandaloneResourceBase) SetName

func (model *SStandaloneResourceBase) SetName(name string)

type SStandaloneResourceBaseManager

type SStandaloneResourceBaseManager struct {
	SStandaloneAnonResourceBaseManager

	NameRequireAscii bool
	NameLength       int
}

func NewStandaloneResourceBaseManager

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

func (*SStandaloneResourceBaseManager) FetchByIdOrName

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

func (*SStandaloneResourceBaseManager) FetchByName

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

func (*SStandaloneResourceBaseManager) FetchCustomizeColumns

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

func (*SStandaloneResourceBaseManager) FilterByName

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

func (*SStandaloneResourceBaseManager) HasName

func (manager *SStandaloneResourceBaseManager) HasName() bool

func (*SStandaloneResourceBaseManager) ListItemExportKeys

func (*SStandaloneResourceBaseManager) ListItemFilter

func (*SStandaloneResourceBaseManager) OrderByExtraFields

func (*SStandaloneResourceBaseManager) ValidateName

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

type SStatusDomainLevelResourceBase

type SStatusDomainLevelResourceBase struct {
	SDomainLevelResourceBase
	SStatusResourceBase
}

func (*SStatusDomainLevelResourceBase) GetIStatusDomainLevelModel

func (self *SStatusDomainLevelResourceBase) GetIStatusDomainLevelModel() IStatusDomainLevelModel

func (*SStatusDomainLevelResourceBase) PerformStatus

更新资源状态

func (*SStatusDomainLevelResourceBase) SetStatus

func (model *SStatusDomainLevelResourceBase) SetStatus(ctx context.Context, userCred mcclient.TokenCredential, status string, reason string) error

type SStatusDomainLevelResourceBaseManager

type SStatusDomainLevelResourceBaseManager struct {
	SDomainLevelResourceBaseManager
	SStatusResourceBaseManager
}

func NewStatusDomainLevelResourceBaseManager

func NewStatusDomainLevelResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SStatusDomainLevelResourceBaseManager

func (*SStatusDomainLevelResourceBaseManager) FetchCustomizeColumns

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

func (*SStatusDomainLevelResourceBaseManager) ListItemFilter

func (*SStatusDomainLevelResourceBaseManager) OrderByExtraFields

func (*SStatusDomainLevelResourceBaseManager) QueryDistinctExtraField

func (manager *SStatusDomainLevelResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SStatusDomainLevelUserResourceBase

type SStatusDomainLevelUserResourceBase struct {
	SStatusDomainLevelResourceBase

	// 本地用户Id
	OwnerId string `width:"128" charset:"ascii" index:"true" list:"user" nullable:"false" create:"optional"`
}

func (*SStatusDomainLevelUserResourceBase) GetOwnerId

func (*SStatusDomainLevelUserResourceBase) SetStatus

func (model *SStatusDomainLevelUserResourceBase) SetStatus(ctx context.Context, userCred mcclient.TokenCredential, status string, reason string) error

type SStatusDomainLevelUserResourceBaseManager

type SStatusDomainLevelUserResourceBaseManager struct {
	SStatusDomainLevelResourceBaseManager
}

func NewStatusDomainLevelUserResourceBaseManager

func NewStatusDomainLevelUserResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SStatusDomainLevelUserResourceBaseManager

func (*SStatusDomainLevelUserResourceBaseManager) FetchCustomizeColumns

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

func (*SStatusDomainLevelUserResourceBaseManager) FilterByOwner

func (*SStatusDomainLevelUserResourceBaseManager) ListItemExportKeys

func (*SStatusDomainLevelUserResourceBaseManager) ListItemFilter

func (*SStatusDomainLevelUserResourceBaseManager) OrderByExtraFields

func (*SStatusDomainLevelUserResourceBaseManager) QueryDistinctExtraField

func (manager *SStatusDomainLevelUserResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SStatusInfrasResourceBase

type SStatusInfrasResourceBase struct {
	SInfrasResourceBase
	SStatusResourceBase
}

func (*SStatusInfrasResourceBase) GetIStatusInfrasModel

func (self *SStatusInfrasResourceBase) GetIStatusInfrasModel() IStatusInfrasModel

func (*SStatusInfrasResourceBase) PerformStatus

更新资源状态

func (*SStatusInfrasResourceBase) SetStatus

func (model *SStatusInfrasResourceBase) SetStatus(ctx context.Context, userCred mcclient.TokenCredential, status string, reason string) error

type SStatusInfrasResourceBaseManager

type SStatusInfrasResourceBaseManager struct {
	SInfrasResourceBaseManager
	SStatusResourceBaseManager
}

func NewStatusInfrasResourceBaseManager

func NewStatusInfrasResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SStatusInfrasResourceBaseManager

func (*SStatusInfrasResourceBaseManager) FetchCustomizeColumns

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

func (*SStatusInfrasResourceBaseManager) GetPropertyStatistics

func (manager *SStatusInfrasResourceBaseManager) GetPropertyStatistics(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*apis.StatusStatistic, error)

func (*SStatusInfrasResourceBaseManager) ListItemFilter

func (*SStatusInfrasResourceBaseManager) OrderByExtraFields

func (*SStatusInfrasResourceBaseManager) QueryDistinctExtraField

func (manager *SStatusInfrasResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type SStatusResourceBase

type SStatusResourceBase struct {
	// 资源状态
	Status string `width:"36" charset:"ascii" nullable:"false" default:"init" list:"user" create:"optional" json:"status"`

	// 操作进度0-100
	Progress float32 `list:"user" update:"user" default:"100" json:"progress" log:"skip"`
}

func (*SStatusResourceBase) GetDetailsStatus

获取资源状态

func (SStatusResourceBase) GetProgress

func (model SStatusResourceBase) GetProgress() float32

func (SStatusResourceBase) GetStatus

func (model SStatusResourceBase) GetStatus() string

func (*SStatusResourceBase) IsInStatus

func (model *SStatusResourceBase) IsInStatus(status ...string) bool

func (*SStatusResourceBase) SetProgressValue

func (model *SStatusResourceBase) SetProgressValue(progress float32)

func (*SStatusResourceBase) SetStatusValue

func (model *SStatusResourceBase) SetStatusValue(status string)

type SStatusResourceBaseManager

type SStatusResourceBaseManager struct{}

func (*SStatusResourceBaseManager) ListItemFilter

func (*SStatusResourceBaseManager) OrderByExtraFields

type SStatusStandaloneResourceBase

type SStatusStandaloneResourceBase struct {
	SStandaloneResourceBase
	SStatusResourceBase
}

func (*SStatusStandaloneResourceBase) GetIStatusStandaloneModel

func (self *SStatusStandaloneResourceBase) GetIStatusStandaloneModel() IStatusStandaloneModel

func (*SStatusStandaloneResourceBase) PerformStatus

更新资源状态

func (*SStatusStandaloneResourceBase) SetProgress

func (model *SStatusStandaloneResourceBase) SetProgress(progress float32) error

func (*SStatusStandaloneResourceBase) SetStatus

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

type SStatusStandaloneResourceBaseManager

type SStatusStandaloneResourceBaseManager struct {
	SStandaloneResourceBaseManager
	SStatusResourceBaseManager
}

func NewStatusStandaloneResourceBaseManager

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

func (*SStatusStandaloneResourceBaseManager) FetchCustomizeColumns

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

func (*SStatusStandaloneResourceBaseManager) GetPropertyStatistics

func (*SStatusStandaloneResourceBaseManager) ListItemFilter

func (*SStatusStandaloneResourceBaseManager) OrderByExtraFields

func (*SStatusStandaloneResourceBaseManager) QueryDistinctExtraField

func (manager *SStatusStandaloneResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

type STenant

type STenant struct {
	SKeystoneCacheObject
}

func NewDomain

func NewDomain(idStr, name string) STenant

func NewTenant

func NewTenant(idStr string, name string, domainId string, domainName string) STenant

func (*STenant) GetAllClassMetadata

func (tenant *STenant) GetAllClassMetadata() (map[string]string, error)

func (*STenant) GetDomainId

func (tenant *STenant) GetDomainId() string

func (*STenant) GetDomainName

func (tenant *STenant) GetDomainName() string

func (*STenant) GetModelManager

func (tenant *STenant) GetModelManager() IModelManager

func (*STenant) GetProjectDomain

func (tenant *STenant) GetProjectDomain() string

func (*STenant) GetProjectDomainId

func (tenant *STenant) GetProjectDomainId() string

func (*STenant) GetProjectId

func (tenant *STenant) GetProjectId() string

func (*STenant) GetProjectName

func (tenant *STenant) GetProjectName() string

func (*STenant) GetTags

func (t *STenant) GetTags() tagutils.TTagSet

func (*STenant) GetTenantId

func (tenant *STenant) GetTenantId() string

func (*STenant) GetTenantName

func (tenant *STenant) GetTenantName() string

func (*STenant) GetUserId

func (tenant *STenant) GetUserId() string

func (*STenant) GetUserName

func (tenant *STenant) GetUserName() string

func (*STenant) IsDomain

func (tenant *STenant) IsDomain() bool

func (*STenant) IsExpired

func (t *STenant) IsExpired() bool

type STenantCacheManager

type STenantCacheManager struct {
	SKeystoneCacheObjectManager
}
var TenantCacheManager *STenantCacheManager

func GetTenantCacheManagerInContext

func GetTenantCacheManagerInContext(ctx context.Context) *STenantCacheManager

func (*STenantCacheManager) ConvertIds

func (manager *STenantCacheManager) ConvertIds(ids []string, isDomain bool) ([]string, error)

func (*STenantCacheManager) Delete

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

func (*STenantCacheManager) FetchDomainById

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

func (*STenantCacheManager) FetchDomainByIdOrName

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

func (*STenantCacheManager) FetchDomainByIdWithoutExpireCheck

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

func (*STenantCacheManager) FetchDomainByName

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

func (*STenantCacheManager) FetchTenantById

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

func (*STenantCacheManager) FetchTenantByIdOrNameInDomain

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

func (*STenantCacheManager) FetchTenantByIdWithoutExpireCheck

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

func (*STenantCacheManager) FetchTenantByNameInDomain

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

func (*STenantCacheManager) FindFirstProjectOfDomain

func (manager *STenantCacheManager) FindFirstProjectOfDomain(ctx context.Context, domainId string) (*STenant, error)

func (*STenantCacheManager) GetDomainQuery

func (manager *STenantCacheManager) GetDomainQuery(fields ...string) *sqlchemy.SQuery

func (*STenantCacheManager) GetTenantQuery

func (manager *STenantCacheManager) GetTenantQuery(fields ...string) *sqlchemy.SQuery

func (*STenantCacheManager) InitializeData

func (manager *STenantCacheManager) InitializeData() error

func (*STenantCacheManager) Save

func (manager *STenantCacheManager) Save(ctx context.Context, item SCachedTenant, saveMeta bool) (*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(ctx context.Context, idStr string) (*SUser, error)

func (*SUserCacheManager) FetchUserByIdOrName

func (manager *SUserCacheManager) FetchUserByIdOrName(ctx context.Context, idStr string) (*SUser, error)

func (*SUserCacheManager) FetchUserByName

func (manager *SUserCacheManager) FetchUserByName(ctx context.Context, idStr string) (*SUser, error)

func (*SUserCacheManager) FetchUserFromKeystone

func (manager *SUserCacheManager) FetchUserFromKeystone(ctx context.Context, idStr string) (*SUser, error)

func (*SUserCacheManager) Save

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

type SUserResourceBase

type SUserResourceBase struct {
	SStandaloneResourceBase

	// 本地用户Id
	OwnerId string `width:"128" charset:"ascii" index:"true" list:"user" nullable:"false" create:"required"`
}

func (*SUserResourceBase) GetOwnerId

func (self *SUserResourceBase) GetOwnerId() mcclient.IIdentityProvider

func (*SUserResourceBase) IsOwner

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

type SUserResourceBaseManager

type SUserResourceBaseManager struct {
	SStandaloneResourceBaseManager
}

func NewUserResourceBaseManager

func NewUserResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SUserResourceBaseManager

func (*SUserResourceBaseManager) FetchByIdOrName

func (manager *SUserResourceBaseManager) FetchByIdOrName(ctx context.Context, userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SUserResourceBaseManager) FetchByName

func (manager *SUserResourceBaseManager) FetchByName(ctx context.Context, userCred mcclient.IIdentityProvider, idStr string) (IModel, error)

func (*SUserResourceBaseManager) FetchCustomizeColumns

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

func (*SUserResourceBaseManager) FetchOwnerId

func (*SUserResourceBaseManager) FilterByOwner

func (*SUserResourceBaseManager) GetIUserModelManager

func (manager *SUserResourceBaseManager) GetIUserModelManager() IUserModelManager

func (*SUserResourceBaseManager) GetResourceCount

func (userman *SUserResourceBaseManager) GetResourceCount() ([]SScopeResourceCount, error)

func (*SUserResourceBaseManager) ListItemFilter

func (*SUserResourceBaseManager) NamespaceScope

func (manager *SUserResourceBaseManager) NamespaceScope() rbacscope.TRbacScope

func (*SUserResourceBaseManager) OrderByExtraFields

func (*SUserResourceBaseManager) QueryDistinctExtraField

func (manager *SUserResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SUserResourceBaseManager) ResourceScope

func (manager *SUserResourceBaseManager) ResourceScope() rbacscope.TRbacScope

func (*SUserResourceBaseManager) ValidateCreateData

type SVirtualJointResourceBase

type SVirtualJointResourceBase struct {
	SJointResourceBase
}

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) FetchCustomizeColumns

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

func (*SVirtualJointResourceBaseManager) FilterByHiddenSystemAttributes

func (manager *SVirtualJointResourceBaseManager) FilterByHiddenSystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery

func (*SVirtualJointResourceBaseManager) FilterById

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

func (*SVirtualJointResourceBaseManager) FilterByOwner

func (*SVirtualJointResourceBaseManager) FilterBySystemAttributes

func (manager *SVirtualJointResourceBaseManager) FilterBySystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery

func (*SVirtualJointResourceBaseManager) ListItemFilter

func (*SVirtualJointResourceBaseManager) OrderByExtraFields

type SVirtualResourceBase

type SVirtualResourceBase struct {
	SStatusStandaloneResourceBase
	SProjectizedResourceBase
	SPendingDeletedBase

	// 云上同步资源是否在本地被更改过配置, local: 更改过, cloud: 未更改过
	// example: local
	ProjectSrc string `width:"10" charset:"ascii" nullable:"false" list:"user" default:"" json:"project_src"`

	// 是否是系统资源
	IsSystem bool `nullable:"true" default:"false" list:"admin" create:"optional" json:"is_system"`

	// 资源是否被冻结
	Freezed bool `nullable:"false" default:"false" get:"user" list:"user" json:"freezed"`
}

func (*SVirtualResourceBase) CustomizeCreate

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) GetDetailsChangeOwnerCandidateDomains

func (model *SVirtualResourceBase) GetDetailsChangeOwnerCandidateDomains(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (apis.ChangeOwnerCandidateDomainsOutput, error)

func (*SVirtualResourceBase) GetIVirtualModel

func (model *SVirtualResourceBase) GetIVirtualModel() IVirtualModel

func (*SVirtualResourceBase) GetShortDesc

func (model *SVirtualResourceBase) GetShortDesc(ctx context.Context) *jsonutils.JSONDict

func (*SVirtualResourceBase) GetTenantCache

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

func (*SVirtualResourceBase) IsOwner

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

func (*SVirtualResourceBase) PerformCancelDelete

func (*SVirtualResourceBase) PerformChangeOwner

func (*SVirtualResourceBase) PerformFreeze

freezed update and perform action operation except for unfreeze

func (*SVirtualResourceBase) PerformUnfreeze

func (*SVirtualResourceBase) PostCreate

func (*SVirtualResourceBase) PreCheckPerformAction

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

func (*SVirtualResourceBase) SetProjectInfo

func (model *SVirtualResourceBase) SetProjectInfo(ctx context.Context, userCred mcclient.TokenCredential, projectId, domainId string) error

func (*SVirtualResourceBase) SetProjectSrc

func (model *SVirtualResourceBase) SetProjectSrc(src apis.TOwnerSource)

func (*SVirtualResourceBase) SetSystemInfo

func (model *SVirtualResourceBase) SetSystemInfo(isSystem bool) error

func (*SVirtualResourceBase) SyncCloudProjectId

func (model *SVirtualResourceBase) SyncCloudProjectId(userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider)

func (*SVirtualResourceBase) VirtualModelManager

func (model *SVirtualResourceBase) VirtualModelManager() IVirtualModelManager

type SVirtualResourceBaseManager

func NewVirtualResourceBaseManager

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

func (*SVirtualResourceBaseManager) CustomizedTotalCount

func (manager *SVirtualResourceBaseManager) CustomizedTotalCount(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, totalQ *sqlchemy.SQuery) (int, jsonutils.JSONObject, error)

func (*SVirtualResourceBaseManager) FetchByIdOrName

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

func (*SVirtualResourceBaseManager) FetchByName

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

func (*SVirtualResourceBaseManager) FetchCustomizeColumns

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

func (*SVirtualResourceBaseManager) FilterByHiddenSystemAttributes

func (manager *SVirtualResourceBaseManager) FilterByHiddenSystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery

func (*SVirtualResourceBaseManager) FilterBySystemAttributes

func (manager *SVirtualResourceBaseManager) FilterBySystemAttributes(q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject, scope rbacscope.TRbacScope) *sqlchemy.SQuery

func (*SVirtualResourceBaseManager) GetExportExtraKeys

func (manager *SVirtualResourceBaseManager) GetExportExtraKeys(ctx context.Context, keys stringutils2.SSortedStrings, rowMap map[string]string) *jsonutils.JSONDict

func (*SVirtualResourceBaseManager) GetIVirtualModelManager

func (manager *SVirtualResourceBaseManager) GetIVirtualModelManager() IVirtualModelManager

func (*SVirtualResourceBaseManager) GetPropertyDomainStatistics

func (manager *SVirtualResourceBaseManager) GetPropertyDomainStatistics(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) ([]apis.ProjectStatistic, error)

func (*SVirtualResourceBaseManager) GetPropertyProjectStatistics

func (manager *SVirtualResourceBaseManager) GetPropertyProjectStatistics(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) ([]apis.ProjectStatistic, error)

func (*SVirtualResourceBaseManager) GetPropertyProjectTagValuePairs

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

func (*SVirtualResourceBaseManager) GetPropertyProjectTagValueTree

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

func (*SVirtualResourceBaseManager) GetPropertyStatistics

func (manager *SVirtualResourceBaseManager) GetPropertyStatistics(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*apis.StatusStatistic, error)

func (*SVirtualResourceBaseManager) GetResourceCount

func (virtman *SVirtualResourceBaseManager) GetResourceCount() ([]SScopeResourceCount, error)

func (*SVirtualResourceBaseManager) ListItemExportKeys

func (*SVirtualResourceBaseManager) ListItemFilter

func (*SVirtualResourceBaseManager) OrderByExtraFields

func (*SVirtualResourceBaseManager) QueryDistinctExtraField

func (manager *SVirtualResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SVirtualResourceBaseManager) ValidateCreateData

type UUIDGenerator

type UUIDGenerator func() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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