Skip to content

Commit

Permalink
[backend] Add collector caldera (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomuDeuxfois committed Jan 16, 2024
1 parent 95dd097 commit 242d876
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions openex-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
<artifactId>openex-collector-users</artifactId>
<version>3.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.openex</groupId>
<artifactId>openex-collector-caldera</artifactId>
<version>3.5.0-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
</profiles>
Expand Down
6 changes: 6 additions & 0 deletions openex-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,10 @@ lade.password=<password>
http.enable=true

# Collectors
## Collector user
collector.users.enable=false

## Collector Caldera
collector.caldera.enable=false
collector.caldera.url=http://localhost:8888
collector.caldera.api-key=ChangeMe
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public Endpoint createEndpoint(@NotNull final Endpoint endpoint) {
return this.endpointRepository.save(endpoint);
}

public Iterable<Endpoint> createEndpoints(@NotNull final List<Endpoint> endpoints) {
return this.endpointRepository.saveAll(endpoints);
}

public Endpoint endpoint(@NotBlank final String endpointId) {
return this.endpointRepository.findById(endpointId).orElseThrow();
}
Expand All @@ -40,6 +44,11 @@ public Endpoint updateEndpoint(@NotNull final Endpoint endpoint) {
return this.endpointRepository.save(endpoint);
}

public Iterable<Endpoint> updateEndpoints(@NotNull final List<Endpoint> endpoints) {
endpoints.forEach((e) -> e.setUpdatedAt(now()));
return this.endpointRepository.saveAll(endpoints);
}

public void deleteEndpoint(@NotBlank final String endpointId) {
this.endpointRepository.deleteById(endpointId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum OS_TYPE {
@JsonProperty("endpoint_last_seen")
private Instant lastSeen;

@ElementCollection(fetch = FetchType.EAGER)
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "macadresses", joinColumns = @JoinColumn(name = "endpoint_id"))
@Column(name = "mac_adress")
@JsonProperty("endpoint_mac_adresses")
Expand Down

0 comments on commit 242d876

Please sign in to comment.