| 969 | } |
| 970 | |
| 971 | async fn update_gcp_pub_sub_integration( |
| 972 | &self, |
| 973 | request: Request<api::UpdateGcpPubSubIntegrationRequest>, |
| 974 | ) -> Result<Response<()>, Status> { |
| 975 | let req_int = match &request.get_ref().integration { |
| 976 | Some(v) => v, |
| 977 | None => { |
| 978 | return Err(Status::invalid_argument("integration is missing")); |
| 979 | } |
| 980 | }; |
| 981 | let app_id = Uuid::from_str(&req_int.application_id).map_err(|e| e.status())?; |
| 982 | |
| 983 | self.validator |
| 984 | .validate( |
| 985 | request.extensions(), |
| 986 | validator::ValidateApplicationAccess::new(validator::Flag::Update, app_id), |
| 987 | ) |
| 988 | .await?; |
| 989 | |
| 990 | let _ = application::update_integration(application::Integration { |
| 991 | application_id: app_id.into(), |
| 992 | kind: application::IntegrationKind::GcpPubSub, |
| 993 | configuration: application::IntegrationConfiguration::GcpPubSub( |
| 994 | application::GcpPubSubConfiguration { |
| 995 | encoding: req_int.encoding, |
| 996 | credentials_file: req_int.credentials_file.clone(), |
| 997 | project_id: req_int.project_id.clone(), |
| 998 | topic_name: req_int.topic_name.clone(), |
| 999 | }, |
| 1000 | ), |
| 1001 | ..Default::default() |
| 1002 | }) |
| 1003 | .await |
| 1004 | .map_err(|e| e.status())?; |
| 1005 | |
| 1006 | let mut resp = Response::new(()); |
| 1007 | resp.metadata_mut().insert( |
| 1008 | "x-log-application_id", |
| 1009 | req_int.application_id.parse().unwrap(), |
| 1010 | ); |
| 1011 | |
| 1012 | Ok(resp) |
| 1013 | } |
| 1014 | |
| 1015 | async fn delete_gcp_pub_sub_integration( |
| 1016 | &self, |