Skip to content

Commit f009f3d

Browse files
chore: cover tenantInfo api call with types
1 parent e6c691c commit f009f3d

File tree

4 files changed

+137
-3
lines changed

4 files changed

+137
-3
lines changed

src/services/api.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ interface Window {
4545
getHealthcheckInfo: (
4646
database: string,
4747
) => Promise<import('../types/api/healthcheck').HealthCheckAPIResponse>;
48+
getTenantInfo: (params: {
49+
path: string;
50+
}) => Promise<import('../types/api/tenant').TTenantInfo>;
4851
[method: string]: Function;
4952
};
5053
}

src/types/api/nodes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface TNodeInfo {
1919
Tablets?: TTabletStateInfo[];
2020
}
2121

22-
interface TSystemStateInfo {
22+
export interface TSystemStateInfo {
2323
/** uint64 */
2424
StartTime?: string;
2525
/** uint64 */
@@ -57,7 +57,7 @@ interface TSystemStateInfo {
5757
Location?: TNodeLocation;
5858
}
5959

60-
interface TPoolStats {
60+
export interface TPoolStats {
6161
Name?: string;
6262
/** double */
6363
Usage?: number;

src/types/api/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ enum EStatus {
3838
}
3939

4040
// incomplete interface, only currently used fields are covered
41-
interface TPathDescription {
41+
export interface TPathDescription {
4242
/** info about the path itself */
4343
Self?: TDirEntry;
4444
DomainDescription?: TDomainDescription;

src/types/api/tenant.ts

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
import {EFlag} from './enums';
2+
import {TPoolStats, TSystemStateInfo} from './nodes';
3+
import {TTabletStateInfo} from './tablet';
4+
5+
export interface TTenants {
6+
Tenants?: TTenant[];
7+
}
8+
9+
export interface TTenantInfo {
10+
TenantInfo?: TTenant[];
11+
Errors?: string[];
12+
}
13+
14+
export interface TTenant {
15+
Name: string;
16+
Id: string;
17+
Type: ETenantType;
18+
State: State;
19+
StateStats?: THiveDomainStatsStateCount[];
20+
Metrics: TMetrics;
21+
NodeIds?: number[];
22+
AliveNodes: number;
23+
Resources: TTenantResources;
24+
/** uint64 */
25+
CreateTime: string;
26+
Owner: string;
27+
Users?: string[];
28+
PoolStats?: TPoolStats[];
29+
UserAttributes: Record<string, string>;
30+
Overall: EFlag;
31+
SystemTablets?: TTabletStateInfo[];
32+
ResourceId: string;
33+
Tablets?: TTabletStateInfo[];
34+
/** uint64 */
35+
StorageAllocatedSize: string;
36+
/** uint64 */
37+
StorageMinAvailableSize: string;
38+
Nodes?: TSystemStateInfo[];
39+
/** uint64 */
40+
MemoryUsed: string;
41+
/** uint64 */
42+
MemoryLimit: string;
43+
/** double */
44+
CoresUsed: number;
45+
/** uint64 */
46+
StorageGroups: string;
47+
}
48+
49+
interface THiveDomainStatsStateCount {
50+
VolatileState?: ETabletVolatileState;
51+
Count?: number;
52+
}
53+
54+
interface TMetrics {
55+
/** uint64 */
56+
CPU?: string;
57+
/** uint64 */
58+
Memory?: string;
59+
/** uint64 */
60+
Network?: string;
61+
/** uint64 */
62+
Counter?: string;
63+
/** uint64 */
64+
Storage?: string;
65+
/** uint64 */
66+
ReadThroughput?: string;
67+
/** uint64 */
68+
WriteThroughput?: string;
69+
/** uint64 */
70+
ReadIops?: string;
71+
/** uint64 */
72+
WriteIops?: string;
73+
74+
GroupReadThroughput?: TThroughputRecord[];
75+
GroupWriteThroughput?: TThroughputRecord[];
76+
77+
GroupReadIops?: TIopsRecord[];
78+
GroupWriteIops?: TIopsRecord[];
79+
}
80+
81+
interface TThroughputRecord {
82+
GroupID?: number;
83+
Channel?: number;
84+
/** uint64 */
85+
Throughput?: string;
86+
}
87+
88+
interface TIopsRecord {
89+
GroupID?: number;
90+
Channel?: number;
91+
/** uint64 */
92+
Iops?: string;
93+
}
94+
95+
interface TTenantResources {
96+
Required?: TTenantResource[];
97+
Allocated?: TTenantResource[];
98+
}
99+
100+
interface TTenantResource {
101+
Type: string;
102+
Zone: string;
103+
Kind: string;
104+
Count: number;
105+
}
106+
107+
export enum ETenantType {
108+
'UnknownTenantType' = 'UnknownTenantType',
109+
'Domain' = 'Domain',
110+
'Dedicated' = 'Dedicated',
111+
'Shared' = 'Shared',
112+
'Serverless' = 'Serverless',
113+
}
114+
115+
enum State {
116+
'STATE_UNSPECIFIED' = 'STATE_UNSPECIFIED',
117+
'CREATING' = 'CREATING',
118+
'RUNNING' = 'RUNNING',
119+
'REMOVING' = 'REMOVING',
120+
'PENDING_RESOURCES' = 'PENDING_RESOURCES',
121+
'CONFIGURING' = 'CONFIGURING',
122+
}
123+
124+
enum ETabletVolatileState {
125+
'TABLET_VOLATILE_STATE_UNKNOWN' = 'TABLET_VOLATILE_STATE_UNKNOWN',
126+
'TABLET_VOLATILE_STATE_STOPPED' = 'TABLET_VOLATILE_STATE_STOPPED',
127+
'TABLET_VOLATILE_STATE_BOOTING' = 'TABLET_VOLATILE_STATE_BOOTING',
128+
'TABLET_VOLATILE_STATE_STARTING' = 'TABLET_VOLATILE_STATE_STARTING',
129+
'TABLET_VOLATILE_STATE_RUNNING' = 'TABLET_VOLATILE_STATE_RUNNING',
130+
'_TABLET_VOLATILE_STATE_BLOCKED' = '_TABLET_VOLATILE_STATE_BLOCKED',
131+
}

0 commit comments

Comments
 (0)