深度安全防护系统 12 中应用程序控制中一台计算机的维护模式

Maintenance Mode to one computer in Application Control inside Deep Security 12

我正尝试通过 API 使用此 Python 脚本在 Deep Security 12 的应用程序控制模块中将计算机置于维护模式:

#

import deepsecurity as api
from deepsecurity.rest import ApiException as api_exception
import time, sys, warnings, pprint
import urllib3
urllib3.disable_warnings()

# Setup
configuration = api.Configuration()
configuration.host = 'https://xxxxxxxxxxxx.xxxxxxx.com:4119/api'

# Authentication
configuration.api_key['api-secret-key'] = 'xxxxxxxxxxxxxxxxxxx'

#Initialization
computer_id = "989"
api_version = 'v1'

def turn_on_maintenance_mode():

  # Create and configure an ApplicationControlComputerExtesnion object
  application_control = api.ApplicationControlComputerExtension()
  application_control.maintenance_mode_status = "on"
  application_control.maintenance_mode_duration = "0"

  # Add the ApplicationControlComputerExtension to a Computer object
  computer = api.Computer()
  computer.application_control_computer_extension = application_control

  try: 
    # Update the computer
    computers_api = api.ComputersApi(api.ApiClient(configuration))
    return computers_api.modify_computer(computer_id, computer, api_version)

  except api_exception as e:
    return "Exception: " + str(e)

if __name__ == '__main__':
  turn_on_maintenance_mode()

脚本执行没有任何错误,计算机收到策略更改(因此与 API 和这台计算机的通信正常),但计算机没有将自己置于维护模式。

知道发生了什么事吗?

提前致谢!

computer.application_control_computer_extension = application_control

应该是:

computer.application_control = application_control

自动化中心文章中的示例 python 代码似乎不正确。应该快更新了。