Skip to content

Commit

Permalink
Add "tags" field to DTOs (#13367)
Browse files Browse the repository at this point in the history
  • Loading branch information
thll authored and gally47 committed Sep 29, 2022
1 parent 670e687 commit 011c125
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ public abstract class NodeDetails {
@Nullable
public abstract CollectorStatusList statusList();

@JsonProperty("tags")
@Nullable
public abstract List<String> tags();

@JsonCreator
public static NodeDetails create(@JsonProperty("operating_system") String operatingSystem,
@JsonProperty("ip") @Nullable String ip,
@JsonProperty("metrics") @Nullable NodeMetrics metrics,
@JsonProperty("log_file_list") @Nullable List<NodeLogFile> logFileList,
@JsonProperty("status") @Nullable CollectorStatusList statusList) {
return new AutoValue_NodeDetails(operatingSystem, ip, metrics, logFileList, statusList);
@JsonProperty("status") @Nullable CollectorStatusList statusList,
@JsonProperty("tags") @Nullable List<String> tags) {
return new AutoValue_NodeDetails(operatingSystem, ip, metrics, logFileList, statusList, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ public Sidecar save(Sidecar sidecar) {
} else {
throw new IllegalArgumentException("Specified object failed validation: " + violations);
}
} else
} else {
throw new IllegalArgumentException("Specified object is not of correct implementation type (" + sidecar.getClass() + ")!");
}
}

public List<Sidecar> all() {
Expand Down Expand Up @@ -168,7 +169,8 @@ public int markExpired(Period period, String message) {
nodeDetails.ip(),
nodeDetails.metrics(),
nodeDetails.logFileList(),
statusListToSave);
statusListToSave,
nodeDetails.tags());

Sidecar toSave = collector.toBuilder()
.nodeDetails(nodeDetailsToSave)
Expand All @@ -194,7 +196,8 @@ public Sidecar fromRequest(String nodeId, RegistrationRequest request, String co
request.nodeDetails().ip(),
request.nodeDetails().metrics(),
request.nodeDetails().logFileList(),
request.nodeDetails().statusList()),
request.nodeDetails().statusList(),
request.nodeDetails().tags()),
collectorVersion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public void testSaveFirstRecord() throws Exception {
null,
null,
null,
null,
null),
version
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public void testRegister() throws Exception {
null,
null,
null,
null,
null
)
);
Expand All @@ -144,6 +145,7 @@ public void testRegisterInvalidCollectorId() throws Exception {
null,
null,
null,
null,
null
)
);
Expand All @@ -164,6 +166,7 @@ public void testRegisterInvalidNodeId() throws Exception {
null,
null,
null,
null,
null
)
);
Expand Down Expand Up @@ -198,6 +201,7 @@ public void testRegisterMissingOperatingSystem() throws Exception {
null,
null,
null,
null,
null
)
);
Expand Down

0 comments on commit 011c125

Please sign in to comment.