|
KSC Open API
Kaspersky Security Center API description
|
Deletes an administration group.
See also how to use the KlAkOAPI Python package:
server = KlAkOAPI.AdmServer.KlAkAdmServer.Create("https://ksc.example.com:13299", "username", "password", verify = False)
oHostGroup = KlAkOAPI.HostGroup.KlAkHostGroup(server) # show the group name to delete
oGroupInfo = oHostGroup.GetGroupInfoEx(nGroupId, ['grp_full_name']).RetVal()
print('Group to remove is: ' + oGroupInfo['grp_full_name']) # remove the group asynchronously
strActionGuid = oHostGroup.RemoveGroup(nGroupId, nFlags = 1).OutPar('strActionGuid') # check for result of the asynchronous operation
oAsyncActionStateChecker = KlAkOAPI.AsyncActionStateChecker.KlAkAsyncActionStateChecker (server)
while True:
res = oAsyncActionStateChecker.CheckActionState(strActionGuid)
if res.OutPar('bFinalized'):
if res.OutPar('bSuccededFinalized'):
# got the asynchronous operation result: success
print ('Group deleted successfully')
else:
# got the asynchronous operation result: some error occurred
err_description = KlAkOAPI.Params.KlAkParams(res.OutPar('pStateData'))
print('Cannot delete group:', err_description['GNRL_EA_DESCRIPTION'], '(error code ' + str(err_description['KLBLAG_ERROR_INFO']['KLBLAG_ERROR_CODE']) + ')')
break
else:
# the asynchronous operation result is not ready yet, you need to wait for lNextCheckDelay milliseconds
time.sleep(MillisecondsToSeconds(res.OutPar('lNextCheckDelay')))
|