Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
37 changes: 37 additions & 0 deletions components/databricks/actions/create-endpoint/create-endpoint.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ConfigurationError } from "@pipedream/platform";
import databricks from "../../databricks.app.mjs";

export default {
key: "databricks-create-endpoint",
name: "Create Endpoint",
description: "Create a new vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/createendpoint)",
version: "0.0.1",
type: "action",
props: {
databricks,
name: {
type: "string",
label: "Endpoint Name",
description: "The name of the vector search endpoint",
},
},
async run({ $ }) {
try {
const response = await this.databricks.createEndpoint({
data: {
name: this.name,
endpoint_type: "STANDARD",
},
$,
});

if (response) {
$.export("$summary", `Successfully created endpoint with ID ${response.id}.`);
}

return response;
} catch ({ response }) {
throw new ConfigurationError(response.data.message);
}
},
};
27 changes: 27 additions & 0 deletions components/databricks/actions/delete-endpoint/delete-endpoint.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import databricks from "../../databricks.app.mjs";

export default {
key: "databricks-delete-endpoint",
name: "Delete Endpoint",
description: "Delete a vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/deleteendpoint)",
version: "0.0.1",
type: "action",
props: {
databricks,
endpointName: {
propDefinition: [
databricks,
"endpointName",
],
},
},
async run({ $ }) {
const response = await this.databricks.deleteEndpoint({
endpointName: this.endpointName,
$,
});

$.export("$summary", `Successfully deleted endpoint "${this.endpointName}".`);
return response;
},
};
30 changes: 30 additions & 0 deletions components/databricks/actions/get-endpoint/get-endpoint.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import databricks from "../../databricks.app.mjs";

export default {
key: "databricks-get-endpoint",
name: "Get Endpoint",
description: "Get details of a specific vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/getendpoint)",
version: "0.0.1",
type: "action",
props: {
databricks,
endpointName: {
propDefinition: [
databricks,
"endpointName",
],
},
},
async run({ $ }) {
const response = await this.databricks.getEndpoint({
endpointName: this.endpointName,
$,
});

if (response) {
$.export("$summary", `Successfully retrieved endpoint "${this.endpointName}".`);
}

return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-get-run-output",
name: "Get Run Output",
description: "Retrieve the output and metadata of a single task run. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-get-output)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
45 changes: 45 additions & 0 deletions components/databricks/actions/list-endpoints/list-endpoints.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import databricks from "../../databricks.app.mjs";

export default {
key: "databricks-list-endpoints",
name: "List Endpoints",
description: "List all vector search endpoints. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/listendpoints)",
version: "0.0.1",
type: "action",
props: {
databricks,
maxResults: {
type: "integer",
label: "Max Results",
description: "Maximum number of endpoints to return",
default: 100,
},
},
async run({ $ }) {
const allEndpoints = [];
const params = {};

do {
const {
endpoints, next_page_token,
} = await this.databricks.listEndpoints({
params,
$,
});

allEndpoints.push(...endpoints);
if (!next_page_token) break;
params.page_token = next_page_token;
} while (allEndpoints.length < this.maxResults);

if (allEndpoints.length > this.maxResults) {
allEndpoints.length = this.maxResults;
}

$.export("$summary", `Successfully retrieved ${allEndpoints.length} endpoint${allEndpoints.length === 1
? ""
: "s"}.`);

return allEndpoints;
},
};
2 changes: 1 addition & 1 deletion components/databricks/actions/list-runs/list-runs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-list-runs",
name: "List Runs",
description: "Lists all runs available to the user. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-list)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
2 changes: 1 addition & 1 deletion components/databricks/actions/run-job-now/run-job-now.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-run-job-now",
name: "Run Job Now",
description: "Run a job now and return the id of the triggered run. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-list)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
51 changes: 51 additions & 0 deletions components/databricks/databricks.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ export default {
})) || [];
},
},
endpointName: {
type: "string",
label: "Endpoint Name",
description: "The name of the vector search endpoint",
async options({ prevContext }) {
const {
endpoints, next_page_token,
} = await this.listEndpoints({
params: {
page_token: prevContext.page_token,
},
});

return {
options: endpoints.map(({ name }) => name),
context: {
page_token: next_page_token,
},
};
},
},
},
methods: {
_baseUrl() {
Expand Down Expand Up @@ -90,5 +111,35 @@ export default {
...args,
});
},
createEndpoint(args = {}) {
return this._makeRequest({
path: "/vector-search/endpoints",
method: "POST",
...args,
});
},
getEndpoint({
endpointName, ...opts
}) {
return this._makeRequest({
path: `/vector-search/endpoints/${endpointName}`,
...opts,
});
},
listEndpoints(args = {}) {
return this._makeRequest({
path: "/vector-search/endpoints",
...args,
});
},
deleteEndpoint({
endpointName, ...opts
}) {
return this._makeRequest({
path: `/vector-search/endpoints/${endpointName}`,
method: "DELETE",
...opts,
});
},
},
};
4 changes: 2 additions & 2 deletions components/databricks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/databricks",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream Databricks Components",
"main": "databricks.app.mjs",
"keywords": [
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.5.1"
"@pipedream/platform": "^3.1.0"
}
}
10 changes: 4 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading