com.databricks.sdk.service.files.FilesService Maven / Gradle / Ivy
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package com.databricks.sdk.service.files;
import com.databricks.sdk.support.Generated;
/**
* The Files API is a standard HTTP API that allows you to read, write, list, and delete files and
* directories by referring to their URI. The API makes working with file content as raw bytes
* easier and more efficient.
*
* 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.
*/
@Generated
public interface FilesService {
/**
* Create a directory.
*
*
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 createDirectory(CreateDirectoryRequest createDirectoryRequest);
/**
* Delete a file.
*
*
Deletes a file. If the request is successful, there is no response body.
*/
void delete(DeleteFileRequest deleteFileRequest);
/**
* Delete a directory.
*
*
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.
*/
void deleteDirectory(DeleteDirectoryRequest deleteDirectoryRequest);
/**
* Download a file.
*
*
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.
*/
DownloadResponse download(DownloadRequest downloadRequest);
/**
* Get directory metadata.
*
*
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).
*/
void getDirectoryMetadata(GetDirectoryMetadataRequest getDirectoryMetadataRequest);
/**
* Get file metadata.
*
*
Get the metadata of a file. The response HTTP headers contain the metadata. There is no
* response body.
*/
GetMetadataResponse getMetadata(GetMetadataRequest getMetadataRequest);
/**
* List directory contents.
*
*
Returns the contents of a directory. If there is no directory at the specified path, the API
* returns a HTTP 404 error.
*/
ListDirectoryResponse listDirectoryContents(
ListDirectoryContentsRequest listDirectoryContentsRequest);
/**
* Upload a file.
*
*
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.
*/
void upload(UploadRequest uploadRequest);
}