@Generated public interface FilesService
The API supports [Unity Catalog volumes], where files and directories to operate on are specified using their volume URI path, which follows the format /Volumes/<catalog_name>/<schema_name>/<volume_name>/<path_to_file>.
The Files API has two distinct endpoints, one for working with files (`/fs/files`) and another one for working with directories (`/fs/directories`). Both endpoints, use the standard HTTP methods GET, HEAD, PUT, and DELETE to manage files and directories specified using their URI path. The path is always absolute.
[Unity Catalog volumes]: https://docs.databricks.com/en/connect/unity-catalog/volumes.html
This is the high-level interface, that contains generated methods.
Evolving: this interface is under development. Method signatures may change.
Modifier and Type | Method and Description |
---|---|
void |
createDirectory(CreateDirectoryRequest createDirectoryRequest)
Create a directory.
|
void |
delete(DeleteFileRequest deleteFileRequest)
Delete a file.
|
void |
deleteDirectory(DeleteDirectoryRequest deleteDirectoryRequest)
Delete a directory.
|
DownloadResponse |
download(DownloadRequest downloadRequest)
Download a file.
|
void |
getDirectoryMetadata(GetDirectoryMetadataRequest getDirectoryMetadataRequest)
Get directory metadata.
|
GetMetadataResponse |
getMetadata(GetMetadataRequest getMetadataRequest)
Get file metadata.
|
ListDirectoryResponse |
listDirectoryContents(ListDirectoryContentsRequest listDirectoryContentsRequest)
List directory contents.
|
void |
upload(UploadRequest uploadRequest)
Upload a file.
|
void createDirectory(CreateDirectoryRequest createDirectoryRequest)
Creates an empty directory. If necessary, also creates any parent directories of the new, empty directory (like the shell command `mkdir -p`). If called on an existing directory, returns a success response; this method is idempotent (it will succeed if the directory already exists).
void delete(DeleteFileRequest deleteFileRequest)
Deletes a file. If the request is successful, there is no response body.
void deleteDirectory(DeleteDirectoryRequest deleteDirectoryRequest)
Deletes an empty directory.
To delete a non-empty directory, first delete all of its contents. This can be done by listing the directory contents and deleting each file and subdirectory recursively.
DownloadResponse download(DownloadRequest downloadRequest)
Downloads a file of up to 5 GiB. The file contents are the response body. This is a standard HTTP file download, not a JSON RPC.
void getDirectoryMetadata(GetDirectoryMetadataRequest getDirectoryMetadataRequest)
Get the metadata of a directory. The response HTTP headers contain the metadata. There is no response body.
This method is useful to check if a directory exists and the caller has access to it.
If you wish to ensure the directory exists, you can instead use `PUT`, which will create the directory if it does not exist, and is idempotent (it will succeed if the directory already exists).
GetMetadataResponse getMetadata(GetMetadataRequest getMetadataRequest)
Get the metadata of a file. The response HTTP headers contain the metadata. There is no response body.
ListDirectoryResponse listDirectoryContents(ListDirectoryContentsRequest listDirectoryContentsRequest)
Returns the contents of a directory. If there is no directory at the specified path, the API returns a HTTP 404 error.
void upload(UploadRequest uploadRequest)
Uploads a file of up to 5 GiB. The file contents should be sent as the request body as raw bytes (an octet stream); do not encode or otherwise modify the bytes before sending. The contents of the resulting file will be exactly the bytes sent in the request body. If the request is successful, there is no response body.
Copyright © 2024. All rights reserved.