以下对象均与 usermacro
接口相关 。
全局宏对象具有以下属性。
属性 | 类型 | 描述 |
---|---|---|
globalmacroid | ID | 全局宏的ID。 属性行为: - 只读 - 必填 更新操作时 |
macro | string | 宏字符串。 属性行为: - 必填 创建操作时 |
value | string | 宏的值。 属性行为: - 只写 如果 type 设置为 "Secret macro"时,则只写- 必填 创建操作时 |
type | integer | 宏的类型。 可能的值: 0 - (默认) 文本宏 1 - 密文宏 2 - 密钥宏 |
description | string | 宏描述信息。 |
主机宏对象定义一个主机或模板上可用的宏. 它具有以下属性。
属性 | 类型 | 描述 |
---|---|---|
hostmacroid | ID | 主机宏的ID。 属性行为: - 只读 - 必填 更新操作时 |
hostid | ID | 宏所属主机的主机ID。 属性行为: - 常量 - 必填 创建操作时 |
macro | string | 宏名。 属性行为: - 必填 创建操作时 |
value | string | 宏值。 属性行为: - 只读 如果 type 设置为"Secret macro",则只读- 必填 创建操作时 |
type | integer | 宏的类型。 可能的值: 0 - (默认) 文本宏 1 - 密文宏 2 - 密钥宏 |
description | string | 宏的描述信息。 |
automatic | integer | 定义宏是否受发现规则控制。 可能的值: 0 - (默认) 宏由用户管理 1 - 宏由发现规则管理 用户不允许创建自动宏。 要更新自动宏,必须将其转换为手动。 |
The macro configuration object defines how a macro is displayed in the Host Wizard.
Property | Type | Description |
---|---|---|
type | integer | Type of macro input field. Possible values: 0 - Macro is not used in Host Wizard; 1 - Textbox; 2 - List; 3 - Checkbox. Property behavior: - required |
label | string | Label for macro input field. Property behavior: - required if type is set to "Textbox", "List", or "Checkbox" |
description | text | Help text displayed alongside macro input field. Supports Markdown formatting. |
priority | integer | Macro input field position in the macro list. If priority is not set, the macro is added at the end of the ungrouped macro list. |
required | integer | Marks the macro as mandatory. Possible values: 0 - Not mandatory; 1 - Mandatory. Property behavior: - supported if type is set to "Textbox" or "List" |
regex | string | Regular expression to validate user input in a textbox field. Property behavior: - supported if type is set to "Textbox" |
section_name | string | Label of the collapsible section where the macro is grouped. If section_name is not set, the macro is ungrouped. Ungrouped macros are displayed first; grouped macros are displayed below, ordered by their priority within each collapsible section. |
options | text | JSON string defining list items or checkbox values. For lists: an array of objects with value and text properties.Example: [{"value": "http", "text": "HTTP"}, {"value": "https", "text": "HTTPS"}] For checkboxes: an object with checked and unchecked properties.Example: {"checked": true, "unchecked": false} Property behavior: - required if type is set to "List" or "Checkbox" |