diff --git a/packages/manager/apps/vrack-services/mocks/vrack/association.ts b/packages/manager/apps/vrack-services/mocks/vrack/association.ts
index b71e467b6b8e..b54ccce6587d 100644
--- a/packages/manager/apps/vrack-services/mocks/vrack/association.ts
+++ b/packages/manager/apps/vrack-services/mocks/vrack/association.ts
@@ -1,6 +1,6 @@
import { PathParams } from 'msw';
-import { AllowedServicesResponse, Status, Task } from '../../src/data/api.type';
import vrackServicesList from '../vrack-services/get-vrack-services.json';
+import { AllowedServicesResponse, Status, Task } from '@/types';
export const getAllowedServicesResponse = (
nbEligibleVrackServices: number,
diff --git a/packages/manager/apps/vrack-services/src/components/CreateVrack.component.tsx b/packages/manager/apps/vrack-services/src/components/CreateVrack.component.tsx
index 50b125c78380..e1ffcfd4f980 100644
--- a/packages/manager/apps/vrack-services/src/components/CreateVrack.component.tsx
+++ b/packages/manager/apps/vrack-services/src/components/CreateVrack.component.tsx
@@ -31,7 +31,7 @@ import { useNavigate } from 'react-router-dom';
import { handleClick } from '@ovh-ux/manager-react-components';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { ApiError } from '@ovh-ux/manager-core-api';
-import { getVrackListQueryKey } from '@/data';
+import { getVrackListQueryKey } from '@/data/api';
import { DeliveringMessages } from '@/components/DeliveringMessages.component';
import { MessagesContext } from './feedback-messages/Messages.context';
import { LoadingText } from './LoadingText.component';
diff --git a/packages/manager/apps/vrack-services/src/components/ProductStatusChip.component.tsx b/packages/manager/apps/vrack-services/src/components/ProductStatusChip.component.tsx
index d5d1661bc2d0..f0c0de7c2607 100644
--- a/packages/manager/apps/vrack-services/src/components/ProductStatusChip.component.tsx
+++ b/packages/manager/apps/vrack-services/src/components/ProductStatusChip.component.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { ODS_SPINNER_SIZE } from '@ovhcloud/ods-components';
import { OsdsSpinner, OsdsChip } from '@ovhcloud/ods-components/react';
-import { ProductStatus } from '@/data';
+import { ProductStatus } from '@/types';
const colorByProductStatus = {
[ProductStatus.ACTIVE]: ODS_THEME_COLOR_INTENT.success,
diff --git a/packages/manager/apps/vrack-services/src/components/ProductStatusChip.spec.tsx b/packages/manager/apps/vrack-services/src/components/ProductStatusChip.spec.tsx
index c4b745550475..fd4ece65dea5 100644
--- a/packages/manager/apps/vrack-services/src/components/ProductStatusChip.spec.tsx
+++ b/packages/manager/apps/vrack-services/src/components/ProductStatusChip.spec.tsx
@@ -6,7 +6,7 @@ import {
ProductStatusChip,
ProductStatusChipProps,
} from './ProductStatusChip.component';
-import { ProductStatus } from '@/data';
+import { ProductStatus } from '@/types';
const renderComponent = ({ productStatus }: ProductStatusChipProps) => {
return render();
diff --git a/packages/manager/apps/vrack-services/src/components/display-name/DisplayName.component.tsx b/packages/manager/apps/vrack-services/src/components/display-name/DisplayName.component.tsx
index c92d1cef41c0..c9a6b8cf2447 100644
--- a/packages/manager/apps/vrack-services/src/components/display-name/DisplayName.component.tsx
+++ b/packages/manager/apps/vrack-services/src/components/display-name/DisplayName.component.tsx
@@ -8,9 +8,10 @@ import { useNavigate } from 'react-router-dom';
import { OsdsLink } from '@ovhcloud/ods-components/react';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { EditButton } from './EditButton.component';
-import { VrackServicesWithIAM, getDisplayName, isEditable } from '@/data';
import { urls } from '@/routes/routes.constants';
import { InfoIcon } from './InfoIcon.component';
+import { isEditable, getDisplayName } from '@/utils/vrack-services';
+import { VrackServicesWithIAM } from '@/types';
export type DisplayNameProps = {
isListing?: boolean;
diff --git a/packages/manager/apps/vrack-services/src/components/display-name/DisplayName.spec.tsx b/packages/manager/apps/vrack-services/src/components/display-name/DisplayName.spec.tsx
index eebb15d9ea33..960a7e7bce29 100644
--- a/packages/manager/apps/vrack-services/src/components/display-name/DisplayName.spec.tsx
+++ b/packages/manager/apps/vrack-services/src/components/display-name/DisplayName.spec.tsx
@@ -6,8 +6,8 @@ import { describe, expect, it } from 'vitest';
import { render } from '@testing-library/react';
import { DisplayName } from '@/components/display-name/DisplayName.component';
import vrackServicesList from '../../../mocks/vrack-services/get-vrack-services.json';
-import { VrackServicesWithIAM } from '@/data';
import '@testing-library/jest-dom';
+import { VrackServicesWithIAM } from '@/types';
const defaultVs = vrackServicesList[0] as VrackServicesWithIAM;
diff --git a/packages/manager/apps/vrack-services/src/components/display-name/InfoIcon.component.tsx b/packages/manager/apps/vrack-services/src/components/display-name/InfoIcon.component.tsx
index d018943ffeaf..d4155570fa37 100644
--- a/packages/manager/apps/vrack-services/src/components/display-name/InfoIcon.component.tsx
+++ b/packages/manager/apps/vrack-services/src/components/display-name/InfoIcon.component.tsx
@@ -13,7 +13,8 @@ import {
ODS_SPINNER_SIZE,
} from '@ovhcloud/ods-components';
import { useTranslation } from 'react-i18next';
-import { ResourceStatus, VrackServicesWithIAM, getDisplayName } from '@/data';
+import { ResourceStatus, VrackServicesWithIAM } from '@/types';
+import { getDisplayName } from '@/utils/vrack-services';
export type InfoInconProps = {
className?: string;
diff --git a/packages/manager/apps/vrack-services/src/components/feedback-messages/OperationMessages.component.tsx b/packages/manager/apps/vrack-services/src/components/feedback-messages/OperationMessages.component.tsx
index fa11c233d3a5..b0f8ad0134e8 100644
--- a/packages/manager/apps/vrack-services/src/components/feedback-messages/OperationMessages.component.tsx
+++ b/packages/manager/apps/vrack-services/src/components/feedback-messages/OperationMessages.component.tsx
@@ -7,12 +7,9 @@ import {
} from '@ovhcloud/ods-components';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { useTranslation } from 'react-i18next';
-import {
- useVrackServicesList,
- ResourceStatus,
- VrackServicesWithIAM,
- getDisplayName,
-} from '@/data';
+import { useVrackServicesList } from '@/data/hooks';
+import { ResourceStatus, VrackServicesWithIAM } from '@/types';
+import { getDisplayName } from '@/utils/vrack-services';
const shouldDisplayMessage = (vs: VrackServicesWithIAM) =>
vs.resourceStatus !== ResourceStatus.READY;
diff --git a/packages/manager/apps/vrack-services/src/components/feedback-messages/OperationMessages.spec.tsx b/packages/manager/apps/vrack-services/src/components/feedback-messages/OperationMessages.spec.tsx
index 0ba8a623f283..67d4d9c3b965 100644
--- a/packages/manager/apps/vrack-services/src/components/feedback-messages/OperationMessages.spec.tsx
+++ b/packages/manager/apps/vrack-services/src/components/feedback-messages/OperationMessages.spec.tsx
@@ -5,7 +5,8 @@ import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api';
import { UseQueryResult } from '@tanstack/react-query';
import { OperationMessages } from './OperationMessages.component';
import vrackServicesList from '../../../mocks/vrack-services/get-vrack-services.json';
-import { VrackServicesWithIAM, useVrackServicesList } from '@/data';
+import { useVrackServicesList } from '@/data/hooks';
+import { VrackServicesWithIAM } from '@/types';
/** Render */
@@ -16,8 +17,8 @@ const renderComponent = ({ id }: { id?: string }) => {
/** END RENDER */
/** MOCKS */
-vi.mock('@/data', async (importOriginal) => {
- const original: typeof import('@/data') = await importOriginal();
+vi.mock('@/data/hooks', async (importOriginal) => {
+ const original: typeof import('@/data/hooks') = await importOriginal();
return {
...original,
useVrackServicesList: vi.fn(),
diff --git a/packages/manager/apps/vrack-services/src/components/feedback-messages/SuccessMessage.component.tsx b/packages/manager/apps/vrack-services/src/components/feedback-messages/SuccessMessage.component.tsx
index 326f0bc0b893..804441c47fdf 100644
--- a/packages/manager/apps/vrack-services/src/components/feedback-messages/SuccessMessage.component.tsx
+++ b/packages/manager/apps/vrack-services/src/components/feedback-messages/SuccessMessage.component.tsx
@@ -12,7 +12,7 @@ import {
import { OdsHTMLAnchorElementTarget } from '@ovhcloud/ods-common-core';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { MessageData, MessagesContext } from './Messages.context';
-import { useVrackServicesList } from '@/data';
+import { useVrackServicesList } from '@/data/hooks';
export const SuccessMessage: React.FC> = ({
id,
diff --git a/packages/manager/apps/vrack-services/src/components/feedback-messages/SuccessMessage.spec.tsx b/packages/manager/apps/vrack-services/src/components/feedback-messages/SuccessMessage.spec.tsx
index 7f2bdd1617aa..57d4780bac38 100644
--- a/packages/manager/apps/vrack-services/src/components/feedback-messages/SuccessMessage.spec.tsx
+++ b/packages/manager/apps/vrack-services/src/components/feedback-messages/SuccessMessage.spec.tsx
@@ -4,9 +4,10 @@ import { render, waitFor } from '@testing-library/react';
import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api';
import { UseQueryResult } from '@tanstack/react-query';
import vrackServicesList from '../../../mocks/vrack-services/get-vrack-services.json';
-import { VrackServicesWithIAM, useVrackServicesList } from '@/data';
+import { useVrackServicesList } from '@/data/hooks';
import { SuccessMessages } from './SuccessMessage.component';
import { MessagesContext, MessagesContextType } from './Messages.context';
+import { VrackServicesWithIAM } from '@/types';
/** Render */
const mockContextMessage = {
@@ -33,8 +34,8 @@ const renderComponent = ({ id }: { id?: string }) => {
/** END RENDER */
/** MOCKS */
-vi.mock('@/data', async (importOriginal) => {
- const original: typeof import('@/data') = await importOriginal();
+vi.mock('@/data/hooks', async (importOriginal) => {
+ const original: typeof import('@/data/hooks') = await importOriginal();
return {
...original,
useVrackServicesList: vi.fn(),
diff --git a/packages/manager/apps/vrack-services/src/components/layout-helpers/DashboardLayout.spec.tsx b/packages/manager/apps/vrack-services/src/components/layout-helpers/DashboardLayout.spec.tsx
index 7c31917e93ec..b042af9bb96b 100644
--- a/packages/manager/apps/vrack-services/src/components/layout-helpers/DashboardLayout.spec.tsx
+++ b/packages/manager/apps/vrack-services/src/components/layout-helpers/DashboardLayout.spec.tsx
@@ -15,13 +15,14 @@ import {
DashboardLayout,
DashboardLayoutProps,
} from './DashboardLayout.component';
-import { VrackServicesWithIAM, useVrackServicesList } from '@/data';
+import { useVrackServicesList } from '@/data/hooks';
import vrackServicesList from '../../../mocks/vrack-services/get-vrack-services.json';
+import { VrackServicesWithIAM } from '@/types';
const queryClient = new QueryClient();
-vi.mock('@/data', async (importOriginal) => {
- const original: typeof import('@/data') = await importOriginal();
+vi.mock('@/data/hooks', async (importOriginal) => {
+ const original: typeof import('@/data/hooks') = await importOriginal();
return {
...original,
useVrackServicesList: vi.fn(),
diff --git a/packages/manager/apps/vrack-services/src/components/vrack-id/VrackId.component.tsx b/packages/manager/apps/vrack-services/src/components/vrack-id/VrackId.component.tsx
index 6d460ab6da59..ce8df750a015 100644
--- a/packages/manager/apps/vrack-services/src/components/vrack-id/VrackId.component.tsx
+++ b/packages/manager/apps/vrack-services/src/components/vrack-id/VrackId.component.tsx
@@ -3,8 +3,9 @@ import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { OsdsLink } from '@ovhcloud/ods-components/react';
import { ActionMenu, DataGridTextCell } from '@ovh-ux/manager-react-components';
import { ShellContext } from '@ovh-ux/manager-react-shell-client';
-import { VrackServicesWithIAM, isEditable } from '@/data';
import { useVrackMenuItems } from './useVrackMenuItems.hook';
+import { VrackServicesWithIAM } from '@/types';
+import { isEditable } from '@/utils/vrack-services';
export type VrackIdProps = { isListing?: boolean } & VrackServicesWithIAM;
diff --git a/packages/manager/apps/vrack-services/src/components/vrack-id/VrackId.spec.tsx b/packages/manager/apps/vrack-services/src/components/vrack-id/VrackId.spec.tsx
index 2bfc99499e89..28ff48360c76 100644
--- a/packages/manager/apps/vrack-services/src/components/vrack-id/VrackId.spec.tsx
+++ b/packages/manager/apps/vrack-services/src/components/vrack-id/VrackId.spec.tsx
@@ -9,8 +9,8 @@ import {
ShellContextType,
} from '@ovh-ux/manager-react-shell-client';
import { VrackId } from './VrackId.component';
-import { VrackServicesWithIAM } from '@/data';
import vrackServicesList from '../../../mocks/vrack-services/get-vrack-services.json';
+import { VrackServicesWithIAM } from '@/types';
const defaultVs = vrackServicesList[5] as VrackServicesWithIAM;
const vsWithoutVrack = vrackServicesList[0] as VrackServicesWithIAM;
diff --git a/packages/manager/apps/vrack-services/src/components/vrack-id/useVrackMenuItems.hook.ts b/packages/manager/apps/vrack-services/src/components/vrack-id/useVrackMenuItems.hook.ts
index 49e43df485df..2da5b15f62ad 100644
--- a/packages/manager/apps/vrack-services/src/components/vrack-id/useVrackMenuItems.hook.ts
+++ b/packages/manager/apps/vrack-services/src/components/vrack-id/useVrackMenuItems.hook.ts
@@ -6,8 +6,9 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { useNavigate } from 'react-router-dom';
-import { VrackServicesWithIAM, isEditable } from '@/data';
import { urls } from '@/routes/routes.constants';
+import { VrackServicesWithIAM } from '@/types';
+import { isEditable } from '@/utils/vrack-services';
export type UseVrackMenuItemsParams = {
vs: VrackServicesWithIAM;
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/delete.ts b/packages/manager/apps/vrack-services/src/data/api/delete/dissociateVrackServicesFromVrack.ts
similarity index 93%
rename from packages/manager/apps/vrack-services/src/data/vrack/delete.ts
rename to packages/manager/apps/vrack-services/src/data/api/delete/dissociateVrackServicesFromVrack.ts
index f2f74ee26af0..ce40c3bb6359 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack/delete.ts
+++ b/packages/manager/apps/vrack-services/src/data/api/delete/dissociateVrackServicesFromVrack.ts
@@ -1,5 +1,5 @@
import { apiClient } from '@ovh-ux/manager-core-api';
-import { VrackTask } from './vrack.type';
+import { VrackTask } from '@/types';
export type DissociateVrackServicesParams = {
/** The internal name of your vrack */
diff --git a/packages/manager/apps/vrack-services/src/data/api/delete/index.ts b/packages/manager/apps/vrack-services/src/data/api/delete/index.ts
new file mode 100644
index 000000000000..36583f6a8e6b
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/delete/index.ts
@@ -0,0 +1 @@
+export * from './dissociateVrackServicesFromVrack';
diff --git a/packages/manager/apps/vrack-services/src/data/api/get/elegibleManagedServiceList.ts b/packages/manager/apps/vrack-services/src/data/api/get/elegibleManagedServiceList.ts
new file mode 100644
index 000000000000..379ad031b0bc
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/get/elegibleManagedServiceList.ts
@@ -0,0 +1,14 @@
+import { apiClient } from '@ovh-ux/manager-core-api';
+import { EligibleManagedService } from '@/types';
+
+export const getEligibleManagedServiceListQueryKey = (
+ vrackServicesId: string,
+) => [`get/vrackServices/resource/${vrackServicesId}/eligibleManagedService`];
+
+/**
+ * List all managed services eligible to the requested vRack Services
+ */
+export const getEligibleManagedServiceList = async (vrackServicesId: string) =>
+ apiClient.v2.get(
+ `/vrackServices/resource/${vrackServicesId}/eligibleManagedService`,
+ );
diff --git a/packages/manager/apps/vrack-services/src/data/iam/get.ts b/packages/manager/apps/vrack-services/src/data/api/get/iamResource.ts
similarity index 92%
rename from packages/manager/apps/vrack-services/src/data/iam/get.ts
rename to packages/manager/apps/vrack-services/src/data/api/get/iamResource.ts
index 18f5e1f752bb..1a2a9ea9a83e 100644
--- a/packages/manager/apps/vrack-services/src/data/iam/get.ts
+++ b/packages/manager/apps/vrack-services/src/data/api/get/iamResource.ts
@@ -1,5 +1,5 @@
import { apiClient } from '@ovh-ux/manager-core-api';
-import { IAMResource } from './iam.type';
+import { IAMResource } from '@/types';
export const getIamResourceQueryKey = (resourceURNList: string[]) => [
`get/iam/resource/${resourceURNList.join(',')}`,
diff --git a/packages/manager/apps/vrack-services/src/data/api/get/index.ts b/packages/manager/apps/vrack-services/src/data/api/get/index.ts
new file mode 100644
index 000000000000..7416803bd853
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/get/index.ts
@@ -0,0 +1,7 @@
+export * from './vrackServicesResource';
+export * from './vrackServicesResourceList';
+export * from './iamResource';
+export * from './elegibleManagedServiceList';
+export * from './vrackList';
+export * from './vrackAllowedServices';
+export * from './vrackServicesReferenceRegionList';
diff --git a/packages/manager/apps/vrack-services/src/data/api/get/vrackAllowedServices.ts b/packages/manager/apps/vrack-services/src/data/api/get/vrackAllowedServices.ts
new file mode 100644
index 000000000000..36320169a77f
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/get/vrackAllowedServices.ts
@@ -0,0 +1,25 @@
+import { apiClient } from '@ovh-ux/manager-core-api';
+import {
+ AllowedServicesResponse,
+ GetVrackAllowedServicesParams,
+} from '@/types';
+
+export const getVrackAllowedServicesQueryKey = ({
+ vrack,
+ serviceFamily,
+}: GetVrackAllowedServicesParams) => [
+ `get/vrack/${vrack}/allowedServices${serviceFamily || ''}`,
+];
+
+/**
+ * allowedServices operations : List all services allowed in this vrack
+ */
+export const getVrackAllowedServices = async ({
+ vrack,
+ serviceFamily,
+}: GetVrackAllowedServicesParams) =>
+ apiClient.v6.get(
+ `/vrack/${vrack}/allowedServices${
+ serviceFamily ? `?serviceFamily=${serviceFamily}` : ''
+ }`,
+ );
diff --git a/packages/manager/apps/vrack-services/src/data/api/get/vrackList.ts b/packages/manager/apps/vrack-services/src/data/api/get/vrackList.ts
new file mode 100644
index 000000000000..42f1c1db3f57
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/get/vrackList.ts
@@ -0,0 +1,5 @@
+import { apiClient } from '@ovh-ux/manager-core-api';
+
+export const getVrackListQueryKey = ['get/vrack'];
+
+export const getVrackList = () => apiClient.v6.get('/vrack');
diff --git a/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesReferenceRegionList.ts b/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesReferenceRegionList.ts
new file mode 100644
index 000000000000..256acf61b446
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesReferenceRegionList.ts
@@ -0,0 +1,12 @@
+import { apiClient } from '@ovh-ux/manager-core-api';
+import { Region } from '@/types';
+
+export const getvrackServicesReferenceRegionListQueryKey = [
+ 'get/vrackServices/reference/region',
+];
+
+/**
+ * List all vRack Services regions
+ */
+export const getvrackServicesReferenceRegionList = () =>
+ apiClient.v2.get('/vrackServices/reference/region');
diff --git a/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesResource.ts b/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesResource.ts
new file mode 100644
index 000000000000..a71802e39f9b
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesResource.ts
@@ -0,0 +1,14 @@
+import { apiClient } from '@ovh-ux/manager-core-api';
+import { VrackServicesWithIAM } from '@/types';
+
+export const getVrackServicesResourceQueryKey = (vrackServicesId: string) => [
+ `get/vrackServices/resource/${vrackServicesId}`,
+];
+
+/**
+ * Get the vRack Services
+ */
+export const getVrackServicesResource = async (vrackServicesId: string) =>
+ apiClient.v2.get(
+ `/vrackServices/resource/${vrackServicesId}`,
+ );
diff --git a/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesResourceList.ts b/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesResourceList.ts
new file mode 100644
index 000000000000..900ea4818f1a
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/get/vrackServicesResourceList.ts
@@ -0,0 +1,21 @@
+import { apiClient } from '@ovh-ux/manager-core-api';
+import {
+ GetVrackServicesResourceListParams,
+ VrackServicesWithIAM,
+} from '@/types';
+
+export const getVrackServicesResourceListQueryKey = [
+ 'get/vrackServices/resource',
+];
+
+/**
+ * Operations on vRack Services : List all vRack Services
+ */
+export const getVrackServicesResourceList = async ({
+ cursor,
+}: GetVrackServicesResourceListParams = {}) =>
+ apiClient.v2.get('/vrackServices/resource', {
+ headers: {
+ 'X-Pagination-Cursor': cursor,
+ },
+ });
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/index.ts b/packages/manager/apps/vrack-services/src/data/api/index.ts
similarity index 57%
rename from packages/manager/apps/vrack-services/src/data/vrack/index.ts
rename to packages/manager/apps/vrack-services/src/data/api/index.ts
index 77319c8664f1..3e2617c16ef9 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack/index.ts
+++ b/packages/manager/apps/vrack-services/src/data/api/index.ts
@@ -1,5 +1,4 @@
export * from './get';
+export * from './put';
export * from './post';
export * from './delete';
-export * from './vrack.type';
-export * from './hooks';
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/post.ts b/packages/manager/apps/vrack-services/src/data/api/post/associateVrackServices.ts
similarity index 67%
rename from packages/manager/apps/vrack-services/src/data/vrack/post.ts
rename to packages/manager/apps/vrack-services/src/data/api/post/associateVrackServices.ts
index 4d4dbe7184da..f6554037eb55 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack/post.ts
+++ b/packages/manager/apps/vrack-services/src/data/api/post/associateVrackServices.ts
@@ -1,12 +1,5 @@
import { apiClient } from '@ovh-ux/manager-core-api';
-import { Task } from '../api.type';
-
-export type AssociateVrackServicesParams = {
- /** The internal name of your vrack */
- vrack: string;
- /** vrackServices service name */
- vrackServices: string;
-};
+import { AssociateVrackServicesParams, Task } from '@/types';
export const associateVrackServicesQueryKey = (vrackServicesId: string) => [
`associateVrackServices-${vrackServicesId}`,
diff --git a/packages/manager/apps/vrack-services/src/data/api/post/index.ts b/packages/manager/apps/vrack-services/src/data/api/post/index.ts
new file mode 100644
index 000000000000..6910b62c0737
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/post/index.ts
@@ -0,0 +1 @@
+export * from './associateVrackServices';
diff --git a/packages/manager/apps/vrack-services/src/data/api/put/index.ts b/packages/manager/apps/vrack-services/src/data/api/put/index.ts
new file mode 100644
index 000000000000..119134959c4d
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/api/put/index.ts
@@ -0,0 +1 @@
+export * from './updateVrackServices';
diff --git a/packages/manager/apps/vrack-services/src/data/vrack-services/put.ts b/packages/manager/apps/vrack-services/src/data/api/put/updateVrackServices.ts
similarity index 92%
rename from packages/manager/apps/vrack-services/src/data/vrack-services/put.ts
rename to packages/manager/apps/vrack-services/src/data/api/put/updateVrackServices.ts
index ac464346e982..755acfbfe726 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack-services/put.ts
+++ b/packages/manager/apps/vrack-services/src/data/api/put/updateVrackServices.ts
@@ -1,8 +1,5 @@
import { apiClient } from '@ovh-ux/manager-core-api';
-import {
- UpdateVrackServicesParams,
- VrackServices,
-} from './vrack-services.type';
+import { UpdateVrackServicesParams, VrackServices } from '@/types';
export const updateVrackServicesQueryKey = (vrackServicesId: string) => [
'put/vrackServices/resource',
diff --git a/packages/manager/apps/vrack-services/src/data/hooks/index.ts b/packages/manager/apps/vrack-services/src/data/hooks/index.ts
new file mode 100644
index 000000000000..bc28ce5c1c78
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/hooks/index.ts
@@ -0,0 +1,8 @@
+export * from './useVrackServicesList';
+export * from './useVrackServices';
+export * from './useUpdateVrackServices';
+export * from './useServiceList';
+export * from './useAssociateVrack';
+export * from './useDissociateVrack';
+export * from './useAllowedVrackList';
+export * from './useVrackList';
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/hooks/useAllowedVrackList.ts b/packages/manager/apps/vrack-services/src/data/hooks/useAllowedVrackList.ts
similarity index 97%
rename from packages/manager/apps/vrack-services/src/data/vrack/hooks/useAllowedVrackList.ts
rename to packages/manager/apps/vrack-services/src/data/hooks/useAllowedVrackList.ts
index 04dbdefa6aab..9689d76ea007 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack/hooks/useAllowedVrackList.ts
+++ b/packages/manager/apps/vrack-services/src/data/hooks/useAllowedVrackList.ts
@@ -1,12 +1,12 @@
import { UseQueryOptions, useQueries, useQuery } from '@tanstack/react-query';
import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api';
import {
- getVrackList,
- getVrackListQueryKey,
getVrackAllowedServices,
getVrackAllowedServicesQueryKey,
-} from '../get';
-import { AllowedServicesResponse } from '../../api.type';
+ getVrackList,
+ getVrackListQueryKey,
+} from '@/data/api';
+import { AllowedServicesResponse } from '@/types';
/**
* @returns List of allowed vRack to be associated to a vRack Services
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/hooks/useAssociateVrack.ts b/packages/manager/apps/vrack-services/src/data/hooks/useAssociateVrack.ts
similarity index 96%
rename from packages/manager/apps/vrack-services/src/data/vrack/hooks/useAssociateVrack.ts
rename to packages/manager/apps/vrack-services/src/data/hooks/useAssociateVrack.ts
index b714c822867d..9a0b6e564d80 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack/hooks/useAssociateVrack.ts
+++ b/packages/manager/apps/vrack-services/src/data/hooks/useAssociateVrack.ts
@@ -2,11 +2,11 @@ import React from 'react';
import { useTask } from '@ovh-ux/manager-react-components';
import { useMutation } from '@tanstack/react-query';
import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api';
-import { Task } from '../../api.type';
+import { Task } from '@/types';
import {
associateVrackServices,
associateVrackServicesQueryKey,
-} from '../post';
+} from '@/data/api';
export type UseAssociateVrackParams = {
vrackServicesId: string;
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/hooks/useDissociateVrack.ts b/packages/manager/apps/vrack-services/src/data/hooks/useDissociateVrack.ts
similarity index 92%
rename from packages/manager/apps/vrack-services/src/data/vrack/hooks/useDissociateVrack.ts
rename to packages/manager/apps/vrack-services/src/data/hooks/useDissociateVrack.ts
index c59b334ac765..cae37947b32c 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack/hooks/useDissociateVrack.ts
+++ b/packages/manager/apps/vrack-services/src/data/hooks/useDissociateVrack.ts
@@ -2,12 +2,12 @@ import React from 'react';
import { useTask } from '@ovh-ux/manager-react-components';
import { useMutation } from '@tanstack/react-query';
import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api';
-import { VrackTask } from '../vrack.type';
+import { useVrackService } from '@/data/hooks';
+import { VrackTask } from '@/types';
import {
dissociateVrackServices,
dissociateVrackServicesQueryKey,
-} from '../delete';
-import { useVrackService } from '@/data/vrack-services';
+} from '@/data/api';
export type UseDissociateVrackParams = {
vrackServicesId: string;
diff --git a/packages/manager/apps/vrack-services/src/data/iam/iam-api-utils.ts b/packages/manager/apps/vrack-services/src/data/hooks/useServiceList.ts
similarity index 89%
rename from packages/manager/apps/vrack-services/src/data/iam/iam-api-utils.ts
rename to packages/manager/apps/vrack-services/src/data/hooks/useServiceList.ts
index 15447666b666..054d0e6818e2 100644
--- a/packages/manager/apps/vrack-services/src/data/iam/iam-api-utils.ts
+++ b/packages/manager/apps/vrack-services/src/data/hooks/useServiceList.ts
@@ -1,18 +1,19 @@
import React from 'react';
import { useQuery } from '@tanstack/react-query';
import { ApiResponse, ApiError } from '@ovh-ux/manager-core-api';
-import { getIamResourceQueryKey, getIamResource } from './get';
-import { IAMResource } from './iam.type';
-import { useVrackService } from '../vrack-services/vs-api-utils';
-import {
- getEligibleManagedServiceListQueryKey,
- getEligibleManagedServiceList,
-} from '../vrack-services/get';
import {
EligibleManagedService,
+ IAMResource,
Subnet,
VrackServicesWithIAM,
-} from '../vrack-services/vrack-services.type';
+} from '@/types';
+import {
+ getEligibleManagedServiceList,
+ getEligibleManagedServiceListQueryKey,
+ getIamResource,
+ getIamResourceQueryKey,
+} from '@/data/api';
+import { useVrackService } from '@/data/hooks';
const addVrackServicesUrnToUrnList = (vrackServices: VrackServicesWithIAM) => (
urns: string[],
diff --git a/packages/manager/apps/vrack-services/src/data/vrack-services/vs-api-utils.ts b/packages/manager/apps/vrack-services/src/data/hooks/useUpdateVrackServices.ts
similarity index 60%
rename from packages/manager/apps/vrack-services/src/data/vrack-services/vs-api-utils.ts
rename to packages/manager/apps/vrack-services/src/data/hooks/useUpdateVrackServices.ts
index dbe8d67b8080..2f1c7905aaf4 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack-services/vs-api-utils.ts
+++ b/packages/manager/apps/vrack-services/src/data/hooks/useUpdateVrackServices.ts
@@ -1,108 +1,17 @@
import React from 'react';
-import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
-import { useParams } from 'react-router-dom';
+import { useMutation, useQueryClient } from '@tanstack/react-query';
import { ApiResponse, ApiError } from '@ovh-ux/manager-core-api';
import { useTask } from '@ovh-ux/manager-react-components';
import {
getVrackServicesResourceListQueryKey,
- getVrackServicesResource,
- getVrackServicesResourceQueryKey,
- ResourceStatus,
- VrackServices,
- UpdateVrackServicesParams,
- updateVrackServicesQueryKey,
updateVrackServices,
- ProductStatus,
+ updateVrackServicesQueryKey,
+} from '@/data/api';
+import {
+ UpdateVrackServicesParams,
+ VrackServices,
VrackServicesWithIAM,
- getVrackServicesResourceList,
-} from '@/data';
-
-export const useVrackServicesList = (refetchIntervalTime = 5000) => {
- const queryClient = useQueryClient();
-
- return useQuery, ApiError>({
- queryKey: getVrackServicesResourceListQueryKey,
- queryFn: async () => {
- const result = await getVrackServicesResourceList();
- result?.data.forEach((vs) => {
- queryClient.setQueryData(getVrackServicesResourceQueryKey(vs.id), vs);
- });
- return result;
- },
- refetchInterval: (query) =>
- query.state.data?.data?.some((vs) =>
- vs?.currentTasks?.some((task) =>
- ['RUNNING', 'PENDING'].includes(task.status),
- ),
- )
- ? refetchIntervalTime
- : undefined,
- });
-};
-
-// Regular expression pattern for /24 subnet
-export const pattern =
- '^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?).){2}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?).0/24$';
-
-// The subnet address is limited to only "/24".
-export const isValidCidr = (subnet: string): boolean => {
- return new RegExp(pattern).test(subnet);
-};
-
-/**
- * Query the current vRack Services and poll it if it is not ready
- */
-export const useVrackService = (refetchIntervalTime = 2000) => {
- const { id } = useParams();
- const queryClient = useQueryClient();
-
- return useQuery<
- VrackServicesWithIAM,
- ApiError,
- VrackServicesWithIAM,
- string[]
- >({
- queryKey: getVrackServicesResourceQueryKey(id),
- queryFn: async () => {
- const response = await getVrackServicesResource(id);
- queryClient.setQueryData(
- getVrackServicesResourceListQueryKey,
- ({ data: listingData, ...rest }: ApiResponse) => ({
- data: listingData.map((vrackServices) =>
- vrackServices.id === response.data.id
- ? response.data
- : vrackServices,
- ),
- ...rest,
- }),
- );
- return response.data;
- },
- refetchInterval: (query) =>
- query.state.data?.currentTasks?.some((task) =>
- ['RUNNING', 'PENDING'].includes(task.status),
- )
- ? refetchIntervalTime
- : undefined,
- });
-};
-
-export const isEditable = (vs?: VrackServicesWithIAM) =>
- vs?.resourceStatus === ResourceStatus.READY &&
- [ProductStatus.ACTIVE, ProductStatus.DRAFT].includes(
- vs?.currentState.productStatus,
- );
-
-export const hasSubnet = (vs?: VrackServicesWithIAM) =>
- vs?.currentState.subnets.length > 0;
-
-export const getSubnetFromCidr = (vs?: VrackServicesWithIAM, cidr?: string) =>
- vs?.currentState?.subnets.find((s) => s.cidr === cidr);
-
-export const getDisplayName = (vs?: VrackServicesWithIAM) =>
- vs?.iam?.displayName || vs?.id;
-
-export const isValidVlanNumber = (vlan: number) => vlan >= 2 && vlan <= 4094;
+} from '@/types';
/**
* Get the function to mutate a vRack Services
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/hooks/useVrackList.ts b/packages/manager/apps/vrack-services/src/data/hooks/useVrackList.ts
similarity index 87%
rename from packages/manager/apps/vrack-services/src/data/vrack/hooks/useVrackList.ts
rename to packages/manager/apps/vrack-services/src/data/hooks/useVrackList.ts
index 245e982aa97e..65732972e39e 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack/hooks/useVrackList.ts
+++ b/packages/manager/apps/vrack-services/src/data/hooks/useVrackList.ts
@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query';
import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api';
-import { getVrackList, getVrackListQueryKey } from '../get';
+import { getVrackList, getVrackListQueryKey } from '@/data/api';
export const useVrackList = () => {
const { data: vrackListResponse, isLoading, isError, error } = useQuery<
diff --git a/packages/manager/apps/vrack-services/src/data/hooks/useVrackServices.ts b/packages/manager/apps/vrack-services/src/data/hooks/useVrackServices.ts
new file mode 100644
index 000000000000..5e152fc5bb36
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/hooks/useVrackServices.ts
@@ -0,0 +1,48 @@
+import React from 'react';
+import { useQuery, useQueryClient } from '@tanstack/react-query';
+import { useParams } from 'react-router-dom';
+import { ApiResponse, ApiError } from '@ovh-ux/manager-core-api';
+import { VrackServices, VrackServicesWithIAM } from '@/types';
+import {
+ getVrackServicesResource,
+ getVrackServicesResourceListQueryKey,
+ getVrackServicesResourceQueryKey,
+} from '@/data/api';
+
+/**
+ * Query the current vRack Services and poll it if it is not ready
+ */
+export const useVrackService = (refetchIntervalTime = 2000) => {
+ const { id } = useParams();
+ const queryClient = useQueryClient();
+
+ return useQuery<
+ VrackServicesWithIAM,
+ ApiError,
+ VrackServicesWithIAM,
+ string[]
+ >({
+ queryKey: getVrackServicesResourceQueryKey(id),
+ queryFn: async () => {
+ const response = await getVrackServicesResource(id);
+ queryClient.setQueryData(
+ getVrackServicesResourceListQueryKey,
+ ({ data: listingData, ...rest }: ApiResponse) => ({
+ data: listingData.map((vrackServices) =>
+ vrackServices.id === response.data.id
+ ? response.data
+ : vrackServices,
+ ),
+ ...rest,
+ }),
+ );
+ return response.data;
+ },
+ refetchInterval: (query) =>
+ query.state.data?.currentTasks?.some((task) =>
+ ['RUNNING', 'PENDING'].includes(task.status),
+ )
+ ? refetchIntervalTime
+ : undefined,
+ });
+};
diff --git a/packages/manager/apps/vrack-services/src/data/hooks/useVrackServicesList.ts b/packages/manager/apps/vrack-services/src/data/hooks/useVrackServicesList.ts
new file mode 100644
index 000000000000..43a444a8bb9d
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/data/hooks/useVrackServicesList.ts
@@ -0,0 +1,32 @@
+import React from 'react';
+import { useQuery, useQueryClient } from '@tanstack/react-query';
+import { ApiResponse, ApiError } from '@ovh-ux/manager-core-api';
+import { VrackServicesWithIAM } from '@/types';
+import {
+ getVrackServicesResourceListQueryKey,
+ getVrackServicesResourceList,
+ getVrackServicesResourceQueryKey,
+} from '@/data/api';
+
+export const useVrackServicesList = (refetchIntervalTime = 5000) => {
+ const queryClient = useQueryClient();
+
+ return useQuery, ApiError>({
+ queryKey: getVrackServicesResourceListQueryKey,
+ queryFn: async () => {
+ const result = await getVrackServicesResourceList();
+ result?.data.forEach((vs) => {
+ queryClient.setQueryData(getVrackServicesResourceQueryKey(vs.id), vs);
+ });
+ return result;
+ },
+ refetchInterval: (query) =>
+ query.state.data?.data?.some((vs) =>
+ vs?.currentTasks?.some((task) =>
+ ['RUNNING', 'PENDING'].includes(task.status),
+ ),
+ )
+ ? refetchIntervalTime
+ : undefined,
+ });
+};
diff --git a/packages/manager/apps/vrack-services/src/data/iam/index.ts b/packages/manager/apps/vrack-services/src/data/iam/index.ts
deleted file mode 100644
index be11641b1957..000000000000
--- a/packages/manager/apps/vrack-services/src/data/iam/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './get';
-export * from './iam.type';
-export * from './iam-api-utils';
diff --git a/packages/manager/apps/vrack-services/src/data/index.ts b/packages/manager/apps/vrack-services/src/data/index.ts
deleted file mode 100644
index 1ebe355ce7bc..000000000000
--- a/packages/manager/apps/vrack-services/src/data/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './vrack';
-export * from './vrack-services';
-export * from './api.type';
-export * from './iam';
diff --git a/packages/manager/apps/vrack-services/src/data/vrack-services/get.ts b/packages/manager/apps/vrack-services/src/data/vrack-services/get.ts
deleted file mode 100644
index 47af0104ce14..000000000000
--- a/packages/manager/apps/vrack-services/src/data/vrack-services/get.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-import { apiClient, fetchIcebergV2 } from '@ovh-ux/manager-core-api';
-import {
- EligibleManagedService,
- VrackServicesWithIAM,
- Region,
-} from './vrack-services.type';
-
-export const getvrackServicesReferenceRegionListQueryKey = [
- 'get/vrackServices/reference/region',
-];
-
-/**
- * List all vRack Services regions
- */
-export const getvrackServicesReferenceRegionList = () =>
- apiClient.v2.get('/vrackServices/reference/region');
-
-export type GetVrackServicesResourceListParams = {
- /** Pagination cursor */
- cursor?: 'next' | 'prev';
-};
-
-export const getVrackServicesResourceListQueryKey = [
- 'get/vrackServices/resource',
-];
-
-/**
- * Operations on vRack Services : List all vRack Services
- */
-export const getVrackServicesResourceList = async ({
- cursor,
-}: GetVrackServicesResourceListParams = {}) =>
- apiClient.v2.get('/vrackServices/resource', {
- headers: {
- 'X-Pagination-Cursor': cursor,
- },
- });
-
-export const getListingIcebergQueryKey = ['servicesListingIceberg'];
-
-export const getListingIceberg = async () =>
- fetchIcebergV2({
- route: '/vrackServices/resource',
- });
-
-export const getVrackServicesResourceQueryKey = (vrackServicesId: string) => [
- `get/vrackServices/resource/${vrackServicesId}`,
-];
-
-/**
- * Get the vRack Services
- */
-export const getVrackServicesResource = async (vrackServicesId: string) =>
- apiClient.v2.get(
- `/vrackServices/resource/${vrackServicesId}`,
- );
-
-export const getEligibleManagedServiceListQueryKey = (
- vrackServicesId: string,
-) => [`get/vrackServices/resource/${vrackServicesId}/eligibleManagedService`];
-
-/**
- * List all managed services eligible to the requested vRack Services
- */
-export const getEligibleManagedServiceList = async (vrackServicesId: string) =>
- apiClient.v2.get(
- `/vrackServices/resource/${vrackServicesId}/eligibleManagedService`,
- );
diff --git a/packages/manager/apps/vrack-services/src/data/vrack-services/index.ts b/packages/manager/apps/vrack-services/src/data/vrack-services/index.ts
deleted file mode 100644
index f730f4155e18..000000000000
--- a/packages/manager/apps/vrack-services/src/data/vrack-services/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './get';
-export * from './put';
-export * from './vrack-services.type';
-export * from './vs-api-utils';
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/get.ts b/packages/manager/apps/vrack-services/src/data/vrack/get.ts
deleted file mode 100644
index cc7088eef5bb..000000000000
--- a/packages/manager/apps/vrack-services/src/data/vrack/get.ts
+++ /dev/null
@@ -1,116 +0,0 @@
-import { apiClient } from '@ovh-ux/manager-core-api';
-import {
- AllowedServicesResponse,
- AllowedService,
- EligibleServicesResponse,
- NonExpiringService,
-} from '../api.type';
-import { VrackTask } from './vrack.type';
-
-export const getVrackListQueryKey = ['get/vrack'];
-
-export const getVrackList = () => apiClient.v6.get('/vrack');
-
-export type GetVrackAllowedServicesParams = {
- /** Filter on a specific service family */
- serviceFamily: AllowedService;
- /** The internal name of your vrack */
- vrack: string;
-};
-
-export const getVrackAllowedServicesQueryKey = ({
- vrack,
- serviceFamily,
-}: GetVrackAllowedServicesParams) => [
- `get/vrack/${vrack}/allowedServices${serviceFamily || ''}`,
-];
-
-/**
- * allowedServices operations : List all services allowed in this vrack
- */
-export const getVrackAllowedServices = async ({
- vrack,
- serviceFamily,
-}: GetVrackAllowedServicesParams) =>
- apiClient.v6.get(
- `/vrack/${vrack}/allowedServices${
- serviceFamily ? `?serviceFamily=${serviceFamily}` : ''
- }`,
- );
-
-export type GetVrackEligibleServicesParams = {
- /** The internal name of your vrack */
- vrack: string;
-};
-
-export const getVrackEligibleServicesQueryKey = ({
- vrack,
-}: GetVrackEligibleServicesParams) => [`get/vrack/${vrack}/eligibleServices`];
-
-/**
- * List all eligible services for this vRack asynchronously : List all eligible services for this vRack asynchronously
- */
-export const getVrackServiceEligibleServices = async ({
- vrack,
-}: GetVrackEligibleServicesParams) =>
- apiClient.v6.get(
- `/vrack/${vrack}/eligibleServices`,
- );
-
-export type GetVrackServiceInfosParams = {
- /** The internal name of your vrack */
- vrack: string;
-};
-
-export const getVrackServiceInfosQueryKey = ({
- vrack,
-}: GetVrackServiceInfosParams) => [`get/vrack/${vrack}/serviceInfos`];
-
-/**
- * Details about a non-expiring Service : Get this object properties
- */
-export const getVrackServiceInfos = async ({
- vrack,
-}: GetVrackServiceInfosParams) =>
- apiClient.v6.get(`/vrack/${vrack}/serviceInfos`);
-
-export type GetVrackVrackServicesListParams = {
- /** The internal name of your vrack */
- vrack: string;
-};
-
-export const getVrackVrackServicesListQueryKey = ({
- vrack,
-}: GetVrackVrackServicesListParams) => [`get/vrack/${vrack}/vrackServices`];
-
-/**
- * List the vrack.vrackServices objects : vrack for vrackServices
- */
-export const getVrackVrackServicesList = async ({
- vrack,
-}: GetVrackVrackServicesListParams) =>
- apiClient.v6.get(`/vrack/${vrack}/vrackServices`);
-
-export type GetVrackTaskWithIdParams = {
- /** The internal name of your vrack */
- vrack: string;
- /** The task ID */
- taskId: number;
-};
-
-export const getVrackTaskWithIdQueryKey = ({
- vrack,
- taskId,
-}: GetVrackTaskWithIdParams) => [`get/vrack/task`, { taskId, vrack }];
-
-/**
- * Retrieve a given vrack task
- * @param vrack the vrack id
- * @param taskId the task id
- * @returns the detail of the task
- */
-export const getVrackTaskWithId = async ({
- vrack,
- taskId,
-}: GetVrackTaskWithIdParams) =>
- apiClient.v6.get(`/vrack/${vrack}/task/${taskId}`);
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/hooks/index.ts b/packages/manager/apps/vrack-services/src/data/vrack/hooks/index.ts
deleted file mode 100644
index ca86be9851bc..000000000000
--- a/packages/manager/apps/vrack-services/src/data/vrack/hooks/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './useAssociateVrack';
-export * from './useDissociateVrack';
-export * from './useVrackList';
-export * from './useAllowedVrackList';
diff --git a/packages/manager/apps/vrack-services/src/data/vrack/vrack.type.ts b/packages/manager/apps/vrack-services/src/data/vrack/vrack.type.ts
deleted file mode 100644
index b201b5da54a2..000000000000
--- a/packages/manager/apps/vrack-services/src/data/vrack/vrack.type.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { IamMetadata } from '../api.type';
-
-export type Vrack = {
- name: string;
- description: string;
-};
-
-export type VrackWithIAM = Vrack & IamMetadata;
-
-export type VrackTask = {
- function: string;
- id: number;
- lastUpdate: Date;
- orderId?: number;
- serviceName: string;
- status: string;
- targetDomain?: string;
- todoDate: Date;
-};
diff --git a/packages/manager/apps/vrack-services/src/pages/DashboardWrapper.page.tsx b/packages/manager/apps/vrack-services/src/pages/DashboardWrapper.page.tsx
index ebdec6f5bf0d..43afa9b2883a 100644
--- a/packages/manager/apps/vrack-services/src/pages/DashboardWrapper.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/DashboardWrapper.page.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
import { useParams, Outlet, useLocation } from 'react-router-dom';
import { useOvhTracking, ButtonType } from '@ovh-ux/manager-react-shell-client';
import { DashboardLayout } from '@/components/layout-helpers';
-import { useVrackService, useVrackServicesList } from '@/data';
+import { useVrackService, useVrackServicesList } from '@/data/hooks';
import NotFound from '@/pages/not-found/404.page';
import { ErrorPage } from '@/components/ErrorPage.component';
import { urls } from '@/routes/routes.constants';
diff --git a/packages/manager/apps/vrack-services/src/pages/RootWrapper.page.tsx b/packages/manager/apps/vrack-services/src/pages/RootWrapper.page.tsx
index fcd70f7ff88e..c976c30cd333 100644
--- a/packages/manager/apps/vrack-services/src/pages/RootWrapper.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/RootWrapper.page.tsx
@@ -6,7 +6,7 @@ import {
PageType,
} from '@ovh-ux/manager-react-shell-client';
import { defineCurrentPage } from '@ovh-ux/request-tagger';
-import { useVrackServicesList } from '@/data';
+import { useVrackServicesList } from '@/data/hooks';
import { ErrorPage } from '@/components/ErrorPage.component';
import { PageName } from '@/utils/tracking';
diff --git a/packages/manager/apps/vrack-services/src/pages/associate-another/AssociateAnotherVrack.component.tsx b/packages/manager/apps/vrack-services/src/pages/associate-another/AssociateAnotherVrack.component.tsx
index 410380f5433d..025a85ff30c7 100644
--- a/packages/manager/apps/vrack-services/src/pages/associate-another/AssociateAnotherVrack.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/associate-another/AssociateAnotherVrack.component.tsx
@@ -29,15 +29,15 @@ import { useQueryClient } from '@tanstack/react-query';
import { handleClick } from '@ovh-ux/manager-react-components';
import { PageName } from '@/utils/tracking';
import { LoadingText } from '@/components/LoadingText.component';
+import { getVrackServicesResourceListQueryKey } from '@/data/api';
+import { MessagesContext } from '@/components/feedback-messages/Messages.context';
+import { SuccessMessage } from '@/components/feedback-messages/SuccessMessage.component';
import {
- getDisplayName,
- getVrackServicesResourceListQueryKey,
useAssociateVrack,
useDissociateVrack,
useVrackService,
-} from '@/data';
-import { MessagesContext } from '@/components/feedback-messages/Messages.context';
-import { SuccessMessage } from '@/components/feedback-messages/SuccessMessage.component';
+} from '@/data/hooks';
+import { getDisplayName } from '@/utils/vrack-services';
export type AssociateAnotherVrackProps = {
vrackList: string[];
diff --git a/packages/manager/apps/vrack-services/src/pages/associate-another/AssociateAnotherVrackModal.page.tsx b/packages/manager/apps/vrack-services/src/pages/associate-another/AssociateAnotherVrackModal.page.tsx
index aa913c7548b6..19cc3ec14536 100644
--- a/packages/manager/apps/vrack-services/src/pages/associate-another/AssociateAnotherVrackModal.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/associate-another/AssociateAnotherVrackModal.page.tsx
@@ -21,7 +21,7 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { handleClick } from '@ovh-ux/manager-react-components';
-import { useVrackList } from '@/data';
+import { useVrackList } from '@/data/hooks';
import { AssociateAnotherVrack } from './AssociateAnotherVrack.component';
import { CreateVrack } from '@/components/CreateVrack.component';
import { LoadingText } from '@/components/LoadingText.component';
diff --git a/packages/manager/apps/vrack-services/src/pages/associate/AssociateVrack.component.tsx b/packages/manager/apps/vrack-services/src/pages/associate/AssociateVrack.component.tsx
index 412416ca499a..8fc0a61590e3 100644
--- a/packages/manager/apps/vrack-services/src/pages/associate/AssociateVrack.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/associate/AssociateVrack.component.tsx
@@ -26,15 +26,12 @@ import {
} from '@ovh-ux/manager-react-shell-client';
import { useNavigate, useParams } from 'react-router-dom';
import { handleClick } from '@ovh-ux/manager-react-components';
-import {
- getVrackServicesResourceListQueryKey,
- useVrackService,
- useAssociateVrack,
- getDisplayName,
-} from '@/data';
+import { getVrackServicesResourceListQueryKey } from '@/data/api';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
import { LoadingText } from '@/components/LoadingText.component';
import { PageName } from '@/utils/tracking';
+import { useAssociateVrack, useVrackService } from '@/data/hooks';
+import { getDisplayName } from '@/utils/vrack-services';
export type AssociateVrackProps = {
vrackList: string[];
diff --git a/packages/manager/apps/vrack-services/src/pages/associate/AssociateVrackModal.page.tsx b/packages/manager/apps/vrack-services/src/pages/associate/AssociateVrackModal.page.tsx
index a9382dc5350f..d4ba29404869 100644
--- a/packages/manager/apps/vrack-services/src/pages/associate/AssociateVrackModal.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/associate/AssociateVrackModal.page.tsx
@@ -21,7 +21,7 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { handleClick } from '@ovh-ux/manager-react-components';
-import { useAllowedVrackList } from '@/data';
+import { useAllowedVrackList } from '@/data/hooks';
import { AssociateVrack } from './AssociateVrack.component';
import { CreateVrack } from '@/components/CreateVrack.component';
import { LoadingText } from '@/components/LoadingText.component';
diff --git a/packages/manager/apps/vrack-services/src/pages/create-endpoint/EndpointCreate.page.tsx b/packages/manager/apps/vrack-services/src/pages/create-endpoint/EndpointCreate.page.tsx
index d3d680fb732f..c7816b76403c 100644
--- a/packages/manager/apps/vrack-services/src/pages/create-endpoint/EndpointCreate.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/create-endpoint/EndpointCreate.page.tsx
@@ -9,12 +9,7 @@ import {
} from '@ovhcloud/ods-components';
import { PageType, useOvhTracking } from '@ovh-ux/manager-react-shell-client';
import { FormField } from '@/components/FormField.component';
-import {
- getVrackServicesResourceQueryKey,
- useServiceList,
- useUpdateVrackServices,
- useVrackService,
-} from '@/data';
+import { getVrackServicesResourceQueryKey } from '@/data/api';
import { CreatePageLayout } from '@/components/layout-helpers';
import {
subnetSelectName,
@@ -25,6 +20,11 @@ import { ErrorPage } from '@/components/ErrorPage.component';
import { urls } from '@/routes/routes.constants';
import { PageName } from '@/utils/tracking';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
+import {
+ useServiceList,
+ useUpdateVrackServices,
+ useVrackService,
+} from '@/data/hooks';
export default function EndpointCreatePage() {
const { t } = useTranslation('vrack-services/endpoints');
diff --git a/packages/manager/apps/vrack-services/src/pages/create-subnet/SubnetCreate.page.tsx b/packages/manager/apps/vrack-services/src/pages/create-subnet/SubnetCreate.page.tsx
index feb18be405bd..8c78c0c2efc9 100644
--- a/packages/manager/apps/vrack-services/src/pages/create-subnet/SubnetCreate.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/create-subnet/SubnetCreate.page.tsx
@@ -19,14 +19,9 @@ import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { useOvhTracking, PageType } from '@ovh-ux/manager-react-shell-client';
import { FormField } from '@/components/FormField.component';
import {
- getDisplayName,
getVrackServicesResourceListQueryKey,
getVrackServicesResourceQueryKey,
- useUpdateVrackServices,
- useVrackService,
- isValidVlanNumber,
- isValidCidr,
-} from '@/data';
+} from '@/data/api';
import { CreatePageLayout } from '@/components/layout-helpers';
import {
displayNameInputName,
@@ -42,6 +37,9 @@ import {
import { urls } from '@/routes/routes.constants';
import { PageName } from '@/utils/tracking';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
+import { useUpdateVrackServices, useVrackService } from '@/data/hooks';
+import { isValidVlanNumber } from '@/utils/vrack-services';
+import { isValidCidr } from '@/utils/cidr';
export default function SubnetCreate() {
const { t } = useTranslation('vrack-services/subnets');
diff --git a/packages/manager/apps/vrack-services/src/pages/create-vs/CreateVrackServices.page.tsx b/packages/manager/apps/vrack-services/src/pages/create-vs/CreateVrackServices.page.tsx
index 52d294b7c0de..c6280967573b 100644
--- a/packages/manager/apps/vrack-services/src/pages/create-vs/CreateVrackServices.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/create-vs/CreateVrackServices.page.tsx
@@ -4,15 +4,15 @@ import { Outlet, useNavigate } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api';
import { useFeatureAvailability } from '@ovh-ux/manager-react-components';
-import {
- getvrackServicesReferenceRegionList,
- getvrackServicesReferenceRegionListQueryKey,
- Region,
-} from '@/data';
import { ErrorPage } from '@/components/ErrorPage.component';
import { RegionFormField } from './RegionFormField.component';
import { CreatePageLayout } from '@/components/layout-helpers';
import { urls } from '@/routes/routes.constants';
+import { Region } from '@/types';
+import {
+ getvrackServicesReferenceRegionList,
+ getvrackServicesReferenceRegionListQueryKey,
+} from '@/data/api';
export default function CreateVrackServicesPage() {
const [selectedRegion, setSelectedRegion] = React.useState('');
diff --git a/packages/manager/apps/vrack-services/src/pages/create-vs/RegionFormField.component.tsx b/packages/manager/apps/vrack-services/src/pages/create-vs/RegionFormField.component.tsx
index d8378e6c93bb..dd62c0dba8cc 100644
--- a/packages/manager/apps/vrack-services/src/pages/create-vs/RegionFormField.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/create-vs/RegionFormField.component.tsx
@@ -21,7 +21,7 @@ import { Region } from '@ovh-ux/manager-react-components';
import {
getvrackServicesReferenceRegionListQueryKey,
getvrackServicesReferenceRegionList,
-} from '@/data';
+} from '@/data/api';
import {
regionInputName,
regionNameToIsoCode,
diff --git a/packages/manager/apps/vrack-services/src/pages/dissociate/DissociateModal.page.tsx b/packages/manager/apps/vrack-services/src/pages/dissociate/DissociateModal.page.tsx
index 8870b8c8ebf6..48f8b208be7f 100644
--- a/packages/manager/apps/vrack-services/src/pages/dissociate/DissociateModal.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/dissociate/DissociateModal.page.tsx
@@ -23,15 +23,12 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { handleClick } from '@ovh-ux/manager-react-components';
-import {
- getDisplayName,
- getVrackServicesResourceListQueryKey,
- useDissociateVrack,
- useVrackService,
-} from '@/data';
+import { getVrackServicesResourceListQueryKey } from '@/data/api';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
import { LoadingText } from '@/components/LoadingText.component';
import { PageName } from '@/utils/tracking';
+import { useDissociateVrack, useVrackService } from '@/data/hooks';
+import { getDisplayName } from '@/utils/vrack-services';
const sharedTrackingParams = {
location: PageLocation.popup,
diff --git a/packages/manager/apps/vrack-services/src/pages/edit-display-name/EditVrackServicesDisplayNameModal.page.tsx b/packages/manager/apps/vrack-services/src/pages/edit-display-name/EditVrackServicesDisplayNameModal.page.tsx
index ac0a52de020c..6e1cdc7faf86 100644
--- a/packages/manager/apps/vrack-services/src/pages/edit-display-name/EditVrackServicesDisplayNameModal.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/edit-display-name/EditVrackServicesDisplayNameModal.page.tsx
@@ -10,9 +10,10 @@ import {
} from '@ovh-ux/manager-react-shell-client';
import { UpdateIamNameModal } from '@ovh-ux/manager-react-components';
import { useQueryClient } from '@tanstack/react-query';
-import { getVrackServicesResourceListQueryKey, useVrackService } from '@/data';
+import { getVrackServicesResourceListQueryKey } from '@/data/api';
import { PageName } from '@/utils/tracking';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
+import { useVrackService } from '@/data/hooks';
const sharedTrackingParams: TrackingClickParams = {
location: PageLocation.popup,
diff --git a/packages/manager/apps/vrack-services/src/pages/endpoints/EndpointsTab.page.tsx b/packages/manager/apps/vrack-services/src/pages/endpoints/EndpointsTab.page.tsx
index 5c1391047c52..4ebdb902e4b9 100644
--- a/packages/manager/apps/vrack-services/src/pages/endpoints/EndpointsTab.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/endpoints/EndpointsTab.page.tsx
@@ -2,7 +2,7 @@ import React from 'react';
import { Outlet, useLocation, useNavigate, useParams } from 'react-router-dom';
import { OsdsSpinner } from '@ovhcloud/ods-components/react';
import { ODS_SPINNER_SIZE } from '@ovhcloud/ods-components';
-import { useVrackService } from '@/data';
+import { useVrackService } from '@/data/hooks';
import { urls } from '@/routes/routes.constants';
export default function EndpointsTab() {
diff --git a/packages/manager/apps/vrack-services/src/pages/endpoints/delete/EndpointDeleteModal.page.tsx b/packages/manager/apps/vrack-services/src/pages/endpoints/delete/EndpointDeleteModal.page.tsx
index c02173d630b6..e8da0bae03e7 100644
--- a/packages/manager/apps/vrack-services/src/pages/endpoints/delete/EndpointDeleteModal.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/endpoints/delete/EndpointDeleteModal.page.tsx
@@ -9,13 +9,10 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { DeleteModal } from '@ovh-ux/manager-react-components';
-import {
- useVrackService,
- useUpdateVrackServices,
- getEligibleManagedServiceListQueryKey,
-} from '@/data';
+import { useVrackService, useUpdateVrackServices } from '@/data/hooks';
import { PageName } from '@/utils/tracking';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
+import { getEligibleManagedServiceListQueryKey } from '@/data/api';
export default function EndpointsDeleteModal() {
const { t } = useTranslation('vrack-services/endpoints');
diff --git a/packages/manager/apps/vrack-services/src/pages/endpoints/edit/EditEndpointDisplayName.page.tsx b/packages/manager/apps/vrack-services/src/pages/endpoints/edit/EditEndpointDisplayName.page.tsx
index 2be0bff458d5..615ed19f9bae 100644
--- a/packages/manager/apps/vrack-services/src/pages/endpoints/edit/EditEndpointDisplayName.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/endpoints/edit/EditEndpointDisplayName.page.tsx
@@ -9,7 +9,7 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { UpdateIamNameModal } from '@ovh-ux/manager-react-components';
-import { useServiceList } from '@/data';
+import { useServiceList } from '@/data/hooks';
import { PageName } from '@/utils/tracking';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
diff --git a/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/ActionCell.component.tsx b/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/ActionCell.component.tsx
index 75be59bb3af0..a0265671470d 100644
--- a/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/ActionCell.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/ActionCell.component.tsx
@@ -8,9 +8,10 @@ import {
} from '@ovh-ux/manager-react-shell-client';
import { ActionMenu } from '@ovh-ux/manager-react-components';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
-import { isEditable, VrackServicesWithIAM } from '@/data';
import { urls } from '@/routes/routes.constants';
import { EndpointItem } from './useEndpointList.hook';
+import { VrackServicesWithIAM } from '@/types';
+import { isEditable } from '@/utils/vrack-services';
export const ActionCell: React.FC<{
vs: VrackServicesWithIAM;
diff --git a/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/EndpointDataGrid.component.tsx b/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/EndpointDataGrid.component.tsx
index b8c110a9643a..141bb4ffb821 100644
--- a/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/EndpointDataGrid.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/EndpointDataGrid.component.tsx
@@ -10,7 +10,7 @@ import {
useDataGrid,
} from '@ovh-ux/manager-react-components';
import { ErrorPage } from '@/components/ErrorPage.component';
-import { useVrackService, useServiceList } from '@/data';
+import { useVrackService, useServiceList } from '@/data/hooks';
import { EndpointItem, useEndpointsList } from './useEndpointList.hook';
import { ActionCell } from './ActionCell.component';
diff --git a/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/EndpointsListing.page.tsx b/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/EndpointsListing.page.tsx
index 6276308c0bd3..2fb9508ded84 100644
--- a/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/EndpointsListing.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/EndpointsListing.page.tsx
@@ -10,9 +10,10 @@ import {
} from '@ovhcloud/ods-components';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { PageLayout } from '@/components/layout-helpers';
-import { isEditable, useVrackService } from '@/data';
+import { useVrackService } from '@/data/hooks';
import { EndpointDatagrid } from './EndpointDataGrid.component';
import { useNavigateToCreateEndpointPage } from '../endpoints.hook';
+import { isEditable } from '@/utils/vrack-services';
export default function EndpointsListing() {
const { t } = useTranslation('vrack-services/endpoints');
diff --git a/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/useEndpointList.hook.ts b/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/useEndpointList.hook.ts
index c4c45b2a35c8..92b546f706ad 100644
--- a/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/useEndpointList.hook.ts
+++ b/packages/manager/apps/vrack-services/src/pages/endpoints/endpoints-listing/useEndpointList.hook.ts
@@ -1,6 +1,7 @@
import { ColumnSort } from '@ovh-ux/manager-react-components';
import { useParams } from 'react-router-dom';
-import { IAMResource, useServiceList, useVrackService } from '@/data';
+import { useServiceList, useVrackService } from '@/data/hooks';
+import { IAMResource } from '@/types';
export type EndpointItem = {
description: string;
diff --git a/packages/manager/apps/vrack-services/src/pages/endpoints/onboarding/EndpointsOnboarding.page.tsx b/packages/manager/apps/vrack-services/src/pages/endpoints/onboarding/EndpointsOnboarding.page.tsx
index dc4353141543..1a8b171af192 100644
--- a/packages/manager/apps/vrack-services/src/pages/endpoints/onboarding/EndpointsOnboarding.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/endpoints/onboarding/EndpointsOnboarding.page.tsx
@@ -3,8 +3,9 @@ import { ODS_BUTTON_SIZE, ODS_ICON_NAME } from '@ovhcloud/ods-components';
import { useTranslation } from 'react-i18next';
import { OnboardingLayout } from '@/components/layout-helpers/OnboardingLayout.component';
import onboardingImgSrc from '@/assets/onboarding-img.png';
-import { hasSubnet, isEditable, useVrackService } from '@/data';
+import { useVrackService } from '@/data/hooks';
import { useNavigateToCreateEndpointPage } from '../endpoints.hook';
+import { hasSubnet, isEditable } from '@/utils/vrack-services';
export default function EndpointsOnboarding() {
const { t } = useTranslation('vrack-services/endpoints');
diff --git a/packages/manager/apps/vrack-services/src/pages/listing/ActionCell.component.tsx b/packages/manager/apps/vrack-services/src/pages/listing/ActionCell.component.tsx
index 9f46414fc4a2..3dc27b4b5244 100644
--- a/packages/manager/apps/vrack-services/src/pages/listing/ActionCell.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/listing/ActionCell.component.tsx
@@ -8,9 +8,10 @@ import {
} from '@ovh-ux/manager-react-shell-client';
import { ActionMenu } from '@ovh-ux/manager-react-components';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
-import { isEditable, VrackServicesWithIAM } from '@/data';
import { urls } from '@/routes/routes.constants';
import { useVrackMenuItems } from '@/components/vrack-id/useVrackMenuItems.hook';
+import { VrackServicesWithIAM } from '@/types';
+import { isEditable } from '@/utils/vrack-services';
export const ActionCell: React.FC = (vs) => {
const navigate = useNavigate();
diff --git a/packages/manager/apps/vrack-services/src/pages/listing/Listing.page.tsx b/packages/manager/apps/vrack-services/src/pages/listing/Listing.page.tsx
index 91fdb3a4d220..f1bc4f89a890 100644
--- a/packages/manager/apps/vrack-services/src/pages/listing/Listing.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/listing/Listing.page.tsx
@@ -32,16 +32,14 @@ import {
handleClick,
useFeatureAvailability,
} from '@ovh-ux/manager-react-components';
-import {
- getVrackServicesResourceListQueryKey,
- useVrackServicesList,
-} from '@/data';
+import { useVrackServicesList } from '@/data/hooks';
import { VrackServicesDatagrid } from '@/pages/listing/VrackServicesDataGrid.component';
import { PageLayout } from '@/components/layout-helpers';
import { DeliveringMessages } from '@/components/DeliveringMessages.component';
import { betaVrackServicesLimit } from './listing.constants';
import { urls } from '@/routes/routes.constants';
import { SuccessMessages } from '@/components/feedback-messages/SuccessMessage.component';
+import { getVrackServicesResourceListQueryKey } from '@/data/api';
export default function Listing() {
const { t } = useTranslation('vrack-services/listing');
diff --git a/packages/manager/apps/vrack-services/src/pages/listing/VrackServicesDataGrid.component.tsx b/packages/manager/apps/vrack-services/src/pages/listing/VrackServicesDataGrid.component.tsx
index 6f1d2a9d6c61..96dd6ab25e2d 100644
--- a/packages/manager/apps/vrack-services/src/pages/listing/VrackServicesDataGrid.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/listing/VrackServicesDataGrid.component.tsx
@@ -11,13 +11,11 @@ import {
} from '@ovh-ux/manager-react-components';
import { DisplayName } from '@/components/display-name/DisplayName.component';
import { VrackId } from '@/components/vrack-id/VrackId.component';
-import {
- getDisplayName,
- useVrackServicesList,
- VrackServicesWithIAM,
-} from '@/data';
+import { useVrackServicesList } from '@/data/hooks';
import { ProductStatusChip } from '@/components/ProductStatusChip.component';
import { ActionCell } from './ActionCell.component';
+import { VrackServicesWithIAM } from '@/types';
+import { getDisplayName } from '@/utils/vrack-services';
const sortVrackServicesListing = (
sorting: ColumnSort,
diff --git a/packages/manager/apps/vrack-services/src/pages/listing/delete/DeleteVrackServicesModal.page.tsx b/packages/manager/apps/vrack-services/src/pages/listing/delete/DeleteVrackServicesModal.page.tsx
index b2316edcf42a..ceb00642a785 100644
--- a/packages/manager/apps/vrack-services/src/pages/listing/delete/DeleteVrackServicesModal.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/listing/delete/DeleteVrackServicesModal.page.tsx
@@ -4,9 +4,10 @@ import { useTranslation } from 'react-i18next';
import { PageType, useOvhTracking } from '@ovh-ux/manager-react-shell-client';
import { DeleteServiceModal } from '@ovh-ux/manager-react-components';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
-import { getDisplayName, useVrackService } from '@/data';
+import { useVrackService } from '@/data/hooks';
import { PageName } from '@/utils/tracking';
import { sharedTrackingParams } from './deleteVrackServicesModal.constants';
+import { getDisplayName } from '@/utils/vrack-services';
export default function DeleteVrackServicesModal() {
const { id } = useParams();
diff --git a/packages/manager/apps/vrack-services/src/pages/onboarding/Onboarding.page.tsx b/packages/manager/apps/vrack-services/src/pages/onboarding/Onboarding.page.tsx
index 5b58dc2186d9..3cd60894a205 100644
--- a/packages/manager/apps/vrack-services/src/pages/onboarding/Onboarding.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/onboarding/Onboarding.page.tsx
@@ -20,7 +20,7 @@ import {
import { useGuideUtils } from './useGuideUtils';
import { OnboardingLayout } from '@/components/layout-helpers';
import onboardingImgSrc from '@/assets/onboarding-img.png';
-import { getVrackServicesResourceListQueryKey } from '@/data';
+import { getVrackServicesResourceListQueryKey } from '@/data/api';
import { urls } from '@/routes/routes.constants';
import { onboardingRefetchInterval } from './onboarding.constants';
diff --git a/packages/manager/apps/vrack-services/src/pages/overview/OverviewTab.page.tsx b/packages/manager/apps/vrack-services/src/pages/overview/OverviewTab.page.tsx
index 1695dc96ae23..772e25541995 100644
--- a/packages/manager/apps/vrack-services/src/pages/overview/OverviewTab.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/overview/OverviewTab.page.tsx
@@ -6,7 +6,7 @@ import { Outlet } from 'react-router-dom';
import { ovhLocaleToI18next } from '@ovh-ux/manager-react-shell-client';
import { DashboardTile, Region } from '@ovh-ux/manager-react-components';
import { ErrorPage } from '@/components/ErrorPage.component';
-import { useVrackService } from '@/data';
+import { useVrackService } from '@/data/hooks';
import { formatDateString } from '@/utils/date';
import { VrackId } from '@/components/vrack-id/VrackId.component';
import { DisplayName } from '@/components/display-name/DisplayName.component';
diff --git a/packages/manager/apps/vrack-services/src/pages/subnets/SubnetsTab.page.tsx b/packages/manager/apps/vrack-services/src/pages/subnets/SubnetsTab.page.tsx
index af213d359282..795c941b155c 100644
--- a/packages/manager/apps/vrack-services/src/pages/subnets/SubnetsTab.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/subnets/SubnetsTab.page.tsx
@@ -2,7 +2,7 @@ import React from 'react';
import { ODS_SPINNER_SIZE } from '@ovhcloud/ods-components';
import { OsdsSpinner } from '@ovhcloud/ods-components/react';
import { Outlet, useLocation, useNavigate, useParams } from 'react-router-dom';
-import { useVrackService } from '@/data';
+import { useVrackService } from '@/data/hooks';
import { urls } from '@/routes/routes.constants';
export default function SubnetsTab() {
diff --git a/packages/manager/apps/vrack-services/src/pages/subnets/delete/SubnetDeleteModal.page.tsx b/packages/manager/apps/vrack-services/src/pages/subnets/delete/SubnetDeleteModal.page.tsx
index 5cd19a3968f4..9d1f8cb3d988 100644
--- a/packages/manager/apps/vrack-services/src/pages/subnets/delete/SubnetDeleteModal.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/subnets/delete/SubnetDeleteModal.page.tsx
@@ -9,13 +9,10 @@ import {
TrackingClickParams,
} from '@ovh-ux/manager-react-shell-client';
import { DeleteModal } from '@ovh-ux/manager-react-components';
-import {
- useVrackService,
- useUpdateVrackServices,
- getDisplayName,
-} from '@/data';
+import { useVrackService, useUpdateVrackServices } from '@/data/hooks';
import { PageName } from '@/utils/tracking';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
+import { getDisplayName } from '@/utils/vrack-services';
const sharedTrackingParams: TrackingClickParams = {
location: PageLocation.popup,
diff --git a/packages/manager/apps/vrack-services/src/pages/subnets/edit/EditSubnetModal.page.tsx b/packages/manager/apps/vrack-services/src/pages/subnets/edit/EditSubnetModal.page.tsx
index 9a16bc2f9d20..4fb20cd4307e 100644
--- a/packages/manager/apps/vrack-services/src/pages/subnets/edit/EditSubnetModal.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/subnets/edit/EditSubnetModal.page.tsx
@@ -27,14 +27,7 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { handleClick } from '@ovh-ux/manager-react-components';
-import {
- getDisplayName,
- useUpdateVrackServices,
- useVrackService,
- isValidVlanNumber,
- getSubnetFromCidr,
- isValidCidr,
-} from '@/data';
+import { useUpdateVrackServices, useVrackService } from '@/data/hooks';
import { MessagesContext } from '@/components/feedback-messages/Messages.context';
import { LoadingText } from '@/components/LoadingText.component';
import { PageName } from '@/utils/tracking';
@@ -43,6 +36,12 @@ import {
defaultCidr,
defaultServiceRange,
} from '@/pages/create-subnet/subnetCreate.constants';
+import { isValidCidr } from '@/utils/cidr';
+import {
+ getDisplayName,
+ getSubnetFromCidr,
+ isValidVlanNumber,
+} from '@/utils/vrack-services';
const sharedTrackingParams = {
location: PageLocation.popup,
diff --git a/packages/manager/apps/vrack-services/src/pages/subnets/onboarding/SubnetsOnboarding.page.tsx b/packages/manager/apps/vrack-services/src/pages/subnets/onboarding/SubnetsOnboarding.page.tsx
index 97694c49a3bf..57c72bbb8286 100644
--- a/packages/manager/apps/vrack-services/src/pages/subnets/onboarding/SubnetsOnboarding.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/subnets/onboarding/SubnetsOnboarding.page.tsx
@@ -4,9 +4,10 @@ import { useTranslation } from 'react-i18next';
import { Navigate, useParams } from 'react-router-dom';
import { OnboardingLayout } from '@/components/layout-helpers/OnboardingLayout.component';
import onboardingImgSrc from '@/assets/onboarding-img.png';
-import { hasSubnet, isEditable, useVrackService } from '@/data';
+import { useVrackService } from '@/data/hooks';
import { useNavigateToCreateSubnetPage } from '../subnets.hook';
import { urls } from '@/routes/routes.constants';
+import { hasSubnet, isEditable } from '@/utils/vrack-services';
export default function SubnetsOnboarding() {
const { t } = useTranslation('vrack-services/subnets');
diff --git a/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetDatagrid.component.tsx b/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetDatagrid.component.tsx
index 4374b5f0afc0..86ad16c94e0a 100644
--- a/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetDatagrid.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetDatagrid.component.tsx
@@ -8,8 +8,9 @@ import {
DataGridTextCell,
ColumnSort,
} from '@ovh-ux/manager-react-components';
-import { useVrackService, Subnet } from '@/data';
import { SubnetsActionCell } from './SubnetsActionCell.component';
+import { Subnet } from '@/types';
+import { useVrackService } from '@/data/hooks';
const sortSubnets = (sorting: ColumnSort, subnetList: Subnet[] = []) => {
subnetList.sort((s1, s2) => {
diff --git a/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetsActionCell.component.tsx b/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetsActionCell.component.tsx
index b7c3e6f679f3..92f7831646a9 100644
--- a/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetsActionCell.component.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetsActionCell.component.tsx
@@ -8,8 +8,9 @@ import {
} from '@ovh-ux/manager-react-shell-client';
import { ActionMenu } from '@ovh-ux/manager-react-components';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
-import { isEditable, VrackServicesWithIAM } from '@/data';
import { urls } from '@/routes/routes.constants';
+import { VrackServicesWithIAM } from '@/types';
+import { isEditable } from '@/utils/vrack-services';
export type SubnetsActionCellProps = {
vs: VrackServicesWithIAM;
diff --git a/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetsListing.page.tsx b/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetsListing.page.tsx
index 4594590d6e43..e1f5354631e3 100644
--- a/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetsListing.page.tsx
+++ b/packages/manager/apps/vrack-services/src/pages/subnets/subnets-listing/SubnetsListing.page.tsx
@@ -20,8 +20,9 @@ import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { PageLayout } from '@/components/layout-helpers';
import { SubnetDatagrid } from './SubnetDatagrid.component';
import { useNavigateToCreateSubnetPage } from '../subnets.hook';
-import { hasSubnet, useVrackService } from '@/data';
+import { useVrackService } from '@/data/hooks';
import { urls } from '@/routes/routes.constants';
+import { hasSubnet } from '@/utils/vrack-services';
export default function SubnetsListing() {
const { id } = useParams();
diff --git a/packages/manager/apps/vrack-services/src/data/api.type.ts b/packages/manager/apps/vrack-services/src/types/api.type.ts
similarity index 95%
rename from packages/manager/apps/vrack-services/src/data/api.type.ts
rename to packages/manager/apps/vrack-services/src/types/api.type.ts
index a97c56912c5b..50266fbe8659 100644
--- a/packages/manager/apps/vrack-services/src/data/api.type.ts
+++ b/packages/manager/apps/vrack-services/src/types/api.type.ts
@@ -101,3 +101,8 @@ export type NonExpiringService = {
serviceId: number;
status: 'expired' | 'inCreation' | 'ok' | 'pendingDebt' | 'unPaid';
};
+
+export type GetVrackServicesResourceListParams = {
+ /** Pagination cursor */
+ cursor?: 'next' | 'prev';
+};
diff --git a/packages/manager/apps/vrack-services/src/data/iam/iam.type.ts b/packages/manager/apps/vrack-services/src/types/iam.type.ts
similarity index 100%
rename from packages/manager/apps/vrack-services/src/data/iam/iam.type.ts
rename to packages/manager/apps/vrack-services/src/types/iam.type.ts
diff --git a/packages/manager/apps/vrack-services/src/types/index.ts b/packages/manager/apps/vrack-services/src/types/index.ts
new file mode 100644
index 000000000000..aa0c8cd7cd3c
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/types/index.ts
@@ -0,0 +1,4 @@
+export * from './vrack-services.type';
+export * from './api.type';
+export * from './iam.type';
+export * from './vrack.type';
diff --git a/packages/manager/apps/vrack-services/src/data/vrack-services/vrack-services.type.ts b/packages/manager/apps/vrack-services/src/types/vrack-services.type.ts
similarity index 96%
rename from packages/manager/apps/vrack-services/src/data/vrack-services/vrack-services.type.ts
rename to packages/manager/apps/vrack-services/src/types/vrack-services.type.ts
index bce2be5fe6da..d929d9af6292 100644
--- a/packages/manager/apps/vrack-services/src/data/vrack-services/vrack-services.type.ts
+++ b/packages/manager/apps/vrack-services/src/types/vrack-services.type.ts
@@ -1,4 +1,4 @@
-import { Task, IamMetadata } from '../api.type';
+import { Task, IamMetadata } from './api.type';
export type Region = {
name: string;
diff --git a/packages/manager/apps/vrack-services/src/types/vrack.type.ts b/packages/manager/apps/vrack-services/src/types/vrack.type.ts
new file mode 100644
index 000000000000..d8aa8cc38f9c
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/types/vrack.type.ts
@@ -0,0 +1,33 @@
+import { AllowedService, IamMetadata } from '@/types/api.type';
+
+export type Vrack = {
+ name: string;
+ description: string;
+};
+
+export type VrackWithIAM = Vrack & IamMetadata;
+
+export type VrackTask = {
+ function: string;
+ id: number;
+ lastUpdate: Date;
+ orderId?: number;
+ serviceName: string;
+ status: string;
+ targetDomain?: string;
+ todoDate: Date;
+};
+
+export type GetVrackAllowedServicesParams = {
+ /** Filter on a specific service family */
+ serviceFamily: AllowedService;
+ /** The internal name of your vrack */
+ vrack: string;
+};
+
+export type AssociateVrackServicesParams = {
+ /** The internal name of your vrack */
+ vrack: string;
+ /** vrackServices service name */
+ vrackServices: string;
+};
diff --git a/packages/manager/apps/vrack-services/src/utils/cidr.ts b/packages/manager/apps/vrack-services/src/utils/cidr.ts
new file mode 100644
index 000000000000..6fc6cbdc0d43
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/utils/cidr.ts
@@ -0,0 +1,8 @@
+// Regular expression pattern for /24 subnet
+export const pattern =
+ '^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?).){2}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?).0/24$';
+
+// The subnet address is limited to only "/24".
+export const isValidCidr = (subnet: string): boolean => {
+ return new RegExp(pattern).test(subnet);
+};
diff --git a/packages/manager/apps/vrack-services/src/utils/vrack-services.ts b/packages/manager/apps/vrack-services/src/utils/vrack-services.ts
new file mode 100644
index 000000000000..10120c59a775
--- /dev/null
+++ b/packages/manager/apps/vrack-services/src/utils/vrack-services.ts
@@ -0,0 +1,18 @@
+import { ProductStatus, ResourceStatus, VrackServicesWithIAM } from '@/types';
+
+export const isEditable = (vs?: VrackServicesWithIAM) =>
+ vs?.resourceStatus === ResourceStatus.READY &&
+ [ProductStatus.ACTIVE, ProductStatus.DRAFT].includes(
+ vs?.currentState.productStatus,
+ );
+
+export const hasSubnet = (vs?: VrackServicesWithIAM) =>
+ vs?.currentState.subnets.length > 0;
+
+export const getSubnetFromCidr = (vs?: VrackServicesWithIAM, cidr?: string) =>
+ vs?.currentState?.subnets.find((s) => s.cidr === cidr);
+
+export const getDisplayName = (vs?: VrackServicesWithIAM) =>
+ vs?.iam?.displayName || vs?.id;
+
+export const isValidVlanNumber = (vlan: number) => vlan >= 2 && vlan <= 4094;