Skip to content

Commit

Permalink
Merge pull request #18127 from jmchilton/file_source_templates
Browse files Browse the repository at this point in the history
Empower Users to Bring Their Own Storage and File Sources
  • Loading branch information
jdavcs authored May 20, 2024
2 parents f3cb81d + 5cca011 commit 9b6268b
Show file tree
Hide file tree
Showing 225 changed files with 11,988 additions and 208 deletions.
25 changes: 25 additions & 0 deletions client/src/api/configTemplates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { components } from "@/api/schema/schema";

export type Instance =
| components["schemas"]["UserFileSourceModel"]
| components["schemas"]["UserConcreteObjectStoreModel"];

export type TemplateVariable =
| components["schemas"]["TemplateVariableString"]
| components["schemas"]["TemplateVariableInteger"]
| components["schemas"]["TemplateVariablePathComponent"]
| components["schemas"]["TemplateVariableBoolean"];
export type TemplateSecret = components["schemas"]["TemplateSecret"];
export type VariableValueType = (string | boolean | number) | undefined;
export type VariableData = { [key: string]: VariableValueType };
export type SecretData = { [key: string]: string };

export interface TemplateSummary {
description: string | null;
hidden?: boolean;
id: string;
name: string | null;
secrets?: TemplateSecret[] | null;
variables?: TemplateVariable[] | null;
version?: number;
}
6 changes: 6 additions & 0 deletions client/src/api/fileSources.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { type components } from "@/api/schema";

export type FileSourceTemplateSummary = components["schemas"]["FileSourceTemplateSummary"];
export type FileSourceTemplateSummaries = FileSourceTemplateSummary[];

export type UserFileSourceModel = components["schemas"]["UserFileSourceModel"];
19 changes: 17 additions & 2 deletions client/src/api/objectStores.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { fetcher } from "@/api/schema";
import type { components } from "@/api/schema/schema";

export type UserConcreteObjectStore = components["schemas"]["UserConcreteObjectStoreModel"];

export type ObjectStoreTemplateType = "aws_s3" | "azure_blob" | "boto3" | "disk" | "generic_s3";

const getObjectStores = fetcher.path("/api/object_stores").method("get").create();

Expand All @@ -8,10 +13,20 @@ export async function getSelectableObjectStores() {
}

const getObjectStore = fetcher.path("/api/object_stores/{object_store_id}").method("get").create();
const getUserObjectStoreInstance = fetcher
.path("/api/object_store_instances/{user_object_store_id}")
.method("get")
.create();

export async function getObjectStoreDetails(id: string) {
const { data } = await getObjectStore({ object_store_id: id });
return data;
if (id.startsWith("user_objects://")) {
const userObjectStoreId = id.substring("user_objects://".length);
const { data } = await getUserObjectStoreInstance({ user_object_store_id: userObjectStoreId });
return data;
} else {
const { data } = await getObjectStore({ object_store_id: id });
return data;
}
}

const updateObjectStoreFetcher = fetcher.path("/api/datasets/{dataset_id}/object_store_id").method("put").create();
Expand Down
Loading

0 comments on commit 9b6268b

Please sign in to comment.