-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendToS3.js
40 lines (37 loc) · 1.05 KB
/
sendToS3.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const {Command, flags} = require('@oclif/command')
const uploadToS3 = require('../shared/uploadToS3');
class SendToS3Command extends Command {
async run() {
let res;
try {
const {flags} = this.parse(SendToS3Command);
res = await uploadToS3(flags);
this.log(res);
} catch (e) {
this.error(e);
}
}
}
SendToS3Command.description = 'Uploads the specified file to S3'
SendToS3Command.usage = 'sendToS3 [OPTIONS]'
SendToS3Command.examples = ['mongodb-utils sendToS3 --bucket test-bukket-ro --credentials aws.json --file backups/backmeup.json --destDir backups'];
SendToS3Command.flags = {
credentials: flags.string({
description: 'Path to AWS Credentials in JSON form',
required: true,
}),
bucket: flags.string({
description: 'AWS S3 Bucket',
required: true,
}),
destDir: flags.string({
description: 'Destination dir in S3 Bucket',
required: false,
default: '/'
}),
file: flags.string({
description: 'File to upload in S3 Bucket',
required: true,
}),
}
module.exports = SendToS3Command