mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 14:27:59 +00:00
added databricks integration
This commit is contained in:
@@ -2085,6 +2085,76 @@ const syncSecretsCircleCI = async ({
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sync/push [secrets] to Databricks project
|
||||
*/
|
||||
const syncSecretsDatabricks = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
}: {
|
||||
integration: TIntegrations;
|
||||
secrets: Record<string, { value: string; comment?: string }>;
|
||||
accessToken: string;
|
||||
}) => {
|
||||
// sync secrets to Databricks
|
||||
await Promise.all(
|
||||
Object.keys(secrets).map(async (key) =>
|
||||
request.post(
|
||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/put`,
|
||||
{
|
||||
scope: integration.app,
|
||||
key,
|
||||
string_value: secrets[key].value
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
"Accept-Encoding": "application/json"
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// get secrets from Databricks
|
||||
const getSecretsRes = (
|
||||
await request.get<{ secrets: { key: string; last_updated_timestamp: number }[] }>(
|
||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/list`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
params: {
|
||||
scope: integration.app
|
||||
}
|
||||
}
|
||||
)
|
||||
).data.secrets;
|
||||
|
||||
// delete secrets from Databricks
|
||||
await Promise.all(
|
||||
getSecretsRes.map(async (sec) => {
|
||||
if (!(sec.key in secrets)) {
|
||||
return request.post(
|
||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/delete`,
|
||||
{
|
||||
scope: integration.app,
|
||||
key: sec.key
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sync/push [secrets] to TravisCI project
|
||||
*/
|
||||
@@ -4021,6 +4091,13 @@ export const syncIntegrationSecrets = async ({
|
||||
accessToken
|
||||
});
|
||||
break;
|
||||
case Integrations.DATABRICKS:
|
||||
await syncSecretsDatabricks({
|
||||
integration,
|
||||
secrets,
|
||||
accessToken
|
||||
});
|
||||
break;
|
||||
case Integrations.LARAVELFORGE:
|
||||
await syncSecretsLaravelForge({
|
||||
integration,
|
||||
|
||||
Reference in New Issue
Block a user