mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-19 02:25:07 +00:00
feature: databricks sync
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { readLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||
import {
|
||||
CreateDatabricksConnectionSchema,
|
||||
SanitizedDatabricksConnectionSchema,
|
||||
UpdateDatabricksConnectionSchema
|
||||
} from "@app/services/app-connection/databricks";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
|
||||
|
||||
export const registerDatabricksConnectionRouter = async (server: FastifyZodProvider) => {
|
||||
registerAppConnectionEndpoints({
|
||||
app: AppConnection.Databricks,
|
||||
server,
|
||||
sanitizedResponseSchema: SanitizedDatabricksConnectionSchema,
|
||||
createSchema: CreateDatabricksConnectionSchema,
|
||||
updateSchema: UpdateDatabricksConnectionSchema
|
||||
});
|
||||
|
||||
// The below endpoints are not exposed and for Infisical App use
|
||||
|
||||
server.route({
|
||||
method: "GET",
|
||||
url: `/:connectionId/secret-scopes`,
|
||||
config: {
|
||||
rateLimit: readLimit
|
||||
},
|
||||
schema: {
|
||||
params: z.object({
|
||||
connectionId: z.string().uuid()
|
||||
}),
|
||||
response: {
|
||||
200: z.object({
|
||||
secretScopes: z.object({ name: z.string() }).array()
|
||||
})
|
||||
}
|
||||
},
|
||||
onRequest: verifyAuth([AuthMode.JWT]),
|
||||
handler: async (req) => {
|
||||
const { connectionId } = req.params;
|
||||
|
||||
const secretScopes = await server.services.appConnection.databricks.listSecretScopes(
|
||||
connectionId,
|
||||
req.permission
|
||||
);
|
||||
|
||||
return { secretScopes };
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user