GeezerVison is showing github.com — Added support for "--replicas-max-per-node" (#1383) · yauldmar/docker-java@732c0f5
File tree
Expand file treeCollapse file tree
Open diff view settings
docker-java-api/src/main/java/com/github/dockerjava/api/model
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/ServicePlacement.java +33Lines changed: 33 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,6 +28,12 @@ public class ServicePlacement implements Serializable { |
28 | 28 | @JsonProperty("Platforms") |
29 | 29 | private List<SwarmNodePlatform> platforms; |
30 | 30 |
|
| 31 | + /** |
| 32 | + * @since 1.40 |
| 33 | + */ |
| 34 | + @JsonProperty("MaxReplicas") |
| 35 | + private Integer maxReplicas; |
| 36 | + |
31 | 37 | /** |
32 | 38 | * @see #constraints |
33 | 39 | */ |
@@ -54,4 +60,31 @@ public List<SwarmNodePlatform> getPlatforms() { |
54 | 60 | public void setPlatforms(List<SwarmNodePlatform> platforms) { |
55 | 61 | this.platforms = platforms; |
56 | 62 | } |
| 63 | + |
| 64 | + /** |
| 65 | + * Specifies the maximum amount of replicas / tasks that can run on one node. |
| 66 | + * 0 means unlimited replicas per node. |
| 67 | + * |
| 68 | + * @param maxReplicas Max number of replicas |
| 69 | + * @return This instance of ServicePlacement |
| 70 | + * @throws IllegalArgumentException if maxReplicas is less than 0 |
| 71 | + */ |
| 72 | + public ServicePlacement withMaxReplicas(int maxReplicas) { |
| 73 | + if (maxReplicas < 0) { |
| 74 | + throw new IllegalArgumentException("The Value for MaxReplicas must be greater or equal to 0"); |
| 75 | + } |
| 76 | + |
| 77 | + this.maxReplicas = maxReplicas; |
| 78 | + return this; |
| 79 | + } |
| 80 | + |
| 81 | + /** |
| 82 | + * Getter for maxReplicas |
| 83 | + * |
| 84 | + * @return The maximum amount of replicas / tasks that can run on one node. |
| 85 | + */ |
| 86 | + public Integer getMaxReplicas() { |
| 87 | + return this.maxReplicas; |
| 88 | + } |
| 89 | + |
57 | 90 | } |