From a89bc35fa95e18ac55c765dbd302d3fa24a9fa5f Mon Sep 17 00:00:00 2001 From: YanJin Date: Mon, 19 Sep 2022 17:49:08 +0200 Subject: [PATCH] ZKUI-259: Add Outscale as a custom S3 Location --- .../LocationDetailsAwsCustom.tsx | 8 +++++++ .../LocationDetails/storageOptions.ts | 22 +++++++++++++++++++ src/react/backend/location/utils.tsx | 6 ++++- src/react/utils/storageOptions.ts | 8 +++++++ src/types/config.ts | 13 ++++++++++- 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/react/backend/location/LocationDetails/LocationDetailsAwsCustom.tsx b/src/react/backend/location/LocationDetails/LocationDetailsAwsCustom.tsx index 61fc69573..3411337c7 100644 --- a/src/react/backend/location/LocationDetails/LocationDetailsAwsCustom.tsx +++ b/src/react/backend/location/LocationDetails/LocationDetailsAwsCustom.tsx @@ -22,6 +22,10 @@ import { LocationTypeKey, ORANGE_S3_ENDPOINT, ORANGE_S3_LOCATION_KEY, + OUTSCALE_PUBLIC_S3_ENDPOINT, + OUTSCALE_PUBLIC_S3_LOCATION_KEY, + OUTSCALE_SNC_S3_ENDPOINT, + OUTSCALE_SNC_S3_LOCATION_KEY, } from '../../../../types/config'; import { checkIsRingS3Reseller } from '../utils'; @@ -30,6 +34,10 @@ const computeInitialEndpoint = (locationType: LocationTypeKey) => { return { endpoint: JAGUAR_S3_ENDPOINT }; } else if (locationType === ORANGE_S3_LOCATION_KEY) { return { endpoint: ORANGE_S3_ENDPOINT }; + } else if (locationType === OUTSCALE_PUBLIC_S3_LOCATION_KEY) { + return { endpoint: OUTSCALE_PUBLIC_S3_ENDPOINT }; + } else if (locationType === OUTSCALE_SNC_S3_LOCATION_KEY) { + return { endpoint: OUTSCALE_SNC_S3_ENDPOINT }; } else { return {}; } diff --git a/src/react/backend/location/LocationDetails/storageOptions.ts b/src/react/backend/location/LocationDetails/storageOptions.ts index 395023221..b4bef008b 100644 --- a/src/react/backend/location/LocationDetails/storageOptions.ts +++ b/src/react/backend/location/LocationDetails/storageOptions.ts @@ -2,6 +2,8 @@ import { JAGUAR_S3_LOCATION_KEY, LocationTypeKey, ORANGE_S3_LOCATION_KEY, + OUTSCALE_PUBLIC_S3_LOCATION_KEY, + OUTSCALE_SNC_S3_LOCATION_KEY, } from '../../../../types/config'; import LocationDetailsAws from './LocationDetailsAws'; import LocationDetailsAwsCustom from './LocationDetailsAwsCustom'; @@ -97,6 +99,26 @@ export const storageOptions: Record = { hasIcon: false, checkCapability: 'locationTypeS3Custom', }, + [OUTSCALE_PUBLIC_S3_LOCATION_KEY]: { + name: '3DS Outscale OOS Public', + short: 'OOS Public', + formDetails: LocationDetailsAwsCustom, + supportsVersioning: true, + supportsReplicationTarget: true, + supportsReplicationSource: true, + hasIcon: false, + checkCapability: 'locationTypeS3Custom', + }, + [OUTSCALE_SNC_S3_LOCATION_KEY]: { + name: '3DS Outscale OOS SNC', + short: 'OOS SNC', + formDetails: LocationDetailsAwsCustom, + supportsVersioning: true, + supportsReplicationTarget: true, + supportsReplicationSource: true, + hasIcon: false, + checkCapability: 'locationTypeS3Custom', + }, [ORANGE_S3_LOCATION_KEY]: { name: 'Flexible Datastore', short: 'OBS S3', diff --git a/src/react/backend/location/utils.tsx b/src/react/backend/location/utils.tsx index 6b5989e3f..487b36667 100644 --- a/src/react/backend/location/utils.tsx +++ b/src/react/backend/location/utils.tsx @@ -8,6 +8,8 @@ import { Locations as LocationsType, LocationTypeKey, ORANGE_S3_LOCATION_KEY, + OUTSCALE_PUBLIC_S3_LOCATION_KEY, + OUTSCALE_SNC_S3_LOCATION_KEY, Replication, } from '../../../types/config'; import type { @@ -284,7 +286,9 @@ function renderLocation(location: Location) { export const checkIsRingS3Reseller = (locationType: LocationTypeKey) => { return ( locationType === JAGUAR_S3_LOCATION_KEY || - locationType === ORANGE_S3_LOCATION_KEY + locationType === ORANGE_S3_LOCATION_KEY || + locationType === OUTSCALE_PUBLIC_S3_LOCATION_KEY || + locationType === OUTSCALE_SNC_S3_LOCATION_KEY ); }; diff --git a/src/react/utils/storageOptions.ts b/src/react/utils/storageOptions.ts index 19e7fca26..95b6867a3 100644 --- a/src/react/utils/storageOptions.ts +++ b/src/react/utils/storageOptions.ts @@ -11,6 +11,10 @@ import { Locations, ORANGE_S3_ENDPOINT, ORANGE_S3_LOCATION_KEY, + OUTSCALE_PUBLIC_S3_ENDPOINT, + OUTSCALE_PUBLIC_S3_LOCATION_KEY, + OUTSCALE_SNC_S3_ENDPOINT, + OUTSCALE_SNC_S3_LOCATION_KEY, } from '../../types/config'; import { LocationForm } from '../../types/location'; export function checkSupportsReplicationTarget(locations: Locations): boolean { @@ -46,6 +50,10 @@ export const getLocationTypeKey = (location: LocationForm | Location) => { return JAGUAR_S3_LOCATION_KEY; } else if (location.details.endpoint === ORANGE_S3_ENDPOINT) { return ORANGE_S3_LOCATION_KEY; + } else if (location.details.endpoint === OUTSCALE_PUBLIC_S3_ENDPOINT) { + return OUTSCALE_PUBLIC_S3_LOCATION_KEY; + } else if (location.details.endpoint === OUTSCALE_SNC_S3_ENDPOINT) { + return OUTSCALE_SNC_S3_LOCATION_KEY; } else { return location.locationType; } diff --git a/src/types/config.ts b/src/types/config.ts index 3d5e208d6..078d3c369 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -5,9 +5,18 @@ import { Tag } from './s3'; // locations export const JAGUAR_S3_ENDPOINT = 'https://s3.fr-lyo.jaguar-network.com'; export const JAGUAR_S3_LOCATION_KEY = 'location-jaguar-ring-s3-v1'; + export const ORANGE_S3_ENDPOINT = 'https://cloud.orange-business.com'; export const ORANGE_S3_LOCATION_KEY = 'location-orange-ring-s3-v1'; +export const OUTSCALE_PUBLIC_S3_ENDPOINT = 'https://oos.eu-west-2.outscale.com'; +export const OUTSCALE_PUBLIC_S3_LOCATION_KEY = + 'location-3ds-outscale-oos-public'; + +export const OUTSCALE_SNC_S3_ENDPOINT = + 'https://oos.cloudgouv-eu-west-1.outscale.com'; +export const OUTSCALE_SNC_S3_LOCATION_KEY = 'location-3ds-outscale-oos-snc'; + export type LocationName = string; type LocationS3Type = @@ -15,7 +24,9 @@ type LocationS3Type = | 'location-scality-ring-s3-v1' | 'location-jaguar-ring-s3-v1' | 'location-orange-ring-s3-v1' - | 'location-aws-s3-v1'; + | 'location-aws-s3-v1' + | 'location-3ds-outscale-oos-public' + | 'location-3ds-outscale-oos-snc'; type LocationFSType = | 'location-scality-hdclient-v2' | 'location-aws-s3-v1'