forked from TencentBlueKing/bk-job
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: 权限中心获取作业模板/执行方案、脚本、账号等资源的搜索接口 TencentBlueKing#180
- Loading branch information
Showing
12 changed files
with
213 additions
and
148 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...mons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamCallbackAspect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.tencent.bk.job.common.iam.aspect; | ||
|
||
import com.tencent.bk.job.common.util.json.JsonUtils; | ||
import com.tencent.bk.sdk.iam.dto.callback.request.CallbackRequestDTO; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.aspectj.lang.annotation.Pointcut; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Aspect | ||
@Component | ||
public class IamCallbackAspect { | ||
|
||
@Autowired | ||
public IamCallbackAspect() { | ||
} | ||
|
||
@Pointcut("execution (* com.tencent.bk.job.*.api.iam.impl.*.callback(..))") | ||
public void processCallbackRequest() { | ||
} | ||
|
||
private void logRequest(CallbackRequestDTO callbackRequest) { | ||
if (log.isDebugEnabled()) { | ||
log.debug("callbackRequest={}", JsonUtils.toJson(callbackRequest)); | ||
} else { | ||
log.info( | ||
"Received iam callbackRequest:[{}|{}|{}|{}]", | ||
callbackRequest.getMethod().getMethod(), | ||
callbackRequest.getType(), | ||
callbackRequest.getFilter(), | ||
callbackRequest.getPage() | ||
); | ||
} | ||
} | ||
|
||
@Around("processCallbackRequest()") | ||
public Object logBeforeProcessCallbackRequest(ProceedingJoinPoint pjp) throws Throwable { | ||
Object[] args = pjp.getArgs(); | ||
if (args.length < 1) { | ||
log.warn("unexpected ProceedingJoinPoint, please check"); | ||
return pjp.proceed(); | ||
} | ||
CallbackRequestDTO callbackRequest = (CallbackRequestDTO) args[0]; | ||
logRequest(callbackRequest); | ||
return pjp.proceed(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.