use actix_web::{web, HttpResponse, Responder}; use serde::{Deserialize, Serialize}; /// #[derive(Deserialize, Debug)] #[allow(unused)] pub struct LastOperationParams { pub service_id: Option, pub plan_id: Option, pub operation: Option, } /// #[derive(Serialize, Default, Debug)] pub struct ServiceInstanceLastOp { pub state: LastOperationState, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(skip_serializing_if = "Option::is_none")] pub instance_usable: Option, #[serde(skip_serializing_if = "Option::is_none")] pub update_repeatable: Option, } #[derive(Serialize, Debug)] #[serde(rename_all = "lowercase")] #[allow(unused)] pub enum LastOperationState { #[serde(rename(serialize = "in progress"))] InProgress, Succeeded, Failed, } impl Default for LastOperationState { fn default() -> Self { LastOperationState::InProgress } } pub async fn get_service_instance_last_operation( _instance_id: web::Path, web::Query(params): web::Query, ) -> impl Responder { log::info!("params {:?}", params); let mut response = ServiceInstanceLastOp::default(); response.state = LastOperationState::Succeeded; HttpResponse::Ok().json(response) } /// #[derive(Serialize, Default, Debug)] struct ServiceBindingLastOp { pub state: LastOperationState, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, } pub async fn get_service_binding_state( web::Path((_instance_id, _binding_id)): web::Path<(String, String)>, web::Query(params): web::Query, ) -> impl Responder { log::info!("params {:?}", params); let mut response = ServiceBindingLastOp::default(); response.state = LastOperationState::Succeeded; HttpResponse::Ok().json(response) }