-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathindex.js
55 lines (47 loc) · 1.51 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
const BoxCommand = require('../../box-command');
const { Flags } = require('@oclif/core');
const PaginationUtils = require('../../pagination-utils');
class RetentionPoliciesListCommand extends BoxCommand {
async run() {
const { flags } = await this.parse(RetentionPoliciesListCommand);
let options = PaginationUtils.handlePagination(flags);
if (flags['policy-name']) {
options.policy_name = flags['policy-name'];
}
if (flags['policy-type']) {
options.policy_type = flags['policy-type'];
}
if (flags['created-by-user-id']) {
options.created_by_user_id = flags['created-by-user-id'];
}
if (flags.fields) {
options.fields = flags.fields;
}
let policies = await this.client.retentionPolicies.getAll(options);
await this.output(policies);
}
}
RetentionPoliciesListCommand.description = 'List all retention policies for your enterprise';
RetentionPoliciesListCommand.examples = ['box retention-policies'];
RetentionPoliciesListCommand._endpoint = 'get_retention_policies';
RetentionPoliciesListCommand.flags = {
...BoxCommand.flags,
...PaginationUtils.flags,
'policy-name': Flags.string({
char: 'n',
description: 'A name to filter the retention policies by'
}),
'policy-type': Flags.string({
description: 'A policy type to filter the retention policies by',
options: [
'finite',
'indefinite'
]
}),
'created-by-user-id': Flags.string({
char: 'u',
description: 'A user id to filter the retention policies by'
})
};
module.exports = RetentionPoliciesListCommand;