/
OnmsPrimaryType.ts
42 lines (35 loc) · 1.16 KB
/
OnmsPrimaryType.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
39
40
41
42
import {IHasUrlValue} from '../api/IHasUrlValue';
import {OnmsEnum, forId, forLabel} from '../internal/OnmsEnum';
/**
* Represents an OpenNMS "SNMP primary" type.
* @module OnmsPrimaryType
*/
export class OnmsPrimaryType extends OnmsEnum<string> implements IHasUrlValue {
/** Given an ID, return the matching primary type object. */
public static forId(id: string) {
return forId(PrimaryTypes, id);
}
/** Given a label, return the matching primary type object. */
public static forLabel(label: string) {
return forLabel(PrimaryTypes, label);
}
/** Whether or not the interface is a primary SNMP interface. */
public isPrimary() {
return this.id === 'P';
}
public get urlValue() {
return this.id;
}
}
/* tslint:disable:object-literal-sort-keys */
const PrimaryTypes = {
/** Primary SNMP interface */
PRIMARY: new OnmsPrimaryType('P', 'PRIMARY'),
/** Secondary SNMP interface */
SECONDARY: new OnmsPrimaryType('S', 'SECONDARY'),
/** SNMP interface is not eligible for collection */
NOT_ELIGIBLE: new OnmsPrimaryType('N', 'NOT_ELIGIBLE'),
};
/** @hidden */
const frozen = Object.freeze(PrimaryTypes);
export {frozen as PrimaryTypes};