/
OnmsCollectType.ts
38 lines (33 loc) · 1.2 KB
/
OnmsCollectType.ts
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
import {OnmsEnum, forId, forLabel} from '../internal/OnmsEnum';
/**
* Represents an OpenNMS SNMP interface "should collect" type.
* @module OnmsCollectType
*/
export class OnmsCollectType extends OnmsEnum<string> {
/** given an ID, return the matching collect type object */
public static forId(id: string) {
return forId(CollectTypes, id);
}
/** given a label, return the matching collect type object */
public static forLabel(label: string) {
return forLabel(CollectTypes, label);
}
/** whether or not collection is enabled on the SNMP interface */
public isCollectionEnabled() {
return this.id === 'C' || this.id === 'UC';
}
}
/* tslint:disable:object-literal-sort-keys */
const CollectTypes = {
/** Collection Enabled */
COLLECT: new OnmsCollectType('C', 'COLLECT'),
/** User has forced collection */
FORCE_COLLECT: new OnmsCollectType('UC', 'FORCE_COLLECT'),
/** Collection is disabled */
DO_NOT_COLLECT: new OnmsCollectType('N', 'DO_NOT_COLLECT'),
/** User has forced collection to be disabled */
FORCE_DO_NOT_COLLECT: new OnmsCollectType('UN', 'FORCE_DO_NOT_COLLECT'),
};
/** @hidden */
const frozen = Object.freeze(CollectTypes);
export {frozen as CollectTypes};