Skip to content

Commit ea3cbe4

Browse files
authored
RHINENG-22572 - added cost-management client and backend code refacto… (#1974)
* RHINENG-22572 - added cost-management client and backend code refactoring * chore: fixed api ref in filters.tsx for openshift page * updated api reports
1 parent cdc6c17 commit ea3cbe4

File tree

14 files changed

+993
-860
lines changed

14 files changed

+993
-860
lines changed

workspaces/redhat-resource-optimization/plugins/redhat-resource-optimization-backend/src/service/router.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ describe('createRouter', () => {
3232
optimizationApi: {
3333
getRecommendationList: jest.fn(),
3434
getRecommendationById: jest.fn(),
35-
getCostManagementReport: jest.fn(),
36-
downloadCostManagementReport: jest.fn(),
37-
searchOpenShiftProjects: jest.fn(),
38-
searchOpenShiftClusters: jest.fn(),
39-
searchOpenShiftNodes: jest.fn(),
40-
getOpenShiftTags: jest.fn(),
41-
getOpenShiftTagValues: jest.fn(),
4235
},
4336
});
4437
app = express().use(router);

workspaces/redhat-resource-optimization/plugins/redhat-resource-optimization-common/report-clients.api.md

Lines changed: 129 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,134 @@ export interface CostManagementReport {
7373
};
7474
}
7575

76+
// @public (undocumented)
77+
export interface CostManagementSlimApi {
78+
// (undocumented)
79+
downloadCostManagementReport(
80+
request: DownloadCostManagementRequest,
81+
): Promise<void>;
82+
// Warning: (ae-forgotten-export) The symbol "TypedResponse" needs to be exported by the entry point index.d.ts
83+
//
84+
// (undocumented)
85+
getCostManagementReport(
86+
request: GetCostManagementRequest,
87+
): Promise<TypedResponse<CostManagementReport>>;
88+
// (undocumented)
89+
getOpenShiftTags(timeScopeValue?: number): Promise<
90+
TypedResponse<{
91+
data: string[];
92+
meta?: any;
93+
links?: any;
94+
}>
95+
>;
96+
// (undocumented)
97+
getOpenShiftTagValues(
98+
tagKey: string,
99+
timeScopeValue?: number,
100+
): Promise<
101+
TypedResponse<{
102+
data: Array<{
103+
key: string;
104+
values: string[];
105+
enabled: boolean;
106+
}>;
107+
meta?: any;
108+
links?: any;
109+
}>
110+
>;
111+
// (undocumented)
112+
searchOpenShiftClusters(search?: string): Promise<
113+
TypedResponse<{
114+
data: Array<{
115+
value: string;
116+
}>;
117+
meta?: any;
118+
links?: any;
119+
}>
120+
>;
121+
// (undocumented)
122+
searchOpenShiftNodes(search?: string): Promise<
123+
TypedResponse<{
124+
data: Array<{
125+
value: string;
126+
}>;
127+
meta?: any;
128+
links?: any;
129+
}>
130+
>;
131+
// (undocumented)
132+
searchOpenShiftProjects(search?: string): Promise<
133+
TypedResponse<{
134+
data: Array<{
135+
value: string;
136+
}>;
137+
meta?: any;
138+
links?: any;
139+
}>
140+
>;
141+
}
142+
143+
// @public (undocumented)
144+
export class CostManagementSlimClient implements CostManagementSlimApi {
145+
constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi });
146+
// (undocumented)
147+
downloadCostManagementReport(
148+
request: DownloadCostManagementRequest,
149+
): Promise<void>;
150+
// (undocumented)
151+
getCostManagementReport(
152+
request: GetCostManagementRequest,
153+
): Promise<TypedResponse<CostManagementReport>>;
154+
getOpenShiftTags(timeScopeValue?: number): Promise<
155+
TypedResponse<{
156+
data: string[];
157+
meta?: any;
158+
links?: any;
159+
}>
160+
>;
161+
getOpenShiftTagValues(
162+
tagKey: string,
163+
timeScopeValue?: number,
164+
): Promise<
165+
TypedResponse<{
166+
data: Array<{
167+
key: string;
168+
values: string[];
169+
enabled: boolean;
170+
}>;
171+
meta?: any;
172+
links?: any;
173+
}>
174+
>;
175+
searchOpenShiftClusters(search?: string): Promise<
176+
TypedResponse<{
177+
data: Array<{
178+
value: string;
179+
}>;
180+
meta?: any;
181+
links?: any;
182+
}>
183+
>;
184+
searchOpenShiftNodes(search?: string): Promise<
185+
TypedResponse<{
186+
data: Array<{
187+
value: string;
188+
}>;
189+
meta?: any;
190+
links?: any;
191+
}>
192+
>;
193+
searchOpenShiftProjects(search?: string): Promise<
194+
TypedResponse<{
195+
data: Array<{
196+
value: string;
197+
}>;
198+
meta?: any;
199+
links?: any;
200+
}>
201+
>;
202+
}
203+
76204
// @public (undocumented)
77205
export interface CostValue {
78206
// (undocumented)
@@ -220,95 +348,11 @@ export { Node_2 as Node };
220348
export type OptimizationsApi = Omit<
221349
InstanceType<typeof DefaultApiClient>,
222350
'fetchApi' | 'discoveryApi'
223-
> & {
224-
getCostManagementReport(
225-
request: GetCostManagementRequest,
226-
): Promise<TypedResponse<CostManagementReport>>;
227-
downloadCostManagementReport(
228-
request: DownloadCostManagementRequest,
229-
): Promise<void>;
230-
searchOpenShiftProjects(search?: string): Promise<
231-
TypedResponse<{
232-
data: Array<{
233-
value: string;
234-
}>;
235-
meta?: any;
236-
links?: any;
237-
}>
238-
>;
239-
searchOpenShiftClusters(search?: string): Promise<
240-
TypedResponse<{
241-
data: Array<{
242-
value: string;
243-
}>;
244-
meta?: any;
245-
links?: any;
246-
}>
247-
>;
248-
searchOpenShiftNodes(search?: string): Promise<
249-
TypedResponse<{
250-
data: Array<{
251-
value: string;
252-
}>;
253-
meta?: any;
254-
links?: any;
255-
}>
256-
>;
257-
getOpenShiftTags(timeScopeValue?: number): Promise<
258-
TypedResponse<{
259-
data: string[];
260-
meta?: any;
261-
links?: any;
262-
}>
263-
>;
264-
getOpenShiftTagValues(
265-
tagKey: string,
266-
timeScopeValue?: number,
267-
): Promise<
268-
TypedResponse<{
269-
data: Array<{
270-
key: string;
271-
values: string[];
272-
enabled: boolean;
273-
}>;
274-
meta?: any;
275-
links?: any;
276-
}>
277-
>;
278-
};
351+
>;
279352

280353
// @public
281354
export class OptimizationsClient implements OptimizationsApi {
282355
constructor(options: { discoveryApi: DiscoveryApi; fetchApi?: FetchApi });
283-
// (undocumented)
284-
downloadCostManagementReport(
285-
request: DownloadCostManagementRequest,
286-
): Promise<void>;
287-
// (undocumented)
288-
getCostManagementReport(
289-
request: GetCostManagementRequest,
290-
): Promise<TypedResponse<CostManagementReport>>;
291-
getOpenShiftTags(timeScopeValue?: number): Promise<
292-
TypedResponse<{
293-
data: string[];
294-
meta?: any;
295-
links?: any;
296-
}>
297-
>;
298-
getOpenShiftTagValues(
299-
tagKey: string,
300-
timeScopeValue?: number,
301-
): Promise<
302-
TypedResponse<{
303-
data: Array<{
304-
key: string;
305-
values: string[];
306-
enabled: boolean;
307-
}>;
308-
meta?: any;
309-
links?: any;
310-
}>
311-
>;
312356
// Warning: (ae-forgotten-export) The symbol "RecommendationBoxPlots" needs to be exported by the entry point index.d.ts
313357
//
314358
// (undocumented)
@@ -321,33 +365,6 @@ export class OptimizationsClient implements OptimizationsApi {
321365
getRecommendationList(
322366
request: GetRecommendationListRequest,
323367
): Promise<TypedResponse<RecommendationList>>;
324-
searchOpenShiftClusters(search?: string): Promise<
325-
TypedResponse<{
326-
data: Array<{
327-
value: string;
328-
}>;
329-
meta?: any;
330-
links?: any;
331-
}>
332-
>;
333-
searchOpenShiftNodes(search?: string): Promise<
334-
TypedResponse<{
335-
data: Array<{
336-
value: string;
337-
}>;
338-
meta?: any;
339-
links?: any;
340-
}>
341-
>;
342-
searchOpenShiftProjects(search?: string): Promise<
343-
TypedResponse<{
344-
data: Array<{
345-
value: string;
346-
}>;
347-
meta?: any;
348-
links?: any;
349-
}>
350-
>;
351368
}
352369

353370
// @public (undocumented)
@@ -429,9 +446,5 @@ export interface Tag {
429446
values: ProjectValue[];
430447
}
431448

432-
// Warnings were encountered during analysis:
433-
//
434-
// src/clients/optimizations/types.d.ts:33:5 - (ae-forgotten-export) The symbol "TypedResponse" needs to be exported by the entry point index.d.ts
435-
436449
// (No @packageDocumentation comment for this package)
437450
```

0 commit comments

Comments
 (0)