v3

package
v3.1.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Plat plat name
	Plat = "plat"

	// IsIncrement is increment
	IsIncrement = "is_increment"

	// HostID host id
	HostID = "bk_host_id"

	// PlatID  plat id
	PlatID = "bk_cloud_id"
	// BusinessID the business id
	BusinessID = "bk_biz_id"
	// SetID the set id
	SetID = "bk_set_id"
	// ModuleID the module id
	ModuleID = "bk_module_id"
	// ObjectID the object identifier name
	ObjectID = "bk_obj_id"
	// CommonInstID the common inst id
	CommonInstID = "bk_inst_id"
	// SupplierAccount the business id
	SupplierAccount = "bk_supplier_account"
)
View Source
const (
	HostInfoField = "host_info"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

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

func (*Attribute) CreateObjectAttribute

func (m *Attribute) CreateObjectAttribute(data types.MapStr) (int, error)

CreateObjectAttribute create a new model object attribute

func (*Attribute) DeleteObjectAttribute

func (m *Attribute) DeleteObjectAttribute(cond common.Condition) error

DeleteObjectAttribute delete a object attribute by condition

func (*Attribute) SearchObjectAttributes

func (m *Attribute) SearchObjectAttributes(cond common.Condition) ([]types.MapStr, error)

SearchObjectAttributes search some object attributes by condition

func (*Attribute) UpdateObjectAttribute

func (m *Attribute) UpdateObjectAttribute(data types.MapStr, cond common.Condition) error

UpdateObjectAttribute update a object attribute by condition

type AttributeGetter

type AttributeGetter interface {
	Attribute() AttributeInterface
}

type AttributeInterface

type AttributeInterface interface {
	CreateObjectAttribute(data types.MapStr) (int, error)
	DeleteObjectAttribute(cond common.Condition) error
	UpdateObjectAttribute(data types.MapStr, cond common.Condition) error
	SearchObjectAttributes(cond common.Condition) ([]types.MapStr, error)
}

type Business

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

Business define

func (*Business) CreateBusiness

func (h *Business) CreateBusiness(data types.MapStr) (int, error)

CreateBusiness create business

func (*Business) DeleteBusiness

func (h *Business) DeleteBusiness(bizID int) error

DeleteBusiness delete business by ID

func (*Business) SearchBusiness

func (h *Business) SearchBusiness(cond common.Condition) ([]types.MapStr, error)

SearchBusiness search bussiness operation

func (*Business) UpdateBusiness

func (h *Business) UpdateBusiness(data types.MapStr, bizID int) error

UpdateBusiness update business by iD

type BusinessGetter

type BusinessGetter interface {
	Business() BusinessInterface
}

BusinessGetter business getter interface

type BusinessInterface

type BusinessInterface interface {
	// SearchBusiness search host by condition,
	SearchBusiness(cond common.Condition) ([]types.MapStr, error)
	// CreateBusiness create host
	CreateBusiness(data types.MapStr) (int, error)
	// update update host by bizID, bizID could be separated by a comma
	UpdateBusiness(data types.MapStr, bizID int) error
	// DeleteBusiness delete host by bizID, bizID could be separated by a comma
	DeleteBusiness(bizID int) error
}

BusinessInterface business operation interface

type Classification

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

func (*Classification) CreateClassification

func (m *Classification) CreateClassification(data types.MapStr) (int, error)

CreateClassification create a new classification

func (*Classification) DeleteClassification

func (m *Classification) DeleteClassification(cond common.Condition) error

DeleteClassification delete some classification by condition

func (*Classification) SearchClassificationWithObjects

func (m *Classification) SearchClassificationWithObjects(cond common.Condition) ([]types.MapStr, error)

SearchClassificationWithObjects search some classification with objects

func (*Classification) SearchClassifications

func (m *Classification) SearchClassifications(cond common.Condition) ([]types.MapStr, error)

SearchClassifications search some classification by condition

func (*Classification) UpdateClassification

func (m *Classification) UpdateClassification(data types.MapStr, cond common.Condition) error

UpdateClassification update the classification by condition

type ClassificationGetter

type ClassificationGetter interface {
	Classification() ClassificationInterface
}

type ClassificationInterface

type ClassificationInterface interface {
	CreateClassification(data types.MapStr) (int, error)
	DeleteClassification(cond common.Condition) error
	SearchClassifications(cond common.Condition) ([]types.MapStr, error)
	SearchClassificationWithObjects(cond common.Condition) ([]types.MapStr, error)
	UpdateClassification(data types.MapStr, cond common.Condition) error
}

type Client

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

Client the http client

func New

func (*Client) Attribute

func (cli *Client) Attribute() AttributeInterface

func (*Client) Business

func (cli *Client) Business() BusinessInterface

func (*Client) Classification

func (cli *Client) Classification() ClassificationInterface

func (*Client) CommonInst

func (cli *Client) CommonInst() CommonInstInterface

func (*Client) GetAddress

func (cli *Client) GetAddress() string

GetAddress get the address

func (*Client) GetSupplierAccount

func (cli *Client) GetSupplierAccount() string

GetSupplierAccount get the supplier account

func (*Client) GetUser

func (cli *Client) GetUser() string

GetUser get the user

func (*Client) Group

func (cli *Client) Group() GroupInterface

func (*Client) Host

func (cli *Client) Host() HostInterface

func (*Client) Model

func (cli *Client) Model() ModelInterface

func (*Client) Module

func (cli *Client) Module() ModuleInterface

func (*Client) Set

func (cli *Client) Set() SetInterface

func (*Client) SetAddress

func (cli *Client) SetAddress(address string)

SetAddress set a new address

func (*Client) SetSupplierAccount

func (cli *Client) SetSupplierAccount(supplierAccount string)

SetSupplierAccount set a new supplieraccount

func (*Client) SetUser

func (cli *Client) SetUser(user string)

SetUser set a new user

type CommonInst

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

CommonInst inst data

func (*CommonInst) CreateCommonInst

func (m *CommonInst) CreateCommonInst(data types.MapStr) (int, error)

CreateCommonInst create a common inst instance

func (*CommonInst) DeleteCommonInst

func (m *CommonInst) DeleteCommonInst(cond common.Condition) error

DeleteCommonInst delete a common inst instance

func (*CommonInst) SearchInst

func (m *CommonInst) SearchInst(cond common.Condition) ([]types.MapStr, error)

SearchInst search all inst by condition

func (*CommonInst) UpdateCommonInst

func (m *CommonInst) UpdateCommonInst(data types.MapStr, cond common.Condition) error

UpdateCommonInst update a common inst instance

type CommonInstGetter

type CommonInstGetter interface {
	CommonInst() CommonInstInterface
}

CommonInstGetter inst getter

type CommonInstInterface

type CommonInstInterface interface {
	CreateCommonInst(data types.MapStr) (int, error)
	DeleteCommonInst(cond common.Condition) error
	UpdateCommonInst(data types.MapStr, cond common.Condition) error
	SearchInst(cond common.Condition) ([]types.MapStr, error)
}

CommonInstInterface inst operation interface

type Group

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

Group group data struct

func (*Group) CreateGroup

func (g *Group) CreateGroup(data types.MapStr) (int, error)

CreateGroup create a group

func (*Group) DeleteGroup

func (g *Group) DeleteGroup(cond common.Condition) error

DeleteGroup delete a group by condition

func (*Group) SearchGroups

func (g *Group) SearchGroups(cond common.Condition) ([]types.MapStr, error)

SearchGroups search some group by condition

func (*Group) UpdateGroup

func (g *Group) UpdateGroup(data types.MapStr, cond common.Condition) error

UpdateGroup update a group by condition

type GroupGetter

type GroupGetter interface {
	Group() GroupInterface
}

GroupGetter group getter

type GroupInterface

type GroupInterface interface {
	CreateGroup(data types.MapStr) (int, error)
	DeleteGroup(cond common.Condition) error
	UpdateGroup(data types.MapStr, cond common.Condition) error
	SearchGroups(cond common.Condition) ([]types.MapStr, error)
}

GroupInterface group interface

type Host

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

Host define

func (*Host) CreateHostBatch

func (h *Host) CreateHostBatch(bizID int64, moduleIDS []int64, data ...types.MapStr) ([]int, error)

CreateHostBatch batch to create hosts

func (*Host) DeleteHostBatch

func (h *Host) DeleteHostBatch(hostID string) error

DeleteHostBatch batch to delete the host

func (*Host) ResetBusinessHosts

func (h *Host) ResetBusinessHosts(bizID int64, moduleID int64, setID int64) error

ResetBusinessHosts transfer the hosts in set or module to the idle module

func (*Host) SearchHost

func (h *Host) SearchHost(cond common.Condition) ([]types.MapStr, error)

SearchHost search the host

func (*Host) TransferHostFromResourcePoolsToBusinessIdleModule

func (h *Host) TransferHostFromResourcePoolsToBusinessIdleModule(bizID int64, hostIDS []int64) error

TransferHostFromResourcePoolsToBusinessIdleModule transfer the hosts from resource pools to another business

func (*Host) TransferHostToAnotherBusinessModules

func (h *Host) TransferHostToAnotherBusinessModules(bizID int64, moduleID int64, hostInfo []*HostInfo) error

TransferHostToAnotherBusinessModules transfer host to another business modules

func (*Host) TransferHostToBusinessFaultModule

func (h *Host) TransferHostToBusinessFaultModule(bizID int64, hostIDS []int64) error

TransferHostToBusinessFaultModule transfer host module to fault module

func (*Host) TransferHostToBusinessIdleModule

func (h *Host) TransferHostToBusinessIdleModule(bizID int64, hostIDS []int64) error

TransferHostToBusinessIdleModule transfer host module to idle module

func (*Host) TransferHostToBusinessModule

func (h *Host) TransferHostToBusinessModule(bizID int64, hostIDS []int64, newModuleIDS []int64, isIncrement bool) error

TransferHostModule transfer hosts to another modules in the same business

func (*Host) TransferHostToResourcePools

func (h *Host) TransferHostToResourcePools(bizID int64, hostIDS []int64) error

TransferHostToResourcePools transfer host module to resource pools

func (*Host) UpdateHostBatch

func (h *Host) UpdateHostBatch(data types.MapStr, hostID string) error

UpdateHostBatch batch to update the hosts

type HostGetter

type HostGetter interface {
	Host() HostInterface
}

HostGetter host getter

type HostInfo

type HostInfo struct {
	HostInnerIP string `json:"bk_host_innerip"`
	CloudID     int64  `json:"bk_cloud_id"`
}

HostInfo the host infos

type HostInterface

type HostInterface interface {
	// SearchHost search host by condition,
	SearchHost(cond common.Condition) ([]types.MapStr, error)
	// CreateHostBatch create host
	CreateHostBatch(bizID int64, moduleIDS []int64, data ...types.MapStr) ([]int, error)

	// update update host by hostID, hostID could be separated by a comma
	UpdateHostBatch(data types.MapStr, hostID string) error

	// DeleteHost delete host by hostID, hostID could be separated by a comma
	DeleteHostBatch(hostID string) error

	// TransferHostToBusinessModule transfer host to business module
	TransferHostToBusinessModule(bizID int64, hostIDS []int64, newModuleIDS []int64, isIncrement bool) error

	// TransferHostFromResourcePoolsToBusinessIdleModule transfer host to business module
	TransferHostFromResourcePoolsToBusinessIdleModule(bizID int64, hostIDS []int64) error

	// TransferHostToBusinessFaultModule transfer host module to fault module
	TransferHostToBusinessFaultModule(bizID int64, hostIDS []int64) error

	// TransferHostToBusinessIdleModule transfer host module to idle module
	TransferHostToBusinessIdleModule(bizID int64, hostIDS []int64) error

	// TransferHostToResourcePools transfer host module to resource pools
	TransferHostToResourcePools(bizID int64, hostIDS []int64) error

	// TransferHostToAnotherBusinessModules transfer host to another modules
	TransferHostToAnotherBusinessModules(bizID int64, moduleID int64, hostInfo []*HostInfo) error
	// ResetBusinessHosts transfer the hosts in set or module to the idle module
	ResetBusinessHosts(bizID int64, moduleID int64, setID int64) error
}

HostInterface host operation

type Model

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

func (*Model) CreateObject

func (m *Model) CreateObject(data types.MapStr) (int, error)

CreateObject create a new model object

func (*Model) DeleteObject

func (m *Model) DeleteObject(cond common.Condition) error

DeleteObject delete a object by condition

func (*Model) SearchObjectTopo

func (m *Model) SearchObjectTopo(cond common.Condition) ([]types.MapStr, error)

SearchObjectTopo search object topo by condition

func (*Model) SearchObjects

func (m *Model) SearchObjects(cond common.Condition) ([]types.MapStr, error)

SearchObjects search some objects by condition

func (*Model) UpdateObject

func (m *Model) UpdateObject(data types.MapStr, cond common.Condition) error

UpdateObject update a object by condition

type ModelGetter

type ModelGetter interface {
	Model() ModelInterface
}

type ModelInterface

type ModelInterface interface {
	CreateObject(data types.MapStr) (int, error)
	DeleteObject(cond common.Condition) error
	UpdateObject(data types.MapStr, cond common.Condition) error
	SearchObjects(cond common.Condition) ([]types.MapStr, error)
	SearchObjectTopo(cond common.Condition) ([]types.MapStr, error)
}

type Module

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

Module the module interface implement

func (*Module) CreateModule

func (cli *Module) CreateModule(bizID, setID int64, data types.MapStr) (int, error)

CreateModule create a new module object

func (*Module) DeleteModule

func (cli *Module) DeleteModule(bizID, setID, moduleID int64) error

DeleteModule delete a module by condition

func (*Module) SearchModules

func (cli *Module) SearchModules(cond common.Condition) ([]types.MapStr, error)

SearchModules search some modules by condition

func (*Module) UpdateModule

func (cli *Module) UpdateModule(bizID, setID, moduleID int64, data types.MapStr) error

UpdateModule update a module by condition

type ModuleGetter

type ModuleGetter interface {
	Module() ModuleInterface
}

ModuleGetter the module getter interface

type ModuleInterface

type ModuleInterface interface {
	CreateModule(bizID, setID int64, data types.MapStr) (int, error)
	DeleteModule(bizID, setID, moduleID int64) error
	UpdateModule(bizID, setID, moduleID int64, data types.MapStr) error
	SearchModules(cond common.Condition) ([]types.MapStr, error)
}

ModuleInterface the module interface

type Set

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

Set the set interface implement

func (*Set) CreateSet

func (cli *Set) CreateSet(bizID int64, data types.MapStr) (int, error)

CreateSet create a new Set

func (*Set) DeleteSet

func (cli *Set) DeleteSet(cond common.Condition) error

DeleteSet delete a set by condition

func (*Set) SearchSets

func (cli *Set) SearchSets(cond common.Condition) ([]types.MapStr, error)

SearchSets search some sets by condition

func (*Set) UpdateSet

func (cli *Set) UpdateSet(bizID int64, data types.MapStr, cond common.Condition) error

UpdateSet update a set by condition

type SetGetter

type SetGetter interface {
	Set() SetInterface
}

SetGetter the set getter interface

type SetInterface

type SetInterface interface {
	CreateSet(bizID int64, data types.MapStr) (int, error)
	DeleteSet(cond common.Condition) error
	UpdateSet(bizID int64, data types.MapStr, cond common.Condition) error
	SearchSets(cond common.Condition) ([]types.MapStr, error)
}

SetInterface the set interface

Jump to

Keyboard shortcuts

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