-
Notifications
You must be signed in to change notification settings - Fork 9
/
OnmsNodeType.ts
39 lines (34 loc) · 1.02 KB
/
OnmsNodeType.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
import {IHasUrlValue} from '../api/IHasUrlValue';
import {OnmsEnum, forId, forLabel} from '../internal/OnmsEnum';
/**
* Represents an OpenNMS node type.
* @category Model
*/
export class OnmsNodeType extends OnmsEnum<string> implements IHasUrlValue {
/** Given an ID (A, D, etc.), return the corresponding node type object. */
public static forId(id?: string) {
return forId(NodeTypes, id);
}
/** Given a label (ACTIVE, etc.), return the corresponding node type object. */
public static forLabel(label?: string) {
return forLabel(NodeTypes, label);
}
/** @inheritdoc */
public get urlValue() {
return this.id;
}
}
/* tslint:disable:object-literal-sort-keys */
/**
* Contains constant instances of all node types.
* @category Model
*/
export const NodeTypes = {
/** Node is active */
ACTIVE: new OnmsNodeType('A', 'ACTIVE'),
/** Node is disabled */
DELETED: new OnmsNodeType('D', 'DELETED'),
/** Node state is unknown */
UNKNOWN: new OnmsNodeType(' ', 'UNKNOWN'),
};
Object.freeze(NodeTypes);