operation

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: 29 Imported by: 0

Documentation

Index

Constants

View Source
const CCTimeTypeParseFlag = "cc_time_type"

Variables

This section is empty.

Functions

func ConvByPropertytype

func ConvByPropertytype(field model.Attribute, val string) (interface{}, error)

ConvByPropertytype convert str to property type

func NewAsstObjectInst

func NewAsstObjectInst(pheader http.Header, engine *backbone.Engine, ownerID string, fields map[string]*metadata.ObjAttDes) *asstObjectInst

NewAsstObjectInst create asst inst

Types

type AssociationObjectID

type AssociationObjectID string

type AssociationOperationInterface

type AssociationOperationInterface interface {
	CreateMainlineAssociation(params types.ContextParams, data *metadata.Association) (model.Object, error)
	DeleteMainlineAssociaton(params types.ContextParams, objID string) error
	SearchMainlineAssociationTopo(params types.ContextParams, targetObj model.Object) ([]*metadata.MainlineObjectTopo, error)
	SearchMainlineAssociationInstTopo(params types.ContextParams, obj model.Object, instID int64) ([]*metadata.TopoInstRst, error)
	CreateCommonAssociation(params types.ContextParams, data *metadata.Association) error
	DeleteAssociation(params types.ContextParams, cond condition.Condition) error
	UpdateAssociation(params types.ContextParams, data frtypes.MapStr, cond condition.Condition) error
	SearchObjectAssociation(params types.ContextParams, objID string) ([]metadata.Association, error)
	SearchInstAssociation(params types.ContextParams, query *metadata.QueryInput) ([]metadata.InstAsst, error)
	CheckBeAssociation(params types.ContextParams, obj model.Object, cond condition.Condition) error
	CreateCommonInstAssociation(params types.ContextParams, data *metadata.InstAsst) error
	DeleteInstAssociation(params types.ContextParams, cond condition.Condition) error

	SetProxy(cls ClassificationOperationInterface, obj ObjectOperationInterface, grp GroupOperationInterface, attr AttributeOperationInterface, inst InstOperationInterface, targetModel model.Factory, targetInst inst.Factory)
}

AssociationOperationInterface association operation methods

func NewAssociationOperation

func NewAssociationOperation(client apimachinery.ClientSetInterface) AssociationOperationInterface

NewAssociationOperation create a new association operation instance

type AssociationParams

type AssociationParams struct {
	Page      metadata.BasePage          `json:"page,omitempty"`
	Fields    map[string][]string        `json:"fields,omitempty"`
	Condition map[string][]ConditionItem `json:"condition,omitempty"`
}

AssociationParams association params

type AttributeOperationInterface

type AttributeOperationInterface interface {
	CreateObjectAttribute(params types.ContextParams, data frtypes.MapStr) (model.Attribute, error)
	DeleteObjectAttribute(params types.ContextParams, id int64, cond condition.Condition) error
	FindObjectAttributeWithDetail(params types.ContextParams, cond condition.Condition) ([]*metadata.ObjAttDes, error)
	FindObjectAttribute(params types.ContextParams, cond condition.Condition) ([]model.Attribute, error)
	UpdateObjectAttribute(params types.ContextParams, data frtypes.MapStr, attID int64, cond condition.Condition) error

	SetProxy(modelFactory model.Factory, instFactory inst.Factory, obj ObjectOperationInterface, asst AssociationOperationInterface, grp GroupOperationInterface)
}

AttributeOperationInterface attribute operation methods

func NewAttributeOperation

func NewAttributeOperation(client apimachinery.ClientSetInterface) AttributeOperationInterface

NewAttributeOperation create a new attribute operation instance

type AuditInterface

type AuditInterface interface {
	CreateSnapshot(instID int64, cond mapstr.MapStr) *WrapperResult
	CommitCreateLog(preData, currData *WrapperResult, inst inst.Inst)
	CommitDeleteLog(preData, currData *WrapperResult, inst inst.Inst)
	CommitUpdateLog(preData, currData *WrapperResult, inst inst.Inst)
}

AuditInterface audit log methods

type AuditOperationInterface

type AuditOperationInterface interface {
	Query(params types.ContextParams, data mapstr.MapStr) (interface{}, error)
}

func NewAuditOperation

NewAuditOperation create a new inst operation instance

type BatchResult

type BatchResult struct {
	Errors       []string `json:"error"`
	Success      []string `json:"success"`
	UpdateErrors []string `json:"update_error"`
}

type BusinessOperationInterface

type BusinessOperationInterface interface {
	CreateBusiness(params types.ContextParams, obj model.Object, data mapstr.MapStr) (inst.Inst, error)
	DeleteBusiness(params types.ContextParams, obj model.Object, bizID int64) error
	FindBusiness(params types.ContextParams, obj model.Object, fields []string, cond condition.Condition) (count int, results []inst.Inst, err error)
	GetInternalModule(params types.ContextParams, obj model.Object, bizID int64) (count int, result *metadata.InnterAppTopo, err error)
	UpdateBusiness(params types.ContextParams, data mapstr.MapStr, obj model.Object, bizID int64) error

	SetProxy(set SetOperationInterface, module ModuleOperationInterface, inst InstOperationInterface, obj ObjectOperationInterface)
}

BusinessOperationInterface business operation methods

func NewBusinessOperation

func NewBusinessOperation(client apimachinery.ClientSetInterface) BusinessOperationInterface

NewBusinessOperation create a business instance

type ClassificationOperationInterface

type ClassificationOperationInterface interface {
	SetProxy(modelFactory model.Factory, instFactory inst.Factory, asst AssociationOperationInterface, obj ObjectOperationInterface)

	FindSingleClassification(params types.ContextParams, classificationID string) (model.Classification, error)
	CreateClassification(params types.ContextParams, data frtypes.MapStr) (model.Classification, error)
	DeleteClassification(params types.ContextParams, id int64, data frtypes.MapStr, cond condition.Condition) error
	FindClassification(params types.ContextParams, cond condition.Condition) ([]model.Classification, error)
	FindClassificationWithObjects(params types.ContextParams, cond condition.Condition) ([]metadata.ClassificationWithObject, error)
	UpdateClassification(params types.ContextParams, data frtypes.MapStr, id int64, cond condition.Condition) error
}

ClassificationOperationInterface classification opoeration methods

func NewClassificationOperation

func NewClassificationOperation(client apimachinery.ClientSetInterface) ClassificationOperationInterface

NewClassificationOperation create a new classification operation instance

type CompatibleV2OperationInterface

type CompatibleV2OperationInterface interface {
	Business(params types.ContextParams) compatiblev2.BusinessInterface
	Module(params types.ContextParams) compatiblev2.ModuleInterface
	Set(params types.ContextParams) compatiblev2.SetInterface
}

CompatibleV2OperationInterface compatibleV2 methods

func NewCompatibleV2Operation

func NewCompatibleV2Operation(client apimachinery.ClientSetInterface) CompatibleV2OperationInterface

NewCompatibleV2Operation create a new compatiblev2 operation instance

type ConditionItem

type ConditionItem struct {
	Field    string      `json:"field,omitempty"`
	Operator string      `json:"operator,omitempty"`
	Value    interface{} `json:"value,omitempty"`
}

ConditionItem subcondition

type Content

type Content struct {
	PreData interface{} `json:"pre_data"`
	CurData interface{} `json:"cur_data"`
	Headers []Header    `json:"header"`
}

type ExportObjectCondition

type ExportObjectCondition struct {
	ObjIDS []string `json:"condition"`
}

type FieldName

type FieldName string

type GraphicsOperationInterface

type GraphicsOperationInterface interface {
	SelectObjectTopoGraphics(params types.ContextParams, scopeType, scopeID string) ([]metadata.TopoGraphics, error)
	UpdateObjectTopoGraphics(params types.ContextParams, scopeType, scopeID string, datas []metadata.TopoGraphics) error

	SetProxy(obj ObjectOperationInterface, asst AssociationOperationInterface)
}

type GroupOperationInterface

type GroupOperationInterface interface {
	CreateObjectGroup(params types.ContextParams, data frtypes.MapStr) (model.Group, error)
	DeleteObjectGroup(params types.ContextParams, groupID int64) error
	FindObjectGroup(params types.ContextParams, cond condition.Condition) ([]model.Group, error)
	FindGroupByObject(params types.ContextParams, objID string, cond condition.Condition) ([]model.Group, error)
	UpdateObjectGroup(params types.ContextParams, cond *metadata.UpdateGroupCondition) error
	UpdateObjectAttributeGroup(params types.ContextParams, cond []metadata.PropertyGroupObjectAtt) error
	DeleteObjectAttributeGroup(params types.ContextParams, objID, propertyID, groupID string) error
	SetProxy(modelFactory model.Factory, instFactory inst.Factory, obj ObjectOperationInterface)
}

GroupOperationInterface group operation methods

func NewGroupOperation

NewGroupOperation create a new group operation instance

type Header struct {
	PropertyID   string `json:"bk_property_id"`
	PropertyName string `json:"bk_property_name"`
}

type HealthOperationInterface

type HealthOperationInterface interface {
	Health(params types.ContextParams) (*metric.HealthResponse, error)
}

type IdentifierOperationInterface

type IdentifierOperationInterface interface {
	SearchIdentifier(params types.ContextParams, objType string, param *metadata.SearchIdentifierParam) (*metadata.SearchHostIdentifierResult, error)
}

type ImportObjectData

type ImportObjectData struct {
	Meta mapstr.MapStr           `json:"meta"`
	Attr map[int64]mapstr.MapStr `json:"attr"`
}

type InputKey

type InputKey string

type InstBatchInfo

type InstBatchInfo struct {
	// BatchInfo batch info
	BatchInfo *map[int64]map[string]interface{} `json:"BatchInfo"`
	InputType string                            `json:"input_type"`
}

type InstID

type InstID int64

type InstOperationInterface

type InstOperationInterface interface {
	CreateInst(params types.ContextParams, obj model.Object, data frtypes.MapStr) (inst.Inst, error)
	CreateInstBatch(params types.ContextParams, obj model.Object, batchInfo *InstBatchInfo) (*BatchResult, error)
	DeleteInst(params types.ContextParams, obj model.Object, cond condition.Condition, needCheckHost bool) error
	DeleteInstByInstID(params types.ContextParams, obj model.Object, instID []int64, needCheckHost bool) error
	FindOriginInst(params types.ContextParams, obj model.Object, cond *metatype.QueryInput) (*metatype.InstResult, error)
	FindInst(params types.ContextParams, obj model.Object, cond *metatype.QueryInput, needAsstDetail bool) (count int, results []inst.Inst, err error)
	FindInstByAssociationInst(params types.ContextParams, obj model.Object, data frtypes.MapStr) (cont int, results []inst.Inst, err error)
	FindInstChildTopo(params types.ContextParams, obj model.Object, instID int64, query *metatype.QueryInput) (count int, results []interface{}, err error)
	FindInstParentTopo(params types.ContextParams, obj model.Object, instID int64, query *metatype.QueryInput) (count int, results []interface{}, err error)
	FindInstTopo(params types.ContextParams, obj model.Object, instID int64, query *metatype.QueryInput) (count int, results []commonInstTopoV2, err error)
	UpdateInst(params types.ContextParams, data frtypes.MapStr, obj model.Object, cond condition.Condition, instID int64) error

	SetProxy(modelFactory model.Factory, instFactory inst.Factory, asst AssociationOperationInterface, obj ObjectOperationInterface)
}

InstOperationInterface inst operation methods

func NewInstOperation

NewInstOperation create a new inst operation instance

type ModuleOperationInterface

type ModuleOperationInterface interface {
	CreateModule(params types.ContextParams, obj model.Object, bizID, setID int64, data mapstr.MapStr) (inst.Inst, error)
	DeleteModule(params types.ContextParams, obj model.Object, bizID int64, setID, moduleIDS []int64) error
	FindModule(params types.ContextParams, obj model.Object, cond *metadata.QueryInput) (count int, results []inst.Inst, err error)
	UpdateModule(params types.ContextParams, data mapstr.MapStr, obj model.Object, bizID, setID, moduleID int64) error

	SetProxy(inst InstOperationInterface)
}

ModuleOperationInterface module operation methods

func NewModuleOperation

func NewModuleOperation(client apimachinery.ClientSetInterface) ModuleOperationInterface

NewModuleOperation create a new module

type ObjectOperationInterface

type ObjectOperationInterface interface {
	CreateObjectBatch(params types.ContextParams, data frtypes.MapStr) (frtypes.MapStr, error)
	FindObjectBatch(params types.ContextParams, data frtypes.MapStr) (frtypes.MapStr, error)
	CreateObject(params types.ContextParams, data frtypes.MapStr) (model.Object, error)
	CanDelete(params types.ContextParams, targetObj model.Object) error
	DeleteObject(params types.ContextParams, id int64, cond condition.Condition, needCheckInst bool) error
	FindObject(params types.ContextParams, cond condition.Condition) ([]model.Object, error)
	FindObjectTopo(params types.ContextParams, cond condition.Condition) ([]metadata.ObjectTopo, error)
	FindSingleObject(params types.ContextParams, objectID string) (model.Object, error)
	UpdateObject(params types.ContextParams, data frtypes.MapStr, id int64, cond condition.Condition) error

	SetProxy(modelFactory model.Factory, instFactory inst.Factory, cls ClassificationOperationInterface, asst AssociationOperationInterface, inst InstOperationInterface, attr AttributeOperationInterface, grp GroupOperationInterface)
	IsValidObject(params types.ContextParams, objID string) error
}

ObjectOperationInterface object operation methods

func NewObjectOperation

func NewObjectOperation(client apimachinery.ClientSetInterface) ObjectOperationInterface

NewObjectOperation create a new object operation instance

type OpCondition

type OpCondition struct {
	Delete deleteCondition   `json:"delete"`
	Update []updateCondition `json:"update"`
}

OpCondition the condition operation

type OperationLog

type OperationLog struct {
	OwnerID       string      `bson:"bk_supplier_account"    json:"bk_supplier_account"`
	ApplicationID int         `bson:"bk_biz_id"              json:"bk_biz_id"`
	ExtKey        string      `bson:"ext_key"             json:"ext_key"`
	OpDesc        string      `bson:"op_desc"             json:"op_desc"`
	OpType        int         `bson:"op_type"             json:"op_type"`
	OpTarget      string      `bson:"op_target"           json:"op_target"`
	Content       interface{} `bson:"content"             json:"content"`
	User          string      `bson:"operator"                json:"operator"`
	OpFrom        string      `bson:"op_from"             json:"op_from"`
	ExtInfo       string      `bson:"ext_info"            json:"ext_info"`
	CreateTime    time.Time   `bson:"op_time"         json:"op_time"`
	InstID        int         `bson:"inst_id"             json:"inst_id"`
}

OperationLog opeartion log item definition

type PermissionOperationInterface

type PermissionOperationInterface interface {
	Permission(params types.ContextParams) privilege.PermissionInterface
	UserGroup(params types.ContextParams) privilege.UserGroupInterface
	Role(params types.ContextParams) privilege.RolePermission
}

PermissionOperationInterface the permission interface

func NewPermissionOperation

func NewPermissionOperation(client apimachinery.ClientSetInterface) PermissionOperationInterface

NewPermissionOperation create the permission operation

type Ref

type Ref struct {
	RefID   int    `json:"ref_id"`
	RefName string `json:"ref_name"`
}

type RowIndex

type RowIndex int

type SetOperationInterface

type SetOperationInterface interface {
	CreateSet(params types.ContextParams, obj model.Object, bizID int64, data mapstr.MapStr) (inst.Inst, error)
	DeleteSet(params types.ContextParams, obj model.Object, bizID int64, setIDS []int64) error
	FindSet(params types.ContextParams, obj model.Object, cond *metadata.QueryInput) (count int, results []inst.Inst, err error)
	UpdateSet(params types.ContextParams, data mapstr.MapStr, obj model.Object, bizID, setID int64) error

	SetProxy(obj ObjectOperationInterface, inst InstOperationInterface, module ModuleOperationInterface)
}

SetOperationInterface set operation methods

func NewSetOperation

NewSetOperation create a set instance

type Supplementary

type Supplementary interface {
	Audit(params types.ContextParams, client apimachinery.ClientSetInterface, obj model.Object, inst InstOperationInterface) AuditInterface
	Validator(inst InstOperationInterface) ValidatorInterface
}

Supplementary supplementary methods

func NewSupplementary

func NewSupplementary() Supplementary

NewSupplementary create a supplementary instance

type ValidatorInterface

type ValidatorInterface interface {
	ValidatorCreate(params types.ContextParams, obj model.Object, datas mapstr.MapStr) error
	ValidatorUpdate(params types.ContextParams, obj model.Object, datas mapstr.MapStr, instID int64, cond condition.Condition) error
}

ValidatorInterface the validator methods

type WrapperResult

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

WrapperResult the data wrapper

Jump to

Keyboard shortcuts

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