Skip to content

Commit ea40071

Browse files
committed
Add node to model package
1 parent 8c456c2 commit ea40071

File tree

13 files changed

+344
-27
lines changed

13 files changed

+344
-27
lines changed

src/main/java/com/github/dockerjava/api/model/Event.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public class Event {
4141
/**
4242
* ??
4343
*/
44-
@JsonProperty("node")
45-
private Node node;
44+
@JsonProperty("eventNode")
45+
private EventNode eventNode;
4646

4747
/*
4848
* @since 1.
@@ -183,17 +183,17 @@ public Event withTimenano(Long timenano) {
183183
}
184184

185185
/**
186-
* Returns the node when working against docker swarm
186+
* Returns the eventNode when working against docker swarm
187187
*/
188-
public Node getNode() {
189-
return node;
188+
public EventNode getEventNode() {
189+
return eventNode;
190190
}
191191

192192
/**
193-
* @see #node
193+
* @see #eventNode
194194
*/
195-
public Event withNode(Node node) {
196-
this.node = node;
195+
public Event withNode(EventNode eventNode) {
196+
this.eventNode = eventNode;
197197
return this;
198198
}
199199

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
7+
/**
8+
* A node as returned by the /events API, for instance, when Swarm is used.
9+
*/
10+
@JsonInclude(Include.NON_NULL)
11+
public class EventNode {
12+
13+
@JsonProperty("Name")
14+
private String name;
15+
16+
@JsonProperty("Id")
17+
private String id;
18+
19+
@JsonProperty("Addr")
20+
private String addr;
21+
22+
@JsonProperty("Ip")
23+
private String ip;
24+
25+
public String getName() {
26+
return name;
27+
}
28+
29+
public String getId() {
30+
return id;
31+
}
32+
33+
public String getAddr() {
34+
return addr;
35+
}
36+
37+
public String getIp() {
38+
return ip;
39+
}
40+
}
Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,70 @@
11
package com.github.dockerjava.api.model;
22

3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
34
import com.fasterxml.jackson.annotation.JsonInclude;
4-
import com.fasterxml.jackson.annotation.JsonInclude.Include;
55
import com.fasterxml.jackson.annotation.JsonProperty;
66

77
/**
8-
* A node as returned by the /events API, for instance, when Swarm is used.
8+
* Used for Listing containers.
9+
*
10+
* @author Martin Root
911
*/
10-
@JsonInclude(Include.NON_NULL)
12+
@JsonIgnoreProperties(ignoreUnknown = true)
13+
@JsonInclude(JsonInclude.Include.NON_NULL)
1114
public class Node {
12-
13-
@JsonProperty("Name")
14-
private String name;
15-
1615
@JsonProperty("Id")
1716
private String id;
1817

19-
@JsonProperty("Addr")
20-
private String addr;
18+
@JsonProperty("Version")
19+
private String[] version;
2120

22-
@JsonProperty("Ip")
23-
private String ip;
21+
@JsonProperty("CreatedAt")
22+
private String createdAt;
2423

25-
public String getName() {
26-
return name;
27-
}
24+
@JsonProperty("UpdatedAt")
25+
private String updatedAt;
26+
27+
@JsonProperty("Spec")
28+
private NodeSpec spec;
29+
30+
@JsonProperty("Description")
31+
private NodeDescription description;
32+
33+
@JsonProperty("Status")
34+
private NodeStatus status;
35+
36+
@JsonProperty("ManagerStatus")
37+
private NodeManagerStatus managerStatus;
2838

2939
public String getId() {
3040
return id;
3141
}
3242

33-
public String getAddr() {
34-
return addr;
43+
public String[] getVersion() {
44+
return version;
45+
}
46+
47+
public String getCreatedAt() {
48+
return createdAt;
49+
}
50+
51+
public String getUpdatedAt() {
52+
return updatedAt;
53+
}
54+
55+
public NodeSpec getSpec() {
56+
return spec;
57+
}
58+
59+
public NodeDescription getDescription() {
60+
return description;
61+
}
62+
63+
public NodeStatus getStatus() {
64+
return status;
3565
}
3666

37-
public String getIp() {
38-
return ip;
67+
public NodeManagerStatus getManagerStatus() {
68+
return managerStatus;
3969
}
4070
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
7+
8+
@JsonIgnoreProperties(ignoreUnknown = true)
9+
@JsonInclude(JsonInclude.Include.NON_NULL)
10+
public class NodeDescription {
11+
@JsonProperty("Hostname")
12+
private String hostname;
13+
14+
@JsonProperty("Platform")
15+
private NodePlatform platform;
16+
17+
@JsonProperty("Resources")
18+
private NodeResources resources;
19+
20+
@JsonProperty("Engine")
21+
private NodeEngine engine;
22+
23+
public String getHostname() {
24+
return hostname;
25+
}
26+
27+
public NodePlatform getPlatform() {
28+
return platform;
29+
}
30+
31+
public NodeResources getResources() {
32+
return resources;
33+
}
34+
35+
public NodeEngine getEngine() {
36+
return engine;
37+
}
38+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.github.dockerjava.api.model;
2+
3+
4+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5+
import com.fasterxml.jackson.annotation.JsonInclude;
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
import java.util.Map;
9+
10+
11+
@JsonIgnoreProperties(ignoreUnknown = true)
12+
@JsonInclude(JsonInclude.Include.NON_NULL)
13+
public class NodeEngine {
14+
15+
@JsonProperty("EngineVersion")
16+
private String engineVersion;
17+
18+
@JsonProperty("Labels")
19+
private Map<String,String> labels;
20+
21+
@JsonProperty("Plugins")
22+
private NodePlugin[] plugins;
23+
24+
public String getEngineVersion() {
25+
return engineVersion;
26+
}
27+
28+
public Map<String, String> getLabels() {
29+
return labels;
30+
}
31+
32+
public NodePlugin[] getPlugins() {
33+
return plugins;
34+
}
35+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.github.dockerjava.api.model;
2+
3+
4+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5+
import com.fasterxml.jackson.annotation.JsonInclude;
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
9+
@JsonIgnoreProperties(ignoreUnknown = true)
10+
@JsonInclude(JsonInclude.Include.NON_NULL)
11+
public class NodeManagerStatus {
12+
13+
@JsonProperty("Leader")
14+
private boolean leader;
15+
16+
@JsonProperty("Reachability")
17+
private String reachability;
18+
19+
@JsonProperty("Addr")
20+
private String addr;
21+
22+
public boolean isLeader() {
23+
return leader;
24+
}
25+
26+
public String getReachability() {
27+
return reachability;
28+
}
29+
30+
public String getAddr() {
31+
return addr;
32+
}
33+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.github.dockerjava.api.model;
2+
3+
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
public class NodePlatform {
7+
8+
@JsonProperty("Architecture")
9+
private String architecture;
10+
11+
@JsonProperty("OS")
12+
private String os;
13+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.github.dockerjava.api.model;
2+
3+
4+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5+
import com.fasterxml.jackson.annotation.JsonInclude;
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
9+
@JsonIgnoreProperties(ignoreUnknown = true)
10+
@JsonInclude(JsonInclude.Include.NON_NULL)
11+
public class NodePlugin {
12+
13+
@JsonProperty("Type")
14+
private String type;
15+
16+
@JsonProperty("Name")
17+
private String name;
18+
19+
public String getType() {
20+
return type;
21+
}
22+
23+
public String getName() {
24+
return name;
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.github.dockerjava.api.model;
2+
3+
4+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5+
import com.fasterxml.jackson.annotation.JsonInclude;
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
9+
@JsonIgnoreProperties(ignoreUnknown = true)
10+
@JsonInclude(JsonInclude.Include.NON_NULL)
11+
public class NodeResources {
12+
13+
@JsonProperty("NanoCPUs")
14+
private Long nanoCPUs;
15+
16+
@JsonProperty("MemoryBytes")
17+
private Long memoryBytes;
18+
19+
public Long getNanoCPUs() {
20+
return nanoCPUs;
21+
}
22+
23+
public Long getMemoryBytes() {
24+
return memoryBytes;
25+
}
26+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.github.dockerjava.api.model;
2+
3+
4+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5+
import com.fasterxml.jackson.annotation.JsonInclude;
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
import java.util.Map;
9+
10+
@JsonIgnoreProperties(ignoreUnknown = true)
11+
@JsonInclude(JsonInclude.Include.NON_NULL)
12+
public class NodeSpec {
13+
@JsonProperty("Name")
14+
private String name;
15+
16+
@JsonProperty("Role")
17+
private String id;
18+
19+
@JsonProperty("Availability")
20+
private String availability;
21+
22+
@JsonProperty("Labels")
23+
public Map<String, String> labels;
24+
25+
public String getName() {
26+
return name;
27+
}
28+
29+
public String getId() {
30+
return id;
31+
}
32+
33+
public String getAvailability() {
34+
return availability;
35+
}
36+
37+
public Map<String, String> getLabels() {
38+
return labels;
39+
}
40+
}

0 commit comments

Comments
 (0)