Skip to content

Commit 45732e1

Browse files
authored
feat: add different auth methods for external datasource (#2982)
1 parent 2fb30ad commit 45732e1

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

src/containers/Tenant/Info/ExternalDataSource/ExternalDataSource.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,28 @@ const prepareExternalDataSourceSummary = (data: TEvDescribeSchemeResult) => {
2828
return info;
2929
};
3030

31+
function getAuthMethodValue(data: TEvDescribeSchemeResult) {
32+
const {Auth} = data.PathDescription?.ExternalDataSourceDescription || {};
33+
if (Auth?.ServiceAccount) {
34+
return i18n('external-objects.auth-method.service-account');
35+
}
36+
if (Auth?.Aws) {
37+
return i18n('external-objects.auth-method.aws');
38+
}
39+
if (Auth?.Token) {
40+
return i18n('external-objects.auth-method.token');
41+
}
42+
if (Auth?.Basic) {
43+
return i18n('external-objects.auth-method.basic');
44+
}
45+
if (Auth?.MdbBasic) {
46+
return i18n('external-objects.auth-method.mdb-basic');
47+
}
48+
return i18n('external-objects.auth-method.none');
49+
}
50+
3151
const prepareExternalDataSourceInfo = (data: TEvDescribeSchemeResult): InfoViewerItem[] => {
32-
const {Location, Auth} = data.PathDescription?.ExternalDataSourceDescription || {};
52+
const {Location} = data.PathDescription?.ExternalDataSourceDescription || {};
3353

3454
return [
3555
...prepareExternalDataSourceSummary(data),
@@ -47,9 +67,7 @@ const prepareExternalDataSourceInfo = (data: TEvDescribeSchemeResult): InfoViewe
4767
},
4868
{
4969
label: i18n('external-objects.auth-method'),
50-
value: Auth?.ServiceAccount
51-
? i18n('external-objects.auth-method.service-account')
52-
: i18n('external-objects.auth-method.none'),
70+
value: getAuthMethodValue(data),
5371
},
5472
];
5573
};

src/containers/Tenant/Info/i18n/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
"external-objects.auth-method": "Auth Method",
66
"external-objects.auth-method.none": "None",
77
"external-objects.auth-method.service-account": "Service Account",
8+
"external-objects.auth-method.aws": "AWS",
9+
"external-objects.auth-method.token": "Token",
10+
"external-objects.auth-method.basic": "Basic",
11+
"external-objects.auth-method.mdb-basic": "MDB Basic",
812

913
"view.query-text": "Query Text",
1014

src/types/api/schema/externalDataSource.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export interface TExternalDataSourceDescription {
1414
interface TAuth {
1515
None?: NoneAuth;
1616
ServiceAccount?: ServiceAccountAuth;
17+
Aws?: AwsAuth;
18+
Token?: Token;
19+
MdbBasic?: MdbBasic;
20+
Basic?: Basic;
1721
}
1822

1923
interface NoneAuth {}
@@ -22,3 +26,24 @@ interface ServiceAccountAuth {
2226
Id?: string;
2327
SecretName?: string;
2428
}
29+
interface AwsAuth {
30+
AwsSecretAccessKeySecretName?: string;
31+
AwsRegion?: string;
32+
AwsAccessKeyIdSecretName?: string;
33+
}
34+
35+
interface Basic {
36+
Login?: string;
37+
PasswordSecretName?: string;
38+
}
39+
40+
interface MdbBasic {
41+
ServiceAccountId?: string;
42+
ServiceAccountSecretName?: string;
43+
Login?: string;
44+
PasswordSecretName?: string;
45+
}
46+
47+
interface Token {
48+
TokenSecretName?: string;
49+
}

0 commit comments

Comments
 (0)