虚机下载文件
更新时间:2024-08-16
虚机从BOS下载文件
用途
用于在多台云服务器BCC内部从BOS下载文件
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| name | String | 模板任务名称,必填 |
| operator | String | 模板任务类型,必填 |
| properties | Map<String, Object> | 任务执行所需参数,必填,详细内容见下表 |
properties参数
| 名称 | 类型 | 描述 |
|---|---|---|
| __workerSelectors__ | List/Object | 实例ID,必填,支持多选 |
| sourceType | String | 下载源,必填,取值:bos |
| bosBucketName | String | bos桶名称,必填 |
| bosFilePath | String | bos文件名称全路径,必填 |
| fileDir | String | 保存文件路径,必填 |
| filename | String | 保存文件名称,必填 |
示例
__workerSelectors__参数可以直接指定也可以引用模板中的全局参数,示例分别如下:
直接指定
JSON
1{
2 "name": "fileDownload",
3 "operator": "BCE::Agent::FileDownload",
4 "properties": {
5 "sourceType": "bos",
6 "bosBucketName": "testBucketName",
7 "bosFilePath": "hello/test.log",
8 "fileDir": "/tmp",
9 "filename": "new.log",
10 "__workerSelectors__": [
11 {
12 "instanceId":"i-pqJV5Ptu" // BCC短ID
13 },
14 {
15 "instanceId":"i-rXV43yGW" // BCC短ID
16 }
17 ]
18 }
19}
引用全局参数
引用模板中的globalInstanceList全局参数
JSON
1{
2 "name": "fileDownload",
3 "operator": "BCE::Agent::FileDownload",
4 "properties": {
5 "sourceType": "bos",
6 "bosBucketName": "testBucketName",
7 "bosFilePath": "hello/test.log",
8 "fileDir": "/tmp",
9 "filename": "new.log",
10 "__workerSelectors__": {
11 "Ref":"globalInstanceList"
12 }
13 }
14}
虚机从HTTP下载文件
用途
用于在多台BCC内部从HTTP下载文件
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| name | String | 模板任务名称,必填 |
| operator | String | 模板任务类型,必填 |
| properties | Map<String, Object> | 任务执行所需参数,必填,详细内容见下表 |
properties参数
| 名称 | 类型 | 描述 |
|---|---|---|
| __workerSelectors__ | List/Object | 实例ID,必填,支持多选 |
| sourceType | String | 下载源,必填,取值:http |
| source | String | url地址,必填 |
| fileDir | String | 保存文件路径,必填 |
| filename | String | 保存文件名称,必填 |
示例
__workerSelectors__参数可以直接指定也可以引用模板中的全局参数,示例分别如下:
直接指定
JSON
1{
2 "name": "fileDownload",
3 "operator": "BCE::Agent::FileDownload",
4 "properties": {
5 "sourceType": "http",
6 "source": "http://localhost:8837/hello.log",
7 "fileDir": "/tmp",
8 "filename": "new.log",
9 "__workerSelectors__": [
10 {
11 "instanceId":"i-pqJV5Ptu" // BCC短ID
12 },
13 {
14 "instanceId":"i-rXV43yGW" // BCC短ID
15 }
16 ]
17 }
18}
引用全局参数
引用模板中的globalInstanceList全局参数
JSON
1{
2 "name": "fileDownload",
3 "operator": "BCE::Agent::FileDownload",
4 "properties": {
5 "sourceType": "http",
6 "source": "http://localhost:8837/hello.log",
7 "fileDir": "/tmp",
8 "filename": "new.log",
9 "__workerSelectors__": {
10 "Ref":"globalInstanceList"
11 }
12 }
13}
