mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
added custom instance URLs to databricks
This commit is contained in:
@@ -15,6 +15,7 @@ export enum Integrations {
|
||||
FLYIO = "flyio",
|
||||
LARAVELFORGE = "laravel-forge",
|
||||
CIRCLECI = "circleci",
|
||||
DATABRICKS = "databricks",
|
||||
TRAVISCI = "travisci",
|
||||
TEAMCITY = "teamcity",
|
||||
SUPABASE = "supabase",
|
||||
@@ -73,6 +74,7 @@ export enum IntegrationUrls {
|
||||
RAILWAY_API_URL = "https://backboard.railway.app/graphql/v2",
|
||||
FLYIO_API_URL = "https://api.fly.io/graphql",
|
||||
CIRCLECI_API_URL = "https://circleci.com/api",
|
||||
DATABRICKS_API_URL = "https:/dbc-5e0185c0-20ac.cloud.databricks.com/api",
|
||||
TRAVISCI_API_URL = "https://api.travis-ci.com",
|
||||
SUPABASE_API_URL = "https://api.supabase.com",
|
||||
LARAVELFORGE_API_URL = "https://forge.laravel.com",
|
||||
@@ -210,6 +212,15 @@ export const getIntegrationOptions = async () => {
|
||||
clientId: "",
|
||||
docsLink: ""
|
||||
},
|
||||
{
|
||||
name: "Databricks",
|
||||
slug: "databricks",
|
||||
image: "Databricks.png",
|
||||
isAvailable: true,
|
||||
type: "pat",
|
||||
clientId: "",
|
||||
docsLink: ""
|
||||
},
|
||||
{
|
||||
name: "GitLab",
|
||||
slug: "gitlab",
|
||||
|
||||
@@ -2090,18 +2090,22 @@ const syncSecretsCircleCI = async ({
|
||||
*/
|
||||
const syncSecretsDatabricks = async ({
|
||||
integration,
|
||||
integrationAuth,
|
||||
secrets,
|
||||
accessToken
|
||||
}: {
|
||||
integration: TIntegrations;
|
||||
integrationAuth: TIntegrationAuths;
|
||||
secrets: Record<string, { value: string; comment?: string }>;
|
||||
accessToken: string;
|
||||
}) => {
|
||||
const databricksApiUrl = `${integrationAuth.url}/api`;
|
||||
|
||||
// sync secrets to Databricks
|
||||
await Promise.all(
|
||||
Object.keys(secrets).map(async (key) =>
|
||||
request.post(
|
||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/put`,
|
||||
`${databricksApiUrl}/2.0/secrets/put`,
|
||||
{
|
||||
scope: integration.app,
|
||||
key,
|
||||
@@ -2120,7 +2124,7 @@ const syncSecretsDatabricks = async ({
|
||||
// get secrets from Databricks
|
||||
const getSecretsRes = (
|
||||
await request.get<{ secrets: { key: string; last_updated_timestamp: number }[] }>(
|
||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/list`,
|
||||
`${databricksApiUrl}/2.0/secrets/list`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
@@ -2138,7 +2142,7 @@ const syncSecretsDatabricks = async ({
|
||||
getSecretsRes.map(async (sec) => {
|
||||
if (!(sec.key in secrets)) {
|
||||
return request.post(
|
||||
`${IntegrationUrls.DATABRICKS_API_URL}/2.0/secrets/delete`,
|
||||
`${databricksApiUrl}/2.0/secrets/delete`,
|
||||
{
|
||||
scope: integration.app,
|
||||
key: sec.key
|
||||
@@ -4094,6 +4098,7 @@ export const syncIntegrationSecrets = async ({
|
||||
case Integrations.DATABRICKS:
|
||||
await syncSecretsDatabricks({
|
||||
integration,
|
||||
integrationAuth,
|
||||
secrets,
|
||||
accessToken
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@ Prerequisites:
|
||||
|
||||

|
||||
|
||||
Press on the Databricks tile and input your Databricks Access Token to grant Infisical the necessary permissions in your Databricks account.
|
||||
Press on the Databricks tile and enter your Databricks instance URL in the followung format: `https://xxx.cloud.databricks.com`. Then, input your Databricks Access Token to grant Infisical the necessary permissions in your Databricks account.
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -15,22 +15,30 @@ export default function DatabricksCreateIntegrationPage() {
|
||||
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||
|
||||
const [apiKey, setApiKey] = useState("");
|
||||
const [instanceURL, setInstanceURL] = useState("");
|
||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||
const [instanceURLErrorText, setInstanceURLErrorText] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const handleButtonClick = async () => {
|
||||
try {
|
||||
setApiKeyErrorText("");
|
||||
setInstanceURLErrorText("");
|
||||
if (apiKey.length === 0) {
|
||||
setApiKeyErrorText("API Key cannot be blank");
|
||||
return;
|
||||
}
|
||||
if (instanceURL.length === 0) {
|
||||
setInstanceURLErrorText("Instance URL cannot be blank");
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
|
||||
const integrationAuth = await mutateAsync({
|
||||
workspaceId: localStorage.getItem("projectData.id"),
|
||||
integration: "databricks",
|
||||
url: instanceURL,
|
||||
accessToken: apiKey
|
||||
});
|
||||
|
||||
@@ -78,12 +86,20 @@ export default function DatabricksCreateIntegrationPage() {
|
||||
</div>
|
||||
</CardTitle>
|
||||
<FormControl
|
||||
label="Databricks Access Token"
|
||||
label="Databricks Instance URL"
|
||||
errorText={instanceURLErrorText}
|
||||
isError={instanceURLErrorText !== "" ?? false}
|
||||
className="px-6"
|
||||
>
|
||||
<Input value={instanceURL} onChange={(e) => setInstanceURL(e.target.value)} placeholder="https://xxxx.cloud.databricks.com" />
|
||||
</FormControl>
|
||||
<FormControl
|
||||
label="Access Token"
|
||||
errorText={apiKeyErrorText}
|
||||
isError={apiKeyErrorText !== "" ?? false}
|
||||
className="px-6"
|
||||
>
|
||||
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} />
|
||||
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} type="password" />
|
||||
</FormControl>
|
||||
<Button
|
||||
onClick={handleButtonClick}
|
||||
|
||||
Reference in New Issue
Block a user