| 930 | } |
| 931 | |
| 932 | async fn get_gcp_pub_sub_integration( |
| 933 | &self, |
| 934 | request: Request<api::GetGcpPubSubIntegrationRequest>, |
| 935 | ) -> Result<Response<api::GetGcpPubSubIntegrationResponse>, Status> { |
| 936 | let req = request.get_ref(); |
| 937 | let app_id = Uuid::from_str(&req.application_id).map_err(|e| e.status())?; |
| 938 | |
| 939 | self.validator |
| 940 | .validate( |
| 941 | request.extensions(), |
| 942 | validator::ValidateApplicationAccess::new(validator::Flag::Read, app_id), |
| 943 | ) |
| 944 | .await?; |
| 945 | |
| 946 | let i = application::get_integration(&app_id, application::IntegrationKind::GcpPubSub) |
| 947 | .await |
| 948 | .map_err(|e| e.status())?; |
| 949 | |
| 950 | if let application::IntegrationConfiguration::GcpPubSub(conf) = &i.configuration { |
| 951 | let mut resp = Response::new(api::GetGcpPubSubIntegrationResponse { |
| 952 | integration: Some(api::GcpPubSubIntegration { |
| 953 | application_id: app_id.to_string(), |
| 954 | encoding: conf.encoding, |
| 955 | credentials_file: conf.credentials_file.clone(), |
| 956 | project_id: conf.project_id.clone(), |
| 957 | topic_name: conf.topic_name.clone(), |
| 958 | }), |
| 959 | }); |
| 960 | resp.metadata_mut() |
| 961 | .insert("x-log-application_id", req.application_id.parse().unwrap()); |
| 962 | |
| 963 | Ok(resp) |
| 964 | } else { |
| 965 | Err(Status::internal( |
| 966 | "Integration has no GcpPubSub configuration", |
| 967 | )) |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | async fn update_gcp_pub_sub_integration( |
| 972 | &self, |