Documentation
¶
Index ¶
- Constants
- func NewHelperError(httpCode int, message string) error
- type AddCIResult
- type AddRelationResult
- type DeleteCIResult
- type DeleteRelationResult
- type ExistPolicy
- type GetCIResult
- type GetRelationResult
- type Helper
- func (h *Helper) AddCI(ciType string, noAttrPolicy NoAttrPolicy, existPolicy ExistPolicy, ...) (res *AddCIResult, err error)
- func (h *Helper) AddRelation(srcCIID, dstCIID int) (res *AddRelationResult, err error)
- func (h *Helper) DeleteCI(ciID int) (res *DeleteCIResult, err error)
- func (h *Helper) DeleteRelation(relationID, firstCIID, secondCIID int) (res *DeleteRelationResult, err error)
- func (h *Helper) GetCI(q, fl, facet, sort string, page, count int, retKey RetKey) (res *GetCIResult, err error)
- func (h *Helper) GetRelation(rootId, reverse int, level, q, fl, facet, sort string, page, count int, ...) (res *GetRelationResult, err error)
- func (h *Helper) UpdateCI(ciID int, ciType string, noAttrPolicy NoAttrPolicy, attrs map[string]any) (res *UpdateCIResult, err error)
- type HelperError
- type NoAttrPolicy
- type ResponseError
- type RetKey
- type UpdateCIResult
- type UpdateRelationResult
Constants ¶
View Source
const ( RetKeyDefault = RetKey("") RetKeyID = RetKey("id") RetKeyAlias = RetKey("alias") RetKeyName = RetKey("name") )
View Source
const ( NoAttrPolicyDefault = NoAttrPolicy("") NoAttrPolicyReject = NoAttrPolicy("reject") )
View Source
const ( ExistPolicyDefault = ExistPolicy("") ExistPolicyNeed = ExistPolicy("need") ExistPolicyReject = ExistPolicy("reject") ExistPolicyReplace = ExistPolicy("replace") )
Variables ¶
This section is empty.
Functions ¶
func NewHelperError ¶
Types ¶
type AddCIResult ¶
type AddCIResult struct {
CIID int `json:"ci_id"`
}
type AddRelationResult ¶
type AddRelationResult struct {
RelationID int `json:"cr_id"`
}
type DeleteCIResult ¶
type DeleteCIResult struct {
Message string `json:"message"`
}
type DeleteRelationResult ¶
type DeleteRelationResult struct {
Message string `json:"message"`
}
type ExistPolicy ¶
type ExistPolicy = string
type GetCIResult ¶
type GetRelationResult ¶
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
Helper
func NewHelper ¶
NewHelper creates a helper instance for cmdb operation
urlPrefix is used to combine http request eg. the final query url with urlPrefix https://demo.veops.cn/api/v0.1 is https://demo.veops.cn/api/v0.1/ci/s
func (*Helper) AddCI ¶
func (h *Helper) AddCI(ciType string, noAttrPolicy NoAttrPolicy, existPolicy ExistPolicy, attrs map[string]any) (res *AddCIResult, err error)
AddCI adds a CI model
you need to add ci_types firstly
func (*Helper) AddRelation ¶
func (h *Helper) AddRelation(srcCIID, dstCIID int) (res *AddRelationResult, err error)
AddRelation adds a relation between two CIs
you need to add ci_relations firstly
func (*Helper) DeleteCI ¶
func (h *Helper) DeleteCI(ciID int) (res *DeleteCIResult, err error)
DeleteCI deletes a CI by id
func (*Helper) DeleteRelation ¶
func (h *Helper) DeleteRelation(relationID, firstCIID, secondCIID int) (res *DeleteRelationResult, err error)
DeleteRelation deletes a CI relation
use relationID or firstCIID and secondCIID firstCIID and secondCIID will be used if ciID is 0
func (*Helper) GetCI ¶
func (h *Helper) GetCI(q, fl, facet, sort string, page, count int, retKey RetKey) (res *GetCIResult, err error)
GetCI queries CIs
func (*Helper) GetRelation ¶
func (h *Helper) GetRelation(rootId, reverse int, level, q, fl, facet, sort string, page, count int, retKey RetKey) (res *GetRelationResult, err error)
GetRelation queries the CI relation
func (*Helper) UpdateCI ¶
func (h *Helper) UpdateCI(ciID int, ciType string, noAttrPolicy NoAttrPolicy, attrs map[string]any) (res *UpdateCIResult, err error)
UpdateCI updates a CI model
type HelperError ¶
func (HelperError) Error ¶
func (e HelperError) Error() string
type NoAttrPolicy ¶
type NoAttrPolicy = string
type ResponseError ¶
type ResponseError struct {
Message string `json:"message"`
}
type UpdateCIResult ¶
type UpdateCIResult struct {
CIID int `json:"ci_id"`
}
type UpdateRelationResult ¶
type UpdateRelationResult struct {
RelationID int `json:"cr_id"`
}
Click to show internal directories.
Click to hide internal directories.