use of net.ripe.rpki.validator3.domain.IgnoreFilter in project rpki-validator-3 by RIPE-NCC.
the class IgnoreFilterService method execute.
public long execute(@Valid AddIgnoreFilter command) {
IgnoreFilter ignoreFilter = new IgnoreFilter();
if (command.getAsn() != null) {
ignoreFilter.setAsn(Asn.parse(command.getAsn()).longValue());
}
ignoreFilter.setPrefix(command.getPrefix());
ignoreFilter.setComment(command.getComment());
return add(ignoreFilter);
}
use of net.ripe.rpki.validator3.domain.IgnoreFilter in project rpki-validator-3 by RIPE-NCC.
the class RoaPrefixAssertionsController method add.
@PostMapping(consumes = { Api.API_MIME_TYPE, "application/json" })
public ResponseEntity<ApiResponse<RoaPrefixAssertionResource>> add(@RequestBody @Valid ApiCommand<AddRoaPrefixAssertion> command) {
final long id = roaPrefixAssertionsService.execute(command.getData());
final RoaPrefixAssertion ignoreFilter = roaPrefixAssertions.get(id);
final Link selfRel = linkTo(methodOn(RoaPrefixAssertionsController.class).get(id)).withSelfRel();
return ResponseEntity.created(URI.create(selfRel.getHref())).body(ApiResponse.data(toResource(ignoreFilter)));
}
use of net.ripe.rpki.validator3.domain.IgnoreFilter in project rpki-validator-3 by RIPE-NCC.
the class IgnoreFiltersController method list.
@GetMapping
public ResponseEntity<ApiResponse<Stream<IgnoreFilter>>> list(@RequestParam(name = "startFrom", defaultValue = "0") int startFrom, @RequestParam(name = "pageSize", defaultValue = "20") int pageSize, @RequestParam(name = "search", defaultValue = "", required = false) String searchString, @RequestParam(name = "sortBy", defaultValue = "prefix") String sortBy, @RequestParam(name = "sortDirection", defaultValue = "asc") String sortDirection) {
final SearchTerm searchTerm = StringUtils.isNotBlank(searchString) ? new SearchTerm(searchString) : null;
final Sorting sorting = Sorting.parse(sortBy, sortDirection);
final Paging paging = Paging.of(startFrom, pageSize);
final List<net.ripe.rpki.validator3.domain.IgnoreFilter> all = ignoreFilters.all().collect(Collectors.toList());
int totalSize = all.size();
final Links links = Paging.links(startFrom, pageSize, totalSize, (sf, ps) -> methodOn(IgnoreFiltersController.class).list(sf, ps, searchString, sortBy, sortDirection));
return ResponseEntity.ok(ApiResponse.<Stream<IgnoreFilter>>builder().links(links).metadata(Metadata.of(totalSize)).data(all.stream().map(f -> toIgnoreFilter(f))).build());
}
use of net.ripe.rpki.validator3.domain.IgnoreFilter in project rpki-validator-3 by RIPE-NCC.
the class IgnoreFilterService method remove.
public void remove(long ignoreFilterId) {
IgnoreFilter ignoreFilter = ignoreFilters.get(ignoreFilterId);
if (ignoreFilter != null) {
ignoreFilters.remove(ignoreFilter);
notifyListeners();
}
}
use of net.ripe.rpki.validator3.domain.IgnoreFilter in project rpki-validator-3 by RIPE-NCC.
the class BgpPreviewServiceTest method ignoreFilter.
private IgnoreFilter ignoreFilter(Long asn, String prefix) {
IgnoreFilter f = new IgnoreFilter();
f.setAsn(asn);
f.setPrefix(prefix);
return f;
}
Aggregations