Beispiel #1
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("父实例"),
             key="cc_set_parent_select",
             type="array",
             schema=ArrayItemSchema(
                 description=_("父实例 ID 列表"),
                 item_schema=IntItemSchema(description=_("实例 ID"))),
         ),
         self.InputItem(
             name=_("集群信息"),
             key="cc_set_info",
             type="array",
             schema=ArrayItemSchema(
                 description=_("新集群信息对象列表"),
                 item_schema=ObjectItemSchema(description=_("集群信息描述对象"),
                                              property_schemas={}),
             ),
         ),
     ]
Beispiel #2
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("通知人员所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("通知方式"),
             key="bk_notify_type",
             type="array",
             schema=ArrayItemSchema(
                 description=_("需要使用的通知方式,从 API 网关自动获取已实现的通知渠道"),
                 item_schema=StringItemSchema(description=_("通知方式"))),
         ),
         self.InputItem(
             name=_("固定分组"),
             key="bk_receiver_group",
             type="array",
             required=False,
             schema=ArrayItemSchema(
                 description=_("需要进行通知的业务人员分组"),
                 enum=["Maintainers", "ProductPm", "Developer", "Tester"],
                 item_schema=StringItemSchema(description=_("通知分组")),
             ),
         ),
         self.InputItem(
             name=_("项目人员分组"),
             key="bk_staff_group",
             type="array",
             required=False,
             schema=ArrayItemSchema(
                 description=_("需要进行通知的项目人员分组ID列表"),
                 item_schema=IntItemSchema(description=_("项目人员分组ID"))),
         ),
         self.InputItem(
             name=_("额外通知人"),
             key="bk_more_receiver",
             type="string",
             schema=StringItemSchema(
                 description=_("除了通知分组外需要额外通知的人员,多个用英文逗号 `,` 分隔")),
         ),
         self.InputItem(name=_("通知标题"),
                        key="bk_notify_title",
                        type="string",
                        schema=StringItemSchema(description=_("通知的标题"))),
         self.InputItem(name=_("通知内容"),
                        key="bk_notify_content",
                        type="string",
                        schema=StringItemSchema(description=_("通知的内容"))),
         self.InputItem(name=_("通知执行人"),
                        key="notify",
                        type="boolean",
                        schema=BooleanItemSchema(description=_("通知执行人名字"))),
     ]
Beispiel #3
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("填参方式"),
             key="cc_set_select_method",
             type="string",
             schema=StringItemSchema(description=_("集群填入方式,拓扑(topo),层级文本(text)"), enum=["topo", "text"]),
         ),
         self.InputItem(
             name=_("拓扑-集群列表"),
             key="cc_set_select_topo",
             type="array",
             schema=ArrayItemSchema(description=_("所属集群 ID 列表"), item_schema=IntItemSchema(description=_("集群 ID"))),
         ),
         self.InputItem(
             name=_("文本路径-集群"),
             key="cc_set_select_text",
             type="string",
             schema=StringItemSchema(description=_("集群文本路径,请输入完整路径,从业务拓扑开始,如`业务A>集群B`,多个目标集群用换行分隔")),
         ),
         self.InputItem(
             name=_("创建方式"),
             key="cc_create_method",
             type="string",
             schema=StringItemSchema(
                 description=_("按模板创建(template),直接创建-按服务分类创建(category)"), enum=["template", "category"]
             ),
         ),
         self.InputItem(
             name=_("模块信息列表-直接创建(通过服务分类创建)"),
             key="cc_module_infos_category",
             type="array",
             schema=ArrayItemSchema(
                 description=_("模块信息对象列表"),
                 item_schema=ObjectItemSchema(description=_("模块信息描述对象"), property_schemas={}),
             ),
         ),
         self.InputItem(
             name=_("模块信息列表-按服务模板创建"),
             key="cc_module_infos_template",
             type="array",
             schema=ArrayItemSchema(
                 description=_("模块信息对象列表"),
                 item_schema=ObjectItemSchema(description=_("模块信息描述对象"), property_schemas={}),
             ),
         ),
     ]
Beispiel #4
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("IP"),
             key="cc_ip_list",
             type="string",
             schema=StringItemSchema(description=_("多个用换行分隔")),
         ),
         self.InputItem(
             name=_("自定义属性"),
             key="cc_custom_property",
             type="string",
             schema=StringItemSchema(description=_("请选择主机自定义属性")),
         ),
         self.InputItem(
             name=_("规则定义(主机属性)"),
             key="cc_hostname_rule",
             type="array",
             schema=ArrayItemSchema(
                 description=_("没有数据"),
                 item_schema=ObjectItemSchema(
                     description=_("规则定义(主机属性)"),
                     property_schemas={
                         "field_rule_code":
                         StringItemSchema(description=_("字段组件")),
                         "field_content":
                         StringItemSchema(description=_("具体内容")),
                         "field_order":
                         StringItemSchema(description=_("次序")),
                     },
                 ),
             ),
         ),
         self.InputItem(
             name=_("规则定义(自定义属性)"),
             key="cc_hostname_rule",
             type="array",
             schema=ArrayItemSchema(
                 description=_("没有数据"),
                 item_schema=ObjectItemSchema(
                     description=_("规则定义(自定义属性)"),
                     property_schemas={
                         "field_rule_code":
                         StringItemSchema(description=_("字段组件")),
                         "field_content":
                         StringItemSchema(description=_("具体内容")),
                         "field_order":
                         StringItemSchema(description=_("次序")),
                     },
                 ),
             ),
         ),
     ]
Beispiel #5
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_(u'业务 ID'),
             key='biz_cc_id',
             type='string',
             schema=StringItemSchema(description=_(u'当前操作所属的 CMDB 业务 ID'))),
         self.InputItem(name=_(u'主机内网 IP'),
                        key='cc_host_ip',
                        type='string',
                        schema=StringItemSchema(
                            description=_(u'待转移的主机内网 IP,以 "," 分隔'))),
         self.InputItem(
             name=_(u'模块 ID'),
             key='cc_module_select',
             type='array',
             schema=ArrayItemSchema(
                 description=_(u'转移目标模块 ID 列表'),
                 item_schema=IntItemSchema(description=_(u'模块 ID')))),
         self.InputItem(name=_(u'转移方式'),
                        key='cc_is_increment',
                        type='string',
                        schema=StringItemSchema(
                            description=_(u'主机转移方式,覆盖(false)或追加(true)'),
                            enum=['false', 'true'])),
     ]
Beispiel #6
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_(u'业务 ID'),
             key='biz_cc_id',
             type='string',
             schema=StringItemSchema(description=_(u'当前操作所属的 CMDB 业务 ID'))),
         self.InputItem(
             name=_(u'模块'),
             key='cc_module_select',
             type='array',
             schema=ArrayItemSchema(
                 description=_(u'模块 ID 列表'),
                 item_schema=IntItemSchema(description=_(u'模块 ID')))),
         self.InputItem(
             name=_(u'模块属性'),
             key='cc_module_property',
             type='string',
             schema=StringItemSchema(description=_(u'需要修改的模块属性'))),
         self.InputItem(
             name=_(u'属性值'),
             key='cc_module_prop_value',
             type='string',
             schema=StringItemSchema(description=_(u'模块属性更新后的值')))
     ]
Beispiel #7
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("主机替换信息"),
             key="cc_host_replace_detail",
             type="object",
             schema=ArrayItemSchema(
                 description=_("主机替换信息"),
                 item_schema=ObjectItemSchema(
                     description=_("替换机与被替换机信息"),
                     property_schemas={
                         "cc_fault_ip":
                         StringItemSchema(description=_("故障机 内网IP")),
                         "cc_new_ip":
                         StringItemSchema(description=_("替换机 内网IP")),
                     },
                 ),
             ),
         ),
         self.InputItem(
             name=_("复制故障机属性"),
             key="copy_attributes",
             type="bool",
             schema=BooleanItemSchema(description=_("复制故障机属性")),
         ),
     ]
Beispiel #8
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_(u'业务 ID'),
             key='biz_cc_id',
             type='string',
             schema=StringItemSchema(description=_(u'当前操作所属的 CMDB 业务 ID'))),
         self.InputItem(
             name=_(u'作业模板 ID'),
             key='job_task_id',
             type='string',
             schema=StringItemSchema(description=_(u'需要执行的 JOB 作业模板 ID'))),
         self.InputItem(
             name=_(u'全局变量'),
             key='job_global_var',
             type='array',
             schema=ArrayItemSchema(
                 description=_(u'作业模板执行所需的全局变量列表'),
                 item_schema=ObjectItemSchema(
                     description=_(u'全局变量'),
                     property_schemas={
                         'type':
                         IntItemSchema(description=_(u'变量类型,字符串(1) IP(2)')),
                         'name':
                         StringItemSchema(description=_(u'变量名')),
                         'value':
                         StringItemSchema(description=_(u'变量值'))
                     })))
     ]
Beispiel #9
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("填参方式"),
             key="cc_transfer_select_method_method",
             type="string",
             schema=StringItemSchema(description=_("填参方式")),
         ),
         self.InputItem(
             name=_("更新主机所属业务模块详情"),
             key="cc_host_transfer_detail",
             type="array",
             schema=ArrayItemSchema(
                 description=_("更新主机所属业务模块详情"),
                 item_schema=ObjectItemSchema(description=_("业务模块属性修改对象"),
                                              property_schemas={}),
             ),
         ),
         self.InputItem(
             name=_("自动扩展分隔符"),
             key="cc_transfer_host_template_break_line",
             type="string",
             schema=StringItemSchema(description=_("在自动填参时使用的扩展分割符")),
         ),
         self.InputItem(
             name=_("更新方式"),
             key="is_append",
             type="boolean",
             schema=BooleanItemSchema(description=_("更新方式")),
         ),
     ]
Beispiel #10
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("填参方式"),
             key="cc_set_select_method",
             type="string",
             schema=StringItemSchema(description=_("模块填入方式,拓扑(topo),层级文本(text)"), enum=["topo", "text"]),
         ),
         self.InputItem(
             name=_("拓扑-集群列表"),
             key="cc_set_select_topo",
             type="array",
             schema=ArrayItemSchema(
                 description=_("需要清空的集群 ID 列表"), item_schema=IntItemSchema(description=_("集群 ID"))
             ),
         ),
         self.InputItem(
             name=_("文本路径-集群"),
             key="cc_set_select_text",
             type="string",
             schema=StringItemSchema(description=_("集群文本路径,请输入完整路径,从业务拓扑开始,如`业务A>集群B`,多个目标集群用换行分隔")),
         ),
         self.InputItem(
             name=_("服务状态"),
             key="cc_set_status",
             type="string",
             schema=StringItemSchema(description=_("集群服务器状态,开放(1)或关闭(2)"), enum=["1", "2"]),
         ),
     ]
Beispiel #11
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("填参方式"),
             key="cc_set_select_method",
             type="str",
             schema=StringItemSchema(description=_("填参方式")),
         ),
         self.InputItem(
             name=_("拓扑模块属性修改"),
             key="cc_set_update_data",
             type="array",
             schema=ArrayItemSchema(
                 description=_("拓扑模块属性修改"),
                 item_schema=ObjectItemSchema(description=_("拓扑模块属性修改对象"),
                                              property_schemas={}),
             ),
         ),
         self.InputItem(
             name=_("自动扩展分隔符"),
             key="cc_set_template_break_line",
             type="str",
             schema=StringItemSchema(description=_("批量修改模块属性参数")),
         ),
     ]
Beispiel #12
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("模块"),
             key="cc_module_select",
             type="array",
             schema=ArrayItemSchema(
                 description=_("模块 ID 列表"),
                 item_schema=IntItemSchema(description=_("模块 ID"))),
         ),
         self.InputItem(
             name=_("模块属性"),
             key="cc_module_property",
             type="string",
             schema=StringItemSchema(description=_("需要修改的模块属性")),
         ),
         self.InputItem(
             name=_("属性值"),
             key="cc_module_prop_value",
             type="string",
             schema=StringItemSchema(description=_("模块属性更新后的值")),
         ),
     ]
Beispiel #13
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("主机内网 IP"),
             key="cc_host_ip",
             type="string",
             schema=StringItemSchema(
                 description=_("待转移的主机内网 IP,多个用英文逗号 `,` 分隔")),
         ),
         self.InputItem(
             name=_("模块 ID"),
             key="cc_module_select",
             type="array",
             schema=ArrayItemSchema(
                 description=_("转移目标模块 ID 列表"),
                 item_schema=IntItemSchema(description=_("模块 ID"))),
         ),
         self.InputItem(
             name=_("转移方式"),
             key="cc_is_increment",
             type="string",
             schema=StringItemSchema(
                 description=_("主机转移方式,覆盖(false)或追加(true)"),
                 enum=["false", "true"]),
         ),
     ]
Beispiel #14
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_(u'源文件'),
             key='job_source_files',
             type='array',
             schema=ArrayItemSchema(
                 description=_(u'待分发文件列表'),
                 item_schema=ObjectItemSchema(
                     description=_(u'待分发文件信息'),
                     property_schemas={
                         'ip': StringItemSchema(description=_(u'机器 IP')),
                         'files': StringItemSchema(description=_(u'文件路径')),
                         'account': StringItemSchema(description=_(u'执行账户'))
                     }))),
         self.InputItem(name=_(u'目标 IP'),
                        key='job_ip_list',
                        type='string',
                        schema=StringItemSchema(
                            description=_(u'文件分发目标机器 IP,多个以 "," 分隔'))),
         self.InputItem(
             name=_(u'目标账户'),
             key='job_account',
             type='string',
             schema=StringItemSchema(description=_(u'文件分发目标机器账户'))),
         self.InputItem(name=_(u'目标路径'),
                        key='job_target_path',
                        type='string',
                        schema=StringItemSchema(description=_(u'文件分发目标路径')))
     ]
Beispiel #15
0
    def test_as_dict(self):
        schema = ArrayItemSchema(description=self.description,
                                 enum=self.enum,
                                 item_schema=self.item_schema)

        schema_dict = schema.as_dict()
        self.assertEqual(
            schema_dict, {
                'type': 'array',
                'description': self.description,
                'enum': self.enum,
                'items': {
                    'type': 'int',
                    'description': self.item_description,
                    'enum': []
                }
            })
Beispiel #16
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("是否允许跨业务"),
             key="job_across_biz",
             type="bool",
             schema=BooleanItemSchema(description=_("是否允许跨业务,如果允许,源文件IP格式需为【云区域ID:IP】")),
         ),
         self.InputItem(
             name=_("源文件"),
             key="job_source_files",
             type="array",
             schema=ArrayItemSchema(
                 description=_("待分发文件列表"),
                 item_schema=ObjectItemSchema(
                     description=_("待分发文件信息"),
                     property_schemas={
                         "ip": StringItemSchema(description=_("机器 IP")),
                         "files": StringItemSchema(description=_("文件路径")),
                         "account": StringItemSchema(description=_("执行账户")),
                     },
                 ),
             ),
         ),
         self.InputItem(
             name=_("上传限速"),
             key="upload_speed_limit",
             type="string",
             schema=StringItemSchema(description=_("MB/s")),
         ),
         self.InputItem(
             name=_("下载限速"),
             key="download_speed_limit",
             type="string",
             schema=StringItemSchema(description=_("MB/s")),
         ),
         self.InputItem(
             name=_("目标 IP"),
             key="job_ip_list",
             type="string",
             schema=StringItemSchema(description=_("文件分发目标机器 IP,多个用英文逗号 `,` 分隔")),
         ),
         self.InputItem(
             name=_("目标账户"),
             key="job_account",
             type="string",
             schema=StringItemSchema(description=_("文件分发目标机器账户")),
         ),
         self.InputItem(
             name=_("目标路径"),
             key="job_target_path",
             type="string",
             schema=StringItemSchema(description=_("文件分发目标路径")),
         ),
         self.InputItem(
             name=_("超时时间"), key="job_timeout", type="string", schema=StringItemSchema(description=_("超时时间"))
         ),
     ]
Beispiel #17
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("填参方式"),
             key="cc_select_set_parent_method",
             type="string",
             schema=StringItemSchema(
                 description=_("父实例填入方式,拓扑(topo),层级文本(text)"),
                 enum=["topo", "text"]),
         ),
         self.InputItem(
             name=_("拓扑-父实例"),
             key="cc_set_parent_select_topo",
             type="array",
             schema=ArrayItemSchema(
                 description=_("父实例 ID 列表"),
                 item_schema=IntItemSchema(description=_("实例 ID"))),
         ),
         self.InputItem(
             name=_("文本路径-父实例"),
             key="cc_set_parent_select_text",
             type="string",
             schema=StringItemSchema(description=_(
                 "父实例文本路径,请输入完整路径,从业务拓扑开始,如`业务A>网络B`,多个父实例用换行分隔")),
         ),
         self.InputItem(
             name=_("集群信息"),
             key="cc_set_info",
             type="array",
             schema=ArrayItemSchema(
                 description=_("新集群信息对象列表"),
                 item_schema=ObjectItemSchema(description=_("集群信息描述对象"),
                                              property_schemas={}),
             ),
         ),
     ]
Beispiel #18
0
 def inputs_format(self):
     return [self.InputItem(name=_('业务 ID'),
                            key='biz_cc_id',
                            type='string',
                            schema=StringItemSchema(description=_('当前操作所属的 CMDB 业务 ID'))),
             self.InputItem(name=_('集群列表'),
                            key='cc_set_select',
                            type='array',
                            schema=ArrayItemSchema(description=_('需要清空的集群 ID 列表'),
                                                   item_schema=IntItemSchema(description=_('集群 ID'))))
             ]
Beispiel #19
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"), key="bk_biz_id", type="int", schema=IntItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("操作对象"),
             key="nodeman_op_target",
             type="object",
             schema=ObjectItemSchema(
                 description=_("需要操作的对象"),
                 property_schemas={
                     "nodeman_bk_cloud_id": StringItemSchema(description=_("云区域 ID")),
                     "nodeman_node_type": StringItemSchema(
                         description=_("节点类型,可以是 AGENT(表示直连区域安装 Agent)、 PROXY(表示安装 Proxy)")
                     ),
                 },
             ),
         ),
         self.InputItem(
             name=_("操作详情"),
             key="nodeman_op_info",
             type="object",
             schema=ObjectItemSchema(
                 description=_("操作内容信息"),
                 property_schemas={
                     "nodeman_ap_id": StringItemSchema(description=_("接入点 ID")),
                     "nodeman_op_type": StringItemSchema(
                         description=_(
                             "任务操作类型,可以是 INSTALL(安装)、  REINSTALL(重装)、" " UNINSTALL (卸载)、 REMOVE (移除)或 UPGRADE (升级)"
                         )
                     ),
                     "nodeman_ip_str": StringItemSchema(description=_("IP(升级,卸载,移除时需要)")),
                     "nodeman_hosts": ArrayItemSchema(
                         description=_("需要被操作的主机信息(安装与重装时需要)"),
                         item_schema=ObjectItemSchema(
                             description=_("主机相关信息"),
                             property_schemas={
                                 "inner_ip": StringItemSchema(description=_("内网 IP")),
                                 "login_ip": StringItemSchema(description=_("主机登录 IP,可以为空,适配复杂网络时填写")),
                                 "data_ip": StringItemSchema(description=_("主机数据 IP,可以为空,适配复杂网络时填写")),
                                 "outer_ip": StringItemSchema(description=_("外网 IP, 可以为空")),
                                 "os_type": StringItemSchema(description=_("操作系统类型,可以是 LINUX, WINDOWS, 或 AIX")),
                                 "port": StringItemSchema(description=_("端口号")),
                                 "account": StringItemSchema(description=_("登录帐号")),
                                 "auth_type": StringItemSchema(description=_("认证方式,可以是 PASSWORD 或 KEY")),
                                 "auth_key": StringItemSchema(description=_("认证密钥,根据认证方式,是登录密码或者登陆密钥")),
                             },
                         ),
                     ),
                 },
             ),
         ),
     ]
Beispiel #20
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_('业务 ID'),
             key='biz_cc_id',
             type='string',
             schema=StringItemSchema(description=_('通知人员所属的 CMDB 业务 ID'))),
         self.InputItem(
             name=_('通知方式'),
             key='bk_notify_type',
             type='array',
             schema=ArrayItemSchema(
                 description=_('需要使用的通知方式'),
                 enum=['weixin', 'email', 'sms'],
                 item_schema=StringItemSchema(description=_('通知方式')))),
         self.InputItem(
             name=_('通知分组'),
             key='bk_receiver_group',
             type='array',
             required=False,
             schema=ArrayItemSchema(
                 description=_('需要进行通知的业务人员分组'),
                 enum=['Maintainers', 'ProductPm', 'Developer', 'Tester'],
                 item_schema=StringItemSchema(description=_('通知分组')))),
         self.InputItem(
             name=_('额外通知人'),
             key='bk_more_receiver',
             type='string',
             schema=StringItemSchema(description=_('除了通知分组外需要额外通知的人员'))),
         self.InputItem(name=_('通知标题'),
                        key='bk_notify_title',
                        type='string',
                        schema=StringItemSchema(description=_('通知的标题'))),
         self.InputItem(name=_('通知内容'),
                        key='bk_notify_content',
                        type='string',
                        schema=StringItemSchema(description=_('通知的内容')))
     ]
Beispiel #21
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("HTTP 请求方法"),
             key="bk_http_request_method",
             type="string",
             schema=StringItemSchema(description=_("HTTP 请求方法")),
         ),
         self.InputItem(
             name=_("HTTP 请求目标地址"),
             key="bk_http_request_url",
             type="string",
             schema=StringItemSchema(description=_("HTTP 请求目标地址")),
         ),
         self.InputItem(
             name=_("HTTP 请求 header"),
             key="bk_http_request_header",
             type="array",
             schema=ArrayItemSchema(
                 description=_("HTTP 请求头部列表"),
                 item_schema=ObjectItemSchema(
                     description=_("单个头部信息"),
                     property_schemas={
                         "name": StringItemSchema(description=_("请求头名称")),
                         "value": StringItemSchema(description=_("请求头值")),
                     },
                 ),
             ),
         ),
         self.InputItem(
             name=_("HTTP 请求 body"),
             key="bk_http_request_body",
             type="string",
             schema=StringItemSchema(description=_("HTTP 请求 body")),
         ),
         self.InputItem(
             name=_("HTTP 请求超时时间"),
             key="bk_http_request_timeout",
             type="int",
             schema=IntItemSchema(description=_("HTTP 请求超时时间")),
         ),
         self.InputItem(
             name=_("HTTP 请求成功条件"),
             key="bk_http_success_exp",
             type="string",
             schema=StringItemSchema(
                 description=_("根据返回的 JSON 的数据来控制节点的成功或失败, " "使用 resp 引用返回的 JSON 对象,例 resp.result==True")
             ),
         ),
     ]
Beispiel #22
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_('业务 ID'),
             key='biz_cc_id',
             type='string',
             schema=StringItemSchema(description=_('当前操作所属的 CMDB 业务 ID'))),
         self.InputItem(
             name=_('父实例'),
             key='cc_set_parent_select',
             type='array',
             schema=ArrayItemSchema(
                 description=_('父实例 ID 列表'),
                 item_schema=IntItemSchema(description=_('实例 ID')))),
         self.InputItem(name=_('集群信息'),
                        key='cc_set_info',
                        type='array',
                        schema=ArrayItemSchema(
                            description=_('新集群信息对象列表'),
                            item_schema=ObjectItemSchema(
                                description=_('集群信息描述对象'),
                                property_schemas={})))
     ]
Beispiel #23
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="bk_biz_id",
             type="int",
             schema=IntItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("插件操作信息"),
             key="nodeman_plugin_operate",
             type="object",
             schema=ObjectItemSchema(
                 description=_("插件操作内容"),
                 property_schemas={
                     "nodeman_op_type": StringItemSchema(description=_("插件操作类型")),
                     "nodeman_plugin": StringItemSchema(description=_("插件名称")),
                     "nodeman_plugin_version": StringItemSchema(description=_("插件版本")),
                     "install_config": ArrayItemSchema(
                         description=_("安装操作参数"),
                         item_schema=StringItemSchema(
                             description=_("安装选项,nodeman_op_type值为MAIN_INSTALL_PLUGIN时可填"),
                             enum=["keep_config", "no_restart"],
                         ),
                     ),
                 },
             ),
         ),
         self.InputItem(
             name=_("主机信息"),
             key="nodeman_host_info",
             type="object",
             schema=ObjectItemSchema(
                 description=_("主机信息内容"),
                 property_schemas={
                     "nodeman_host_input_type": StringItemSchema(
                         description=_("主机填写方式"), enum=["host_ip", "host_id"]
                     ),
                     "nodeman_bk_cloud_id": IntItemSchema(description=_("主机所在云区域 ID")),
                     "nodeman_host_ip": StringItemSchema(
                         description=_("主机ip,多个以英文','分隔,nodeman_host_input_type值为host_ip时必填")
                     ),
                     "nodeman_host_id": StringItemSchema(
                         description=_("主机id,多个以英文','分隔,nodeman_host_input_type值为host_id时必填")
                     ),
                 },
             ),
         ),
     ]
Beispiel #24
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("填参方式"),
             key="cc_module_select_method",
             type="string",
             schema=StringItemSchema(
                 description=_("模块填入方式,拓扑(topo),层级文本(text)"),
                 enum=["topo", "text"]),
         ),
         self.InputItem(
             name=_("拓扑-模块"),
             key="cc_module_select_topo",
             type="array",
             schema=ArrayItemSchema(
                 description=_("转移目标模块 ID 列表"),
                 item_schema=IntItemSchema(description=_("模块 ID"))),
         ),
         self.InputItem(
             name=_("文本路径-模块"),
             key="cc_module_select_text",
             type="string",
             schema=StringItemSchema(description=_(
                 "模块文本路径,请输入完整路径,从业务拓扑开始,如`业务A>集群B>模块C`,多个目标模块用换行分隔")),
         ),
         self.InputItem(
             name=_("模块属性"),
             key="cc_module_property",
             type="string",
             schema=StringItemSchema(description=_("需要修改的模块属性")),
         ),
         self.InputItem(
             name=_("属性值"),
             key="cc_module_prop_value",
             type="string",
             schema=StringItemSchema(description=_("模块属性更新后的值")),
         ),
     ]
Beispiel #25
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("填参方式"),
             key="cc_module_select_method",
             type="string",
             schema=StringItemSchema(description=_("模块填入方式,拓扑(topo),层级文本(text)"), enum=["topo", "text"]),
         ),
         self.InputItem(
             name=_("主机内网 IP"),
             key="cc_host_ip",
             type="string",
             schema=StringItemSchema(description=_("待转移的主机内网 IP,多个用英文逗号 `,` 分隔")),
         ),
         self.InputItem(
             name=_("拓扑-模块"),
             key="cc_module_select_topo",
             type="array",
             schema=ArrayItemSchema(
                 description=_("转移目标模块 ID 列表"), item_schema=IntItemSchema(description=_("模块 ID"))
             ),
         ),
         self.InputItem(
             name=_("文本路径-模块"),
             key="cc_module_select_text",
             type="string",
             schema=StringItemSchema(description=_("请输入完整路径,从业务拓扑开始,如`业务A>集群B>模块C`,多个目标模块用换行分隔")),
         ),
         self.InputItem(
             name=_("转移方式"),
             key="cc_is_increment",
             type="string",
             schema=StringItemSchema(description=_("主机转移方式,覆盖(false)或追加(true)"), enum=["false", "true"]),
         ),
     ]
Beispiel #26
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_('业务 ID'),
             key='biz_cc_id',
             type='string',
             schema=StringItemSchema(description=_('当前操作所属的 CMDB 业务 ID'))),
         self.InputItem(
             name=_('集群列表'),
             key='cc_set_select',
             type='array',
             schema=ArrayItemSchema(
                 description=_('需要清空的集群 ID 列表'),
                 item_schema=IntItemSchema(description=_('集群 ID')))),
         self.InputItem(name=_('服务状态'),
                        key='cc_set_status',
                        type='string',
                        schema=StringItemSchema(
                            description=_('集群服务器状态,开放(1)或关闭(2)'),
                            enum=['1', '2']))
     ]
Beispiel #27
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("源文件"),
             key="job_source_files",
             type="array",
             schema=ArrayItemSchema(
                 description=_("待分发文件列表"),
                 item_schema=ObjectItemSchema(
                     description=_("待分发文件信息"),
                     property_schemas={
                         "ip": StringItemSchema(description=_("机器 IP")),
                         "files": StringItemSchema(description=_("文件路径")),
                         "account": StringItemSchema(description=_("执行账户")),
                     },
                 ),
             ),
         ),
         self.InputItem(
             name=_("目标 IP"),
             key="job_ip_list",
             type="string",
             schema=StringItemSchema(description=_("文件分发目标机器 IP,多个用英文逗号 `,` 分隔")),
         ),
         self.InputItem(
             name=_("目标账户"),
             key="job_account",
             type="string",
             schema=StringItemSchema(description=_("文件分发目标机器账户")),
         ),
         self.InputItem(
             name=_("目标路径"),
             key="job_target_path",
             type="string",
             schema=StringItemSchema(description=_("文件分发目标路径")),
         ),
         self.InputItem(
             name=_("超时时间"), key="job_timeout", type="string", schema=StringItemSchema(description=_("超时时间"))
         ),
     ]
    def setUp(self):
        self.maxDiff = None
        self.description = 'a simple item'

        self.int_description = 'a integer'
        self.int_schema = IntItemSchema(description=self.int_description)
        self.string_description = 'a string'
        self.string_schema = StringItemSchema(
            description=self.string_description)
        self.array_description = 'a array'
        self.array_item_description = 'item in array'
        self.array_schema = ArrayItemSchema(
            description=self.array_description,
            item_schema=StringItemSchema(
                description=self.array_item_description))
        self.inner_object_description = 'inner object'
        self.inner_object_schema = ObjectItemSchema(
            description=self.inner_object_description,
            property_schemas={
                'int_key': self.int_schema,
                'str_key': self.string_schema
            })
Beispiel #29
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_(u'业务 ID'),
             key='biz_cc_id',
             type='string',
             schema=StringItemSchema(description=_(u'当前操作所属的 CMDB 业务 ID'))),
         self.InputItem(
             name=_(u'主机替换信息'),
             key='cc_host_replace_detail',
             type='object',
             schema=ArrayItemSchema(
                 description=_(u'主机替换信息'),
                 item_schema=ObjectItemSchema(
                     description=_(u'替换机与被替换机信息'),
                     property_schemas={
                         'cc_fault_ip':
                         StringItemSchema(description=_(u'故障机 内网IP')),
                         'cc_new_ip':
                         StringItemSchema(description=_(u'替换机 内网IP'))
                     })))
     ]
Beispiel #30
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="string",
             schema=StringItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("作业模板 ID"),
             key="job_task_id",
             type="string",
             schema=StringItemSchema(description=_("需要执行的 JOB 作业模板 ID")),
         ),
         self.InputItem(
             name=_("全局变量"),
             key="job_global_var",
             type="array",
             schema=ArrayItemSchema(
                 description=_("作业模板执行所需的全局变量列表"),
                 item_schema=ObjectItemSchema(
                     description=_("全局变量"),
                     property_schemas={
                         "category": IntItemSchema(description=_("变量类型,云参(1) 上下文参数(2) IP(3)")),
                         "name": StringItemSchema(description=_("变量名")),
                         "value": StringItemSchema(description=_("变量值")),
                     },
                 ),
             ),
         ),
         self.InputItem(
             name=_("IP 存在性校验"),
             key="ip_is_exist",
             type="boolean",
             schema=BooleanItemSchema(description=_("是否做 IP 存在性校验,如果ip校验开关打开,校验通过的ip数量若减少,即返回错误")),
         ),
     ]