in client/src/components/special/AWSRegionTag.js [96:245]
get zoneInfo () {
if (this.zone) {
const simpleZone = this.zone.toLowerCase().split('-')[0];
let getGlobalFn = () => ({
zone: simpleZone,
result: simpleZone
});
if (this.provider === 'AZURE' || this.zone.split('-').length === 1) {
getGlobalFn = () => {
const checkZones = [
{
check: [
'germany',
'france',
'northeurope',
'westeurope',
'eu',
'europe',
'ge',
'fr',
'it',
'es',
'be',
'po',
'fi',
'sw'
],
result: 'eu'
},
{
check: ['canada', 'ca'],
result: 'ca'
},
{
check: ['china', 'ch'],
result: 'cn'
},
{
check: ['korea'],
result: 'ap ap-northeast-2'
},
{
check: ['japan'],
result: 'ap ap-northeast-3'
},
{
check: ['india'],
result: 'ap ap-south-1'
},
{
check: ['australia'],
result: 'ap ap-southeast-2'
},
{
check: ['eastasia'],
result: 'ap ap-southeast-1'
},
{
check: ['brazil'],
result: 'sa'
},
{
check: ['uk'],
result: 'eu'
},
{
check: ['us', 'usa'],
result: 'us'
}
];
const zone = this.zone.toLowerCase();
const [result] = checkZones.filter(z => {
const [r] = z.check.filter(c => zone.indexOf(c) >= 0);
return !!r;
});
if (result) {
return {
region: zone,
result: result.result,
zone
};
}
return null;
};
} else if (this.provider === 'GCP') {
getGlobalFn = () => {
const checkZones = [
{
region: 'asia',
subRegion: 'east1',
result: 'taiwan'
},
{
region: 'asia',
subRegion: 'east2',
result: 'cn'
},
{
region: 'asia',
subRegion: 'northeast1',
result: 'ap ap-northeast-1'
},
{
region: 'asia',
subRegion: 'south1',
result: 'ap ap-south-1'
},
{
region: 'asia',
subRegion: 'southeast1',
result: 'ap ap-southeast-1'
},
{
region: 'australia',
result: 'ap ap-southeast-2'
},
{
region: 'europe',
result: 'eu'
},
{
region: 'northamerica',
result: 'ca'
},
{
region: 'southamerica',
result: 'sa'
},
{
region: 'us',
result: 'us'
}
];
const zone = this.zone.toLowerCase();
const [region, subRegion] = zone.split('-');
let [result] = checkZones.filter(z => {
return z.region.toLowerCase() === region &&
(z.subRegion || '').toLowerCase() === (subRegion || '');
});
if (!result) {
[result] = checkZones.filter(z => z.region.toLowerCase() === region);
}
return {...result, zone};
};
}
return getGlobalFn();
}
return null;
}