manta_server/backend_dispatcher/ims.rs
1//! [`ImsTrait`] impl for [`StaticBackendDispatcher`].
2//!
3//! Forwards to the CSM IMS (Image Management Service)
4//! `/apis/ims/v3/images` API. Ochami's `impl ImsTrait for Ochami {}`
5//! is empty, so each method on the Ochami branch returns
6//! [`Error::Message`] from the trait default ("not implemented for
7//! this backend").
8
9use super::*;
10
11impl ImsTrait for StaticBackendDispatcher {
12 /// `GET /images/{id}` when `image_id_opt` is `Some`, otherwise
13 /// the full image list. Returned as `Vec<Image>` for shape
14 /// consistency with the list path.
15 async fn get_images(
16 &self,
17 token: &str,
18 image_id_opt: Option<&str>,
19 ) -> Result<Vec<Image>, Error> {
20 dispatch!(self, get_images, token, image_id_opt)
21 }
22
23 /// `GET /images` — every image visible to the bearer.
24 async fn get_all_images(&self, token: &str) -> Result<Vec<Image>, Error> {
25 dispatch!(self, get_all_images, token)
26 }
27
28 /// In-place client-side filter applied to `image_vec` (the only
29 /// sync method on this trait). The backend strips images the
30 /// caller cannot see or that fail a per-backend visibility rule.
31 fn filter_images(&self, image_vec: &mut Vec<Image>) -> Result<(), Error> {
32 dispatch!(sync self, filter_images, image_vec)
33 }
34
35 /// `PATCH /images/{id}` — apply `image` as a partial update.
36 async fn update_image(
37 &self,
38 token: &str,
39 image_id: &str,
40 image: &PatchImage,
41 ) -> Result<(), Error> {
42 dispatch!(self, update_image, token, image_id, image)
43 }
44
45 /// `DELETE /images/{id}`.
46 async fn delete_image(
47 &self,
48 token: &str,
49 image_id: &str,
50 ) -> Result<(), Error> {
51 dispatch!(self, delete_image, token, image_id)
52 }
53}