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

[Backport main] Fix data connection api 404 error #1812

Merged
merged 1 commit into from
May 2, 2024
Merged
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
23 changes: 23 additions & 0 deletions server/routes/data_connections/data_connections_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}),
},
},
async (context, request, response): Promise<any> => {

Check warning on line 28 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
try {
const dataConnectionsresponse = await context.observability_plugin.observabilityClient
.asScoped(request)
Expand All @@ -35,7 +35,7 @@
return response.ok({
body: dataConnectionsresponse,
});
} catch (error: any) {

Check warning on line 38 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Issue in fetching data connection:', error);
return response.custom({
statusCode: error.statusCode || 500,
Expand All @@ -54,7 +54,7 @@
}),
},
},
async (context, request, response): Promise<any> => {

Check warning on line 57 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
try {
const dataConnectionsresponse = await context.observability_plugin.observabilityClient
.asScoped(request)
Expand All @@ -64,7 +64,7 @@
return response.ok({
body: dataConnectionsresponse,
});
} catch (error: any) {

Check warning on line 67 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Issue in deleting data connection:', error);
return response.custom({
statusCode: error.statusCode || 500,
Expand All @@ -84,7 +84,7 @@
}),
},
},
async (context, request, response): Promise<any> => {

Check warning on line 87 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
try {
const dataConnectionsresponse = await context.observability_plugin.observabilityClient
.asScoped(request)
Expand All @@ -97,7 +97,7 @@
return response.ok({
body: dataConnectionsresponse,
});
} catch (error: any) {

Check warning on line 100 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Issue in modifying data connection:', error);
return response.custom({
statusCode: error.statusCode || 500,
Expand All @@ -117,7 +117,7 @@
}),
},
},
async (context, request, response): Promise<any> => {

Check warning on line 120 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
try {
const dataConnectionsresponse = await context.observability_plugin.observabilityClient
.asScoped(request)
Expand All @@ -130,7 +130,7 @@
return response.ok({
body: dataConnectionsresponse,
});
} catch (error: any) {

Check warning on line 133 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Issue in modifying data connection:', error);
return response.custom({
statusCode: error.statusCode || 500,
Expand All @@ -156,7 +156,7 @@
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 159 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
try {
const dataConnectionsresponse = await context.observability_plugin.observabilityClient
.asScoped(request)
Expand All @@ -171,7 +171,7 @@
return response.ok({
body: dataConnectionsresponse,
});
} catch (error: any) {

Check warning on line 174 in server/routes/data_connections/data_connections_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Issue in creating data source:', error);
return response.custom({
statusCode: error.statusCode || 500,
Expand All @@ -181,6 +181,29 @@
}
);

router.get(
{
path: `${DATACONNECTIONS_BASE}`,
validate: false,
},
async (context, request, response): Promise<any> => {
try {
const dataConnectionsresponse = await context.observability_plugin.observabilityClient
.asScoped(request)
.callAsCurrentUser('ppl.getDataConnections');
return response.ok({
body: dataConnectionsresponse,
});
} catch (error: any) {
console.error('Issue in fetching data sources:', error);
return response.custom({
statusCode: error.statusCode || 500,
body: error.response,
});
}
}
);

router.get(
{
path: `${DATACONNECTIONS_BASE}/dataSourceMDSId={dataSourceMDSId?}`,
Expand Down
Loading