inst

package
v3.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// HostID host id
	HostID = "bk_host_id"

	// PlatID the plat id
	PlatID = "bk_cloud_id"
	// Plat the object id
	Plat = "plat"
	// Business the business object
	Business = "biz"

	// Module the module object
	Module = "module"

	// Set the set object
	Set = "set"

	// BusinessID the business id
	BusinessID = "bk_biz_id"
	// BusinessNameField the business name
	BusinessNameField = "bk_biz_name"
	// InstID the common inst id
	InstID = "bk_inst_id"

	ParentID = "bk_parent_id"

	// InstName the common inst name
	InstName = "bk_inst_name"

	// SetID the set id
	SetID = "bk_set_id"

	// SetName the set name
	SetName = "bk_set_name"

	// ModuleID the module id
	ModuleID = "bk_module_id"

	// ModuleName the module name
	ModuleName = "bk_module_name"

	// PlatName the plat name
	PlatName = "bk_cloud_name"

	// DefaultLimit the limit num
	DefaultLimit = 1000
	// HostIDField the host id field
	HostIDField = "bk_host_id"
	// HostNameField the host name field
	HostNameField = "bk_host_name"

	// HostInnerIP the host innerip
	HostInnerIP = "bk_host_innerip"
)

Variables

This section is empty.

Functions

func NewHostIterator

func NewHostIterator(target model.Model, cond common.Condition) (*hostIterator, error)

Types

type BusinessInterface

type BusinessInterface interface {
	Maintaince

	GetModel() model.Model

	GetInstID() (int, error)
	GetInstName() string

	SetValue(key string, value interface{}) error
	GetValues() (types.MapStr, error)
}

BusinessInterface the business interface

type BusinessIterator

type BusinessIterator interface {
	Next() (BusinessInterface, error)
	ForEach(callbackItem func(item BusinessInterface) error) error
}

BusinessIterator the iterator interface for the business

func NewIteratorInstBusiness

func NewIteratorInstBusiness(target model.Model, cond common.Condition) (BusinessIterator, error)

type CommonInstInterface

type CommonInstInterface interface {
	Maintaince

	GetModel() model.Model

	GetInstID() int
	GetInstName() string

	SetValue(key string, value interface{}) error
	GetValues() (types.MapStr, error)
}

CommonInstInterface the inst interface

type FieldName

type FieldName string

FieldName the field name

type HostInterface

type HostInterface interface {
	Maintaince

	Transfer() TransferInterface

	SetBusinessID(bizID int64)
	SetModuleIDS(moduleIDS []int64, isIncrement bool)

	GetBizs() []types.MapStr
	GetSets() []types.MapStr
	GetModules() []types.MapStr

	GetModel() model.Model

	GetInstID() (int64, error)
	GetInstName() string

	SetValue(key string, value interface{}) error
	GetValues() (types.MapStr, error)
}

HostInterface the host interface

type HostIterator

type HostIterator interface {
	Next() (HostInterface, error)
	ForEach(callbackItem func(item HostInterface) error) error
}

HostIterator the iterator interface for the host

type Iterator

type Iterator interface {
	Next() (CommonInstInterface, error)
	ForEach(callbackItem func(item CommonInstInterface) error) error
}

Iterator the iterator interface for the Inst

func NewIteratorInst

func NewIteratorInst(target model.Model, cond common.Condition) (Iterator, error)

type Maintaince

type Maintaince interface {
	IsExists() (bool, error)
	Create() error
	Update() error
	Save() error
}

Maintaince the operation method

type ModuleInterface

type ModuleInterface interface {
	Maintaince

	SetTopo(bizID, setID int64)

	GetModel() model.Model

	GetInstID() (int64, error)
	GetInstName() string

	SetValue(key string, value interface{}) error
	GetValues() (types.MapStr, error)
}

ModuleInterface the module interface

type ModuleIterator

type ModuleIterator interface {
	Next() (ModuleInterface, error)
	ForEach(callbackItem func(item ModuleInterface) error) error
}

ModuleIterator the iterator interface for the module

func NewIteratorInstModule

func NewIteratorInstModule(target model.Model, cond common.Condition) (ModuleIterator, error)

type OperationInterface

type OperationInterface interface {
	CreateCommonInst(target model.Model) CommonInstInterface
	CreateSetInst(target model.Model) SetInterface
	CreateModuleInst(target model.Model) ModuleInterface
	CreateBusinessInst(target model.Model) BusinessInterface
	CreatePlatInst(target model.Model) CommonInstInterface
	CreateHostInst(target model.Model) HostInterface

	DeleteHosts(supplierAccount string, hostIDS []int64) error

	FindCommonInstLikeName(target model.Model, instName string) (Iterator, error)
	FindCommonInstByCondition(target model.Model, cond common.Condition) (Iterator, error)
	FindBusinessLikeName(target model.Model, businessName string) (BusinessIterator, error)
	FindBusinessByCondition(target model.Model, condition common.Condition) (BusinessIterator, error)
	FindHostsLikeName(target model.Model, hostname string) (HostIterator, error)
	FindHostsByCondition(target model.Model, condition common.Condition) (HostIterator, error)
	FindModulesLikeName(target model.Model, moduleName string) (ModuleIterator, error)
	FindModulesByCondition(target model.Model, cond common.Condition) (ModuleIterator, error)
	FindPlatsLikeName(target model.Model, platName string) (Iterator, error)
	FindPlatsByCondition(target model.Model, cond common.Condition) (Iterator, error)
	FindSetsLikeName(target model.Model, setName string) (SetIterator, error)
	FindSetsByCondition(target model.Model, cond common.Condition) (SetIterator, error)
}

OperationInterface inst operation interface

func Operation

func Operation() OperationInterface

Operation inst operation interface

type SetInterface

type SetInterface interface {
	Maintaince

	SetBusinessID(bizID int64)

	GetModel() model.Model

	GetInstID() int
	GetInstName() string

	SetValue(key string, value interface{}) error
	GetValues() (types.MapStr, error)
}

SetInterface the set interface

type SetIterator

type SetIterator interface {
	Next() (SetInterface, error)
	ForEach(callbackItem func(item SetInterface) error) error
}

SetIterator the iterator interface for the set

func NewIteratorInstSet

func NewIteratorInstSet(target model.Model, cond common.Condition) (SetIterator, error)

type TransferInterface

type TransferInterface interface {
	// MoveToModule transfer host to business module
	MoveToModule(newModuleIDS []int64, isIncrement bool) error

	// MoveToFaultModule transfer host module to fault module
	MoveToFaultModule() error

	// MoveToIdleModule transfer host module to idle module
	MoveToIdleModule() error

	// MoveToResourcePools transfer host module to resource pools
	MoveToResourcePools() error

	// MoveToBusinessIdleModuleFromResourcePools transfer host to business module
	MoveToBusinessIdleModuleFromResourcePools(bizID int64) error

	// MoveToAnotherBusinessModules transfer host to another business modules
	MoveToAnotherBusinessModules(bizID int64, moduleID int64) error

	// ResetBusinessHosts transfer the hosts in set or module to the idle module
	ResetBusinessHosts(setID, moduleID int64) error
}

TransferInterface host trnasfer operation

Jump to

Keyboard shortcuts

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