-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathindex.js
51 lines (42 loc) · 1.35 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
'use strict';
const BoxCommand = require('../../../box-command');
const { Flags, Args } = require('@oclif/core');
const PaginationUtils = require('../../../pagination-utils');
class RetentionPoliciesListCommand extends BoxCommand {
async run() {
const { flags, args } = await this.parse(RetentionPoliciesListCommand);
let options = PaginationUtils.handlePagination(flags);
if (flags.type) {
options.type = flags.type;
}
if (flags.fields) {
options.fields = flags.fields;
}
let assignments = await this.client.retentionPolicies.getAssignments(args.id, options);
await this.output(assignments);
}
}
RetentionPoliciesListCommand.description = 'List all retention policies for your enterprise';
RetentionPoliciesListCommand.examples = ['box retention-policies:assignments 12345'];
RetentionPoliciesListCommand._endpoint = 'get_retention_policies_id_assignments';
RetentionPoliciesListCommand.flags = {
...BoxCommand.flags,
...PaginationUtils.flags,
type: Flags.string({
description: 'The type of the retention policy assignment to retrieve',
options: [
'folder',
'enterprise',
'metadata_template'
],
})
};
RetentionPoliciesListCommand.args = {
id: Args.string({
name: 'id',
required: true,
hidden: false,
description: 'ID of the retention policy to get assignments for',
}),
};
module.exports = RetentionPoliciesListCommand;