Skip to content

Commit 60789c2

Browse files
committed
feat(backup-agent): add tenant agents list
ref: #BKP-501 Signed-off-by: Thibault Barske <[email protected]>
1 parent 742d929 commit 60789c2

24 files changed

+804
-3
lines changed

packages/manager/modules/backup-agent/public/translations/common/Messages_fr_FR.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
"services": "Services",
44
"billing": "Facturation",
55
"agents": "Agents",
6-
"buckets": "Buckets"
6+
"buckets": "Buckets",
7+
"policy": "Policy",
8+
"actions": "Actions"
79
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const getBackupAgentsListRoute =
2+
(vspcTenantId: string) => `/backup/tenant/vspc/${vspcTenantId}/backupAgent`;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { mockVaults } from '@/mocks/vaults/vaults';
2+
import {BACKUP_TENANT_DETAILS_QUERY_KEY} from "@/data/hooks/tenants/useBackupTenantDetails";
3+
import {mockAgents} from "@/mocks/agents/agents";
4+
5+
// Remove during unmocking
6+
export const BACKUP_AGENTS_LIST_QUERY_KEY = (tenantId: string) => [...BACKUP_TENANT_DETAILS_QUERY_KEY(tenantId), "agents"];
7+
8+
export const useBackupAgentList = (
9+
{
10+
// tenantId
11+
// pageSize,
12+
}: {
13+
pageSize: number;
14+
tenantId: string;
15+
} = { pageSize: 9999 },
16+
) => ({ flattenData: mockAgents, isLoading: false });
17+
// useResourcesIcebergV2<VaultResource>({
18+
// route: getBackupAgentsList(tenantId),
19+
// queryKey: BACKUP_AGENTS_LIST_QUERY_KEY(tenantId),
20+
// pageSize,
21+
// });
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Handler } from '@ovh-ux/manager-core-test-utils';
2+
3+
import {mockAgents} from "@/mocks/agents/agents";
4+
5+
export type TAgentMockParams = {
6+
isAgentsError?: boolean;
7+
};
8+
9+
export const getAgentMocks = ({
10+
isAgentsError = false,
11+
}: TAgentMockParams = {}): Handler[] => [
12+
{
13+
url: '/backup/tenant/vspc/:vspcTenantId/backupAgent',
14+
response: () => {
15+
return isAgentsError
16+
? null
17+
: mockAgents;
18+
},
19+
api: 'v2',
20+
method: 'get',
21+
status: isAgentsError ? 500 : 200,
22+
},
23+
];
Lines changed: 320 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,320 @@
1+
import { Agent } from '@/types/Agent.type';
2+
import { Resource } from '@/types/Resource.type';
3+
4+
export const mockAgents: Resource<Agent>[] = [
5+
{
6+
createdAt: '2025-09-20T08:15:30.445Z',
7+
currentState: {
8+
id: 'a1b2c3d4-1234-4000-85b0-badd52fc7a01',
9+
ip: ['192.168.1.10', '10.0.0.15'],
10+
name: 'prod-web-server-01',
11+
policy: 'daily-backup-retention-30d',
12+
type: 'BAREMETAL',
13+
},
14+
currentTasks: [],
15+
iam: {
16+
displayName: 'Production Web Server 01',
17+
id: 'a1b2c3d4-1234-4000-8aa0-9994438d3a01',
18+
tags: {
19+
environment: 'production',
20+
team: 'infrastructure',
21+
'ovh:backup-policy': 'daily',
22+
server: 'web',
23+
},
24+
urn: 'urn:ovh:agents:eu-west-1:prod-web-server-01',
25+
},
26+
id: 'a1b2c3d4-1234-4000-82dc-5366d6786a01',
27+
resourceStatus: 'READY',
28+
targetSpec: {
29+
name: 'prod-web-server-01',
30+
},
31+
updatedAt: '2025-09-26T09:30:15.123Z',
32+
},
33+
{
34+
createdAt: '2025-09-21T14:22:15.789Z',
35+
currentState: {
36+
id: 'b2c3d4e5-2345-4000-85b0-badd52fc7a02',
37+
ip: ['172.16.0.25'],
38+
name: 'staging-db-server',
39+
policy: 'weekly-backup-retention-90d',
40+
type: 'VPS',
41+
},
42+
currentTasks: [],
43+
iam: {
44+
displayName: 'Staging Database Server',
45+
id: 'b2c3d4e5-2345-4000-8aa0-9994438d3a02',
46+
tags: {
47+
environment: 'staging',
48+
team: 'development',
49+
'ovh:backup-policy': 'weekly',
50+
server: 'database',
51+
},
52+
urn: 'urn:ovh:agents:eu-central-1:staging-db-server',
53+
},
54+
id: 'b2c3d4e5-2345-4000-82dc-5366d6786a02',
55+
resourceStatus: 'READY',
56+
targetSpec: {
57+
name: 'staging-db-server',
58+
},
59+
updatedAt: '2025-09-25T16:45:22.456Z',
60+
},
61+
{
62+
createdAt: '2025-09-19T10:30:44.332Z',
63+
currentState: {
64+
id: 'c3d4e5f6-3456-4000-85b0-badd52fc7a03',
65+
ip: ['10.10.1.50', '192.168.2.100'],
66+
name: 'on-prem-file-server',
67+
policy: 'hourly-backup-retention-7d',
68+
type: 'ON-PREMISE',
69+
},
70+
currentTasks: [
71+
{
72+
id: 'c3d4e5f6-3456-4000-8008-b3ef9b81ca03',
73+
link: '/tasks/c3d4e5f6-3456-4000-8008-b3ef9b81ca03',
74+
status: 'RUNNING',
75+
type: 'backup_policy_update',
76+
},
77+
],
78+
iam: {
79+
displayName: 'On-Premise File Server',
80+
id: 'c3d4e5f6-3456-4000-8aa0-9994438d3a03',
81+
tags: {
82+
environment: 'on-premise',
83+
team: 'operations',
84+
'ovh:backup-policy': 'hourly',
85+
server: 'file-storage',
86+
},
87+
urn: 'urn:ovh:agents:on-premise:on-prem-file-server',
88+
},
89+
id: 'c3d4e5f6-3456-4000-82dc-5366d6786a03',
90+
resourceStatus: 'UPDATING',
91+
targetSpec: {
92+
name: 'on-prem-file-server',
93+
},
94+
updatedAt: '2025-09-26T11:15:33.789Z',
95+
},
96+
{
97+
createdAt: '2025-09-18T16:45:12.678Z',
98+
currentState: {
99+
id: 'd4e5f6g7-4567-4000-85b0-badd52fc7a04',
100+
ip: ['172.20.0.75'],
101+
name: 'pci-compliance-server',
102+
policy: 'continuous-backup-retention-365d',
103+
type: 'PCI',
104+
},
105+
currentTasks: [],
106+
iam: {
107+
displayName: 'PCI Compliance Server',
108+
id: 'd4e5f6g7-4567-4000-8aa0-9994438d3a04',
109+
tags: {
110+
environment: 'production',
111+
team: 'compliance',
112+
'ovh:backup-policy': 'continuous',
113+
'ovh:compliance': 'pci-dss',
114+
server: 'payment',
115+
},
116+
urn: 'urn:ovh:agents:eu-west-1:pci-compliance-server',
117+
},
118+
id: 'd4e5f6g7-4567-4000-82dc-5366d6786a04',
119+
resourceStatus: 'READY',
120+
targetSpec: {
121+
name: 'pci-compliance-server',
122+
},
123+
updatedAt: '2025-09-24T12:30:55.991Z',
124+
},
125+
{
126+
createdAt: '2025-09-17T09:12:28.991Z',
127+
currentState: {
128+
id: 'e5f6g7h8-5678-4000-85b0-badd52fc7a05',
129+
ip: ['192.168.3.200', '10.1.1.30', '172.18.0.45'],
130+
name: 'prod-app-cluster-node-1',
131+
policy: 'daily-backup-retention-60d',
132+
type: 'BAREMETAL',
133+
},
134+
currentTasks: [],
135+
iam: {
136+
displayName: 'Production App Cluster Node 1',
137+
id: 'e5f6g7h8-5678-4000-8aa0-9994438d3a05',
138+
tags: {
139+
environment: 'production',
140+
team: 'application',
141+
'ovh:backup-policy': 'daily',
142+
server: 'application',
143+
cluster: 'node-1',
144+
},
145+
urn: 'urn:ovh:agents:eu-west-1:prod-app-cluster-node-1',
146+
},
147+
id: 'e5f6g7h8-5678-4000-82dc-5366d6786a05',
148+
resourceStatus: 'READY',
149+
targetSpec: {
150+
name: 'prod-app-cluster-node-1',
151+
},
152+
updatedAt: '2025-09-26T07:22:11.445Z',
153+
},
154+
{
155+
createdAt: '2025-09-22T13:25:17.234Z',
156+
currentState: {
157+
id: 'f6g7h8i9-6789-4000-85b0-badd52fc7a06',
158+
ip: ['10.5.5.10'],
159+
name: 'dev-test-vm',
160+
policy: 'weekly-backup-retention-14d',
161+
type: 'VPS',
162+
},
163+
currentTasks: [
164+
{
165+
id: 'f6g7h8i9-6789-4000-8008-b3ef9b81ca06',
166+
link: '/tasks/f6g7h8i9-6789-4000-8008-b3ef9b81ca06',
167+
status: 'PENDING',
168+
type: 'agent_configuration',
169+
},
170+
],
171+
iam: {
172+
displayName: 'Development Test VM',
173+
id: 'f6g7h8i9-6789-4000-8aa0-9994438d3a06',
174+
tags: {
175+
environment: 'development',
176+
team: 'qa',
177+
'ovh:backup-policy': 'weekly',
178+
'ovh:auto-delete': 'true',
179+
server: 'test',
180+
},
181+
urn: 'urn:ovh:agents:eu-central-1:dev-test-vm',
182+
},
183+
id: 'f6g7h8i9-6789-4000-82dc-5366d6786a06',
184+
resourceStatus: 'CREATING',
185+
targetSpec: {
186+
name: 'dev-test-vm',
187+
},
188+
updatedAt: '2025-09-26T13:25:17.234Z',
189+
},
190+
{
191+
createdAt: '2025-09-16T11:40:55.567Z',
192+
currentState: {
193+
id: 'g7h8i9j0-7890-4000-85b0-badd52fc7a07',
194+
ip: ['192.168.10.150'],
195+
name: 'backup-storage-server',
196+
policy: 'monthly-backup-retention-12m',
197+
type: 'ON-PREMISE',
198+
},
199+
currentTasks: [],
200+
iam: {
201+
displayName: 'Backup Storage Server',
202+
id: 'g7h8i9j0-7890-4000-8aa0-9994438d3a07',
203+
tags: {
204+
environment: 'backup',
205+
team: 'storage',
206+
'ovh:backup-policy': 'monthly',
207+
server: 'backup-storage',
208+
},
209+
urn: 'urn:ovh:agents:on-premise:backup-storage-server',
210+
},
211+
id: 'g7h8i9j0-7890-4000-82dc-5366d6786a07',
212+
resourceStatus: 'READY',
213+
targetSpec: {
214+
name: 'backup-storage-server',
215+
},
216+
updatedAt: '2025-09-23T14:15:42.890Z',
217+
},
218+
{
219+
createdAt: '2025-09-15T08:20:33.123Z',
220+
currentState: {
221+
id: 'h8i9j0k1-8901-4000-85b0-badd52fc7a08',
222+
ip: ['172.25.0.88', '10.2.2.40'],
223+
name: 'secure-payment-gateway',
224+
policy: 'realtime-backup-retention-2y',
225+
type: 'PCI',
226+
},
227+
currentTasks: [],
228+
iam: {
229+
displayName: 'Secure Payment Gateway',
230+
id: 'h8i9j0k1-8901-4000-8aa0-9994438d3a08',
231+
tags: {
232+
environment: 'production',
233+
team: 'security',
234+
'ovh:backup-policy': 'realtime',
235+
'ovh:compliance': 'pci-dss',
236+
'ovh:security-level': 'high',
237+
server: 'payment-gateway',
238+
},
239+
urn: 'urn:ovh:agents:eu-west-1:secure-payment-gateway',
240+
},
241+
id: 'h8i9j0k1-8901-4000-82dc-5366d6786a08',
242+
resourceStatus: 'READY',
243+
targetSpec: {
244+
name: 'secure-payment-gateway',
245+
},
246+
updatedAt: '2025-09-25T10:45:18.456Z',
247+
},
248+
{
249+
createdAt: '2025-09-23T15:35:42.789Z',
250+
currentState: {
251+
id: 'i9j0k1l2-9012-4000-85b0-badd52fc7a09',
252+
ip: ['10.0.10.120'],
253+
name: 'monitoring-server',
254+
policy: 'daily-backup-retention-30d',
255+
type: 'VPS',
256+
},
257+
currentTasks: [
258+
{
259+
id: 'i9j0k1l2-9012-4000-8008-b3ef9b81ca09',
260+
link: '/tasks/i9j0k1l2-9012-4000-8008-b3ef9b81ca09',
261+
status: 'RUNNING',
262+
type: 'monitoring_setup',
263+
},
264+
],
265+
iam: {
266+
displayName: 'Monitoring Server',
267+
id: 'i9j0k1l2-9012-4000-8aa0-9994438d3a09',
268+
tags: {
269+
environment: 'infrastructure',
270+
team: 'monitoring',
271+
'ovh:backup-policy': 'daily',
272+
'ovh:monitoring': 'enabled',
273+
server: 'monitoring',
274+
},
275+
urn: 'urn:ovh:agents:eu-central-1:monitoring-server',
276+
},
277+
id: 'i9j0k1l2-9012-4000-82dc-5366d6786a09',
278+
resourceStatus: 'UPDATING',
279+
targetSpec: {
280+
name: 'monitoring-server',
281+
},
282+
updatedAt: '2025-09-26T15:35:42.789Z',
283+
},
284+
{
285+
createdAt: '2025-09-14T12:10:25.345Z',
286+
currentState: {
287+
id: 'j0k1l2m3-0123-4000-85b0-badd52fc7a10',
288+
ip: ['192.168.5.80', '172.30.0.15'],
289+
name: 'legacy-mainframe-adapter',
290+
policy: 'weekly-backup-retention-180d',
291+
type: 'BAREMETAL',
292+
},
293+
currentTasks: [
294+
{
295+
id: 'j0k1l2m3-0123-4000-8008-b3ef9b81ca10',
296+
link: '/tasks/j0k1l2m3-0123-4000-8008-b3ef9b81ca10',
297+
status: 'WAITING_USER_INPUT',
298+
type: 'legacy_system_migration',
299+
},
300+
],
301+
iam: {
302+
displayName: 'Legacy Mainframe Adapter',
303+
id: 'j0k1l2m3-0123-4000-8aa0-9994438d3a10',
304+
tags: {
305+
environment: 'legacy',
306+
team: 'mainframe',
307+
'ovh:backup-policy': 'weekly',
308+
'ovh:migration': 'pending',
309+
server: 'mainframe-adapter',
310+
},
311+
urn: 'urn:ovh:agents:eu-west-1:legacy-mainframe-adapter',
312+
},
313+
id: 'j0k1l2m3-0123-4000-82dc-5366d6786a10',
314+
resourceStatus: 'SUSPENDED',
315+
targetSpec: {
316+
name: 'legacy-mainframe-adapter',
317+
},
318+
updatedAt: '2025-09-24T17:20:35.678Z',
319+
},
320+
];

0 commit comments

Comments
 (0)