创建模板接口
更新时间:2024-08-16
接口描述
根据需要自定义模板要执行的任务并创建模板。
请求参数
| 名称 | 类型 | 描述 | 是否必须 | 参数位置 |
|---|---|---|---|---|
| name | String | 模板名称 | 是 | Body体参数 |
| operators | List< OperatorModel > | 模板包含的任务列表 | 是 | Body体参数 |
| description | String | 模板描述 | 否 | Body体参数 |
OperatorModel参数
| 名称 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| name | String | 是 | 任务名称 |
| operator | String | 是 | 任务类型 |
| properties | Map<String, Object> | 是 | 任务执行所需参数 |
| retries | int | 否 | 重试次数,默认不重试 |
| retry_interval | int | 否 | 重试时间间隔,单位:毫秒,默认间隔60秒 |
| timeout | int | 否 | 任务执行超时时间,单位:毫秒,默认超时时间1小时 |
| description | String | 否 | 任务描述 |
响应参数
| 名称 | 类型 | 描述 |
|---|---|---|
| id | String | 模板ID,全局唯一 |
请求示例
Python
1 # params definition
2 property1 = {
3 "instances": [
4 {
5 "instanceId": "i-khWMkT**"
6 }
7 ]
8 }
9 operator1 = oos_model.OperatorModel("stop_bcc", "BCE::BCC::StopInstance", property1)
10
11 # create a oos client
12 oos_client = OosClient(oos_sample_conf.config)
13
14 # create template
15 response = oos_client.create_template("test_template_01", [operator1])
16 print response
