Untitled
unknown
plain_text
15 days ago
3.1 kB
1
Indexable
Never
package com.forescout.soaractionservice.controller; import java.net.HttpURLConnection; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.forescout.soaractionservice.service.SoarMultipleActionTriggerService; import com.forescout.soarcore.model.SoarMultipleActionTrigger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestControllerAdvice; import com.forescout.soaractionservice.authentication.AuthenticationHelperService; import com.forescout.soaractionservice.service.SoarActionTriggerService; import com.forescout.soarcore.exception.ConfiguredSoarApplicationException; import com.forescout.soarcore.exception.UnauthorizedException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponses; @RequestMapping("/api/accounts/{accountId}/{triggerSource}/{triggerSourceId}/soar-action-trigger") @Api() @RestController() @RestControllerAdvice public class SoarMultipleActionTriggerApi { @Autowired private SoarMultipleActionTriggerService service; @Autowired private AuthenticationHelperService authenticationHelperService; @PostMapping("/push") @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) @ApiOperation(value = "", notes = "Handle Soar action Multiple Trigger", tags = {}) @ApiResponses(value = { @io.swagger.annotations.ApiResponse( code = HttpURLConnection.HTTP_CREATED, message = "ConfiguredSoarActionTrigger response", response = void.class), @io.swagger.annotations.ApiResponse(code = 0, message = "unexpected error", response = ConfiguredSoarApplicationException.class)}) public Response handleAsyncConfiguredSoarMultipleActionTrigger(@PathVariable("accountId") String accountId, @PathVariable("triggerSourceId") String triggerSourceId, @PathVariable("triggerSource") String triggerSource, @RequestBody SoarMultipleActionTrigger soarMultipleActionTrigger) throws ConfiguredSoarApplicationException, UnauthorizedException { String userEmail = authenticationHelperService.getUserEmail(); String userRole = authenticationHelperService.getHighestRoleForAccount(accountId); return service.handleAsyncConfiguredSoarMultipleActionTrigger(accountId, triggerSourceId, triggerSource, soarMultipleActionTrigger,userEmail, userRole); } }
Leave a Comment