Skip to content
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
2 changes: 1 addition & 1 deletion client-api/src/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type DatasetStorageDetails = components["schemas"]["DatasetStorageDetails
export type DatasetCollectionAttributes = components["schemas"]["DatasetCollectionAttributesResult"];
export type ConcreteObjectStoreModel = components["schemas"]["ConcreteObjectStoreModel"];
export type MessageException = components["schemas"]["MessageExceptionModel"];
export type DatasetHash = components["schemas"]["DatasetHash"];
export type DatasetHash = components["schemas"]["DatasetHash-Output"];
export type DatasetSource = components["schemas"]["DatasetSource"];
export type DatasetTransform = components["schemas"]["DatasetSourceTransform"];
export type StoreExportPayload = components["schemas"]["StoreExportPayload"];
Expand Down
2 changes: 1 addition & 1 deletion client/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export function canMutateHistory(history: AnyHistory): boolean {
return !history.purged && !history.archived;
}

export type DatasetHash = components["schemas"]["DatasetHash"];
export type DatasetHash = components["schemas"]["DatasetHash-Output"];

export type DatasetSource = components["schemas"]["DatasetSource"];
export type DatasetTransform = components["schemas"]["DatasetSourceTransform"];
Expand Down
232 changes: 229 additions & 3 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,23 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/file_landings": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Create File Landing */
post: operations["create_file_landing_api_file_landings_post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/file_source_instances": {
parameters: {
query?: never;
Expand Down Expand Up @@ -7400,6 +7417,75 @@ export interface components {
/** Item Ids */
item_ids: string[];
};
/** CollectionElementCollectionRequestUri */
CollectionElementCollectionRequestUri: {
/**
* Class
* @constant
*/
class: "Collection";
/** Collection Type */
collection_type: string;
/** Elements */
elements: (
| components["schemas"]["CollectionElementCollectionRequestUri"]
| components["schemas"]["CollectionElementDataRequestUri"]
)[];
/**
* Identifier
* @description A unique identifier for this element within the collection.
*/
identifier: string;
};
/** CollectionElementDataRequestUri */
CollectionElementDataRequestUri: {
/**
* Class
* @constant
*/
class: "File";
/** Created From Basename */
created_from_basename?: string | null;
/**
* Dbkey
* @default ?
*/
dbkey: string;
/**
* Deferred
* @default false
*/
deferred: boolean;
/** Ext */
ext: string;
/** Hashes */
hashes?: components["schemas"]["DatasetHash-Input"][] | null;
/**
* Identifier
* @description A unique identifier for this element within the collection.
*/
identifier: string;
/** Info */
info?: string | null;
/** Location */
location: string;
/** Name */
name?: string | null;
/**
* Space To Tab
* @default false
*/
space_to_tab: boolean;
/** Src */
src?: null;
/** Tags */
tags?: string[] | null;
/**
* To Posix Lines
* @default false
*/
to_posix_lines: boolean;
};
/** CollectionElementIdentifier */
CollectionElementIdentifier: {
/**
Expand Down Expand Up @@ -7991,6 +8077,23 @@ export interface components {
*/
target: string;
};
/** CreateFileLandingPayload */
CreateFileLandingPayload: {
/** Client Secret */
client_secret?: string | null;
/** Origin */
origin?: string | null;
/**
* Public
* @default false
*/
public: boolean;
/** Request State */
request_state: (
| components["schemas"]["FileRequestUri"]
| components["schemas"]["DataRequestCollectionUri"]
)[];
};
/** CreateHistoryContentFromStore */
CreateHistoryContentFromStore: {
model_store_format?: components["schemas"]["ModelStoreFormat"] | null;
Expand Down Expand Up @@ -9589,6 +9692,30 @@ export interface components {
*/
type: "data";
};
/** DataRequestCollectionUri */
DataRequestCollectionUri: {
/**
* @description discriminator enum property added by openapi-typescript
* @enum {string}
*/
class: "Collection";
/** Collection Type */
collection_type: string;
/**
* Deferred
* @default false
*/
deferred: boolean;
/** Elements */
elements: (
| components["schemas"]["CollectionElementCollectionRequestUri"]
| components["schemas"]["CollectionElementDataRequestUri"]
)[];
/** Name */
name?: string | null;
/** Src */
src?: null;
};
/** DatasetAssociationRoles */
DatasetAssociationRoles: {
/**
Expand Down Expand Up @@ -9666,7 +9793,17 @@ export interface components {
*/
DatasetExtraFiles: components["schemas"]["ExtraFileEntry"][];
/** DatasetHash */
DatasetHash: {
"DatasetHash-Input": {
/**
* Hash Function
* @enum {string}
*/
hash_function: "MD5" | "SHA-1" | "SHA-256" | "SHA-512";
/** Hash Value */
hash_value: string;
};
/** DatasetHash */
"DatasetHash-Output": {
/**
* Extra Files Path
* @description The path to the extra files used to generate the hash.
Expand Down Expand Up @@ -11378,6 +11515,50 @@ export interface components {
/** visible */
visible: boolean;
};
/** FileRequestUri */
FileRequestUri: {
/**
* @description discriminator enum property added by openapi-typescript
* @enum {string}
*/
class: "File";
/** Created From Basename */
created_from_basename?: string | null;
/**
* Dbkey
* @default ?
*/
dbkey: string;
/**
* Deferred
* @default false
*/
deferred: boolean;
/** Ext */
ext: string;
/** Hashes */
hashes?: components["schemas"]["DatasetHash-Input"][] | null;
/** Info */
info?: string | null;
/** Location */
location: string;
/** Name */
name?: string | null;
/**
* Space To Tab
* @default false
*/
space_to_tab: boolean;
/** Src */
src?: null;
/** Tags */
tags?: string[] | null;
/**
* To Posix Lines
* @default false
*/
to_posix_lines: boolean;
};
/** FileSourceTemplateSummaries */
FileSourceTemplateSummaries: components["schemas"]["FileSourceTemplateSummary"][];
/** FileSourceTemplateSummary */
Expand Down Expand Up @@ -12218,7 +12399,7 @@ export interface components {
* Hashes
* @description The list of hashes associated with this dataset.
*/
hashes?: components["schemas"]["DatasetHash"][] | null;
hashes?: components["schemas"]["DatasetHash-Output"][] | null;
/**
* HDA or LDDA
* @description Whether this dataset belongs to a history (HDA) or a library (LDDA).
Expand Down Expand Up @@ -12479,7 +12660,7 @@ export interface components {
* Hashes
* @description The list of hashes associated with this dataset.
*/
hashes: components["schemas"]["DatasetHash"][];
hashes: components["schemas"]["DatasetHash-Output"][];
/**
* HDA or LDDA
* @description Whether this dataset belongs to a history (HDA) or a library (LDDA).
Expand Down Expand Up @@ -26641,6 +26822,51 @@ export interface operations {
};
};
};
create_file_landing_api_file_landings_post: {
parameters: {
query?: never;
header?: {
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
"run-as"?: string | null;
};
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["CreateFileLandingPayload"];
};
};
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ToolLandingRequest"];
};
};
/** @description Request Error */
"4XX": {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
/** @description Server Error */
"5XX": {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
};
};
file_sources__instances_index: {
parameters: {
query?: never;
Expand Down
15 changes: 15 additions & 0 deletions lib/galaxy/schema/fetch_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
)
from galaxy.schema.terms import HelpTerms
from galaxy.schema.types import CoercedStringType
from galaxy.tool_util_models.parameters import FileOrCollectionRequest
from galaxy.util.hash_util import HashFunctionNames

HELP_TERMS = HelpTerms()
Expand Down Expand Up @@ -307,6 +308,11 @@ class DataLandingRequestState(Model):
targets: Targets


FileOrCollectionRequests = list[FileOrCollectionRequest]

FileOrCollectionRequestsAdapter = TypeAdapter(FileOrCollectionRequests)


# Vaguely matches the schema.schema.ToolLandingState but we don't allow data_fetch to be called directly
# via the tool API so we have a more specific model here.
class CreateDataLandingPayload(Model):
Expand All @@ -316,3 +322,12 @@ class CreateDataLandingPayload(Model):
origin: Optional[HttpUrl] = None

model_config = ConfigDict(extra="forbid")


class CreateFileLandingPayload(Model):
request_state: FileOrCollectionRequests
client_secret: Optional[str] = None
public: bool = False
origin: Optional[HttpUrl] = None

model_config = ConfigDict(extra="forbid")
4 changes: 3 additions & 1 deletion lib/galaxy/tool_util/client/landing.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def generate_claim_url(request: Request) -> Response:
template_type = "tool"
elif "workflow_id" in template:
template_type = "workflow"
elif isinstance(template["request_state"], list):
template_type = "file"
else:
template_type = "data"
if client_secret:
Expand All @@ -79,7 +81,7 @@ def generate_claim_url(request: Request) -> Response:
try:
raw_response.raise_for_status()
except Exception:
raise Exception("Request failed: %s", raw_response.text)
raise Exception("Request failed: %s", raw_response.json())
response = raw_response.json()
response_type = "workflow" if template_type == "workflow" else "tool"
url = f"{galaxy_url}/{response_type}_landings/{response['uuid']}"
Expand Down
Loading
Loading