@ApiOperation( value = "Resolve and explain this violation", notes = "Resolve and explain violation", response = Void.class ) @ApiResponses(value = {@ApiResponse(code = 200, message = "Violation resolved successfully")}) @RequestMapping(value = "/{id}/resolution", method = POST) public Violation resolveViolations( @ApiParam(value = "", required = true) @PathVariable("id") final Long id, @ApiParam(value = "", required = true) @RequestBody final String comment, @ApiIgnore @AuthenticationPrincipal(errorOnInvalidType = true) final String userId) throws NotFoundException, ForbiddenException { final ViolationEntity violation = violationService.findOne(id); if (violation == null) { throw new NotFoundException(format("Violation %s does not exist", id)); } if (!hasAccessToAccount(userId, violation.getAccountId())) { throw new ForbiddenException( format( "You must have access to AWS account '%s' to resolve violation '%s'", violation.getAccountId(), id)); } violation.setComment(comment); final ViolationEntity dbViolationEntity = violationService.save(violation); return entityToDto.convert(dbViolationEntity); }
.ifPresent(metaData::putAll); if (violationService.violationExists(account, awsRegion.getName(), EVENT_ID, canonicalHostedZoneName, UNSECURED_PUBLIC_ENDPOINT)) { return;
@ApiOperation( value = "violations", notes = "Get one violation", response = Violation.class ) @ApiResponses(value = {@ApiResponse(code = 200, message = "Violation")}) @RequestMapping(value = "/{id}", method = GET) public Violation getViolation( @ApiParam(value = "Violation id") @PathVariable(value = "id") final Long id) throws NotFoundException { return Optional.ofNullable(violationService.findOne(id)) .map(entityToDto::convert) .orElseThrow(() -> new NotFoundException("Violation with id: " + id + " not found!")); }
violationService.queryViolations( accounts, from, to, lastViolation, checked, severity, priority, auditRelevant, allTypes, whitelisted, applicationIds, applicationVersionIds, pageable));
final String instancePublicIpAddress = instance.getPublicIpAddress(); if (violationService.violationExists(account, region, EVENT_ID, instance.getInstanceId(), UNSECURED_PUBLIC_ENDPOINT)) { return;
private void processInstance(final AmazonEC2Client ec2Client, final String account, final String region, final Instance instance) { if (violationService.violationExists(account, region, EVENT_ID, instance.getInstanceId(), OUTDATED_TAUPAGE)) { return;