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

Method list_deployments

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

Source from the content-addressed store, hash-verified

326 }
327
328 async fn list_deployments(
329 &self,
330 request: Request<api::ListFuotaDeploymentsRequest>,
331 ) -> Result<Response<api::ListFuotaDeploymentsResponse>, Status> {
332 let req = request.get_ref();
333 let user_id: Option<Uuid> =
334 if let Some(AuthID::User(v)) = request.extensions().get::<AuthID>() {
335 Some(*v)
336 } else {
337 None
338 };
339 let tenant_id = if req.tenant_id.is_empty() {
340 None
341 } else {
342 Some(Uuid::from_str(&req.tenant_id).map_err(|e| e.status())?)
343 };
344 let app_id = if req.application_id.is_empty() {
345 None
346 } else {
347 Some(Uuid::from_str(&req.application_id).map_err(|e| e.status())?)
348 };
349
350 self.validator
351 .validate(
352 request.extensions(),
353 validator::ValidateFuotaDeploymentsAccess::new(
354 validator::Flag::List,
355 tenant_id,
356 app_id,
357 ),
358 )
359 .await?;
360
361 let count = fuota::get_deployment_count(user_id, tenant_id, app_id)
362 .await
363 .map_err(|e| e.status())?;
364 let items = fuota::list_deployments(
365 user_id,
366 tenant_id,
367 app_id,
368 req.limit as i64,
369 req.offset as i64,
370 )
371 .await
372 .map_err(|e| e.status())?;
373
374 let mut resp = Response::new(api::ListFuotaDeploymentsResponse {
375 total_count: count as u32,
376 result: items
377 .iter()
378 .map(|d| api::FuotaDeploymentListItem {
379 id: d.id.to_string(),
380 created_at: Some(helpers::datetime_to_prost_timestamp(&d.created_at)),
381 updated_at: Some(helpers::datetime_to_prost_timestamp(&d.created_at)),
382 started_at: d
383 .started_at
384 .as_ref()
385 .map(helpers::datetime_to_prost_timestamp),

Callers 1

test_fuotaFunction · 0.80

Calls 10

get_deployment_countFunction · 0.85
list_deploymentsFunction · 0.85
statusMethod · 0.80
iterMethod · 0.80
to_stringMethod · 0.80
as_refMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
validateMethod · 0.45

Tested by 1

test_fuotaFunction · 0.64