#![doc = "Generated reqwest client with typed errors and streaming bodies."]
use async_trait::async_trait;
use futures::{Stream, TryStreamExt, stream};
use reqwest::{Client, Url};
use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use spiral_contract::auth::AuthHeader;
use spiral_contract::call::{CallError, ServiceFailure};
use spiral_contract::error::ErrorEnvelope;
use crate::api::storage::StorageApi;
use crate::api::storage::objects::*;
#[derive(Clone)]
pub struct StorageClient {
http: ClientWithMiddleware,
base: Url,
}
impl std::fmt::Debug for StorageClient {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("StorageClient")
.field("base", &self.base)
.finish_non_exhaustive()
}
}
impl StorageClient {
#[expect(
clippy::disallowed_methods,
reason = "Generated clients keep their transport independent of the Spiral application runtime."
)]
pub fn new(base: &str) -> Result<Self, CallError<StorageError>> {
let http = Client::builder()
.redirect(reqwest::redirect::Policy::none())
.connect_timeout(std::time::Duration::from_secs(10))
.build()
.map_err(CallError::transport)?;
Self::from_http(base, http)
}
pub fn from_http(base: &str, http: Client) -> Result<Self, CallError<StorageError>> {
Self::from_transport(base, ClientBuilder::new(http).build())
}
pub fn from_transport(
base: &str,
http: ClientWithMiddleware,
) -> Result<Self, CallError<StorageError>> {
let base = Url::parse(base)
.map_err(|_| CallError::<StorageError>::protocol("invalid base URL"))?;
if !matches!(base.scheme(), "http" | "https")
|| base.host_str().is_none()
|| !base.username().is_empty()
|| base.password().is_some()
|| base.query().is_some()
|| base.fragment().is_some()
{
return Err(CallError::<StorageError>::protocol("invalid base URL"));
}
Ok(Self { http, base })
}
pub fn with_transport(mut self, http: ClientWithMiddleware) -> Self {
self.http = http;
self
}
pub fn with_http(mut self, http: Client) -> Self {
self.http = ClientBuilder::new(http).build();
self
}
pub async fn create_mount_http(
&self,
auth_header: AuthHeader,
project_id: String,
request: CreateMountRequest,
) -> Result<CreateMountResponse, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("projects");
let segment = project_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("mounts");
}
let builder = self.http.post(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder
.header("content-type", "application/json")
.json(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn issue_mount_token_http(
&self,
auth_header: AuthHeader,
mount_id: String,
request: IssueMountTokenRequest,
) -> Result<IssueMountTokenResponse, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("mounts");
let segment = mount_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("token");
}
let builder = self.http.post(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder
.header("content-type", "application/json")
.json(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn list_mounts_http(
&self,
auth_header: AuthHeader,
project_id: String,
request: PageRequest,
) -> Result<MountPage, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("projects");
let segment = project_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("mounts");
}
let builder = self.http.get(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder.query(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub fn list_mounts_pages<'a>(
&'a self,
auth_header: &'a AuthHeader,
project_id: String,
request: PageRequest,
) -> impl Stream<Item = Result<MountPage, CallError<StorageError>>> + 'a {
stream::try_unfold(Some(request), move |request| {
#[allow(
clippy::clone_on_copy,
reason = "Hosts may implement Copy for generated aliases; pagination also supports Clone aliases."
)]
let project_id = project_id.clone();
async move {
let Some(mut request) = request else {
return Ok(None);
};
let page = self
.list_mounts_http(auth_header.clone(), project_id, request.clone())
.await?;
let next = page.next_page_token.clone();
if next.as_ref().is_some_and(|token| {
token.is_empty() || Some(token) == request.page_token.as_ref()
}) {
return Err(CallError::<StorageError>::protocol(
"invalid pagination token",
));
}
request.page_token = next;
let next_request = request.page_token.is_some().then_some(request);
Ok(Some((page, next_request)))
}
})
}
pub fn list_mounts_items<'a>(
&'a self,
auth_header: &'a AuthHeader,
project_id: String,
request: PageRequest,
) -> impl Stream<Item = Result<Mount, CallError<StorageError>>> + 'a {
self.list_mounts_pages(auth_header, project_id, request)
.map_ok(|page| {
stream::iter(page.items.into_iter().map(Ok::<_, CallError<StorageError>>))
})
.try_flatten()
}
pub async fn list_mounts_global_http(
&self,
auth_header: AuthHeader,
request: GlobalMountsRequest,
) -> Result<MountPage, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("mounts");
}
let builder = self.http.get(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder.query(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub fn list_mounts_global_pages<'a>(
&'a self,
auth_header: &'a AuthHeader,
request: GlobalMountsRequest,
) -> impl Stream<Item = Result<MountPage, CallError<StorageError>>> + 'a {
stream::try_unfold(Some(request), move |request| async move {
let Some(mut request) = request else {
return Ok(None);
};
let page = self
.list_mounts_global_http(auth_header.clone(), request.clone())
.await?;
let next = page.next_page_token.clone();
if next
.as_ref()
.is_some_and(|token| token.is_empty() || Some(token) == request.page_token.as_ref())
{
return Err(CallError::<StorageError>::protocol(
"invalid pagination token",
));
}
request.page_token = next;
let next_request = request.page_token.is_some().then_some(request);
Ok(Some((page, next_request)))
})
}
pub fn list_mounts_global_items<'a>(
&'a self,
auth_header: &'a AuthHeader,
request: GlobalMountsRequest,
) -> impl Stream<Item = Result<Mount, CallError<StorageError>>> + 'a {
self.list_mounts_global_pages(auth_header, request)
.map_ok(|page| {
stream::iter(page.items.into_iter().map(Ok::<_, CallError<StorageError>>))
})
.try_flatten()
}
pub async fn list_volumes_http(
&self,
auth_header: AuthHeader,
request: PageRequest,
) -> Result<VolumePage, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("volumes");
}
let builder = self.http.get(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder.query(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub fn list_volumes_pages<'a>(
&'a self,
auth_header: &'a AuthHeader,
request: PageRequest,
) -> impl Stream<Item = Result<VolumePage, CallError<StorageError>>> + 'a {
stream::try_unfold(Some(request), move |request| async move {
let Some(mut request) = request else {
return Ok(None);
};
let page = self
.list_volumes_http(auth_header.clone(), request.clone())
.await?;
let next = page.next_page_token.clone();
if next
.as_ref()
.is_some_and(|token| token.is_empty() || Some(token) == request.page_token.as_ref())
{
return Err(CallError::<StorageError>::protocol(
"invalid pagination token",
));
}
request.page_token = next;
let next_request = request.page_token.is_some().then_some(request);
Ok(Some((page, next_request)))
})
}
pub fn list_volumes_items<'a>(
&'a self,
auth_header: &'a AuthHeader,
request: PageRequest,
) -> impl Stream<Item = Result<VolumeView, CallError<StorageError>>> + 'a {
self.list_volumes_pages(auth_header, request)
.map_ok(|page| {
stream::iter(page.items.into_iter().map(Ok::<_, CallError<StorageError>>))
})
.try_flatten()
}
pub async fn read_mount_http(
&self,
auth_header: AuthHeader,
mount_id: String,
) -> Result<Mount, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("mounts");
let segment = mount_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
}
let builder = self.http.get(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn read_mount_storage_http(
&self,
auth_header: AuthHeader,
mount_id: String,
) -> Result<GetMountAndFileSystemResponse, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("mounts");
let segment = mount_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("storage");
}
let builder = self.http.get(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn read_project_storage_http(
&self,
auth_header: AuthHeader,
project_id: String,
) -> Result<ProjectStorageView, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("projects");
let segment = project_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("storage");
}
let builder = self.http.get(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn register_volume_http(
&self,
auth_header: AuthHeader,
request: RegisterVolumeRequest,
) -> Result<VolumeView, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("volumes");
}
let builder = self.http.post(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder
.header("content-type", "application/json")
.json(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn remove_mount_http(
&self,
auth_header: AuthHeader,
mount_id: String,
) -> Result<(), CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("mounts");
let segment = mount_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
}
let builder = self.http.delete(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn select_project_storage_http(
&self,
auth_header: AuthHeader,
project_id: String,
request: ProjectStorage,
) -> Result<ProjectStorageView, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("projects");
let segment = project_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("storage");
}
let builder = self.http.put(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder
.header("content-type", "application/json")
.json(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn test_volume_http(
&self,
auth_header: AuthHeader,
volume_id: String,
) -> Result<TestVolumeResponse, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("volumes");
let segment = volume_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("test");
}
let builder = self.http.post(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn update_volume_credential_http(
&self,
auth_header: AuthHeader,
volume_id: String,
request: UpdateVolumeCredentialRequest,
) -> Result<VolumeView, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("volumes");
let segment = volume_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("credential");
}
let builder = self.http.put(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder
.header("content-type", "application/json")
.json(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
pub async fn update_volume_status_http(
&self,
auth_header: AuthHeader,
volume_id: String,
request: UpdateVolumeStatusRequest,
) -> Result<VolumeView, CallError<StorageError>> {
let mut url = self.base.clone();
{
let mut path = url.path_segments_mut().map_err(|_| {
CallError::<StorageError>::protocol("base URL cannot contain path segments")
})?;
path.pop_if_empty();
path.push("api");
path.push("storage");
path.push("volumes");
let segment = volume_id.to_string();
if matches!(segment.as_str(), "." | "..") {
return Err(CallError::<StorageError>::protocol("dot path segment"));
}
path.push(&segment);
path.push("status");
}
let builder = self.http.put(url).header("accept", "application/json");
let builder = builder.header("authorization", auth_header.as_str());
let builder = builder
.header("content-type", "application/json")
.json(&request);
let response = self.send(builder, "application/json").await?;
let status = response.status().as_u16();
let bytes = bounded_body(response, 8 * 1024 * 1024).await?;
serde_json::from_slice(&bytes)
.map_err(|_| CallError::protocol_response(status, "invalid JSON response"))
}
async fn send(
&self,
builder: reqwest_middleware::RequestBuilder,
expected_media: &str,
) -> Result<reqwest::Response, CallError<StorageError>> {
let response = builder
.timeout(std::time::Duration::from_secs(60))
.send()
.await
.map_err(CallError::transport)?;
let status = response.status();
if !status.is_success() {
let status = status.as_u16();
let content_type = response
.headers()
.get("content-type")
.and_then(|value| value.to_str().ok())
.map(str::to_owned);
let (bytes, truncated) = bounded_error_body::<StorageError>(
response,
64 * 1024,
status,
content_type.clone(),
)
.await?;
if truncated {
return Err(CallError::unknown_remote(status, content_type, bytes, true));
}
return match serde_json::from_slice::<ErrorEnvelope>(&bytes) {
Ok(envelope) => Err(CallError::Service(ServiceFailure::remote(status, envelope))),
Err(_) => Err(CallError::unknown_remote(
status,
content_type,
bytes,
false,
)),
};
}
if !media_matches(&response, expected_media) {
return Err(CallError::protocol_response(
status.as_u16(),
"unexpected response media type",
));
}
Ok(response)
}
}
fn media_matches(response: &reqwest::Response, expected: &str) -> bool {
response
.headers()
.get("content-type")
.and_then(|value| value.to_str().ok())
.and_then(|value| value.split(';').next())
.is_some_and(|value| value.trim().eq_ignore_ascii_case(expected))
}
async fn bounded_body(
mut response: reqwest::Response,
limit: usize,
) -> Result<Vec<u8>, CallError<StorageError>> {
let status = response.status().as_u16();
let mut result = Vec::new();
while let Some(chunk) = response
.chunk()
.await
.map_err(|error| CallError::transport_response(status, error))?
{
if chunk.len() > limit.saturating_sub(result.len()) {
return Err(CallError::protocol_response(
status,
"response exceeds JSON size limit",
));
}
result.extend_from_slice(&chunk);
}
Ok(result)
}
async fn bounded_error_body<E>(
mut response: reqwest::Response,
limit: usize,
status: u16,
content_type: Option<String>,
) -> Result<(Vec<u8>, bool), CallError<E>> {
let mut result = Vec::new();
loop {
let chunk = response.chunk().await.map_err(|error| {
CallError::unreadable_remote(status, content_type.clone(), result.clone(), error)
})?;
let Some(chunk) = chunk else {
return Ok((result, false));
};
let remaining = limit.saturating_sub(result.len());
if chunk.len() > remaining {
result.extend_from_slice(&chunk[..remaining]);
return Ok((result, true));
}
result.extend_from_slice(&chunk);
}
}
#[async_trait]
impl StorageApi for StorageClient {
async fn create_mount(
&self,
auth_header: AuthHeader,
project_id: String,
request: CreateMountRequest,
) -> Result<CreateMountResponse, CallError<StorageError>> {
let response = Self::create_mount_http(self, auth_header, project_id, request).await?;
Ok(response)
}
async fn issue_mount_token(
&self,
auth_header: AuthHeader,
mount_id: String,
request: IssueMountTokenRequest,
) -> Result<IssueMountTokenResponse, CallError<StorageError>> {
let response = Self::issue_mount_token_http(self, auth_header, mount_id, request).await?;
Ok(response)
}
async fn list_mounts(
&self,
auth_header: AuthHeader,
project_id: String,
request: PageRequest,
) -> Result<MountPage, CallError<StorageError>> {
let response = Self::list_mounts_http(self, auth_header, project_id, request).await?;
Ok(response)
}
async fn list_mounts_global(
&self,
auth_header: AuthHeader,
request: GlobalMountsRequest,
) -> Result<MountPage, CallError<StorageError>> {
let response = Self::list_mounts_global_http(self, auth_header, request).await?;
Ok(response)
}
async fn list_volumes(
&self,
auth_header: AuthHeader,
request: PageRequest,
) -> Result<VolumePage, CallError<StorageError>> {
let response = Self::list_volumes_http(self, auth_header, request).await?;
Ok(response)
}
async fn read_mount(
&self,
auth_header: AuthHeader,
mount_id: String,
) -> Result<Mount, CallError<StorageError>> {
let response = Self::read_mount_http(self, auth_header, mount_id).await?;
Ok(response)
}
async fn read_mount_storage(
&self,
auth_header: AuthHeader,
mount_id: String,
) -> Result<GetMountAndFileSystemResponse, CallError<StorageError>> {
let response = Self::read_mount_storage_http(self, auth_header, mount_id).await?;
Ok(response)
}
async fn read_project_storage(
&self,
auth_header: AuthHeader,
project_id: String,
) -> Result<ProjectStorageView, CallError<StorageError>> {
let response = Self::read_project_storage_http(self, auth_header, project_id).await?;
Ok(response)
}
async fn register_volume(
&self,
auth_header: AuthHeader,
request: RegisterVolumeRequest,
) -> Result<VolumeView, CallError<StorageError>> {
let response = Self::register_volume_http(self, auth_header, request).await?;
Ok(response)
}
async fn remove_mount(
&self,
auth_header: AuthHeader,
mount_id: String,
) -> Result<(), CallError<StorageError>> {
let response = Self::remove_mount_http(self, auth_header, mount_id).await?;
Ok(response)
}
async fn select_project_storage(
&self,
auth_header: AuthHeader,
project_id: String,
request: ProjectStorage,
) -> Result<ProjectStorageView, CallError<StorageError>> {
let response =
Self::select_project_storage_http(self, auth_header, project_id, request).await?;
Ok(response)
}
async fn test_volume(
&self,
auth_header: AuthHeader,
volume_id: String,
) -> Result<TestVolumeResponse, CallError<StorageError>> {
let response = Self::test_volume_http(self, auth_header, volume_id).await?;
Ok(response)
}
async fn update_volume_credential(
&self,
auth_header: AuthHeader,
volume_id: String,
request: UpdateVolumeCredentialRequest,
) -> Result<VolumeView, CallError<StorageError>> {
let response =
Self::update_volume_credential_http(self, auth_header, volume_id, request).await?;
Ok(response)
}
async fn update_volume_status(
&self,
auth_header: AuthHeader,
volume_id: String,
request: UpdateVolumeStatusRequest,
) -> Result<VolumeView, CallError<StorageError>> {
let response =
Self::update_volume_status_http(self, auth_header, volume_id, request).await?;
Ok(response)
}
}