| 568 | } |
| 569 | |
| 570 | async fn remove_gateways( |
| 571 | &self, |
| 572 | request: Request<api::RemoveGatewaysFromFuotaDeploymentRequest>, |
| 573 | ) -> Result<Response<()>, Status> { |
| 574 | let req = request.get_ref(); |
| 575 | let dp_id = Uuid::from_str(&req.fuota_deployment_id).map_err(|e| e.status())?; |
| 576 | |
| 577 | self.validator |
| 578 | .validate( |
| 579 | request.extensions(), |
| 580 | validator::ValidateFuotaDeploymentAccess::new(validator::Flag::Update, dp_id), |
| 581 | ) |
| 582 | .await?; |
| 583 | |
| 584 | let mut gateway_ids = Vec::with_capacity(req.gateway_ids.len()); |
| 585 | for gateway_id in &req.gateway_ids { |
| 586 | gateway_ids.push(EUI64::from_str(gateway_id).map_err(|e| e.status())?); |
| 587 | } |
| 588 | |
| 589 | fuota::remove_gateways(dp_id, gateway_ids) |
| 590 | .await |
| 591 | .map_err(|e| e.status())?; |
| 592 | |
| 593 | let mut resp = Response::new(()); |
| 594 | resp.metadata_mut().insert( |
| 595 | "x-log-fuota_deployment_id", |
| 596 | req.fuota_deployment_id.parse().unwrap(), |
| 597 | ); |
| 598 | Ok(resp) |
| 599 | } |
| 600 | |
| 601 | async fn list_gateways( |
| 602 | &self, |