Skip to content

Commit

Permalink
OP-21724-gate added parameters for new api (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthopsmx authored Feb 1, 2024
1 parent b1bf032 commit 6a1a564
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,25 @@ class OpsmxPlatformController {
@RequestParam(name = "canaryId", required = false) Integer canaryId,
@RequestParam(value = "applicationName", required = false) String applicationName,
@RequestParam(value = "argoName", required = false) String argoName,
@RequestParam(value = "argoId", required = false) String argoId,
HttpServletRequest httpServletRequest) {

String path = httpServletRequest.getRequestURI()
if (CacheUtil.isRegisteredCachingEndpoint(path)) {
return handleCaching(path, httpServletRequest, version, type, source, source1, agentName, cdName, datasourceType, permissionId,applicationName,argoName)
return handleCaching(path, httpServletRequest, version, type, source, source1, agentName, cdName, datasourceType, permissionId,applicationName,argoName,argoId)
} else {
return opsmxPlatformService.getPlatformResponse4(version, type, source, source1, agentName, cdName, datasourceType, permissionId, applicationId, canaryId,applicationName,argoName)
return opsmxPlatformService.getPlatformResponse4(version, type, source, source1, agentName, cdName, datasourceType, permissionId, applicationId, canaryId,applicationName,argoName,argoId)
}
}

private Object handleCaching(String path, HttpServletRequest httpServletRequest, String version, String type, String source, String source1, String agentName, String cdName, String datasourceType, String permissionId,String applicationName,String argoName) {
private Object handleCaching(String path, HttpServletRequest httpServletRequest, String version, String type, String source, String source1, String agentName, String cdName, String datasourceType, String permissionId,String applicationName,String argoName,String argoId) {
Object response
PlatformCachingService platformCachingService = platformCachingServiceBeanFactory.getBean(path)

String userName = httpServletRequest.getUserPrincipal().getName()
response = platformCachingService.fetchResponseFromCache(userName)
if (response == null) {
response = opsmxPlatformService.getPlatformResponse4(version, type, source, source1, agentName, cdName, datasourceType, permissionId,applicationName,argoName)
response = opsmxPlatformService.getPlatformResponse4(version, type, source, source1, agentName, cdName, datasourceType, permissionId,applicationName,argoName,argoId)
platformCachingService.cacheResponse(response, userName)
}
return response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ interface OpsmxPlatformService {
@Query("applicationId") Integer applicationId,
@Query("canaryId") Integer canaryId,
@Query("applicationName") String applicationName,
@Query("argoName") String argoName)
@Query("argoName") String argoName,
@Query("argoId") String argoId)

@GET("/platformservice/{version}/{type}/{source}/{source1}/{source2}")
Object getPlatformResponse5(@Path('version') String version,
Expand Down

0 comments on commit 6a1a564

Please sign in to comment.