Example #1
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=_("认证密钥,根据认证方式,是登录密码或者登陆密钥")),
                             },
                         ),
                     ),
                 },
             ),
         ),
     ]
Example #2
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=_("次序")),
                     },
                 ),
             ),
         ),
     ]
Example #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={}),
             ),
         ),
     ]
Example #4
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时必填")
                     ),
                 },
             ),
         ),
     ]
Example #5
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=_("批量修改模块属性参数")),
         ),
     ]
Example #6
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=_("复制故障机属性")),
         ),
     ]
Example #7
0
File: job.py Project: manlucas/atom
 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'文件分发目标路径')))
     ]
Example #8
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={}),
             ),
         ),
     ]
Example #9
0
File: job.py Project: manlucas/atom
 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'变量值'))
                     })))
     ]
Example #10
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=_("更新方式")),
         ),
     ]
Example #11
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("屏蔽范围类型"),
             key="bk_alarm_shield_info",
             type="object",
             schema=ObjectItemSchema(description=_(u"屏蔽范围类型"),
                                     property_schemas={}),
         ),
         self.InputItem(
             name=_("策略 ID"),
             key="bk_alarm_shield_target",
             type="string",
             schema=StringItemSchema(description=_("需要执行屏蔽的指标")),
         ),
         self.InputItem(
             name=_("屏蔽开始时间"),
             key="bk_alarm_shield_begin_time",
             type="string",
             schema=StringItemSchema(description=_("开始屏蔽的时间")),
         ),
         self.InputItem(
             name=_("屏蔽结束时间"),
             key="bk_alarm_shield_end_time",
             type="string",
             schema=StringItemSchema(description=_("结束屏蔽的时间")),
         ),
     ]
Example #12
0
 def outputs_format(self):
     return super(JobLocalContentUploadService, self).outputs_format() + [
         self.OutputItem(
             name=_("JOB全局变量"),
             key="log_outputs",
             type="object",
             schema=ObjectItemSchema(
                 description=_(
                     "输出日志中提取的全局变量,日志中形如 <SOPS_VAR>key:val</SOPS_VAR> 的变量会被提取到 log_outputs['key'] 中,值为 val"
                 ),
                 property_schemas={
                     "name": StringItemSchema(description=_("全局变量名称")),
                     "value": StringItemSchema(description=_("全局变量值")),
                 },
             ),
         ),
         self.OutputItem(
             name=_("JOB任务ID"),
             key="job_inst_id",
             type="int",
             schema=IntItemSchema(description=_("提交的任务在 JOB 平台的实例 ID")),
         ),
         self.OutputItem(
             name=_("JOB任务链接"),
             key="job_inst_url",
             type="string",
             schema=StringItemSchema(description=_("提交的任务在 JOB 平台的 URL")),
         ),
     ]
Example #13
0
 def outputs_format(self):
     return [
         self.OutputItem(
             name=_("更新成功的主机"),
             key="set_update_success",
             type="object",
             schema=ObjectItemSchema(description=_("更新成功的主机"),
                                     property_schemas={}),
         ),
         self.OutputItem(
             name=_("更新失败的主机"),
             key="set_update_failed",
             type="object",
             schema=ObjectItemSchema(description=_("更新失败的主机"),
                                     property_schemas={}),
         ),
     ]
Example #14
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=_("超时时间"))
         ),
     ]
Example #15
0
 def outputs_format(self):
     return [
         self.OutputItem(
             name=_("API回调数据"),
             key="callback_data",
             type="object",
             schema=ObjectItemSchema(
                 description=_("通过node_callback API接口回调并传入数据,支持dict数据"),
                 property_schemas={},
             ),
         ),
     ]
Example #16
0
 def outputs_format(self):
     return [
         self.OutputItem(
             name=_("响应内容"),
             key="data",
             type="object",
             schema=ObjectItemSchema(description=_("HTTP 请求响应内容,内部结构不固定"), property_schemas={}),
         ),
         self.OutputItem(
             name=_("状态码"), key="status_code", type="int", schema=IntItemSchema(description=_("HTTP 请求响应状态码"))
         ),
     ]
Example #17
0
 def outputs_format(self):
     return [
         self.OutputItem(name=_(u'响应内容'),
                         key='data',
                         type='object',
                         schema=ObjectItemSchema(
                             description=_(u'HTTP 请求响应内容,内部结构不固定'),
                             property_schemas={})),
         self.OutputItem(
             name=_(u'状态码'),
             key='status_code',
             type='int',
             schema=IntItemSchema(description=_(u'HTTP 请求响应状态码')))
     ]
Example #18
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")
             ),
         ),
     ]
Example #19
0
 def outputs_format(self):
     return super(JobFastExecuteScriptService, self).outputs_format() + [
         self.OutputItem(
             name=_("JOB全局变量"),
             key="log_outputs",
             type="dict",
             schema=ObjectItemSchema(
                 description=
                 _("输出日志中提取的全局变量,日志中形如 <SOPS_VAR>key:val</SOPS_VAR> 的变量会被提取到 log_outputs['key'] 中,值为 val"
                   ),
                 property_schemas={
                     "name": StringItemSchema(description=_("全局变量名称")),
                     "value": StringItemSchema(description=_("全局变量值")),
                 },
             ),
         ),
     ]
Example #20
0
    def test_as_dict(self):
        object_schema = ObjectItemSchema(description=self.description,
                                         property_schemas={
                                             'array_key': self.array_schema,
                                             'object_key':
                                             self.inner_object_schema
                                         })

        schema_dict = object_schema.as_dict()
        self.assertEqual(
            schema_dict, {
                'type': 'object',
                'description': self.description,
                'enum': [],
                'properties': {
                    'array_key': {
                        'type': 'array',
                        'description': self.array_description,
                        'enum': [],
                        'items': {
                            'type': 'string',
                            'description': self.array_item_description,
                            'enum': [],
                        }
                    },
                    'object_key': {
                        'type': 'object',
                        'description': self.inner_object_description,
                        'enum': [],
                        'properties': {
                            'int_key': {
                                'type': 'int',
                                'description': self.int_description,
                                'enum': [],
                            },
                            'str_key': {
                                'type': 'string',
                                'description': self.string_description,
                                'enum': []
                            }
                        }
                    }
                }
            })
Example #21
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={}),
             ),
         ),
     ]
Example #22
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=_("超时时间"))
         ),
     ]
Example #23
0
File: cc.py Project: manlucas/atom
 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'))
                     })))
     ]
Example #24
0
    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
            })
Example #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_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={})))
     ]
Example #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=_("作业模板 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数量若减少,即返回错误")),
         ),
     ]
Example #27
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("填参方式"),
             key="cc_host_update_method",
             type="string",
             schema=StringItemSchema(description=_("填参方式"),
                                     enum=["manual", "auto"]),
         ),
         self.InputItem(
             name=_("主机属性修改"),
             key="cc_host_property_custom",
             type="array",
             schema=ArrayItemSchema(item_schema=ObjectItemSchema(
                 description=_("主机属性修改"), property_schemas={}),
                                    description="主机属性列表"),
         ),
         self.InputItem(
             name=_("自动扩展分隔符"),
             key="gcs_template_break_line",
             type="string",
             schema=StringItemSchema(description=_("凯丽开区参数")),
         ),
     ]
Example #28
0
 def inputs_format(self):
     return [
         self.InputItem(name=_("目标IP"),
                        key="job_target_ip_list",
                        type="string",
                        schema=StringItemSchema(description=_("目标IP"))),
         self.InputItem(name=_("执行账号"),
                        key="job_target_account",
                        type="string",
                        schema=StringItemSchema(description=_("执行账号"))),
         self.InputItem(
             name=_("本地文件信息"),
             key="job_local_files_info",
             type="object",
             schema=ObjectItemSchema(
                 description=_("本地文件信息"),
                 property_schemas={
                     "job_push_multi_local_files_table":
                     ArrayItemSchema(
                         description=_("文件信息表"),
                         item_schema=ObjectItemSchema(
                             description=_("文件信息与目标路径"),
                             property_schemas={
                                 "file_info":
                                 ArrayItemSchema(
                                     description=_("本地文件"),
                                     item_schema=ObjectItemSchema(
                                         description=_("需要操作的文件"),
                                         property_schemas={
                                             "tag":
                                             ObjectItemSchema(
                                                 description=_("tag"),
                                                 property_schemas={
                                                     "type":
                                                     StringItemSchema(
                                                         description=_(
                                                             "文件类型"),
                                                         enum=[
                                                             "upload_module",
                                                             "host_nfs"
                                                         ]),
                                                     "tags":
                                                     ObjectItemSchema(
                                                         description=
                                                         _("tags,文件类型为upload_module, tag_id必填。"
                                                           "文件类型为host_nfs, uid shims name必填"
                                                           ),
                                                         property_schemas={
                                                             "tag_id":
                                                             StringItemSchema(
                                                                 description
                                                                 =_("tag_id"
                                                                    )),
                                                             "uid":
                                                             StringItemSchema(
                                                                 description
                                                                 =_("uid")),
                                                             "shims":
                                                             StringItemSchema(
                                                                 description
                                                                 =_("shims"
                                                                    )),
                                                             "name":
                                                             StringItemSchema(
                                                                 description
                                                                 =_("name"
                                                                    )),
                                                         },
                                                     ),
                                                 },
                                             )
                                         },
                                     ),
                                 ),
                                 "target_path":
                                 StringItemSchema(description=_("目标地址")),
                             },
                         ),
                     )
                 },
             ),
         ),
         self.InputItem(name=_("超时时间"),
                        key="job_timeout",
                        type="string",
                        schema=StringItemSchema(description=_("超时时间"))),
     ]
Example #29
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("源文件"),
             key="job_source_files",
             type="array",
             schema=ArrayItemSchema(
                 description=_("待分发文件列表"),
                 item_schema=ObjectItemSchema(
                     description=_("待分发文件信息"),
                     property_schemas={
                         "bk_cloud_id":
                         StringItemSchema(description=_("云区域ID, 默认为0")),
                         "ip":
                         StringItemSchema(description=_("机器 IP")),
                         "files":
                         StringItemSchema(
                             description=_("文件路径, 多个用换行(\\n)分隔")),
                         "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=_("分发配置"),
             key="job_dispatch_attr",
             type="array",
             schema=ArrayItemSchema(
                 description=_("待分发至目标信息列表"),
                 item_schema=ObjectItemSchema(
                     description=_("待分发至目标信息列表"),
                     property_schemas={
                         "bk_cloud_id":
                         StringItemSchema(description=_("云区域ID, 默认为0")),
                         "job_ip_list":
                         StringItemSchema(
                             description=_("待分发机器 IP,多IP请使用;分隔")),
                         "job_target_path":
                         StringItemSchema(description=_(
                             "分发目标绝对路径,(可用[FILESRCIP]代替源IP)")),
                         "job_target_account":
                         StringItemSchema(
                             description=_("执行账户,输入在蓝鲸作业平台上注册的账户名")),
                     },
                 ),
             ),
         ),
         self.InputItem(name=_("超时时间"),
                        key="job_timeout",
                        type="string",
                        schema=StringItemSchema(description=_("超时时间"))),
     ]
Example #30
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("业务 ID"),
             key="biz_cc_id",
             type="int",
             schema=IntItemSchema(description=_("当前操作所属的 CMDB 业务 ID")),
         ),
         self.InputItem(
             name=_("云区域 ID"),
             key="nodeman_bk_cloud_id",
             type="string",
             schema=StringItemSchema(description=_("节点所在云区域 ID")),
         ),
         self.InputItem(
             name=_("节点类型"),
             key="nodeman_node_type",
             type="string",
             schema=StringItemSchema(description=_(
                 "节点类型,可以是 AGENT(表示直连区域安装 Agent)、 "
                 "PROXY(表示安装 Proxy) 或 PAGENT(表示直连区域安装 Agent)")),
         ),
         self.InputItem(
             name=_("操作类型"),
             key="nodeman_op_type",
             type="string",
             schema=StringItemSchema(description=_(
                 "任务操作类型,可以是 INSTALL(安装)、  REINSTALL(重装)、"
                 " UNINSTALL (卸载)、 REMOVE (移除)或 UPGRADE (升级)")),
         ),
         self.InputItem(
             name=_("主机"),
             key="nodeman_hosts",
             type="array",
             schema=ArrayItemSchema(
                 description=_("主机所在云区域 ID"),
                 item_schema=ObjectItemSchema(
                     description=_("主机相关信息"),
                     property_schemas={
                         "conn_ips":
                         StringItemSchema(description=_("主机通信 IP")),
                         "login_ip":
                         StringItemSchema(
                             description=_("主机登录 IP,可以为空,适配复杂网络时填写")),
                         "data_ip":
                         StringItemSchema(
                             description=_("主机数据 IP,可以为空,适配复杂网络时填写")),
                         "cascade_ip":
                         StringItemSchema(
                             description=_("级联 IP, 可以为空,安装 PROXY 时必填")),
                         "os_type":
                         StringItemSchema(description=_(
                             "操作系统类型,可以是 LINUX, WINDOWS, 或 AIX")),
                         "has_cygwin":
                         StringItemSchema(
                             description=_("是否安装了 cygwin,True:表示已安装,"
                                           "False:表示未安装, windows 操作系统时选填")),
                         "port":
                         StringItemSchema(description=_("端口号")),
                         "account":
                         StringItemSchema(description=_("登录帐号")),
                         "auth_type":
                         StringItemSchema(
                             description=_("认证方式,可以是 PASSWORD 或 KEY")),
                         "auth_key":
                         StringItemSchema(
                             description=_("认证密钥,根据认证方式,是登录密码或者登陆密钥")),
                     },
                 ),
             ),
         ),
     ]