summaryrefslogtreecommitdiff
path: root/module/ri-engine/src/main/java/io/trygvis/rules/dba
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2021-01-12 22:08:14 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2021-01-12 22:08:14 +0100
commit0e8048146ddf85adf28c1da09e45b98760f23210 (patch)
tree76c2755ec7f1da4af2361e85f1cd84c44b66c00a /module/ri-engine/src/main/java/io/trygvis/rules/dba
parent34bb772073b1954ac95b4f1491236eb8b063ef83 (diff)
downloadrules-sandbox-0e8048146ddf85adf28c1da09e45b98760f23210.tar.gz
rules-sandbox-0e8048146ddf85adf28c1da09e45b98760f23210.tar.bz2
rules-sandbox-0e8048146ddf85adf28c1da09e45b98760f23210.tar.xz
rules-sandbox-0e8048146ddf85adf28c1da09e45b98760f23210.zip
Better output YAML.
Enabling object references internally in the document. Needed to write all objects in one go for Jackson to resolve all internal references. Applied some sorting magic to write out as many as possible objects on the root level. Will need some more magic later for customers to customize the output ordering.
Diffstat (limited to 'module/ri-engine/src/main/java/io/trygvis/rules/dba')
-rw-r--r--module/ri-engine/src/main/java/io/trygvis/rules/dba/Cluster.java4
-rw-r--r--module/ri-engine/src/main/java/io/trygvis/rules/dba/Container.java6
2 files changed, 10 insertions, 0 deletions
diff --git a/module/ri-engine/src/main/java/io/trygvis/rules/dba/Cluster.java b/module/ri-engine/src/main/java/io/trygvis/rules/dba/Cluster.java
index 949d9ae..0b65aaa 100644
--- a/module/ri-engine/src/main/java/io/trygvis/rules/dba/Cluster.java
+++ b/module/ri-engine/src/main/java/io/trygvis/rules/dba/Cluster.java
@@ -1,5 +1,9 @@
package io.trygvis.rules.dba;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "name")
public class Cluster {
public String name;
diff --git a/module/ri-engine/src/main/java/io/trygvis/rules/dba/Container.java b/module/ri-engine/src/main/java/io/trygvis/rules/dba/Container.java
index d852115..f6d2ba4 100644
--- a/module/ri-engine/src/main/java/io/trygvis/rules/dba/Container.java
+++ b/module/ri-engine/src/main/java/io/trygvis/rules/dba/Container.java
@@ -1,8 +1,13 @@
package io.trygvis.rules.dba;
+import com.fasterxml.jackson.annotation.JsonIdentityReference;
import io.trygvis.rules.machine.Machine;
+//@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class Container {
+ public final String id;
+
+// @JsonIdentityReference(alwaysAsId = true)
public final Cluster cluster;
public final String name;
public final String machineRole;
@@ -12,6 +17,7 @@ public class Container {
private Machine machine;
public Container(Cluster cluster, String name, String machineRole, String image, String tag) {
+ this.id = cluster.name + "-" + name;
this.cluster = cluster;
this.name = name;
this.machineRole = machineRole;