| 1083 | } |
| 1084 | |
| 1085 | async fn get_aws_sns_integration( |
| 1086 | &self, |
| 1087 | request: Request<api::GetAwsSnsIntegrationRequest>, |
| 1088 | ) -> Result<Response<api::GetAwsSnsIntegrationResponse>, Status> { |
| 1089 | let req = request.get_ref(); |
| 1090 | let app_id = Uuid::from_str(&req.application_id).map_err(|e| e.status())?; |
| 1091 | |
| 1092 | self.validator |
| 1093 | .validate( |
| 1094 | request.extensions(), |
| 1095 | validator::ValidateApplicationAccess::new(validator::Flag::Read, app_id), |
| 1096 | ) |
| 1097 | .await?; |
| 1098 | |
| 1099 | let i = application::get_integration(&app_id, application::IntegrationKind::AwsSns) |
| 1100 | .await |
| 1101 | .map_err(|e| e.status())?; |
| 1102 | |
| 1103 | if let application::IntegrationConfiguration::AwsSns(conf) = &i.configuration { |
| 1104 | let mut resp = Response::new(api::GetAwsSnsIntegrationResponse { |
| 1105 | integration: Some(api::AwsSnsIntegration { |
| 1106 | application_id: app_id.to_string(), |
| 1107 | encoding: conf.encoding, |
| 1108 | region: conf.region.clone(), |
| 1109 | access_key_id: conf.access_key_id.clone(), |
| 1110 | secret_access_key: conf.secret_access_key.clone(), |
| 1111 | topic_arn: conf.topic_arn.clone(), |
| 1112 | }), |
| 1113 | }); |
| 1114 | resp.metadata_mut() |
| 1115 | .insert("x-log-application_id", req.application_id.parse().unwrap()); |
| 1116 | |
| 1117 | Ok(resp) |
| 1118 | } else { |
| 1119 | Err(Status::internal("Integration has no AwsSns configuration")) |
| 1120 | } |
| 1121 | } |
| 1122 | |
| 1123 | async fn update_aws_sns_integration( |
| 1124 | &self, |