Documentation ¶
Index ¶
- Constants
- type AttributeGroupParams
- type AttributeParams
- type AttributeType
- type BindError
- type Ci
- type CiAttribute
- type CiAttributes
- type CiIds
- type CiTypeParams
- type Client
- func (c *Client) AddCiProjectMapping(ciID int, projectID int, historyID int) (err error)
- func (c *Client) AttributeBasedRelation(sourceCiId int, attributeName string, ciRelationTypeName string, ...) (relationCisAdded []int, relationCisRemoved []int, err error)
- func (c *Client) CiBasedRelation(srcCiId int, destCiId []int, ciRelationTypeName string, triggerType string, ...) (relationCisAdded []int, relationCisRemoved []int, err error)
- func (c *Client) CreateAttribute(attributeParams *AttributeParams) (attributeId int, err error)
- func (c *Client) CreateAttributeGroup(attributeGroupParams *AttributeGroupParams) (attributeGroupId int, err error)
- func (c *Client) CreateCi(ciTypeID int, icon string, historyID int) (r CreateCi, err error)
- func (c *Client) CreateCiRelation(ciId1 int, ciId2 int, ciRelationTypeName string, ...) (err error)
- func (c *Client) CreateCiType(typeParams *CiTypeParams) (typeId int, err error)
- func (c *Client) DeleteCi(ciId int, userId int, message string) (err error)
- func (c *Client) DeleteCiRelation(ciId1 int, ciId2 int, ciRelationTypeName string) (err error)
- func (c *Client) GetAndBindCi(ciId int, out interface{}) (err error)
- func (c *Client) GetAndBindCiByAttributeValue(name string, value string, valueType v2.AttributeValueType, out interface{}) (err error)
- func (c *Client) GetAndBindCiByAttributeValueCi(name string, value string, out interface{}) (err error)
- func (c *Client) GetAndBindCiByAttributeValueText(name string, value string, out interface{}) (err error)
- func (c *Client) GetAndBindListOfCis(ciIds []int, out interface{}) (err error)
- func (c *Client) GetAndBindListOfCisOfCiTypeName(ciTypeName string, out interface{}) (err error)
- func (c *Client) GetAttrDefaultOptionIdByAttrId(attrId int, optionValue string) (attrDefaultOptionId int, err error)
- func (c *Client) GetAttrDefaultOptionIdByAttrName(attrName string, optionValue string) (attrDefaultOptionId int, err error)
- func (c *Client) GetAttributeDefaultOption(optionId int) (r string, err error)
- func (c *Client) GetAttributeGroupIdByName(attributeGroupName string) (attGroupId int, err error)
- func (c *Client) GetAttributeIdByAttributeName(name string) (attrId int, err error)
- func (c *Client) GetCi(ciID int) (r Ci, err error)
- func (c *Client) GetCiAttributeValue(ciId int, attributeName string, valueType v2.AttributeValueType) (r GetCiAttributeValue, err error)
- func (c *Client) GetCiAttributeValueCi(ciId int, attributeName string) (value string, id int, err error)
- func (c *Client) GetCiAttributeValueDate(ciId int, attributeName string) (value string, id int, err error)
- func (c *Client) GetCiAttributeValueDefault(ciId int, attributeName string) (value string, id int, err error)
- func (c *Client) GetCiAttributeValueText(ciId int, attributeName string) (value string, id int, err error)
- func (c *Client) GetCiAttributes(ciId int) (ciAttributes CiAttributes, err error)
- func (c *Client) GetCiIdByAttributeValue(name string, value string, valueType v2.AttributeValueType) (ciId int, err error)
- func (c *Client) GetCiRelationCount(ciId1 int, ciId2 int, ciRelationTypeName string) (r int, err error)
- func (c *Client) GetCiRelationTypeIdByRelationTypeName(name string) (r int, err error)
- func (c *Client) GetCiTypeIdByCiTypeName(name string) (r int, err error)
- func (c *Client) GetCiTypeName(ciId int) (ciTypeName string, err error)
- func (c *Client) GetListOfCiIdsByAttributeValue(name string, value string, valueType v2.AttributeValueType) (ciIds CiIds, err error)
- func (c *Client) GetListOfCiIdsByCiRelation(ciId int, ciRelationTypeName string, direction v2.CiRelationDirection) (r CiIds, err error)
- func (c *Client) GetListOfCiIdsOfCiType(ciTypeID int) (ciIds CiIds, err error)
- func (c *Client) GetListOfCiIdsOfCiTypeName(ciTypeName string) (ciIds CiIds, err error)
- func (c *Client) GetListOfCiIdsOfCiTypeV2(ciTypeID int) (ciIds CiIds, err error)
- func (c *Client) GetListOfRelationsByName(name string) (relations []Relation, err error)
- func (c *Client) GetMapOfCiAttributes(ciIds []int) (ciIdToAttributesMap map[int]CiAttributes, err error)
- func (c *Client) GetProjectIdByProjectName(name string) (projectID int, err error)
- func (c *Client) GetRoleIdByName(roleName string) (roleId int, err error)
- func (c *Client) GetWorkflowContext(workflowInstanceId int) (workflowContext *v2.WorkflowContext, err error)
- func (c *Client) LoadConfig(path string) (err error)
- func (c *Client) NewAttributeGroupParams() (params *AttributeGroupParams)
- func (c *Client) NewAttributeParams() (params *AttributeParams)
- func (c *Client) NewCiTypeParams() (params *CiTypeParams)
- func (c *Client) Query(ws string, out interface{}, params map[string]string) (err error)
- func (c *Client) QueryWebservice(ws string, params map[string]string) (resp string, err error)
- func (c *Client) SendNotification(name string, par v1.NotifyParams) (resp v1.NotificationResponse, err error)
- func (c *Client) SetAttributeRole(attributeName string, roleName string, permission string) (err error)
- func (c *Client) SetTypeOfCi(ciId int, ciType string) (err error)
- func (c *Client) UpdateCiAttribute(ci int, ua []v2.UpdateCiAttribute) (err error)
- func (c *Client) UploadFile(file interface{}) (uploadId string, err error)
- type Columns
- type Config
- type CreateCi
- type GetCiAttributeValue
- type IntWrapper
- type Multiselect
- type Precondition
- type PreconditionType
- type Preconditions
- type Relation
- type Workflow
- type WorkflowFunc
- type WorkflowParams
- type WorkflowParamsHelper
Constants ¶
const ( TYPE_CI_TYPE = "ci type" TYPE_ATTRIBUTE = "attribute" TYPE_RELATION = "relation" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributeGroupParams ¶
type AttributeParams ¶
type AttributeParams struct { Name string Description string Note string Hint string AttributeType AttributeType AttributeGroupName string OrderNumber int Column Columns //values in db enum('1','2') IsUnique bool IsNumeric bool IsBold bool IsEvent bool IsUniqueCheck bool IsAutocomplete bool IsMultiselect Multiselect //values in db enum('0','1','2') IsProjectRestricted bool Regex string ScriptName string InputMaxlength int TextareaCols int TextareaRows int IsActive bool Historicize bool UserId int }
type AttributeType ¶
type AttributeType int
const ( AT_INPUT AttributeType = iota + 1 AT_TEXTAREA AT_TEXTEDIT AT_SELECTFIELD AT_CHECKBOX AT_RADIO AT_DATE AT_DATETIME AT_ZAHLUNGSMITTEL AT_PASSWORD AT_LINK AT_ATTACHMENT AT_SCRIPT AT_EXECUTEABLE AT_QUERY AT_CITYPE AT_INFO AT_QUERYPERSIST AT_CITYPEPERSIST AT_FILTER AT_SELECTQUERY AT_SELECTPOPUP )
type CiAttribute ¶
type CiAttribute struct { CiID int `json:"ci_id,string"` CiAttributeID int `json:"ci_attribute_id,string"` AttributeID int `json:"attribute_id,string"` AttributeName string `json:"attribute_name"` AttributeDescription string `json:"attribute_description"` AttributeType string `json:"attribute_type"` Value string `json:"value"` ModifiedAt string `json:"modified_at"` }
type CiAttributes ¶
type CiAttributes = []CiAttribute
type CiTypeParams ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client combines connectivity methods for version 1 and 2 of the cmdb
func (*Client) AddCiProjectMapping ¶
func (*Client) AttributeBasedRelation ¶
func (*Client) CiBasedRelation ¶
func (c *Client) CiBasedRelation(srcCiId int, destCiId []int, ciRelationTypeName string, triggerType string, swapCiColumns bool) (relationCisAdded []int, relationCisRemoved []int, err error)
noinspection GoUnusedParameter preserved to remain backwards compatible
func (*Client) CreateAttribute ¶
func (c *Client) CreateAttribute(attributeParams *AttributeParams) (attributeId int, err error)
func (*Client) CreateAttributeGroup ¶
func (c *Client) CreateAttributeGroup(attributeGroupParams *AttributeGroupParams) (attributeGroupId int, err error)
func (*Client) CreateCiRelation ¶
func (*Client) CreateCiType ¶
func (c *Client) CreateCiType(typeParams *CiTypeParams) (typeId int, err error)
func (*Client) DeleteCiRelation ¶
func (*Client) GetAndBindCi ¶
func (*Client) GetAndBindCiByAttributeValue ¶
func (*Client) GetAndBindCiByAttributeValueCi ¶
func (*Client) GetAndBindCiByAttributeValueText ¶
func (*Client) GetAndBindListOfCis ¶
func (*Client) GetAndBindListOfCisOfCiTypeName ¶
func (*Client) GetAttrDefaultOptionIdByAttrId ¶
func (*Client) GetAttrDefaultOptionIdByAttrName ¶
func (*Client) GetAttributeDefaultOption ¶
func (*Client) GetAttributeGroupIdByName ¶
func (*Client) GetAttributeIdByAttributeName ¶
func (*Client) GetCiAttributeValue ¶
func (c *Client) GetCiAttributeValue(ciId int, attributeName string, valueType v2.AttributeValueType) (r GetCiAttributeValue, err error)
func (*Client) GetCiAttributeValueCi ¶
func (*Client) GetCiAttributeValueDate ¶
func (*Client) GetCiAttributeValueDefault ¶
func (*Client) GetCiAttributeValueText ¶
func (*Client) GetCiAttributes ¶
func (c *Client) GetCiAttributes(ciId int) (ciAttributes CiAttributes, err error)
func (*Client) GetCiIdByAttributeValue ¶
func (*Client) GetCiRelationCount ¶
func (*Client) GetCiRelationTypeIdByRelationTypeName ¶
func (*Client) GetCiTypeIdByCiTypeName ¶
func (*Client) GetCiTypeName ¶
func (*Client) GetListOfCiIdsByAttributeValue ¶
func (*Client) GetListOfCiIdsByCiRelation ¶
func (*Client) GetListOfCiIdsOfCiType ¶
func (*Client) GetListOfCiIdsOfCiTypeName ¶
func (*Client) GetListOfCiIdsOfCiTypeV2 ¶
func (*Client) GetListOfRelationsByName ¶
func (*Client) GetMapOfCiAttributes ¶
func (c *Client) GetMapOfCiAttributes(ciIds []int) (ciIdToAttributesMap map[int]CiAttributes, err error)
func (*Client) GetProjectIdByProjectName ¶
func (*Client) GetRoleIdByName ¶
func (*Client) GetWorkflowContext ¶
func (c *Client) GetWorkflowContext(workflowInstanceId int) (workflowContext *v2.WorkflowContext, err error)
func (*Client) LoadConfig ¶
LoadConfig from file in yaml format
func (*Client) NewAttributeGroupParams ¶
func (c *Client) NewAttributeGroupParams() (params *AttributeGroupParams)
func (*Client) NewAttributeParams ¶
func (c *Client) NewAttributeParams() (params *AttributeParams)
func (*Client) NewCiTypeParams ¶
func (c *Client) NewCiTypeParams() (params *CiTypeParams)
func (*Client) Query ¶
Query allows you to call a generic webservice(arg1: ws) with the providing params and a reference to a result. It will take the built in resty function to deserialize the result Return: error
func (*Client) QueryWebservice ¶
QueryWebservices allows you to call a generic webservice(arg1: ws) with the providing params Return: json string
func (*Client) SendNotification ¶
func (c *Client) SendNotification(name string, par v1.NotifyParams) (resp v1.NotificationResponse, err error)
func (*Client) SetAttributeRole ¶
func (*Client) UpdateCiAttribute ¶
func (c *Client) UpdateCiAttribute(ci int, ua []v2.UpdateCiAttribute) (err error)
func (*Client) UploadFile ¶
Supported file data types are `string`, `[]byte` and `io.Reader`. The returned uploadId can be used for attachment attributes in the `UpdateCiAttribute` function.
type Config ¶
type Config struct { ApiUrl string `yaml:"apiUrl"` ApiUser string `yaml:"apiUser"` ApiPassword string `yaml:"apiPassword"` ApiKey string CmdbBasePath string `yaml:"CmdbBasePath"` }
Client configuration values. Usually taken from data/configs/workflows/infocmdb.yml
type GetCiAttributeValue ¶
type IntWrapper ¶
type IntWrapper int
func (*IntWrapper) UnmarshalJSON ¶
func (iw *IntWrapper) UnmarshalJSON(b []byte) error
type Precondition ¶
type Precondition struct { Type PreconditionType Name string }
Single workflow requirement.
type PreconditionType ¶
type PreconditionType string
Type of the precondition that will be tested for existence.
type Relation ¶
type Relation struct { Id int CiId1 int CiId2 int Direction v2.CiRelationDirection }
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
Helper struct that encapsulates everything that is necessary to run or test a workflow.
func (Workflow) Run ¶
func (w Workflow) Run(workflowFunc WorkflowFunc)
Executes a workflow.
First a infoCMDB client instance is created and the workflow parameters are parsed. The workflow parameters are decoded from the first process argument if available. Absence of any process argument will lead to a failure. For development/testing an empty json object "{}" can be passed.
If everything is successful the workflow function will be executed with the prepared parameters and client.
Any errors that are returned from the workflow function will be logged and lead to a execution failure. Additionally the workflow will be marked as failed when something is printed to Stderr during execution.
func (Workflow) TestPreconditions ¶
func (w Workflow) TestPreconditions(t *testing.T, preconditions Preconditions)
Executes an existence check test for every supplied precondition.
type WorkflowFunc ¶
type WorkflowFunc func(params WorkflowParams, cmdb *Client) (err error)
User defined workflow function that can be passed to `workflow.Run`.
type WorkflowParams ¶
type WorkflowParams struct { Apikey string `json:"apikey"` TriggerType string `json:"triggerType"` WorkflowItemId int `json:"workflow_item_id"` WorkflowInstanceId int `json:"workflow_instance_id"` CiId int `json:"ciid"` CiAttributeId int `json:"ciAttributeId"` CiRelationId int `json:"ciRelationId"` CiProjectId int `json:"ciProjectId"` FileImportHistoryId int `json:"fileImportHistoryId"` UserId int `json:"user_id"` }
Input parameters to a workflow. These are usually passed encoded as a json string as first process argument. These are supplied to the `WorkflowFunc` of `workflow.Run`.
type WorkflowParamsHelper ¶
type WorkflowParamsHelper struct { Apikey string `json:"apikey"` TriggerType string `json:"triggerType"` WorkflowItemId int `json:"workflow_item_id"` WorkflowInstanceId int `json:"workflow_instance_id"` CiId IntWrapper `json:"ciid"` CiAttributeId IntWrapper `json:"ciAttributeId"` CiRelationId int `json:"ciRelationId"` CiProjectId int `json:"ciProjectId"` FileImportHistoryId int `json:"fileImportHistoryId"` UserId IntWrapper `json:"user_id"` }