class AssetController {

    @GetMapping(value = "/v1/list/environment")
    public ResponseEntity<Object> getListOfEnvironments(@RequestParam(name = "ag", required = true) String assetGroup,
            @RequestParam(name = "application", required = false) String application,
            @RequestParam(name = "domain", required = false) String domain) {
        Map<String, Object> response = new HashMap<>();
        List<Map<String, Object>> environments = assetService.getEnvironmentsByAssetGroup(assetGroup, application,
                domain);
        if (environments.isEmpty()) {
            return ResponseUtils
                    .buildFailureResponse(new Exception(
                            "No environments found for the asset group /application . Please check the asset group configuration"));
        } else {
            response.put("ag", assetGroup);
            if (application != null) {
                response.put("application", application);
            }
            response.put("environments", environments);
            return ResponseUtils.buildSucessResponse(response);
        }
    }

}