Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden User Object Store and File Source Creation #18172

Merged
merged 15 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
28 changes: 28 additions & 0 deletions client/src/api/configTemplates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 type PluginAspectStatus = components["schemas"]["PluginAspectStatus"];
export type PluginStatus = components["schemas"]["PluginStatus"];

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
Loading