Beispiel #1
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 #2
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("传参形式"),
             key="set_select_method",
             type="string",
             schema=StringItemSchema(description=_(
                 "集群填入方式,Set名称(name),Set ID(id),自定义(根据集群属性过滤)"),
                                     enum=["name", "id", "custom"]),
         ),
         self.InputItem(
             name=_("集群属性ID"),
             key="set_attr_id",
             type="string",
             schema=StringItemSchema(
                 description=_("集群范围中填写的值会在此处填写的属性 ID 的值上进行过滤")),
         ),
         self.InputItem(
             name=_("集群范围"),
             key="set_list",
             type="string",
             schema=StringItemSchema(description=_("集群范围,多个集群使用英文','分割")),
         ),
         self.InputItem(
             name=_("服务状态"),
             key="set_status",
             type="string",
             schema=StringItemSchema(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_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 #4
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 #5
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=_("结束屏蔽的时间")),
         ),
     ]
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'主机内网 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 #7
0
 def outputs_format(self):
     return [
         self.OutputItem(name=_("总任务数"),
                         key="task_count",
                         type="string",
                         schema=StringItemSchema(description=_("总任务数"))),
         self.OutputItem(
             name=_("上传请求成功数"),
             key="request_success_count",
             type="string",
             schema=StringItemSchema(description=_("上传请求成功数")),
         ),
         self.OutputItem(name=_("上传成功数"),
                         key="success_count",
                         type="string",
                         schema=StringItemSchema(description=_("上传成功数"))),
         self.OutputItem(
             name=_("任务id"),
             key="job_instance_id_list",
             type="string",
             schema=StringItemSchema(description=_("任务id")),
         ),
         self.OutputItem(name=_("任务url"),
                         key="job_inst_url",
                         type="string",
                         schema=StringItemSchema(description=_("任务url"))),
     ]
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=_(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 #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=_("更新方式")),
         ),
     ]
Beispiel #11
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="job_cron_name",
             type="string",
             schema=StringItemSchema(description=_("待创建的定时作业名称")),
         ),
         self.InputItem(
             name=_("定时规则"),
             key="job_cron_expression",
             type="string",
             schema=StringItemSchema(description=_("待创建的定时作业定时规则")),
         ),
         self.InputItem(
             name=_("定时作业状态"),
             key="job_cron_status",
             type="int",
             schema=IntItemSchema(description=_("待创建的定时作业状态,暂停(1) 启动(2)"),
                                  enum=[1, 2]),
         ),
     ]
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=_("主机内网 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 #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=_("填参方式"),
             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 #14
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")),
         ),
     ]
Beispiel #15
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("会话 ID"),
             key="wechat_work_chat_id",
             type="string",
             schema=StringItemSchema(
                 description=_("通过在群里@企业微信机器人获取,多个用换行分隔")),
         ),
         self.InputItem(
             name=_("消息内容"),
             key="message_content",
             type="string",
             schema=StringItemSchema(description=_("消息内容")),
         ),
         self.InputItem(
             name=_("提醒人"),
             key="wechat_work_mentioned_members",
             type="string",
             schema=StringItemSchema(
                 description=_("提醒群指定成员(@某个成员),多个成员用 `,` 分隔,@all表示提醒所有人")),
         ),
         self.InputItem(
             name=_("消息格式"),
             key="msgtype",
             type="string",
             schema=StringItemSchema(description=_("文本(text)或Markdown")),
         ),
     ]
Beispiel #16
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("策略 ID"),
             key="bk_alarm_shield_strategy",
             type="string",
             schema=StringItemSchema(description=_("需要执行屏蔽的策略 ID")),
         ),
         self.InputItem(name=_("IP"),
                        key="bk_alarm_shield_IP",
                        type="string",
                        schema=StringItemSchema(description=_("IP"))),
         self.InputItem(
             name=_("屏蔽开始时间"),
             key="bk_alarm_shield_strategy_begin_time",
             type="string",
             schema=StringItemSchema(description=_("开始屏蔽的时间")),
         ),
         self.InputItem(
             name=_("屏蔽结束时间"),
             key="bk_alarm_shield_strategy_end_time",
             type="string",
             schema=StringItemSchema(description=_("结束屏蔽的时间")),
         ),
     ]
Beispiel #17
0
    def test_as_dict(self):
        schema = StringItemSchema(description=self.description,
                                  enum=self.enum)

        schema_dict = schema.as_dict()
        self.assertEqual(schema_dict, {'type': 'string',
                                       'description': self.description,
                                       'enum': self.enum})
Beispiel #18
0
 def outputs_format(self):
     return [
         self.OutputItem(name=_("单据sn"),
                         key="sn",
                         type="string",
                         schema=StringItemSchema(description=_("单据sn"))),
         self.OutputItem(name=_("审核结果"),
                         key="approve_result",
                         type="string",
                         schema=StringItemSchema(description=_("审核结果"))),
     ]
Beispiel #19
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 #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="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 #21
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,多个以 "," 分隔')))
     ]
Beispiel #22
0
 def outputs_format(self):
     return [
         self.OutputItem(
             name=_("屏蔽Id"),
             key="shield_id",
             type="string",
             schema=StringItemSchema(description=_("创建的告警屏蔽 ID"))),
         self.OutputItem(
             name=_("详情"),
             key="message",
             type="string",
             schema=StringItemSchema(description=_("创建的告警屏蔽详情"))),
     ]
Beispiel #23
0
 def outputs_format(self):
     return [
         self.OutputItem(
             name=_('返回码'),
             key='code',
             type='string',
             schema=StringItemSchema(description=_('通知接口的返回码'))),
         self.OutputItem(
             name=_('信息'),
             key='message',
             type='string',
             schema=StringItemSchema(description=_('通知接口返回的信息')))
     ]
Beispiel #24
0
 def inputs_format(self):
     return [
         self.InputItem(
             name=_("任务ID"),
             key="job_task_id",
             type="string",
             schema=StringItemSchema(description=_("任务ID")),
         ),
         self.InputItem(
             name=_("目标 IP"),
             key="job_target_ip",
             type="string",
             schema=StringItemSchema(description=_("日志查询目标IP,仅支持一个IP")),
         ),
     ]
Beispiel #25
0
class Datetime(CommonPlainVariable):
    code = 'datetime'
    name = _(u"日期时间")
    type = 'general'
    tag = 'datetime.datetime'
    form = '%svariables/%s.js' % (settings.STATIC_URL, code)
    schema = StringItemSchema(description=_(u'日期时间变量'))
Beispiel #26
0
class Textarea(CommonPlainVariable):
    code = 'textarea'
    name = _(u"文本框")
    type = 'general'
    tag = 'textarea.textarea'
    form = '%svariables/%s.js' % (settings.STATIC_URL, code)
    schema = StringItemSchema(description=_(u'文本框变量'))
Beispiel #27
0
class Input(CommonPlainVariable):
    code = 'input'
    name = _(u"输入框")
    type = 'general'
    tag = 'input.input'
    form = '%svariables/%s.js' % (settings.STATIC_URL, code)
    schema = StringItemSchema(description=_(u'输入框变量'))
Beispiel #28
0
 def outputs_format(self):
     return [
         self.OutputItem(name=_("任务日志"),
                         key="job_task_log",
                         type="string",
                         schema=StringItemSchema(description=_("任务日志")))
     ]
Beispiel #29
0
 def outputs_format(self):
     return [
         self.OutputItem(name=_("不合法的IP"),
                         key="invalid_ip",
                         type="string",
                         schema=StringItemSchema(description=_("不合法的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=_("主机 IP"),
             key="cc_host_ip",
             type="string",
             schema=StringItemSchema(
                 description=_("转移到故障机的主机内网 IP,多个用英文逗号 `,` 分隔")),
         ),
     ]