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

Method get_http_integration

chirpstack/src/api/application.rs:317–355  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::GetHttpIntegrationRequest>,
    )

Source from the content-addressed store, hash-verified

315 }
316
317 async fn get_http_integration(
318 &self,
319 request: Request<api::GetHttpIntegrationRequest>,
320 ) -> Result<Response<api::GetHttpIntegrationResponse>, Status> {
321 let req = request.get_ref();
322 let app_id = Uuid::from_str(&req.application_id).map_err(|e| e.status())?;
323
324 self.validator
325 .validate(
326 request.extensions(),
327 validator::ValidateApplicationAccess::new(validator::Flag::Read, app_id),
328 )
329 .await?;
330
331 let i = application::get_integration(&app_id, application::IntegrationKind::Http)
332 .await
333 .map_err(|e| e.status())?;
334
335 if let application::IntegrationConfiguration::Http(conf) = &i.configuration {
336 let mut resp = Response::new(api::GetHttpIntegrationResponse {
337 integration: Some(api::HttpIntegration {
338 application_id: app_id.to_string(),
339 headers: conf.headers.clone(),
340 encoding: match conf.json {
341 true => api::Encoding::Json,
342 false => api::Encoding::Protobuf,
343 }
344 .into(),
345 event_endpoint_url: conf.event_endpoint_url.clone(),
346 }),
347 });
348 resp.metadata_mut()
349 .insert("x-log-application_id", req.application_id.parse().unwrap());
350
351 Ok(resp)
352 } else {
353 Err(Status::internal("Integration has no Http configuration"))
354 }
355 }
356
357 async fn update_http_integration(
358 &self,

Callers 1

test_http_integrationFunction · 0.80

Calls 7

get_integrationFunction · 0.85
statusMethod · 0.80
to_stringMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
validateMethod · 0.45
intoMethod · 0.45

Tested by 1

test_http_integrationFunction · 0.64