airfoil 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +843 -99650
- package/package.json +21 -22
- package/src/commands/cluster/index.ts +15 -42
- package/src/commands/cluster/namespace/create.ts +280 -73
- package/src/commands/cluster/namespace/delete.ts +12 -20
- package/src/commands/cluster/namespace/get.ts +15 -21
- package/src/commands/cluster/namespace/list.ts +17 -44
- package/src/commands/cluster/table/create.ts +279 -0
- package/src/commands/cluster/table/delete.ts +54 -0
- package/src/commands/cluster/table/get.ts +62 -0
- package/src/commands/cluster/table/list.ts +61 -0
- package/src/commands/dev.ts +73 -172
- package/src/commands/sql.ts +31 -62
- package/src/index.ts +13 -6
- package/src/utils/client.ts +3 -3
- package/src/utils/docker.ts +137 -0
- package/src/utils/options.ts +2 -4
- package/src/utils/wings.ts +72 -64
- package/src/commands/cluster/data-lake/create-iceberg.ts +0 -61
- package/src/commands/cluster/data-lake/create-parquet.ts +0 -61
- package/src/commands/cluster/data-lake/create.ts +0 -16
- package/src/commands/cluster/data-lake/delete.ts +0 -58
- package/src/commands/cluster/data-lake/get.ts +0 -46
- package/src/commands/cluster/data-lake/list.ts +0 -72
- package/src/commands/cluster/object-store/create-aws.ts +0 -106
- package/src/commands/cluster/object-store/create-azure.ts +0 -100
- package/src/commands/cluster/object-store/create-google.ts +0 -102
- package/src/commands/cluster/object-store/create-s3.ts +0 -126
- package/src/commands/cluster/object-store/create.ts +0 -20
- package/src/commands/cluster/object-store/delete.ts +0 -58
- package/src/commands/cluster/object-store/get.ts +0 -51
- package/src/commands/cluster/object-store/list.ts +0 -72
- package/src/commands/cluster/tenant/create.ts +0 -46
- package/src/commands/cluster/tenant/delete.ts +0 -62
- package/src/commands/cluster/tenant/get.ts +0 -44
- package/src/commands/cluster/tenant/list.ts +0 -60
- package/src/commands/cluster/topic/create.ts +0 -317
- package/src/commands/cluster/topic/delete.ts +0 -67
- package/src/commands/cluster/topic/get.ts +0 -51
- package/src/commands/cluster/topic/list.ts +0 -70
- package/src/scripts/compile-all.ts +0 -21
- package/src/utils/effect.ts +0 -11
package/package.json
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "airfoil",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"repository": "useairfoil/typescript-sdk",
|
|
5
|
+
"bin": {
|
|
6
|
+
"airfoil": "./dist/index.js"
|
|
7
|
+
},
|
|
6
8
|
"files": [
|
|
7
9
|
"dist",
|
|
8
10
|
"src",
|
|
9
11
|
"README.md"
|
|
10
12
|
],
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./dist/index.js"
|
|
13
17
|
},
|
|
14
18
|
"scripts": {
|
|
19
|
+
"build": "tsdown",
|
|
15
20
|
"typecheck": "tsc --noEmit",
|
|
16
|
-
"
|
|
17
|
-
"lint:fix": "bun run lint --write",
|
|
18
|
-
"format": "biome format --write .",
|
|
19
|
-
"airfoil:dev": "bun run src/index.ts",
|
|
20
|
-
"build": "bun build src/index.ts --outdir dist --target node",
|
|
21
|
-
"compile": "bun build src/index.ts --compile --outfile airfoil",
|
|
22
|
-
"compile:all": "bun run src/scripts/compile-all.ts"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/bun": "^1.3.5"
|
|
26
|
-
},
|
|
27
|
-
"peerDependencies": {
|
|
28
|
-
"typescript": "^5"
|
|
21
|
+
"dev": "tsx src/index.ts"
|
|
29
22
|
},
|
|
30
23
|
"dependencies": {
|
|
31
24
|
"@clack/prompts": "^0.11.0",
|
|
32
|
-
"@effect/platform-node": "4.0.0-beta.
|
|
33
|
-
"@useairfoil/flight": "0.
|
|
34
|
-
"@useairfoil/wings": "0.
|
|
25
|
+
"@effect/platform-node": "4.0.0-beta.83",
|
|
26
|
+
"@useairfoil/flight": "0.4.3",
|
|
27
|
+
"@useairfoil/wings": "0.4.1",
|
|
35
28
|
"console-table-printer": "^2.15.0",
|
|
36
|
-
"effect": "4.0.0-beta.
|
|
29
|
+
"effect": "4.0.0-beta.83",
|
|
37
30
|
"nice-grpc": "^2.1.13",
|
|
38
31
|
"nice-grpc-common": "^2.0.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^24.2.0",
|
|
35
|
+
"tsdown": "^0.15.6",
|
|
36
|
+
"tsx": "^4.21.0",
|
|
37
|
+
"typescript": "^5.9.3"
|
|
39
38
|
}
|
|
40
39
|
}
|
|
@@ -1,52 +1,25 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { Command } from "effect/unstable/cli";
|
|
3
|
-
import { createDataLakeCommand } from "./data-lake/create.js";
|
|
4
|
-
import { deleteDataLakeCommand } from "./data-lake/delete.js";
|
|
5
|
-
import { getDataLakeCommand } from "./data-lake/get.js";
|
|
6
|
-
import { listDataLakesCommand } from "./data-lake/list.js";
|
|
7
|
-
import { createNamespaceCommand } from "./namespace/create.js";
|
|
8
|
-
import { deleteNamespaceCommand } from "./namespace/delete.js";
|
|
9
|
-
import { getNamespaceCommand } from "./namespace/get.js";
|
|
10
|
-
import { listNamespacesCommand } from "./namespace/list.js";
|
|
11
|
-
import { createObjectStoreCommand } from "./object-store/create.js";
|
|
12
|
-
import { deleteObjectStoreCommand } from "./object-store/delete.js";
|
|
13
|
-
import { getObjectStoreCommand } from "./object-store/get.js";
|
|
14
|
-
import { listObjectStoresCommand } from "./object-store/list.js";
|
|
15
|
-
import { createTenantCommand } from "./tenant/create.js";
|
|
16
|
-
import { deleteTenantCommand } from "./tenant/delete.js";
|
|
17
|
-
import { getTenantCommand } from "./tenant/get.js";
|
|
18
|
-
import { listTenantsCommand } from "./tenant/list.js";
|
|
19
|
-
import { createTopicCommand } from "./topic/create.js";
|
|
20
|
-
import { deleteTopicCommand } from "./topic/delete.js";
|
|
21
|
-
import { getTopicCommand } from "./topic/get.js";
|
|
22
|
-
import { listTopicsCommand } from "./topic/list.js";
|
|
23
3
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
import { createNamespaceCommand } from "./namespace/create";
|
|
5
|
+
import { deleteNamespaceCommand } from "./namespace/delete";
|
|
6
|
+
import { getNamespaceCommand } from "./namespace/get";
|
|
7
|
+
import { listNamespacesCommand } from "./namespace/list";
|
|
8
|
+
import { createTableCommand } from "./table/create";
|
|
9
|
+
import { deleteTableCommand } from "./table/delete";
|
|
10
|
+
import { getTableCommand } from "./table/get";
|
|
11
|
+
import { listTablesCommand } from "./table/list";
|
|
12
|
+
|
|
13
|
+
export const clusterCommand = Command.make("cluster", {}, () => Effect.void).pipe(
|
|
14
|
+
Command.withDescription("Manage Wings namespaces and tables"),
|
|
30
15
|
Command.withSubcommands([
|
|
31
|
-
createTenantCommand,
|
|
32
|
-
listTenantsCommand,
|
|
33
|
-
getTenantCommand,
|
|
34
|
-
deleteTenantCommand,
|
|
35
16
|
createNamespaceCommand,
|
|
36
17
|
listNamespacesCommand,
|
|
37
18
|
getNamespaceCommand,
|
|
38
19
|
deleteNamespaceCommand,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
createObjectStoreCommand,
|
|
44
|
-
listObjectStoresCommand,
|
|
45
|
-
getObjectStoreCommand,
|
|
46
|
-
deleteObjectStoreCommand,
|
|
47
|
-
createDataLakeCommand,
|
|
48
|
-
listDataLakesCommand,
|
|
49
|
-
getDataLakeCommand,
|
|
50
|
-
deleteDataLakeCommand,
|
|
20
|
+
createTableCommand,
|
|
21
|
+
listTablesCommand,
|
|
22
|
+
getTableCommand,
|
|
23
|
+
deleteTableCommand,
|
|
51
24
|
]),
|
|
52
25
|
);
|
|
@@ -1,107 +1,314 @@
|
|
|
1
1
|
import * as p from "@clack/prompts";
|
|
2
|
-
import {
|
|
2
|
+
import { Cluster, ClusterClient } from "@useairfoil/wings";
|
|
3
3
|
import { printTable } from "console-table-printer";
|
|
4
|
-
import { Effect } from "effect";
|
|
4
|
+
import { Config, Effect, Option, Redacted } from "effect";
|
|
5
5
|
import { Command, Flag } from "effect/unstable/cli";
|
|
6
|
-
import { makeClusterMetadataLayer } from "../../../utils/client.js";
|
|
7
|
-
import { handleCliError } from "../../../utils/effect.js";
|
|
8
|
-
import { hostOption, portOption } from "../../../utils/options.js";
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
7
|
+
import { makeClusterClientLayer } from "../../../utils/client";
|
|
8
|
+
import { hostOption, portOption } from "../../../utils/options";
|
|
9
|
+
|
|
10
|
+
type LakeTag = Cluster.Lake.LakeApp["lakeConfig"]["_tag"];
|
|
15
11
|
|
|
16
12
|
const namespaceIdOption = Flag.string("namespace-id").pipe(
|
|
17
|
-
Flag.withDescription(
|
|
18
|
-
"Unique identifier for the namespace (e.g., 'production')",
|
|
19
|
-
),
|
|
13
|
+
Flag.withDescription("Unique identifier for the namespace (e.g., 'production')"),
|
|
20
14
|
);
|
|
21
15
|
|
|
22
|
-
const
|
|
23
|
-
Flag.withDescription(
|
|
24
|
-
|
|
25
|
-
),
|
|
26
|
-
Flag.withDefault(0),
|
|
16
|
+
const lakeOption = Flag.string("lake").pipe(
|
|
17
|
+
Flag.withDescription("Lake format: iceberg, parquet, or delta"),
|
|
18
|
+
Flag.withDefault("iceberg" as LakeTag),
|
|
27
19
|
);
|
|
28
20
|
|
|
29
|
-
const
|
|
30
|
-
Flag.withDescription(
|
|
31
|
-
|
|
32
|
-
),
|
|
33
|
-
Flag.withDefault(0),
|
|
21
|
+
const prefixOption = Flag.string("prefix").pipe(
|
|
22
|
+
Flag.withDescription("Storage prefix (optional)"),
|
|
23
|
+
Flag.optional,
|
|
34
24
|
);
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
26
|
+
function makeLakeConfig(lake: string): Cluster.Lake.LakeApp {
|
|
27
|
+
switch (lake) {
|
|
28
|
+
case "iceberg":
|
|
29
|
+
return { lakeConfig: { _tag: "iceberg" as const, iceberg: {} } };
|
|
30
|
+
case "parquet":
|
|
31
|
+
return { lakeConfig: { _tag: "parquet" as const, parquet: {} } };
|
|
32
|
+
case "delta":
|
|
33
|
+
return { lakeConfig: { _tag: "delta" as const, delta: {} } };
|
|
34
|
+
default:
|
|
35
|
+
throw new Error(`Invalid lake type: "${lake}". Must be iceberg, parquet, or delta.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function displayNamespace(namespace: Cluster.Namespace.Namespace) {
|
|
40
|
+
printTable([
|
|
41
|
+
{
|
|
42
|
+
name: namespace.name,
|
|
43
|
+
object_store: namespace.objectStore?.objectStoreConfig._tag ?? "-",
|
|
44
|
+
lake: namespace.lake?.lakeConfig._tag ?? "-",
|
|
45
|
+
},
|
|
46
|
+
]);
|
|
47
|
+
p.outro("✓ Done");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ─── AWS ──────────────────────────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
const createNamespaceAwsCommand = Command.make(
|
|
53
|
+
"aws",
|
|
54
|
+
{
|
|
55
|
+
namespaceId: namespaceIdOption,
|
|
56
|
+
lake: lakeOption,
|
|
57
|
+
bucketName: Flag.string("bucket-name").pipe(Flag.withDescription("AWS S3 bucket name")),
|
|
58
|
+
prefix: prefixOption,
|
|
59
|
+
accessKeyId: Flag.redacted("access-key-id").pipe(
|
|
60
|
+
Flag.withDescription("AWS access key ID (or set AWS_ACCESS_KEY_ID env var)"),
|
|
61
|
+
Flag.withFallbackConfig(Config.redacted("AWS_ACCESS_KEY_ID")),
|
|
62
|
+
),
|
|
63
|
+
secretAccessKey: Flag.redacted("secret-access-key").pipe(
|
|
64
|
+
Flag.withDescription("AWS secret access key (or set AWS_SECRET_ACCESS_KEY env var)"),
|
|
65
|
+
Flag.withFallbackConfig(Config.redacted("AWS_SECRET_ACCESS_KEY")),
|
|
66
|
+
),
|
|
67
|
+
region: Flag.string("region").pipe(
|
|
68
|
+
Flag.withDescription("AWS region (e.g., us-east-1)"),
|
|
69
|
+
Flag.optional,
|
|
70
|
+
),
|
|
71
|
+
host: hostOption,
|
|
72
|
+
port: portOption,
|
|
73
|
+
},
|
|
74
|
+
({ namespaceId, lake, bucketName, prefix, accessKeyId, secretAccessKey, region }) =>
|
|
75
|
+
Effect.gen(function* () {
|
|
76
|
+
p.intro("📁 Create Namespace (AWS S3)");
|
|
77
|
+
|
|
78
|
+
const lakeConfig = yield* Effect.try({
|
|
79
|
+
try: () => makeLakeConfig(lake),
|
|
80
|
+
catch: (e) => (e instanceof Error ? e : new Error(String(e))),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const s = p.spinner();
|
|
84
|
+
s.start("Creating namespace...");
|
|
85
|
+
|
|
86
|
+
const namespace = yield* ClusterClient.createNamespace({
|
|
87
|
+
namespaceId,
|
|
88
|
+
objectStore: {
|
|
89
|
+
objectStoreConfig: {
|
|
90
|
+
_tag: "aws",
|
|
91
|
+
aws: {
|
|
92
|
+
bucketName,
|
|
93
|
+
prefix: Option.getOrUndefined(prefix),
|
|
94
|
+
accessKeyId: Redacted.value(accessKeyId),
|
|
95
|
+
secretAccessKey: Redacted.value(secretAccessKey),
|
|
96
|
+
region: Option.getOrUndefined(region),
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
lake: lakeConfig,
|
|
101
|
+
}).pipe(Effect.tapError(() => Effect.sync(() => s.stop("Failed to create namespace"))));
|
|
102
|
+
|
|
103
|
+
s.stop("Namespace created successfully");
|
|
104
|
+
yield* Effect.sync(() => displayNamespace(namespace));
|
|
105
|
+
}),
|
|
106
|
+
).pipe(
|
|
107
|
+
Command.withDescription("Create a namespace backed by AWS S3"),
|
|
108
|
+
Command.provide(({ host, port }) => makeClusterClientLayer(host, port)),
|
|
40
109
|
);
|
|
41
110
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
111
|
+
// ─── Azure ────────────────────────────────────────────────────────────────────
|
|
112
|
+
|
|
113
|
+
const createNamespaceAzureCommand = Command.make(
|
|
114
|
+
"azure",
|
|
115
|
+
{
|
|
116
|
+
namespaceId: namespaceIdOption,
|
|
117
|
+
lake: lakeOption,
|
|
118
|
+
containerName: Flag.string("container-name").pipe(
|
|
119
|
+
Flag.withDescription("Azure Blob container name"),
|
|
120
|
+
),
|
|
121
|
+
prefix: prefixOption,
|
|
122
|
+
storageAccountName: Flag.string("storage-account-name").pipe(
|
|
123
|
+
Flag.withDescription("Azure storage account name"),
|
|
124
|
+
),
|
|
125
|
+
storageAccountKey: Flag.redacted("storage-account-key").pipe(
|
|
126
|
+
Flag.withDescription("Azure storage account key (or set AZURE_STORAGE_ACCOUNT_KEY env var)"),
|
|
127
|
+
Flag.withFallbackConfig(Config.redacted("AZURE_STORAGE_ACCOUNT_KEY")),
|
|
128
|
+
),
|
|
129
|
+
host: hostOption,
|
|
130
|
+
port: portOption,
|
|
131
|
+
},
|
|
132
|
+
({ namespaceId, lake, containerName, prefix, storageAccountName, storageAccountKey }) =>
|
|
133
|
+
Effect.gen(function* () {
|
|
134
|
+
p.intro("📁 Create Namespace (Azure Blob)");
|
|
135
|
+
|
|
136
|
+
const lakeConfig = yield* Effect.try({
|
|
137
|
+
try: () => makeLakeConfig(lake),
|
|
138
|
+
catch: (e) => (e instanceof Error ? e : new Error(String(e))),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const s = p.spinner();
|
|
142
|
+
s.start("Creating namespace...");
|
|
143
|
+
|
|
144
|
+
const namespace = yield* ClusterClient.createNamespace({
|
|
145
|
+
namespaceId,
|
|
146
|
+
objectStore: {
|
|
147
|
+
objectStoreConfig: {
|
|
148
|
+
_tag: "azure",
|
|
149
|
+
azure: {
|
|
150
|
+
containerName,
|
|
151
|
+
prefix: Option.getOrUndefined(prefix),
|
|
152
|
+
storageAccountName,
|
|
153
|
+
storageAccountKey: Redacted.value(storageAccountKey),
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
lake: lakeConfig,
|
|
158
|
+
}).pipe(Effect.tapError(() => Effect.sync(() => s.stop("Failed to create namespace"))));
|
|
159
|
+
|
|
160
|
+
s.stop("Namespace created successfully");
|
|
161
|
+
yield* Effect.sync(() => displayNamespace(namespace));
|
|
162
|
+
}),
|
|
163
|
+
).pipe(
|
|
164
|
+
Command.withDescription("Create a namespace backed by Azure Blob Storage"),
|
|
165
|
+
Command.provide(({ host, port }) => makeClusterClientLayer(host, port)),
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
// ─── Google ───────────────────────────────────────────────────────────────────
|
|
169
|
+
|
|
170
|
+
const createNamespaceGoogleCommand = Command.make(
|
|
171
|
+
"google",
|
|
172
|
+
{
|
|
173
|
+
namespaceId: namespaceIdOption,
|
|
174
|
+
lake: lakeOption,
|
|
175
|
+
bucketName: Flag.string("bucket-name").pipe(Flag.withDescription("GCS bucket name")),
|
|
176
|
+
prefix: prefixOption,
|
|
177
|
+
serviceAccount: Flag.string("service-account").pipe(
|
|
178
|
+
Flag.withDescription("GCP service account email"),
|
|
179
|
+
),
|
|
180
|
+
serviceAccountKey: Flag.redacted("service-account-key").pipe(
|
|
181
|
+
Flag.withDescription(
|
|
182
|
+
"GCP service account key JSON (or set GOOGLE_SERVICE_ACCOUNT_KEY env var)",
|
|
183
|
+
),
|
|
184
|
+
Flag.withFallbackConfig(Config.redacted("GOOGLE_SERVICE_ACCOUNT_KEY")),
|
|
185
|
+
),
|
|
186
|
+
host: hostOption,
|
|
187
|
+
port: portOption,
|
|
188
|
+
},
|
|
189
|
+
({ namespaceId, lake, bucketName, prefix, serviceAccount, serviceAccountKey }) =>
|
|
190
|
+
Effect.gen(function* () {
|
|
191
|
+
p.intro("📁 Create Namespace (Google Cloud Storage)");
|
|
192
|
+
|
|
193
|
+
const lakeConfig = yield* Effect.try({
|
|
194
|
+
try: () => makeLakeConfig(lake),
|
|
195
|
+
catch: (e) => (e instanceof Error ? e : new Error(String(e))),
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const s = p.spinner();
|
|
199
|
+
s.start("Creating namespace...");
|
|
200
|
+
|
|
201
|
+
const namespace = yield* ClusterClient.createNamespace({
|
|
202
|
+
namespaceId,
|
|
203
|
+
objectStore: {
|
|
204
|
+
objectStoreConfig: {
|
|
205
|
+
_tag: "google",
|
|
206
|
+
google: {
|
|
207
|
+
bucketName,
|
|
208
|
+
prefix: Option.getOrUndefined(prefix),
|
|
209
|
+
serviceAccount,
|
|
210
|
+
serviceAccountKey: Redacted.value(serviceAccountKey),
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
lake: lakeConfig,
|
|
215
|
+
}).pipe(Effect.tapError(() => Effect.sync(() => s.stop("Failed to create namespace"))));
|
|
216
|
+
|
|
217
|
+
s.stop("Namespace created successfully");
|
|
218
|
+
yield* Effect.sync(() => displayNamespace(namespace));
|
|
219
|
+
}),
|
|
220
|
+
).pipe(
|
|
221
|
+
Command.withDescription("Create a namespace backed by Google Cloud Storage"),
|
|
222
|
+
Command.provide(({ host, port }) => makeClusterClientLayer(host, port)),
|
|
46
223
|
);
|
|
47
224
|
|
|
48
|
-
|
|
49
|
-
|
|
225
|
+
// ─── S3-Compatible ────────────────────────────────────────────────────────────
|
|
226
|
+
|
|
227
|
+
const createNamespaceS3Command = Command.make(
|
|
228
|
+
"s3",
|
|
50
229
|
{
|
|
51
|
-
parent: parentOption,
|
|
52
230
|
namespaceId: namespaceIdOption,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
231
|
+
lake: lakeOption,
|
|
232
|
+
bucketName: Flag.string("bucket-name").pipe(Flag.withDescription("S3-compatible bucket name")),
|
|
233
|
+
prefix: prefixOption,
|
|
234
|
+
accessKeyId: Flag.redacted("access-key-id").pipe(
|
|
235
|
+
Flag.withDescription("Access key ID (or set S3_ACCESS_KEY_ID env var)"),
|
|
236
|
+
Flag.withFallbackConfig(Config.redacted("S3_ACCESS_KEY_ID")),
|
|
237
|
+
),
|
|
238
|
+
secretAccessKey: Flag.redacted("secret-access-key").pipe(
|
|
239
|
+
Flag.withDescription("Secret access key (or set S3_SECRET_ACCESS_KEY env var)"),
|
|
240
|
+
Flag.withFallbackConfig(Config.redacted("S3_SECRET_ACCESS_KEY")),
|
|
241
|
+
),
|
|
242
|
+
endpoint: Flag.string("endpoint").pipe(
|
|
243
|
+
Flag.withDescription("S3-compatible endpoint URL (e.g., http://minio:9000)"),
|
|
244
|
+
),
|
|
245
|
+
allowHttp: Flag.boolean("allow-http").pipe(
|
|
246
|
+
Flag.withDescription("Allow plain HTTP connections"),
|
|
247
|
+
Flag.withDefault(false),
|
|
248
|
+
),
|
|
249
|
+
region: Flag.string("region").pipe(Flag.withDescription("Region"), Flag.optional),
|
|
57
250
|
host: hostOption,
|
|
58
251
|
port: portOption,
|
|
59
252
|
},
|
|
60
253
|
({
|
|
61
|
-
parent,
|
|
62
254
|
namespaceId,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
255
|
+
lake,
|
|
256
|
+
bucketName,
|
|
257
|
+
prefix,
|
|
258
|
+
accessKeyId,
|
|
259
|
+
secretAccessKey,
|
|
260
|
+
endpoint,
|
|
261
|
+
allowHttp,
|
|
262
|
+
region,
|
|
69
263
|
}) =>
|
|
70
264
|
Effect.gen(function* () {
|
|
71
|
-
p.intro("📁 Create Namespace");
|
|
265
|
+
p.intro("📁 Create Namespace (S3-Compatible)");
|
|
72
266
|
|
|
73
|
-
const
|
|
267
|
+
const lakeConfig = yield* Effect.try({
|
|
268
|
+
try: () => makeLakeConfig(lake),
|
|
269
|
+
catch: (e) => (e instanceof Error ? e : new Error(String(e))),
|
|
270
|
+
});
|
|
74
271
|
|
|
75
272
|
const s = p.spinner();
|
|
76
273
|
s.start("Creating namespace...");
|
|
77
274
|
|
|
78
|
-
const namespace = yield*
|
|
79
|
-
parent,
|
|
275
|
+
const namespace = yield* ClusterClient.createNamespace({
|
|
80
276
|
namespaceId,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
277
|
+
objectStore: {
|
|
278
|
+
objectStoreConfig: {
|
|
279
|
+
_tag: "s3Compatible",
|
|
280
|
+
s3Compatible: {
|
|
281
|
+
bucketName,
|
|
282
|
+
prefix: Option.getOrUndefined(prefix),
|
|
283
|
+
accessKeyId: Redacted.value(accessKeyId),
|
|
284
|
+
secretAccessKey: Redacted.value(secretAccessKey),
|
|
285
|
+
endpoint,
|
|
286
|
+
allowHttp,
|
|
287
|
+
region: Option.getOrUndefined(region),
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
lake: lakeConfig,
|
|
292
|
+
}).pipe(Effect.tapError(() => Effect.sync(() => s.stop("Failed to create namespace"))));
|
|
91
293
|
|
|
92
294
|
s.stop("Namespace created successfully");
|
|
295
|
+
yield* Effect.sync(() => displayNamespace(namespace));
|
|
296
|
+
}),
|
|
297
|
+
).pipe(
|
|
298
|
+
Command.withDescription("Create a namespace backed by an S3-compatible object store"),
|
|
299
|
+
Command.provide(({ host, port }) => makeClusterClientLayer(host, port)),
|
|
300
|
+
);
|
|
93
301
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
).pipe(Command.withDescription("Create a new namespace belonging to a tenant"));
|
|
302
|
+
// ─── Parent command ───────────────────────────────────────────────────────────
|
|
303
|
+
|
|
304
|
+
export const createNamespaceCommand = Command.make("create-namespace", {}, () => Effect.void).pipe(
|
|
305
|
+
Command.withDescription(
|
|
306
|
+
"Create a new namespace (choose a storage provider as subcommand: aws, azure, google, s3)",
|
|
307
|
+
),
|
|
308
|
+
Command.withSubcommands([
|
|
309
|
+
createNamespaceAwsCommand,
|
|
310
|
+
createNamespaceAzureCommand,
|
|
311
|
+
createNamespaceGoogleCommand,
|
|
312
|
+
createNamespaceS3Command,
|
|
313
|
+
]),
|
|
314
|
+
);
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import * as p from "@clack/prompts";
|
|
2
|
-
import {
|
|
2
|
+
import { ClusterClient } from "@useairfoil/wings";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
import { Command, Flag } from "effect/unstable/cli";
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import { forceOption, hostOption, portOption } from "../../../utils/options
|
|
5
|
+
|
|
6
|
+
import { makeClusterClientLayer } from "../../../utils/client";
|
|
7
|
+
import { forceOption, hostOption, portOption } from "../../../utils/options";
|
|
8
8
|
|
|
9
9
|
const nameOption = Flag.string("name").pipe(
|
|
10
|
-
Flag.withDescription(
|
|
11
|
-
"Namespace name in format: tenants/{tenant}/namespaces/{namespace}",
|
|
12
|
-
),
|
|
10
|
+
Flag.withDescription("Namespace name in format: namespaces/{namespace}"),
|
|
13
11
|
);
|
|
14
12
|
|
|
15
13
|
export const deleteNamespaceCommand = Command.make(
|
|
@@ -20,7 +18,7 @@ export const deleteNamespaceCommand = Command.make(
|
|
|
20
18
|
host: hostOption,
|
|
21
19
|
port: portOption,
|
|
22
20
|
},
|
|
23
|
-
({ name, force
|
|
21
|
+
({ name, force }) =>
|
|
24
22
|
Effect.gen(function* () {
|
|
25
23
|
p.intro("🗑️ Delete Namespace");
|
|
26
24
|
|
|
@@ -36,27 +34,21 @@ export const deleteNamespaceCommand = Command.make(
|
|
|
36
34
|
|
|
37
35
|
if (p.isCancel(confirm) || !confirm) {
|
|
38
36
|
p.cancel("Deletion cancelled");
|
|
39
|
-
|
|
37
|
+
return;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
const layer = makeClusterMetadataLayer(host, port);
|
|
44
|
-
|
|
45
41
|
const s = p.spinner();
|
|
46
42
|
s.start("Deleting namespace...");
|
|
47
43
|
|
|
48
|
-
yield*
|
|
49
|
-
Effect.
|
|
50
|
-
Effect.tapError(() =>
|
|
51
|
-
Effect.sync(() => s.stop("Failed to delete namespace")),
|
|
52
|
-
),
|
|
44
|
+
yield* ClusterClient.deleteNamespace({ name }).pipe(
|
|
45
|
+
Effect.tapError(() => Effect.sync(() => s.stop("Failed to delete namespace"))),
|
|
53
46
|
);
|
|
54
47
|
|
|
55
48
|
s.stop("Namespace deleted successfully");
|
|
56
49
|
p.outro("✓ Done");
|
|
57
|
-
})
|
|
50
|
+
}),
|
|
58
51
|
).pipe(
|
|
59
|
-
Command.withDescription(
|
|
60
|
-
|
|
61
|
-
),
|
|
52
|
+
Command.withDescription("Delete a namespace from the cluster"),
|
|
53
|
+
Command.provide(({ host, port }) => makeClusterClientLayer(host, port)),
|
|
62
54
|
);
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as p from "@clack/prompts";
|
|
2
|
-
import {
|
|
2
|
+
import { ClusterClient } from "@useairfoil/wings";
|
|
3
3
|
import { printTable } from "console-table-printer";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { Command, Flag } from "effect/unstable/cli";
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import { hostOption, portOption } from "../../../utils/options
|
|
6
|
+
|
|
7
|
+
import { makeClusterClientLayer } from "../../../utils/client";
|
|
8
|
+
import { hostOption, portOption } from "../../../utils/options";
|
|
9
9
|
|
|
10
10
|
const nameOption = Flag.string("name").pipe(
|
|
11
|
-
Flag.withDescription(
|
|
12
|
-
"Namespace name in format: tenants/{tenant}/namespaces/{namespace}",
|
|
13
|
-
),
|
|
11
|
+
Flag.withDescription("Namespace name in format: namespaces/{namespace}"),
|
|
14
12
|
);
|
|
15
13
|
|
|
16
14
|
export const getNamespaceCommand = Command.make(
|
|
@@ -20,18 +18,13 @@ export const getNamespaceCommand = Command.make(
|
|
|
20
18
|
host: hostOption,
|
|
21
19
|
port: portOption,
|
|
22
20
|
},
|
|
23
|
-
({ name
|
|
21
|
+
({ name }) =>
|
|
24
22
|
Effect.gen(function* () {
|
|
25
|
-
const layer = makeClusterMetadataLayer(host, port);
|
|
26
|
-
|
|
27
23
|
const s = p.spinner();
|
|
28
24
|
s.start("Fetching namespace...");
|
|
29
25
|
|
|
30
|
-
const namespace = yield*
|
|
31
|
-
Effect.
|
|
32
|
-
Effect.tapError(() =>
|
|
33
|
-
Effect.sync(() => s.stop("Failed to get namespace")),
|
|
34
|
-
),
|
|
26
|
+
const namespace = yield* ClusterClient.getNamespace({ name }).pipe(
|
|
27
|
+
Effect.tapError(() => Effect.sync(() => s.stop("Failed to get namespace"))),
|
|
35
28
|
);
|
|
36
29
|
|
|
37
30
|
s.stop("Namespace retrieved");
|
|
@@ -40,13 +33,14 @@ export const getNamespaceCommand = Command.make(
|
|
|
40
33
|
printTable([
|
|
41
34
|
{
|
|
42
35
|
name: namespace.name,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
object_store: namespace.objectStore || "-",
|
|
46
|
-
data_lake: namespace.dataLake || "-",
|
|
36
|
+
object_store: namespace.objectStore?.objectStoreConfig._tag ?? "-",
|
|
37
|
+
lake: namespace.lake?.lakeConfig._tag ?? "-",
|
|
47
38
|
},
|
|
48
39
|
]);
|
|
49
40
|
p.outro("✓ Done");
|
|
50
41
|
});
|
|
51
|
-
})
|
|
52
|
-
).pipe(
|
|
42
|
+
}),
|
|
43
|
+
).pipe(
|
|
44
|
+
Command.withDescription("Get details of a specific namespace"),
|
|
45
|
+
Command.provide(({ host, port }) => makeClusterClientLayer(host, port)),
|
|
46
|
+
);
|