Skip to content

Commit 1e6f76c

Browse files
committed
Merge branch 'master' into notion-api-update
2 parents 822de7f + ea4b419 commit 1e6f76c

File tree

149 files changed

+2558
-2278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+2558
-2278
lines changed

components/apimage/apimage.app.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "apimage",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};

components/apimage/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/apimage",
3+
"version": "0.0.1",
4+
"description": "Pipedream APImage Components",
5+
"main": "apimage.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"apimage"
9+
],
10+
"homepage": "https://pipedream.com/apps/apimage",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
import databricks from "../../databricks.app.mjs";
2+
import constants from "../../common/constants.mjs";
3+
import utils from "../../common/utils.mjs";
4+
import { ConfigurationError } from "@pipedream/platform";
5+
6+
export default {
7+
key: "databricks-create-sql-warehouse",
8+
name: "Create SQL Warehouse",
9+
description: "Creates a new SQL Warehouse in Databricks. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/create)",
10+
version: "0.0.1",
11+
type: "action",
12+
props: {
13+
databricks,
14+
name: {
15+
type: "string",
16+
label: "Warehouse Name",
17+
description: "A human-readable name for the warehouse",
18+
},
19+
clusterSize: {
20+
type: "string",
21+
label: "Cluster Size",
22+
description: "Size of the cluster",
23+
options: constants.CLUSTER_SIZES,
24+
},
25+
autoStopMinutes: {
26+
type: "integer",
27+
label: "Auto Stop (minutes)",
28+
description:
29+
"Minutes of inactivity before auto-stop. 0 disables auto-stop. Must be 0 or ≥ 10.",
30+
optional: true,
31+
default: 10,
32+
},
33+
minNumClusters: {
34+
type: "integer",
35+
label: "Min Number of Clusters",
36+
description: "Minimum number of clusters to maintain (> 0 and ≤ min(max_num_clusters, 30)).",
37+
optional: true,
38+
default: 1,
39+
},
40+
maxNumClusters: {
41+
type: "integer",
42+
label: "Max Number of Clusters",
43+
description: "Maximum number of clusters for autoscaler (≥ min_num_clusters and ≤ 30).",
44+
optional: true,
45+
default: 1,
46+
},
47+
enablePhoton: {
48+
type: "boolean",
49+
label: "Enable Photon",
50+
description: "Whether the warehouse should use Photon optimized clusters.",
51+
optional: true,
52+
},
53+
enableServerlessCompute: {
54+
type: "boolean",
55+
label: "Enable Serverless Compute",
56+
description: "Whether the warehouse should use serverless compute.",
57+
optional: true,
58+
},
59+
warehouseType: {
60+
type: "string",
61+
label: "Warehouse Type",
62+
description:
63+
"Warehouse type: PRO or CLASSIC. Set PRO + enableServerlessCompute = true to use serverless.",
64+
options: [
65+
"TYPE_UNSPECIFIED",
66+
"CLASSIC",
67+
"PRO",
68+
],
69+
optional: true,
70+
},
71+
spotInstancePolicy: {
72+
type: "string",
73+
label: "Spot Instance Policy",
74+
description: "Configures whether the warehouse should use spot instances.",
75+
options: [
76+
"POLICY_UNSPECIFIED",
77+
"COST_OPTIMIZED",
78+
"RELIABILITY_OPTIMIZED",
79+
],
80+
optional: true,
81+
},
82+
channel: {
83+
type: "object",
84+
label: "Channel",
85+
description:
86+
"Channel details. Example: `{ \"name\": \"CHANNEL_NAME_CUSTOM\", \"dbsql_version\": \"2023.35\" }`",
87+
optional: true,
88+
},
89+
tags: {
90+
type: "object",
91+
label: "Tags",
92+
description:
93+
"Custom key-value tags for resources associated with this SQL Warehouse.",
94+
optional: true,
95+
},
96+
instanceProfileArn: {
97+
type: "string",
98+
label: "Instance Profile ARN (Deprecated)",
99+
description: "Deprecated. Instance profile used to pass IAM role to the cluster.",
100+
optional: true,
101+
},
102+
},
103+
104+
async run({ $ }) {
105+
const payload = {
106+
name: this.name,
107+
cluster_size: this.clusterSize,
108+
};
109+
110+
if (this.autoStopMinutes !== undefined) {
111+
if (this.autoStopMinutes !== 0 && this.autoStopMinutes < 10) {
112+
throw new ConfigurationError("autoStopMinutes must be 0 or ≥ 10.");
113+
}
114+
payload.auto_stop_mins = this.autoStopMinutes;
115+
}
116+
117+
const minNumClusters = this.minNumClusters ?? 1;
118+
if (minNumClusters < 1 || minNumClusters > 30) {
119+
throw new ConfigurationError("minNumClusters must be between 1 and 30.");
120+
}
121+
payload.min_num_clusters = minNumClusters;
122+
123+
if (this.maxNumClusters !== undefined) {
124+
if (
125+
this.maxNumClusters < payload.min_num_clusters ||
126+
this.maxNumClusters > 30
127+
) {
128+
throw new ConfigurationError(
129+
`maxNumClusters must be ≥ minNumClusters (${payload.min_num_clusters}) and ≤ 30.`,
130+
);
131+
}
132+
payload.max_num_clusters = this.maxNumClusters;
133+
}
134+
135+
const parsedTags = utils.parseObject(this.tags);
136+
const tagArray = Object.entries(parsedTags).map(([
137+
key,
138+
value,
139+
]) => ({
140+
key,
141+
value,
142+
}));
143+
if (tagArray.length) {
144+
payload.tags = {
145+
custom_tags: tagArray,
146+
};
147+
}
148+
149+
if (this.enablePhoton !== undefined)
150+
payload.enable_photon = this.enablePhoton;
151+
if (this.enableServerlessCompute !== undefined)
152+
payload.enable_serverless_compute = this.enableServerlessCompute;
153+
if (this.warehouseType) payload.warehouse_type = this.warehouseType;
154+
if (this.spotInstancePolicy)
155+
payload.spot_instance_policy = this.spotInstancePolicy;
156+
if (this.channel) payload.channel = utils.parseObject(this.channel);
157+
if (this.instanceProfileArn)
158+
payload.instance_profile_arn = this.instanceProfileArn;
159+
160+
const response = await this.databricks.createSQLWarehouse({
161+
data: payload,
162+
$,
163+
});
164+
165+
$.export(
166+
"$summary",
167+
`Successfully created SQL Warehouse: ${response?.name || this.name}`,
168+
);
169+
return response;
170+
},
171+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import databricks from "../../databricks.app.mjs";
2+
3+
export default {
4+
key: "databricks-delete-sql-warehouse",
5+
name: "Delete SQL Warehouse",
6+
description: "Deletes a SQL Warehouse by ID. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/delete)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
databricks,
11+
warehouseId: {
12+
description: "The ID of the SQL Warehouse to delete",
13+
propDefinition: [
14+
databricks,
15+
"warehouseId",
16+
],
17+
},
18+
},
19+
async run({ $ }) {
20+
await this.databricks.deleteSQLWarehouse({
21+
warehouseId: this.warehouseId,
22+
$,
23+
});
24+
25+
$.export("$summary", `Successfully deleted SQL Warehouse with ID ${this.warehouseId}`);
26+
return {
27+
success: true,
28+
};
29+
},
30+
};

0 commit comments

Comments
 (0)