| 478 | } |
| 479 | |
| 480 | async fn get_influx_db_integration( |
| 481 | &self, |
| 482 | request: Request<api::GetInfluxDbIntegrationRequest>, |
| 483 | ) -> Result<Response<api::GetInfluxDbIntegrationResponse>, Status> { |
| 484 | let req = request.get_ref(); |
| 485 | let app_id = Uuid::from_str(&req.application_id).map_err(|e| e.status())?; |
| 486 | |
| 487 | self.validator |
| 488 | .validate( |
| 489 | request.extensions(), |
| 490 | validator::ValidateApplicationAccess::new(validator::Flag::Read, app_id), |
| 491 | ) |
| 492 | .await?; |
| 493 | |
| 494 | let i = application::get_integration(&app_id, application::IntegrationKind::InfluxDb) |
| 495 | .await |
| 496 | .map_err(|e| e.status())?; |
| 497 | |
| 498 | if let application::IntegrationConfiguration::InfluxDb(conf) = &i.configuration { |
| 499 | let mut resp = Response::new(api::GetInfluxDbIntegrationResponse { |
| 500 | integration: Some(api::InfluxDbIntegration { |
| 501 | application_id: app_id.to_string(), |
| 502 | endpoint: conf.endpoint.clone(), |
| 503 | db: conf.db.clone(), |
| 504 | username: conf.username.clone(), |
| 505 | password: conf.password.clone(), |
| 506 | retention_policy_name: conf.retention_policy_name.clone(), |
| 507 | precision: conf.precision, |
| 508 | version: conf.version, |
| 509 | token: conf.token.clone(), |
| 510 | organization: conf.organization.clone(), |
| 511 | bucket: conf.bucket.clone(), |
| 512 | }), |
| 513 | }); |
| 514 | resp.metadata_mut() |
| 515 | .insert("x-log-application_id", req.application_id.parse().unwrap()); |
| 516 | |
| 517 | Ok(resp) |
| 518 | } else { |
| 519 | Err(Status::internal( |
| 520 | "Integration has no InfluxDb configuration", |
| 521 | )) |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | async fn update_influx_db_integration( |
| 526 | &self, |