MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / add_gateways

Method add_gateways

chirpstack/src/api/fuota.rs:532–568  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::AddGatewaysToFuotaDeploymentRequest>,
    )

Source from the content-addressed store, hash-verified

530 }
531
532 async fn add_gateways(
533 &self,
534 request: Request<api::AddGatewaysToFuotaDeploymentRequest>,
535 ) -> Result<Response<()>, Status> {
536 let req = request.get_ref();
537 let dp_id = Uuid::from_str(&req.fuota_deployment_id).map_err(|e| e.status())?;
538
539 self.validator
540 .validate(
541 request.extensions(),
542 validator::ValidateFuotaDeploymentAccess::new(validator::Flag::Update, dp_id),
543 )
544 .await?;
545
546 let d = fuota::get_deployment(dp_id).await.map_err(|e| e.status())?;
547 if d.started_at.is_some() {
548 return Err(Status::failed_precondition(
549 "FUOTA deployment has already started",
550 ));
551 }
552
553 let mut gateway_ids = Vec::with_capacity(req.gateway_ids.len());
554 for gateway_id in &req.gateway_ids {
555 gateway_ids.push(EUI64::from_str(gateway_id).map_err(|e| e.status())?);
556 }
557
558 fuota::add_gateways(dp_id, gateway_ids)
559 .await
560 .map_err(|e| e.status())?;
561
562 let mut resp = Response::new(());
563 resp.metadata_mut().insert(
564 "x-log-fuota_deployment_id",
565 req.fuota_deployment_id.parse().unwrap(),
566 );
567 Ok(resp)
568 }
569
570 async fn remove_gateways(
571 &self,

Callers 1

test_fuotaFunction · 0.80

Calls 7

get_deploymentFunction · 0.85
add_gatewaysFunction · 0.85
statusMethod · 0.80
pushMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
validateMethod · 0.45

Tested by 1

test_fuotaFunction · 0.64