pub struct Volume {
pub volume_id: String,
pub name: String,
pub token: Option<String>,
/* private fields */
}Expand description
Persistent volume that can be mounted into sandboxes and edited while detached.
Fields§
§volume_id: StringVolume id.
name: StringVolume name.
token: Option<String>Volume access token returned by the API.
Implementations§
Source§impl Volume
impl Volume
Sourcepub async fn create(
name: impl Into<String>,
opts: VolumeCreateOptions,
) -> Result<Self>
pub async fn create( name: impl Into<String>, opts: VolumeCreateOptions, ) -> Result<Self>
Create a persistent volume and return a connected SDK object.
Sourcepub async fn connect(
volume_id: impl ToString,
connection: ConnectionOptions,
) -> Result<Self>
pub async fn connect( volume_id: impl ToString, connection: ConnectionOptions, ) -> Result<Self>
Connect to an existing volume by id or name.
Sourcepub async fn get_info_by_id(
volume_id: impl ToString,
connection: ConnectionOptions,
) -> Result<VolumeInfo>
pub async fn get_info_by_id( volume_id: impl ToString, connection: ConnectionOptions, ) -> Result<VolumeInfo>
Fetch metadata for an existing volume by id or name.
Sourcepub async fn list(opts: VolumeListOptions) -> Result<Vec<VolumeInfo>>
pub async fn list(opts: VolumeListOptions) -> Result<Vec<VolumeInfo>>
List volumes visible to the configured API key.
Sourcepub async fn destroy_by_id(
volume_id: impl ToString,
connection: ConnectionOptions,
) -> Result<bool>
pub async fn destroy_by_id( volume_id: impl ToString, connection: ConnectionOptions, ) -> Result<bool>
Destroy a volume by id or name. Returns false when it does not exist.
Sourcepub async fn get_info(&self) -> Result<VolumeInfo>
pub async fn get_info(&self) -> Result<VolumeInfo>
Fetch this volume metadata.
Sourcepub async fn get_path_info(
&self,
path: impl AsRef<str>,
) -> Result<VolumeEntryStat>
pub async fn get_path_info( &self, path: impl AsRef<str>, ) -> Result<VolumeEntryStat>
Fetch metadata for a path inside this volume.
Sourcepub async fn list_files(
&self,
path: impl AsRef<str>,
depth: Option<u64>,
) -> Result<Vec<VolumeEntryStat>>
pub async fn list_files( &self, path: impl AsRef<str>, depth: Option<u64>, ) -> Result<Vec<VolumeEntryStat>>
List files and directories under path.
Sourcepub async fn make_dir(
&self,
path: impl Into<String>,
opts: VolumeWriteOptions,
) -> Result<VolumeEntryStat>
pub async fn make_dir( &self, path: impl Into<String>, opts: VolumeWriteOptions, ) -> Result<VolumeEntryStat>
Create a directory inside the detached volume.
Sourcepub async fn exists(&self, path: impl AsRef<str>) -> Result<bool>
pub async fn exists(&self, path: impl AsRef<str>) -> Result<bool>
Return whether a path exists inside the detached volume.
Sourcepub async fn update_metadata(
&self,
path: impl Into<String>,
opts: VolumeWriteOptions,
) -> Result<VolumeEntryStat>
pub async fn update_metadata( &self, path: impl Into<String>, opts: VolumeWriteOptions, ) -> Result<VolumeEntryStat>
Update ownership or mode metadata for a path.
Sourcepub async fn read_file(&self, path: impl AsRef<str>) -> Result<Vec<u8>>
pub async fn read_file(&self, path: impl AsRef<str>) -> Result<Vec<u8>>
Read a file from the detached volume as bytes.
Sourcepub async fn write_file(
&self,
path: impl Into<String>,
data: impl AsRef<[u8]>,
opts: VolumeWriteOptions,
) -> Result<VolumeEntryStat>
pub async fn write_file( &self, path: impl Into<String>, data: impl AsRef<[u8]>, opts: VolumeWriteOptions, ) -> Result<VolumeEntryStat>
Write a file into the detached volume.