Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZKUI-259: Add Outscale as a custom S3 Location #462

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions src/react/backend/location/__tests__/LocationEditor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ describe('LocationEditor', () => {
'Google Cloud Storage',
'Microsoft Azure Blob Storage',
'Atlas Object Storage',
'3DS Outscale OOS Public',
'3DS Outscale OOS SNC',
'Flexible Datastore',
'Tape DMF',
].forEach((locationName) => {
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