diff --git a/support/iam/src/console_interface/api/iam_ci_cert_api.rs b/support/iam/src/console_interface/api/iam_ci_cert_api.rs index d1523a1af..5e134a183 100644 --- a/support/iam/src/console_interface/api/iam_ci_cert_api.rs +++ b/support/iam/src/console_interface/api/iam_ci_cert_api.rs @@ -11,7 +11,8 @@ use crate::console_interface::serv::iam_ci_oauth2_token_serv::IamCiOauth2AkSkSer use crate::iam_constants; use crate::iam_enumeration::Oauth2GrantType; use bios_basic::helper::request_helper::add_remote_ip; -use bios_basic::rbum::dto::rbum_cert_dto::RbumCertSummaryWithSkResp; +use bios_basic::rbum::dto::rbum_cert_dto::{RbumCertSummaryResp, RbumCertSummaryWithSkResp}; +use bios_basic::rbum::dto::rbum_filer_dto::RbumCertFilterReq; use tardis::basic::dto::TardisContext; use tardis::basic::error::TardisError; use tardis::web::context_extractor::TardisContextExtractor; @@ -72,6 +73,26 @@ impl IamCiCertManageApi { #[poem_openapi::OpenApi(prefix_path = "/ci/cert", tag = "bios_basic::ApiTag::Interface")] impl IamCiCertApi { + #[oai(path = "/get/:id", method = "get")] + async fn get_cert_by_id(&self, id: Path, ctx: TardisContextExtractor, request: &Request) -> TardisApiResult { + add_remote_ip(request, &ctx.0).await?; + let funs = iam_constants::get_tardis_inst(); + let result = IamCertServ::find_certs( + &RbumCertFilterReq { + id: Some(id.0), + ..Default::default() + }, + None, + None, + &funs, + &ctx.0, + ) + .await? + .pop() + .ok_or_else(|| funs.err().internal_error("iam_ci_cert", "get_cert_by_id", "cert is not found", "401-iam-cert-code-not-exist"))?; + ctx.0.execute_task().await?; + TardisResp::ok(result) + } /// Find Cert By Kind And Supplier /// /// if kind is none,query default kind(UserPwd) diff --git a/support/iam/src/console_interface/api/iam_ci_role_api.rs b/support/iam/src/console_interface/api/iam_ci_role_api.rs index 2dcb43595..9f481e445 100644 --- a/support/iam/src/console_interface/api/iam_ci_role_api.rs +++ b/support/iam/src/console_interface/api/iam_ci_role_api.rs @@ -1,5 +1,5 @@ -use itertools::Itertools; use crate::basic::dto::iam_role_dto::IamRoleRelAccountCertResp; +use itertools::Itertools; use crate::basic::serv::iam_app_serv::IamAppServ; use crate::basic::serv::iam_cert_serv::IamCertServ;