Skip to content

Commit

Permalink
ZKUI-259: Add Outscale as a custom S3 Location
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengYanJin committed Sep 19, 2022
1 parent de9ce4d commit a89bc35
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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 {};
}
Expand Down
22 changes: 22 additions & 0 deletions src/react/backend/location/LocationDetails/storageOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -97,6 +99,26 @@ export const storageOptions: Record<LocationTypeKey, StorageOptionValues> = {
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',
Expand Down
6 changes: 5 additions & 1 deletion src/react/backend/location/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
);
};

Expand Down
8 changes: 8 additions & 0 deletions src/react/utils/storageOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
13 changes: 12 additions & 1 deletion src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,28 @@ 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 =
| 'location-scality-artesca-s3-v1'
| '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'
Expand Down

0 comments on commit a89bc35

Please sign in to comment.