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

Method list_by_dev_addr_prefix_overlap

chirpstack/src/api/tenant.rs:263–299  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::ListTenantsByDevAddrPrefixOverlapRequest>,
    )

Source from the content-addressed store, hash-verified

261 }
262
263 async fn list_by_dev_addr_prefix_overlap(
264 &self,
265 request: Request<api::ListTenantsByDevAddrPrefixOverlapRequest>,
266 ) -> Result<Response<api::ListTenantsResponse>, Status> {
267 self.validator
268 .validate(
269 request.extensions(),
270 validator::ValidateTenantsAccess::new(validator::Flag::List),
271 )
272 .await?;
273
274 let req = request.get_ref();
275 let dev_addr_prefix =
276 lrwn::DevAddrPrefix::from_str(&req.dev_addr_prefix).map_err(|e| e.status())?;
277
278 let tenants = tenant::list_by_dev_addr_prefix_overlap(dev_addr_prefix)
279 .await
280 .map_err(|e| e.status())?;
281
282 Ok(Response::new(api::ListTenantsResponse {
283 total_count: tenants.len() as u32,
284 result: tenants
285 .iter()
286 .map(|t| api::TenantListItem {
287 id: t.id.to_string(),
288 created_at: Some(helpers::datetime_to_prost_timestamp(&t.created_at)),
289 updated_at: Some(helpers::datetime_to_prost_timestamp(&t.updated_at)),
290 name: t.name.clone(),
291 can_have_gateways: t.can_have_gateways,
292 private_gateways_up: t.private_gateways_up,
293 private_gateways_down: t.private_gateways_down,
294 max_gateway_count: t.max_gateway_count as u32,
295 max_device_count: t.max_device_count as u32,
296 })
297 .collect(),
298 }))
299 }
300
301 async fn add_user(
302 &self,

Callers 1

test_tenantFunction · 0.80

Calls 6

statusMethod · 0.80
iterMethod · 0.80
to_stringMethod · 0.80
validateMethod · 0.45

Tested by 1

test_tenantFunction · 0.64