All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.infusers.core.eng.selfheal.SelfHealController Maven / Gradle / Ivy

There is a newer version: 2024.12.0008
Show newest version
package com.infusers.core.eng.selfheal;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.infusers.core.audit.AuditService;
import com.infusers.core.eng.selfheal.deployment.CloudProviderService;
import com.infusers.core.logger.ILogger;

@RestController
@RequestMapping("infusers/api")
@CrossOrigin(origins = "*")
public class SelfHealController {
	private static final String CLASS_NAME = "SelfHealController";
	
	@Autowired(required = true)
	private AuditService auditService;
	
	@Autowired(required = true)
	private SelfHealService apiService;

	@Autowired(required = true)
	private CloudProviderService cloudProviderService;
	
    @GetMapping("/cloud-provider")
    public ResponseEntity getCloudProvider() {
    	
		String methodName = "getCloudProvider";
		String comments = String.format("Called!!");
		auditService.log(null, ILogger.LogTypes.DEBUG, CLASS_NAME, methodName, "", comments);
		
        return cloudProviderService.getCloudProvider();
    }	

	@GetMapping("/version")
	public ResponseEntity getVersion() {
		
//		String methodName = "getVersion";
//		String comments = String.format("Called!!");
//		auditService.log(null, ILogger.LogTypes.DEBUG, CLASS_NAME, methodName, "", comments);
		
		return apiService.getVersion();
	}
	
	@GetMapping("/audit-spring-boot-dependencies")
	public ResponseEntity auditSpringBootDependencies(
			@RequestParam(defaultValue = "false", required = false) boolean recursive
			) 
	{
		
		String methodName = "auditSpringBootDependencies";
		String comments = String.format("recursive = %s", recursive);
		auditService.log(null, ILogger.LogTypes.DEBUG, CLASS_NAME, methodName, "", comments);
		
        return apiService.auditSpringBootDependencies(recursive);
	}
}