NAME
Kernel::GenericInterface::Operation::ConfigItem::ConfigItemUpdate – GenericInterface ConfigItem ConfigItemUpdate Operation backend
PUBLIC INTERFACE
has OperationSubType
Attribute that holds the operation sub type.
around _BuildConfig()
Overwrites the builder method _BuildConfig (has Config), to set a default value.
OperationName()
Returns the name of the operation.
Run()
perform ConfigItemUpdate Operation. This will return the updated configuration item number.
my $Result = $OperationObject->Run(
Data => {
UserLogin => 'some agent login', # UserLogin or AccessToken is
AccessToken => 123, # required
Password => 'some password', # if UserLogin is sent then Password is required
ReplaceExistingData => 0, # optional, 0 or 1, default 0
# this will replace the existing XML data and attachments
ConfigItemID => 123,
ConfigItem => {
Class => 'Configuration Item Class',
Name => 'The Name',
DeplState => 'deployment state',
InciState => 'incident state',
CIXMLData => $ArrayHashRef, # it depends on the Configuration Item class and definition
Attachment => [
{
Content => 'content' # base64 encoded
ContentType => 'some content type'
Filename => 'some fine name'
},
# ...
],
# or
#Attachment => {
# Content => 'content'
# ContentType => 'some content type'
# Filename => 'some fine name'
#},
},
},
);
$Result = {
Success => 1, # 0 or 1
ErrorMessage => '', # in case of error
Data => { # result data payload after Operation
ConfigItemID => 123, # Configuration Item ID number in OTRS::ITSM (Service desk system)
Number => 2324454323322 # Configuration Item Number in OTRS::ITSM (Service desk system)
Error => { # should not return errors
ErrorCode => 'ConfigItemUpdate.ErrorCode'
ErrorMessage => 'Error Description'
},
},
};
INTERNAL INTERFACE
_CleanXMLData()
removed trailing and leading white spaces in the XMLData.
my $XMLDataClean = $OperationObject->_CleanXMLData(
Definition => $DefinitionArrayRef, # Configuration Item Definition ot just part of it
XMLData => $XMLDataHashRef,
);
returns:
$XMLDataClean = {
Success => 1, # if everything is OK
}
$XMLDataClean = {
ErrorCode => 'Function.Error', # if error
ErrorMessage => 'Error description',
}
_CheckConfigItem()
checks if the given config item parameters are valid.
my $ConfigItemCheck = $OperationObject->_CheckConfigItem(
ConfigItem => $ConfigItem, # all config item parameters
);
returns:
$ConfigItemCheck = {
Success => 1, # if everything is OK
}
$ConfigItemCheck = {
ErrorCode => 'Function.Error', # if error
ErrorMessage => 'Error description',
}
_ConfigItemUpdate()
updates a configuration item with attachments if specified.
my $Response = $OperationObject->_ConfigItemUpdate(
ConfigItemID => 123,
ConfigItem => $ConfigItem, # all configuration item parameters
AttachmentList => $Attachment, # a list of all attachments
ReplaceExistingData => 0, # if the existing xml attributes and attachments should be replaced or kept
UserID => 123,
);
returns:
$Response = {
Success => 1, # if everething is OK
Data => {
ConfigItemID => 123,
ConfigItemNumber => 'CN123',
}
}
$Response = {
Success => 0, # if unexpected error
ErrorMessage => "$Param{ErrorCode}: $Param{ErrorMessage}",
}
