logics

package
v0.0.0-...-cb472e6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SplitFlag      = "##"
	TopoSetName    = "TopSetName"
	TopoModuleName = "TopModuleName"
)

HostSearch search host by multiple condition

Variables

This section is empty.

Functions

func NewImportInstance

func NewImportInstance(kit *rest.Kit, ownerID string, lgc *Logics) *importInstance

func NewSearchHost

func NewSearchHost(kit *rest.Kit, lgc *Logics, hostSearchParam *metadata.HostCommonSearch) searchHostInterface

Types

type InstNameAsst

type InstNameAsst struct {
	ID         string                 `json:"id"`
	ObjID      string                 `json:"bk_obj_id"`
	ObjIcon    string                 `json:"bk_obj_icon"`
	ObjectID   int64                  `json:"bk_inst_id"`
	ObjectName string                 `json:"bk_obj_name"`
	Name       string                 `json:"bk_inst_name"`
	InstInfo   map[string]interface{} `json:"inst_info,omitempty"`
}

type Logics

type Logics struct {
	*backbone.Engine

	AuthManager *extensions.AuthManager
	// contains filtered or unexported fields
}

func NewLogics

func NewLogics(b *backbone.Engine, cache *redis.Client, authManager *extensions.AuthManager) *Logics

NewLogics get logics handle

func (*Logics) AddHost

func (lgc *Logics) AddHost(kit *rest.Kit, appID int64, moduleIDs []int64, ownerID string, hostInfos map[int64]map[string]interface{}, importType metadata.HostInputType) ([]int64, []string, []string, []string, error)

func (*Logics) AddHostToResourcePool

func (lgc *Logics) AddHostToResourcePool(kit *rest.Kit, hostList metadata.AddHostToResourcePoolHostList) ([]int64, *metadata.AddHostToResourcePoolResult, error)

func (*Logics) AssignHostToApp

func (lgc *Logics) AssignHostToApp(kit *rest.Kit, conf *metadata.DefaultModuleHostConfigParams) ([]metadata.ExceptionResult, error)

AssignHostToApp transfer resource host to idle module

func (*Logics) CloneHostProperty

func (lgc *Logics) CloneHostProperty(kit *rest.Kit, appID int64, srcHostID int64, dstHostID int64) errors.CCErrorCoder

CloneHostProperty clone host info and host and module relation in same application

func (*Logics) DeleteHostBusinessAttributes

func (lgc *Logics) DeleteHostBusinessAttributes(kit *rest.Kit, hostIDArr []int64, bizID int64) error

DeleteHostBusinessAttributes delete host business private property

func (*Logics) DeleteHostFromBusiness

func (lgc *Logics) DeleteHostFromBusiness(kit *rest.Kit, bizID int64, hostIDArr []int64) ([]metadata.ExceptionResult, errors.CCError)

DeleteHostFromBusiness delete host from business,

func (*Logics) EnterIP

func (lgc *Logics) EnterIP(kit *rest.Kit, appID, moduleID int64, ip string, cloudID int64, host map[string]interface{}, isIncrement bool) errors.CCError

EnterIP 将机器导入到指定模块或者空闲模块, 已经存在机器,不操作

func (*Logics) ExistHostIDSInApp

func (lgc *Logics) ExistHostIDSInApp(kit *rest.Kit, appID int64, hostIDArray []int64) ([]int64, error)

ExistHostIDSInApp exist host id in app return []int64 don't exist in app hostID, error handle logics error

func (*Logics) ExistInnerModule

func (lgc *Logics) ExistInnerModule(kit *rest.Kit, moduleIDArr []int64) (bool, errors.CCErrorCoder)

func (*Logics) FindHostByModuleIDs

func (lgc *Logics) FindHostByModuleIDs(kit *rest.Kit, data *metadata.HostModuleFind, isDetail bool) (*metadata.SearchHost, error)

func (*Logics) GetAllHostIDByCond

func (lgc *Logics) GetAllHostIDByCond(kit *rest.Kit, cond metadata.HostModuleRelationRequest) ([]int64, errors.CCError)

GetAllHostIDByCond 专用结构, page start 和limit 无效, 获取条件所有满足条件的主机

func (*Logics) GetAppDetails

func (lgc *Logics) GetAppDetails(kit *rest.Kit, fields string, condition map[string]interface{}) (types.MapStr, errors.CCError)

func (*Logics) GetAppIDByCond

func (lgc *Logics) GetAppIDByCond(kit *rest.Kit, cond []metadata.ConditionItem) ([]int64, errors.CCError)

func (*Logics) GetAppMapByCond

func (lgc *Logics) GetAppMapByCond(kit *rest.Kit, fields []string, cond mapstr.MapStr) (map[int64]types.MapStr, errors.CCError)

func (*Logics) GetConfigByCond

func (lgc *Logics) GetConfigByCond(kit *rest.Kit, input metadata.HostModuleRelationRequest) ([]metadata.ModuleHost, errors.CCError)

GetConfigByCond get hosts owned set, module info, where hosts must match condition specify by cond.

func (*Logics) GetDefaultAppID

func (lgc *Logics) GetDefaultAppID(kit *rest.Kit) (int64, errors.CCError)

func (*Logics) GetDefaultAppIDWithSupplier

func (lgc *Logics) GetDefaultAppIDWithSupplier(kit *rest.Kit) (int64, errors.CCError)

func (*Logics) GetHostAttributes

func (lgc *Logics) GetHostAttributes(kit *rest.Kit, bizMetaOpt mapstr.MapStr) ([]metadata.Attribute, error)

func (*Logics) GetHostIDByCond

func (lgc *Logics) GetHostIDByCond(kit *rest.Kit, cond metadata.HostModuleRelationRequest) ([]int64, errors.CCError)

GetHostIDByCond query hostIDs by condition base on cc_ModuleHostConfig available condition fields are bk_supplier_account, bk_biz_id, bk_host_id, bk_module_id, bk_set_id

func (*Logics) GetHostIDByInstID

func (lgc *Logics) GetHostIDByInstID(kit *rest.Kit, asstObjId string, instIDArr []int64) ([]int64, errors.CCError)

func (*Logics) GetHostInfoByConds

func (lgc *Logics) GetHostInfoByConds(kit *rest.Kit, cond map[string]interface{}) ([]mapstr.MapStr, errors.CCErrorCoder)

func (*Logics) GetHostInstanceDetails

func (lgc *Logics) GetHostInstanceDetails(kit *rest.Kit, hostID int64) (map[string]interface{}, string, errors.CCError)

func (*Logics) GetHostModuleRelation

func (lgc *Logics) GetHostModuleRelation(kit *rest.Kit, cond metadata.HostModuleRelationRequest) (*metadata.HostConfigData, errors.CCErrorCoder)

GetHostModuleRelation query host and module relation, condition key use appID, moduleID,setID,HostID

func (*Logics) GetModuleIDAndIsInternal

func (lgc *Logics) GetModuleIDAndIsInternal(kit *rest.Kit, bizID, moduleID int64) (int64, bool, error)

func (*Logics) GetModuleIDByCond

func (lgc *Logics) GetModuleIDByCond(kit *rest.Kit, cond []metadata.ConditionItem) ([]int64, errors.CCError)

func (*Logics) GetModuleMapByCond

func (lgc *Logics) GetModuleMapByCond(kit *rest.Kit, fields []string, cond mapstr.MapStr) (map[int64]types.MapStr, errors.CCError)

func (*Logics) GetNormalModuleByModuleID

func (lgc *Logics) GetNormalModuleByModuleID(kit *rest.Kit, appID, moduleID int64) ([]mapstr.MapStr, errors.CCError)

func (*Logics) GetObjectAttributes

func (lgc *Logics) GetObjectAttributes(kit *rest.Kit, objID string, page meta.BasePage) ([]meta.Attribute, errors.CCError)

get the object attributes

func (*Logics) GetObjectInstByCond

func (lgc *Logics) GetObjectInstByCond(kit *rest.Kit, objID string, cond []meta.ConditionItem) ([]int64, errors.CCError)

func (*Logics) GetResourcePoolModuleID

func (lgc *Logics) GetResourcePoolModuleID(kit *rest.Kit, condition mapstr.MapStr) (int64, errors.CCError)

func (*Logics) GetSetIDByCond

func (lgc *Logics) GetSetIDByCond(kit *rest.Kit, cond []metadata.ConditionItem) ([]int64, errors.CCError)

func (*Logics) GetSetIDByObjectCond

func (lgc *Logics) GetSetIDByObjectCond(kit *rest.Kit, appID int64, objectCond []meta.ConditionItem) ([]int64, errors.CCError)

func (*Logics) GetSetIDsByTopo

func (lgc *Logics) GetSetIDsByTopo(kit *rest.Kit, objID string, instID int64) ([]int64, error)

GetSetIDsByTopo get set IDs by custom layer node

func (*Logics) GetSetMapByCond

func (lgc *Logics) GetSetMapByCond(kit *rest.Kit, fields []string, cond mapstr.MapStr) (map[int64]mapstr.MapStr, errors.CCError)

func (*Logics) GetSingleApp

func (lgc *Logics) GetSingleApp(kit *rest.Kit, cond mapstr.MapStr) (mapstr.MapStr, errors.CCError)

func (*Logics) GetTopoIDByName

func (lgc *Logics) GetTopoIDByName(kit *rest.Kit, c *meta.HostToAppModule) (int64, int64, int64, errors.CCError)

func (*Logics) IPCloudToHost

func (lgc *Logics) IPCloudToHost(kit *rest.Kit, ip string, cloudID int64) (HostMap mapstr.MapStr, hostID int64, err errors.CCErrorCoder)

IPCloudToHost get host id by ip and cloud

func (*Logics) IsHostExistInApp

func (lgc *Logics) IsHostExistInApp(kit *rest.Kit, appID, hostID int64) (bool, errors.CCErrorCoder)

func (*Logics) IsPlatExist

func (lgc *Logics) IsPlatExist(kit *rest.Kit, cond mapstr.MapStr) (bool, errors.CCError)

func (*Logics) LockHost

func (lgc *Logics) LockHost(kit *rest.Kit, input *metadata.HostLockRequest) errors.CCError

func (*Logics) MoveHostToResourcePool

func (lgc *Logics) MoveHostToResourcePool(kit *rest.Kit, conf *metadata.DefaultModuleHostConfigParams) ([]metadata.ExceptionResult, error)

func (*Logics) NewSpecial

func (lgc *Logics) NewSpecial(kit *rest.Kit) SpecialHandle

NewSpecial return handle special logic

func (*Logics) QueryHostLock

func (lgc *Logics) QueryHostLock(kit *rest.Kit, input *metadata.QueryHostLockRequest) (map[int64]bool, errors.CCError)

func (*Logics) SearchHost

func (lgc *Logics) SearchHost(kit *rest.Kit, data *metadata.HostCommonSearch, isDetail bool) (*metadata.SearchHost, error)

func (*Logics) SearchHostInfo

func (lgc *Logics) SearchHostInfo(kit *rest.Kit, cond metadata.QueryCondition) ([]mapstr.MapStr, errors.CCErrorCoder)

SearchHostInfo search host info by QueryCondition

func (*Logics) TransferHostAcrossBusiness

func (lgc *Logics) TransferHostAcrossBusiness(kit *rest.Kit, srcBizID, dstAppID int64, hostID []int64, moduleID []int64) errors.CCError

TransferHostAcrossBusiness Transfer host across business, delete old business host and module relation

func (*Logics) UnlockHost

func (lgc *Logics) UnlockHost(kit *rest.Kit, input *metadata.HostLockRequest) errors.CCError

type SpecialHandle

type SpecialHandle interface {
	BkSystemInstall(ctx context.Context, appName string, input *metadata.BkSystemInstallRequest) errors.CCError
}

SpecialHandle 用来做隔离, 不让logic 正常逻辑调用

Jump to

Keyboard shortcuts

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