diff --git a/generator/generate.sh b/generator/generate.sh new file mode 100755 index 0000000..f128997 --- /dev/null +++ b/generator/generate.sh @@ -0,0 +1,6 @@ +#! /bin/bash +# Generates the API model JavaBeans using reflection on the golang nomad/api package + +set -euo pipefail + +GO111MODULE=on go run *.go ../sdk/src/main/java/com/hashicorp/nomad/apimodel/ diff --git a/generator/generator.go b/generator/generator.go index 8eb0dc8..83fb1a4 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -152,9 +152,10 @@ func (generator *Generator) generateClass(t reflect.Type) error { if t.Field(i).Name == "WriteMeta" || t.Field(i).Name == "QueryMeta" { continue } - property := generator.javaBeanProperty(t.Field(i)) - properties = append(properties, property) - collectTypes(property.JavaType) + if property, ok := generator.javaBeanProperty(className, t.Field(i)); ok { + properties = append(properties, property) + collectTypes(property.JavaType) + } } out, err := os.Create(className + ".java") @@ -216,19 +217,24 @@ func (generator *Generator) generateClass(t reflect.Type) error { return nil } -func (g *Generator) javaBeanProperty(f reflect.StructField) java.BeanProperty { +func (g *Generator) javaBeanProperty(className string, f reflect.StructField) (java.BeanProperty,bool) { nameInJson := f.Tag.Get("json") if i := strings.IndexByte(nameInJson, ','); i >= 0 { nameInJson = nameInJson[0:i] } + if nameInJson == "-" { + return java.BeanProperty{}, false + } if nameInJson == "" { nameInJson = f.Name } + propName := propertyName(nameInJson) return java.BeanProperty{ - Name: propertyName(nameInJson), - JavaType: g.javaType(f.Type), + Name: propName, + MethodSuffix: methodSuffix(nameInJson), + JavaType: g.javaType(className, propName, f.Type), GetterAnnotation: "@JsonProperty(\"" + nameInJson + "\")", - } + }, true } func className(t reflect.Type) string { @@ -238,7 +244,17 @@ func className(t reflect.Type) string { // To meet JavaBean conventions, lowercase the first letter of the name // and lowercase the non-first letters of multi-letter acronyms func propertyName(nameInJson string) string { - return javaName(nameInJson, false) + raw := javaName(nameInJson, false) + if java.IsTypeName(raw) { + raw += "Val" + } + return raw +} + +// methodSuffix is prefixed by get- and set- in the getter and the setter +// it is therefore less restrictive than propertyName +func methodSuffix(nameInJson string) string { + return javaName(nameInJson, true) } func javaName(nameInJson string, firstCharacterUppercase bool) string { @@ -267,7 +283,11 @@ func javaName(nameInJson string, firstCharacterUppercase bool) string { } } -func (generator *Generator) javaType(t reflect.Type) java.JavaType { +func (generator *Generator) javaType(class, property string, t reflect.Type) java.JavaType { + if typ, ok := typeHack(class, property); ok { + return typ + } + if t.PkgPath() == "" { switch t.Kind() { case reflect.Bool: @@ -311,7 +331,9 @@ func (generator *Generator) javaType(t reflect.Type) java.JavaType { panic("Unknown interface to convert to Java" + t.String()) } case reflect.Map: - return java.NewMapType(generator.javaType(t.Key()), generator.javaType(t.Elem())) + return java.NewMapType( + generator.javaType(class, property, t.Key()), + generator.javaType(class, property, t.Elem())) case reflect.Ptr: switch t.Elem().Kind() { case reflect.Bool: @@ -328,7 +350,7 @@ func (generator *Generator) javaType(t reflect.Type) java.JavaType { case reflect.String: return java.String case reflect.Struct: - return generator.javaType(t.Elem()) + return generator.javaType(class, property, t.Elem()) case reflect.Uint64: // the only unsigned type in Java is byte, use wider type return java.BigInteger @@ -339,7 +361,7 @@ func (generator *Generator) javaType(t reflect.Type) java.JavaType { if t.Elem().Kind() == reflect.Uint8 { return java.NewReferenceType("byte[]") } else { - return java.NewListType(generator.javaType(t.Elem())) + return java.NewListType(generator.javaType(class, property, t.Elem())) } case reflect.String: return java.String @@ -364,8 +386,25 @@ func (generator *Generator) javaType(t reflect.Type) java.JavaType { return java.String case reflect.Int: return java.Integer + case reflect.Map: + return java.NewMapType( + generator.javaType(class, property, t.Key()), + generator.javaType(class, property, t.Elem())) default: panic("Unknown kind " + t.Kind().String() + " for " + t.String() + " in package " + t.PkgPath()) } } } + +func typeHack(className, propertyName string) (java.JavaType, bool) { + // these are timestamps from Consul's autopilot code, which encode times differently than the rest of Nomad's API + if className == "ServerHealth" && propertyName == "lastContact" { + return java.String, true + } else if className == "AutopilotConfiguration" { + if propertyName == "lastContactThreshold" || propertyName == "serverStabilizationTime" { + return java.String, true + } + } + + return nil, false +} diff --git a/generator/go.mod b/generator/go.mod new file mode 100644 index 0000000..d3a91e0 --- /dev/null +++ b/generator/go.mod @@ -0,0 +1,5 @@ +module github.com/hashicorp/nomad-java-sdk/generator + +go 1.14 + +require github.com/hashicorp/nomad/api v0.0.0-20200512134002-a12cfc806065 diff --git a/generator/go.sum b/generator/go.sum new file mode 100644 index 0000000..297473d --- /dev/null +++ b/generator/go.sum @@ -0,0 +1,35 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75 h1:f0n1xnMSmBLzVfsMMvriDyA75NB/oBgILX2GcHXIQzY= +github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= +github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/nomad/api v0.0.0-20200512134002-a12cfc806065 h1:nj+XKX1cwCFnjtNLZynzm737GVdFDyTbBe5SDqE6zFw= +github.com/hashicorp/nomad/api v0.0.0-20200512134002-a12cfc806065/go.mod h1:QqvoCwX0S1cAwfN21AbIqTGL+WBB5/tFxkMzF8tM/zg= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/generator/java/beanproperty.go b/generator/java/beanproperty.go index 90f90ca..3f834ee 100644 --- a/generator/java/beanproperty.go +++ b/generator/java/beanproperty.go @@ -10,9 +10,13 @@ type BeanProperty struct { Name string JavaType JavaType GetterAnnotation string + MethodSuffix string } func (p *BeanProperty) methodSuffix() string { + if p.MethodSuffix != "" { + return p.MethodSuffix + } return strings.ToUpper(p.Name[0:1]) + p.Name[1:] } diff --git a/generator/java/lang.go b/generator/java/lang.go index 18eaced..384a6f2 100644 --- a/generator/java/lang.go +++ b/generator/java/lang.go @@ -6,6 +6,23 @@ func IsKeyword(s string) bool { return true case "public": return true + case "native": + return true + default: + return false + } +} + +func IsTypeName(s string) bool { + switch s { + case "int": + return true + case "string": + return true + case "float": + return true + case "bool": + return true default: return false } diff --git a/scripts/build-nomad.sh b/scripts/build-nomad.sh index 13da2b5..98b5618 100755 --- a/scripts/build-nomad.sh +++ b/scripts/build-nomad.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -euo pipefail -nomad_version=v0.10.5 -go_version=1.12 +nomad_version=v0.11.1 +go_version=1.14 cd "$(dirname "$0")/.." diff --git a/scripts/generate.sh b/scripts/generate.sh deleted file mode 100755 index 8c6e6cb..0000000 --- a/scripts/generate.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash -# Generates the API model JavaBeans using reflection on the golang nomad/api package - -set -euo pipefail - -# move to the root directory of the repository -cd "$(dirname "$0")/.." - -go run generator/*.go sdk/src/main/java/com/hashicorp/nomad/apimodel/ diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/Attribute.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/Attribute.java index 9141e12..f3863df 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/Attribute.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/Attribute.java @@ -13,10 +13,6 @@ * @see Nomad HTTP API documentation associated with the endpoint you are using. */ public final class Attribute extends ApiObject { - /** - * The generator is going to make a mess of these, because the JSON names collide with Java types. - * This file will need to be manually restored. - */ private double floatVal; private Long intVal; private String stringVal; diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/AutopilotConfiguration.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/AutopilotConfiguration.java index 1e9d4c3..49be554 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/AutopilotConfiguration.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/AutopilotConfiguration.java @@ -15,11 +15,10 @@ */ public final class AutopilotConfiguration extends ApiObject { private boolean cleanupDeadServers; - private String lastContactThreshold; // NOTE: the API generator will try to convert this to long but - // the Nomad HTTP API emits it as a string; do not change + private String lastContactThreshold; private BigInteger maxTrailingLogs; - private String serverStabilizationTime; // NOTE: the API generator will try to convert this to long but - // the Nomad HTTP API emits it as a string; do not change + private long minQuorum; + private String serverStabilizationTime; private boolean enableRedundancyZones; private boolean disableUpgradeMigration; private boolean enableCustomUpgrades; @@ -56,6 +55,16 @@ public AutopilotConfiguration setMaxTrailingLogs(BigInteger maxTrailingLogs) { return this; } + @JsonProperty("MinQuorum") + public long getMinQuorum() { + return minQuorum; + } + + public AutopilotConfiguration setMinQuorum(long minQuorum) { + this.minQuorum = minQuorum; + return this; + } + @JsonProperty("ServerStabilizationTime") public String getServerStabilizationTime() { return serverStabilizationTime; diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulConnect.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulConnect.java index 7f51e92..7c07e92 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulConnect.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulConnect.java @@ -13,17 +13,17 @@ * @see Nomad HTTP API documentation associated with the endpoint you are using. */ public final class ConsulConnect extends ApiObject { - private boolean connectNative; + private boolean Native; private ConsulSidecarService sidecarService; private SidecarTask sidecarTask; @JsonProperty("Native") public boolean getNative() { - return connectNative; + return Native; } - public ConsulConnect setNative(boolean connectNative) { - this.connectNative = connectNative; + public ConsulConnect setNative(boolean Native) { + this.Native = Native; return this; } diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulExposeConfig.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulExposeConfig.java new file mode 100644 index 0000000..58fe06d --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulExposeConfig.java @@ -0,0 +1,48 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class ConsulExposeConfig extends ApiObject { + private List path; + + @JsonProperty("Path") + public List getPath() { + return path; + } + + public ConsulExposeConfig setPath(List path) { + this.path = path; + return this; + } + + public ConsulExposeConfig addPath(ConsulExposePath... path) { + if (this.path == null) + this.path = new java.util.ArrayList<>(); + for (ConsulExposePath item : path) + this.path.add(item); + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static ConsulExposeConfig fromJson(String json) throws IOException { + return NomadJson.deserialize(json, ConsulExposeConfig.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, ConsulExposeConfig.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulExposePath.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulExposePath.java new file mode 100644 index 0000000..f17920d --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulExposePath.java @@ -0,0 +1,73 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class ConsulExposePath extends ApiObject { + private String path; + private String protocol; + private int localPathPort; + private String listenerPort; + + @JsonProperty("Path") + public String getPath() { + return path; + } + + public ConsulExposePath setPath(String path) { + this.path = path; + return this; + } + + @JsonProperty("Protocol") + public String getProtocol() { + return protocol; + } + + public ConsulExposePath setProtocol(String protocol) { + this.protocol = protocol; + return this; + } + + @JsonProperty("LocalPathPort") + public int getLocalPathPort() { + return localPathPort; + } + + public ConsulExposePath setLocalPathPort(int localPathPort) { + this.localPathPort = localPathPort; + return this; + } + + @JsonProperty("ListenerPort") + public String getListenerPort() { + return listenerPort; + } + + public ConsulExposePath setListenerPort(String listenerPort) { + this.listenerPort = listenerPort; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static ConsulExposePath fromJson(String json) throws IOException { + return NomadJson.deserialize(json, ConsulExposePath.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, ConsulExposePath.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulProxy.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulProxy.java index 321dada..affa207 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulProxy.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ConsulProxy.java @@ -16,6 +16,7 @@ public final class ConsulProxy extends ApiObject { private String localServiceAddress; private int localServicePort; + private ConsulExposeConfig exposeConfig; private List upstreams; private Map config; @@ -39,6 +40,16 @@ public ConsulProxy setLocalServicePort(int localServicePort) { return this; } + @JsonProperty("ExposeConfig") + public ConsulExposeConfig getExposeConfig() { + return exposeConfig; + } + + public ConsulProxy setExposeConfig(ConsulExposeConfig exposeConfig) { + this.exposeConfig = exposeConfig; + return this; + } + @JsonProperty("Upstreams") public List getUpstreams() { return upstreams; diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiControllerInfo.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiControllerInfo.java new file mode 100644 index 0000000..bff1650 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiControllerInfo.java @@ -0,0 +1,73 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiControllerInfo extends ApiObject { + private boolean supportsReadOnlyAttach; + private boolean supportsAttachDetach; + private boolean supportsListVolumes; + private boolean supportsListVolumesAttachedNodes; + + @JsonProperty("SupportsReadOnlyAttach") + public boolean getSupportsReadOnlyAttach() { + return supportsReadOnlyAttach; + } + + public CsiControllerInfo setSupportsReadOnlyAttach(boolean supportsReadOnlyAttach) { + this.supportsReadOnlyAttach = supportsReadOnlyAttach; + return this; + } + + @JsonProperty("SupportsAttachDetach") + public boolean getSupportsAttachDetach() { + return supportsAttachDetach; + } + + public CsiControllerInfo setSupportsAttachDetach(boolean supportsAttachDetach) { + this.supportsAttachDetach = supportsAttachDetach; + return this; + } + + @JsonProperty("SupportsListVolumes") + public boolean getSupportsListVolumes() { + return supportsListVolumes; + } + + public CsiControllerInfo setSupportsListVolumes(boolean supportsListVolumes) { + this.supportsListVolumes = supportsListVolumes; + return this; + } + + @JsonProperty("SupportsListVolumesAttachedNodes") + public boolean getSupportsListVolumesAttachedNodes() { + return supportsListVolumesAttachedNodes; + } + + public CsiControllerInfo setSupportsListVolumesAttachedNodes(boolean supportsListVolumesAttachedNodes) { + this.supportsListVolumesAttachedNodes = supportsListVolumesAttachedNodes; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiControllerInfo fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiControllerInfo.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiControllerInfo.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiInfo.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiInfo.java new file mode 100644 index 0000000..8472d85 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiInfo.java @@ -0,0 +1,118 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.Date; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiInfo extends ApiObject { + private String pluginId; + private boolean healthy; + private String healthDescription; + private Date updateTime; + private boolean requiresControllerPlugin; + private boolean requiresTopologies; + private CsiControllerInfo controllerInfo; + private CsiNodeInfo nodeInfo; + + @JsonProperty("PluginID") + public String getPluginId() { + return pluginId; + } + + public CsiInfo setPluginId(String pluginId) { + this.pluginId = pluginId; + return this; + } + + @JsonProperty("Healthy") + public boolean getHealthy() { + return healthy; + } + + public CsiInfo setHealthy(boolean healthy) { + this.healthy = healthy; + return this; + } + + @JsonProperty("HealthDescription") + public String getHealthDescription() { + return healthDescription; + } + + public CsiInfo setHealthDescription(String healthDescription) { + this.healthDescription = healthDescription; + return this; + } + + @JsonProperty("UpdateTime") + public Date getUpdateTime() { + return updateTime; + } + + public CsiInfo setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + return this; + } + + @JsonProperty("RequiresControllerPlugin") + public boolean getRequiresControllerPlugin() { + return requiresControllerPlugin; + } + + public CsiInfo setRequiresControllerPlugin(boolean requiresControllerPlugin) { + this.requiresControllerPlugin = requiresControllerPlugin; + return this; + } + + @JsonProperty("RequiresTopologies") + public boolean getRequiresTopologies() { + return requiresTopologies; + } + + public CsiInfo setRequiresTopologies(boolean requiresTopologies) { + this.requiresTopologies = requiresTopologies; + return this; + } + + @JsonProperty("ControllerInfo") + public CsiControllerInfo getControllerInfo() { + return controllerInfo; + } + + public CsiInfo setControllerInfo(CsiControllerInfo controllerInfo) { + this.controllerInfo = controllerInfo; + return this; + } + + @JsonProperty("NodeInfo") + public CsiNodeInfo getNodeInfo() { + return nodeInfo; + } + + public CsiInfo setNodeInfo(CsiNodeInfo nodeInfo) { + this.nodeInfo = nodeInfo; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiInfo fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiInfo.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiInfo.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiMountOptions.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiMountOptions.java new file mode 100644 index 0000000..917acc6 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiMountOptions.java @@ -0,0 +1,59 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiMountOptions extends ApiObject { + private String fsType; + private List mountFlags; + + @JsonProperty("FSType") + public String getFsType() { + return fsType; + } + + public CsiMountOptions setFsType(String fsType) { + this.fsType = fsType; + return this; + } + + @JsonProperty("MountFlags") + public List getMountFlags() { + return mountFlags; + } + + public CsiMountOptions setMountFlags(List mountFlags) { + this.mountFlags = mountFlags; + return this; + } + + public CsiMountOptions addMountFlags(String... mountFlags) { + if (this.mountFlags == null) + this.mountFlags = new java.util.ArrayList<>(); + for (String item : mountFlags) + this.mountFlags.add(item); + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiMountOptions fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiMountOptions.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiMountOptions.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiNodeInfo.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiNodeInfo.java new file mode 100644 index 0000000..99a5869 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiNodeInfo.java @@ -0,0 +1,73 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiNodeInfo extends ApiObject { + private String id; + private long maxVolumes; + private CsiTopology accessibleTopology; + private boolean requiresNodeStageVolume; + + @JsonProperty("ID") + public String getId() { + return id; + } + + public CsiNodeInfo setId(String id) { + this.id = id; + return this; + } + + @JsonProperty("MaxVolumes") + public long getMaxVolumes() { + return maxVolumes; + } + + public CsiNodeInfo setMaxVolumes(long maxVolumes) { + this.maxVolumes = maxVolumes; + return this; + } + + @JsonProperty("AccessibleTopology") + public CsiTopology getAccessibleTopology() { + return accessibleTopology; + } + + public CsiNodeInfo setAccessibleTopology(CsiTopology accessibleTopology) { + this.accessibleTopology = accessibleTopology; + return this; + } + + @JsonProperty("RequiresNodeStageVolume") + public boolean getRequiresNodeStageVolume() { + return requiresNodeStageVolume; + } + + public CsiNodeInfo setRequiresNodeStageVolume(boolean requiresNodeStageVolume) { + this.requiresNodeStageVolume = requiresNodeStageVolume; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiNodeInfo fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiNodeInfo.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiNodeInfo.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiPlugin.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiPlugin.java new file mode 100644 index 0000000..0b65dab --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiPlugin.java @@ -0,0 +1,196 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiPlugin extends ApiObject { + private String id; + private String provider; + private String version; + private boolean controllerRequired; + private Map controllers; + private Map nodes; + private List allocations; + private int controllersHealthy; + private int controllersExpected; + private int nodesHealthy; + private int nodesExpected; + private BigInteger createIndex; + private BigInteger modifyIndex; + + @JsonProperty("ID") + public String getId() { + return id; + } + + public CsiPlugin setId(String id) { + this.id = id; + return this; + } + + @JsonProperty("Provider") + public String getProvider() { + return provider; + } + + public CsiPlugin setProvider(String provider) { + this.provider = provider; + return this; + } + + @JsonProperty("Version") + public String getVersion() { + return version; + } + + public CsiPlugin setVersion(String version) { + this.version = version; + return this; + } + + @JsonProperty("ControllerRequired") + public boolean getControllerRequired() { + return controllerRequired; + } + + public CsiPlugin setControllerRequired(boolean controllerRequired) { + this.controllerRequired = controllerRequired; + return this; + } + + @JsonProperty("Controllers") + public Map getControllers() { + return controllers; + } + + public CsiPlugin setControllers(Map controllers) { + this.controllers = controllers; + return this; + } + + public CsiPlugin addControllers(String key, CsiInfo value) { + if (this.controllers == null) + this.controllers = new java.util.HashMap<>(); + this.controllers.put(key, value); + return this; + } + + @JsonProperty("Nodes") + public Map getNodes() { + return nodes; + } + + public CsiPlugin setNodes(Map nodes) { + this.nodes = nodes; + return this; + } + + public CsiPlugin addNodes(String key, CsiInfo value) { + if (this.nodes == null) + this.nodes = new java.util.HashMap<>(); + this.nodes.put(key, value); + return this; + } + + @JsonProperty("Allocations") + public List getAllocations() { + return allocations; + } + + public CsiPlugin setAllocations(List allocations) { + this.allocations = allocations; + return this; + } + + public CsiPlugin addAllocations(AllocationListStub... allocations) { + if (this.allocations == null) + this.allocations = new java.util.ArrayList<>(); + for (AllocationListStub item : allocations) + this.allocations.add(item); + return this; + } + + @JsonProperty("ControllersHealthy") + public int getControllersHealthy() { + return controllersHealthy; + } + + public CsiPlugin setControllersHealthy(int controllersHealthy) { + this.controllersHealthy = controllersHealthy; + return this; + } + + @JsonProperty("ControllersExpected") + public int getControllersExpected() { + return controllersExpected; + } + + public CsiPlugin setControllersExpected(int controllersExpected) { + this.controllersExpected = controllersExpected; + return this; + } + + @JsonProperty("NodesHealthy") + public int getNodesHealthy() { + return nodesHealthy; + } + + public CsiPlugin setNodesHealthy(int nodesHealthy) { + this.nodesHealthy = nodesHealthy; + return this; + } + + @JsonProperty("NodesExpected") + public int getNodesExpected() { + return nodesExpected; + } + + public CsiPlugin setNodesExpected(int nodesExpected) { + this.nodesExpected = nodesExpected; + return this; + } + + @JsonProperty("CreateIndex") + public BigInteger getCreateIndex() { + return createIndex; + } + + public CsiPlugin setCreateIndex(BigInteger createIndex) { + this.createIndex = createIndex; + return this; + } + + @JsonProperty("ModifyIndex") + public BigInteger getModifyIndex() { + return modifyIndex; + } + + public CsiPlugin setModifyIndex(BigInteger modifyIndex) { + this.modifyIndex = modifyIndex; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiPlugin fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiPlugin.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiPlugin.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiPluginListStub.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiPluginListStub.java new file mode 100644 index 0000000..ef5ae07 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiPluginListStub.java @@ -0,0 +1,129 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiPluginListStub extends ApiObject { + private String id; + private String provider; + private boolean controllerRequired; + private int controllersHealthy; + private int controllersExpected; + private int nodesHealthy; + private int nodesExpected; + private BigInteger createIndex; + private BigInteger modifyIndex; + + @JsonProperty("ID") + public String getId() { + return id; + } + + public CsiPluginListStub setId(String id) { + this.id = id; + return this; + } + + @JsonProperty("Provider") + public String getProvider() { + return provider; + } + + public CsiPluginListStub setProvider(String provider) { + this.provider = provider; + return this; + } + + @JsonProperty("ControllerRequired") + public boolean getControllerRequired() { + return controllerRequired; + } + + public CsiPluginListStub setControllerRequired(boolean controllerRequired) { + this.controllerRequired = controllerRequired; + return this; + } + + @JsonProperty("ControllersHealthy") + public int getControllersHealthy() { + return controllersHealthy; + } + + public CsiPluginListStub setControllersHealthy(int controllersHealthy) { + this.controllersHealthy = controllersHealthy; + return this; + } + + @JsonProperty("ControllersExpected") + public int getControllersExpected() { + return controllersExpected; + } + + public CsiPluginListStub setControllersExpected(int controllersExpected) { + this.controllersExpected = controllersExpected; + return this; + } + + @JsonProperty("NodesHealthy") + public int getNodesHealthy() { + return nodesHealthy; + } + + public CsiPluginListStub setNodesHealthy(int nodesHealthy) { + this.nodesHealthy = nodesHealthy; + return this; + } + + @JsonProperty("NodesExpected") + public int getNodesExpected() { + return nodesExpected; + } + + public CsiPluginListStub setNodesExpected(int nodesExpected) { + this.nodesExpected = nodesExpected; + return this; + } + + @JsonProperty("CreateIndex") + public BigInteger getCreateIndex() { + return createIndex; + } + + public CsiPluginListStub setCreateIndex(BigInteger createIndex) { + this.createIndex = createIndex; + return this; + } + + @JsonProperty("ModifyIndex") + public BigInteger getModifyIndex() { + return modifyIndex; + } + + public CsiPluginListStub setModifyIndex(BigInteger modifyIndex) { + this.modifyIndex = modifyIndex; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiPluginListStub fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiPluginListStub.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiPluginListStub.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiTopology.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiTopology.java new file mode 100644 index 0000000..d724b84 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiTopology.java @@ -0,0 +1,48 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiTopology extends ApiObject { + private Map segments; + + @JsonProperty("Segments") + public Map getSegments() { + return segments; + } + + public CsiTopology setSegments(Map segments) { + this.segments = segments; + return this; + } + + public CsiTopology addSegments(String key, String value) { + if (this.segments == null) + this.segments = new java.util.HashMap<>(); + this.segments.put(key, value); + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiTopology fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiTopology.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiTopology.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiVolume.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiVolume.java new file mode 100644 index 0000000..514c3b7 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiVolume.java @@ -0,0 +1,333 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiVolume extends ApiObject { + private String id; + private String name; + private String externalId; + private String namespace; + private List topologies; + private String accessMode; + private String attachmentMode; + private CsiMountOptions mountOptions; + private Map secrets; + private Map readAllocs; + private Map writeAllocs; + private List allocations; + private boolean schedulable; + private String pluginId; + private String provider; + private String providerVersion; + private boolean controllerRequired; + private int controllersHealthy; + private int controllersExpected; + private int nodesHealthy; + private int nodesExpected; + private Date resourceExhausted; + private BigInteger createIndex; + private BigInteger modifyIndex; + + @JsonProperty("ID") + public String getId() { + return id; + } + + public CsiVolume setId(String id) { + this.id = id; + return this; + } + + @JsonProperty("Name") + public String getName() { + return name; + } + + public CsiVolume setName(String name) { + this.name = name; + return this; + } + + @JsonProperty("ExternalID") + public String getExternalId() { + return externalId; + } + + public CsiVolume setExternalId(String externalId) { + this.externalId = externalId; + return this; + } + + @JsonProperty("Namespace") + public String getNamespace() { + return namespace; + } + + public CsiVolume setNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + @JsonProperty("Topologies") + public List getTopologies() { + return topologies; + } + + public CsiVolume setTopologies(List topologies) { + this.topologies = topologies; + return this; + } + + public CsiVolume addTopologies(CsiTopology... topologies) { + if (this.topologies == null) + this.topologies = new java.util.ArrayList<>(); + for (CsiTopology item : topologies) + this.topologies.add(item); + return this; + } + + @JsonProperty("AccessMode") + public String getAccessMode() { + return accessMode; + } + + public CsiVolume setAccessMode(String accessMode) { + this.accessMode = accessMode; + return this; + } + + @JsonProperty("AttachmentMode") + public String getAttachmentMode() { + return attachmentMode; + } + + public CsiVolume setAttachmentMode(String attachmentMode) { + this.attachmentMode = attachmentMode; + return this; + } + + @JsonProperty("MountOptions") + public CsiMountOptions getMountOptions() { + return mountOptions; + } + + public CsiVolume setMountOptions(CsiMountOptions mountOptions) { + this.mountOptions = mountOptions; + return this; + } + + @JsonProperty("Secrets") + public Map getSecrets() { + return secrets; + } + + public CsiVolume setSecrets(Map secrets) { + this.secrets = secrets; + return this; + } + + public CsiVolume addSecrets(String key, String value) { + if (this.secrets == null) + this.secrets = new java.util.HashMap<>(); + this.secrets.put(key, value); + return this; + } + + @JsonProperty("ReadAllocs") + public Map getReadAllocs() { + return readAllocs; + } + + public CsiVolume setReadAllocs(Map readAllocs) { + this.readAllocs = readAllocs; + return this; + } + + public CsiVolume addReadAllocs(String key, Allocation value) { + if (this.readAllocs == null) + this.readAllocs = new java.util.HashMap<>(); + this.readAllocs.put(key, value); + return this; + } + + @JsonProperty("WriteAllocs") + public Map getWriteAllocs() { + return writeAllocs; + } + + public CsiVolume setWriteAllocs(Map writeAllocs) { + this.writeAllocs = writeAllocs; + return this; + } + + public CsiVolume addWriteAllocs(String key, Allocation value) { + if (this.writeAllocs == null) + this.writeAllocs = new java.util.HashMap<>(); + this.writeAllocs.put(key, value); + return this; + } + + @JsonProperty("Allocations") + public List getAllocations() { + return allocations; + } + + public CsiVolume setAllocations(List allocations) { + this.allocations = allocations; + return this; + } + + public CsiVolume addAllocations(AllocationListStub... allocations) { + if (this.allocations == null) + this.allocations = new java.util.ArrayList<>(); + for (AllocationListStub item : allocations) + this.allocations.add(item); + return this; + } + + @JsonProperty("Schedulable") + public boolean getSchedulable() { + return schedulable; + } + + public CsiVolume setSchedulable(boolean schedulable) { + this.schedulable = schedulable; + return this; + } + + @JsonProperty("PluginID") + public String getPluginId() { + return pluginId; + } + + public CsiVolume setPluginId(String pluginId) { + this.pluginId = pluginId; + return this; + } + + @JsonProperty("Provider") + public String getProvider() { + return provider; + } + + public CsiVolume setProvider(String provider) { + this.provider = provider; + return this; + } + + @JsonProperty("ProviderVersion") + public String getProviderVersion() { + return providerVersion; + } + + public CsiVolume setProviderVersion(String providerVersion) { + this.providerVersion = providerVersion; + return this; + } + + @JsonProperty("ControllerRequired") + public boolean getControllerRequired() { + return controllerRequired; + } + + public CsiVolume setControllerRequired(boolean controllerRequired) { + this.controllerRequired = controllerRequired; + return this; + } + + @JsonProperty("ControllersHealthy") + public int getControllersHealthy() { + return controllersHealthy; + } + + public CsiVolume setControllersHealthy(int controllersHealthy) { + this.controllersHealthy = controllersHealthy; + return this; + } + + @JsonProperty("ControllersExpected") + public int getControllersExpected() { + return controllersExpected; + } + + public CsiVolume setControllersExpected(int controllersExpected) { + this.controllersExpected = controllersExpected; + return this; + } + + @JsonProperty("NodesHealthy") + public int getNodesHealthy() { + return nodesHealthy; + } + + public CsiVolume setNodesHealthy(int nodesHealthy) { + this.nodesHealthy = nodesHealthy; + return this; + } + + @JsonProperty("NodesExpected") + public int getNodesExpected() { + return nodesExpected; + } + + public CsiVolume setNodesExpected(int nodesExpected) { + this.nodesExpected = nodesExpected; + return this; + } + + @JsonProperty("ResourceExhausted") + public Date getResourceExhausted() { + return resourceExhausted; + } + + public CsiVolume setResourceExhausted(Date resourceExhausted) { + this.resourceExhausted = resourceExhausted; + return this; + } + + @JsonProperty("CreateIndex") + public BigInteger getCreateIndex() { + return createIndex; + } + + public CsiVolume setCreateIndex(BigInteger createIndex) { + this.createIndex = createIndex; + return this; + } + + @JsonProperty("ModifyIndex") + public BigInteger getModifyIndex() { + return modifyIndex; + } + + public CsiVolume setModifyIndex(BigInteger modifyIndex) { + this.modifyIndex = modifyIndex; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiVolume fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiVolume.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiVolume.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiVolumeListStub.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiVolumeListStub.java new file mode 100644 index 0000000..afb9925 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/CsiVolumeListStub.java @@ -0,0 +1,237 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.Date; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class CsiVolumeListStub extends ApiObject { + private String id; + private String namespace; + private String name; + private String externalId; + private List topologies; + private String accessMode; + private String attachmentMode; + private boolean schedulable; + private String pluginId; + private String provider; + private boolean controllerRequired; + private int controllersHealthy; + private int controllersExpected; + private int nodesHealthy; + private int nodesExpected; + private Date resourceExhausted; + private BigInteger createIndex; + private BigInteger modifyIndex; + + @JsonProperty("ID") + public String getId() { + return id; + } + + public CsiVolumeListStub setId(String id) { + this.id = id; + return this; + } + + @JsonProperty("Namespace") + public String getNamespace() { + return namespace; + } + + public CsiVolumeListStub setNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + @JsonProperty("Name") + public String getName() { + return name; + } + + public CsiVolumeListStub setName(String name) { + this.name = name; + return this; + } + + @JsonProperty("ExternalID") + public String getExternalId() { + return externalId; + } + + public CsiVolumeListStub setExternalId(String externalId) { + this.externalId = externalId; + return this; + } + + @JsonProperty("Topologies") + public List getTopologies() { + return topologies; + } + + public CsiVolumeListStub setTopologies(List topologies) { + this.topologies = topologies; + return this; + } + + public CsiVolumeListStub addTopologies(CsiTopology... topologies) { + if (this.topologies == null) + this.topologies = new java.util.ArrayList<>(); + for (CsiTopology item : topologies) + this.topologies.add(item); + return this; + } + + @JsonProperty("AccessMode") + public String getAccessMode() { + return accessMode; + } + + public CsiVolumeListStub setAccessMode(String accessMode) { + this.accessMode = accessMode; + return this; + } + + @JsonProperty("AttachmentMode") + public String getAttachmentMode() { + return attachmentMode; + } + + public CsiVolumeListStub setAttachmentMode(String attachmentMode) { + this.attachmentMode = attachmentMode; + return this; + } + + @JsonProperty("Schedulable") + public boolean getSchedulable() { + return schedulable; + } + + public CsiVolumeListStub setSchedulable(boolean schedulable) { + this.schedulable = schedulable; + return this; + } + + @JsonProperty("PluginID") + public String getPluginId() { + return pluginId; + } + + public CsiVolumeListStub setPluginId(String pluginId) { + this.pluginId = pluginId; + return this; + } + + @JsonProperty("Provider") + public String getProvider() { + return provider; + } + + public CsiVolumeListStub setProvider(String provider) { + this.provider = provider; + return this; + } + + @JsonProperty("ControllerRequired") + public boolean getControllerRequired() { + return controllerRequired; + } + + public CsiVolumeListStub setControllerRequired(boolean controllerRequired) { + this.controllerRequired = controllerRequired; + return this; + } + + @JsonProperty("ControllersHealthy") + public int getControllersHealthy() { + return controllersHealthy; + } + + public CsiVolumeListStub setControllersHealthy(int controllersHealthy) { + this.controllersHealthy = controllersHealthy; + return this; + } + + @JsonProperty("ControllersExpected") + public int getControllersExpected() { + return controllersExpected; + } + + public CsiVolumeListStub setControllersExpected(int controllersExpected) { + this.controllersExpected = controllersExpected; + return this; + } + + @JsonProperty("NodesHealthy") + public int getNodesHealthy() { + return nodesHealthy; + } + + public CsiVolumeListStub setNodesHealthy(int nodesHealthy) { + this.nodesHealthy = nodesHealthy; + return this; + } + + @JsonProperty("NodesExpected") + public int getNodesExpected() { + return nodesExpected; + } + + public CsiVolumeListStub setNodesExpected(int nodesExpected) { + this.nodesExpected = nodesExpected; + return this; + } + + @JsonProperty("ResourceExhausted") + public Date getResourceExhausted() { + return resourceExhausted; + } + + public CsiVolumeListStub setResourceExhausted(Date resourceExhausted) { + this.resourceExhausted = resourceExhausted; + return this; + } + + @JsonProperty("CreateIndex") + public BigInteger getCreateIndex() { + return createIndex; + } + + public CsiVolumeListStub setCreateIndex(BigInteger createIndex) { + this.createIndex = createIndex; + return this; + } + + @JsonProperty("ModifyIndex") + public BigInteger getModifyIndex() { + return modifyIndex; + } + + public CsiVolumeListStub setModifyIndex(BigInteger modifyIndex) { + this.modifyIndex = modifyIndex; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static CsiVolumeListStub fromJson(String json) throws IOException { + return NomadJson.deserialize(json, CsiVolumeListStub.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, CsiVolumeListStub.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/JobScaleStatusResponse.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/JobScaleStatusResponse.java new file mode 100644 index 0000000..3399b72 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/JobScaleStatusResponse.java @@ -0,0 +1,93 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class JobScaleStatusResponse extends ApiObject { + private String jobId; + private BigInteger jobCreateIndex; + private BigInteger jobModifyIndex; + private boolean jobStopped; + private Map taskGroups; + + @JsonProperty("JobID") + public String getJobId() { + return jobId; + } + + public JobScaleStatusResponse setJobId(String jobId) { + this.jobId = jobId; + return this; + } + + @JsonProperty("JobCreateIndex") + public BigInteger getJobCreateIndex() { + return jobCreateIndex; + } + + public JobScaleStatusResponse setJobCreateIndex(BigInteger jobCreateIndex) { + this.jobCreateIndex = jobCreateIndex; + return this; + } + + @JsonProperty("JobModifyIndex") + public BigInteger getJobModifyIndex() { + return jobModifyIndex; + } + + public JobScaleStatusResponse setJobModifyIndex(BigInteger jobModifyIndex) { + this.jobModifyIndex = jobModifyIndex; + return this; + } + + @JsonProperty("JobStopped") + public boolean getJobStopped() { + return jobStopped; + } + + public JobScaleStatusResponse setJobStopped(boolean jobStopped) { + this.jobStopped = jobStopped; + return this; + } + + @JsonProperty("TaskGroups") + public Map getTaskGroups() { + return taskGroups; + } + + public JobScaleStatusResponse setTaskGroups(Map taskGroups) { + this.taskGroups = taskGroups; + return this; + } + + public JobScaleStatusResponse addTaskGroups(String key, TaskGroupScaleStatus value) { + if (this.taskGroups == null) + this.taskGroups = new java.util.HashMap<>(); + this.taskGroups.put(key, value); + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static JobScaleStatusResponse fromJson(String json) throws IOException { + return NomadJson.deserialize(json, JobScaleStatusResponse.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, JobScaleStatusResponse.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/License.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/License.java new file mode 100644 index 0000000..7ba63e8 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/License.java @@ -0,0 +1,175 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class License extends ApiObject { + private String licenseId; + private String customerId; + private String installationId; + private Date issueTime; + private Date startTime; + private Date expirationTime; + private Date terminationTime; + private String product; + private Map flags; + private List modules; + private List features; + + @JsonProperty("LicenseID") + public String getLicenseId() { + return licenseId; + } + + public License setLicenseId(String licenseId) { + this.licenseId = licenseId; + return this; + } + + @JsonProperty("CustomerID") + public String getCustomerId() { + return customerId; + } + + public License setCustomerId(String customerId) { + this.customerId = customerId; + return this; + } + + @JsonProperty("InstallationID") + public String getInstallationId() { + return installationId; + } + + public License setInstallationId(String installationId) { + this.installationId = installationId; + return this; + } + + @JsonProperty("IssueTime") + public Date getIssueTime() { + return issueTime; + } + + public License setIssueTime(Date issueTime) { + this.issueTime = issueTime; + return this; + } + + @JsonProperty("StartTime") + public Date getStartTime() { + return startTime; + } + + public License setStartTime(Date startTime) { + this.startTime = startTime; + return this; + } + + @JsonProperty("ExpirationTime") + public Date getExpirationTime() { + return expirationTime; + } + + public License setExpirationTime(Date expirationTime) { + this.expirationTime = expirationTime; + return this; + } + + @JsonProperty("TerminationTime") + public Date getTerminationTime() { + return terminationTime; + } + + public License setTerminationTime(Date terminationTime) { + this.terminationTime = terminationTime; + return this; + } + + @JsonProperty("Product") + public String getProduct() { + return product; + } + + public License setProduct(String product) { + this.product = product; + return this; + } + + @JsonProperty("Flags") + public Map getFlags() { + return flags; + } + + public License setFlags(Map flags) { + this.flags = flags; + return this; + } + + public License addFlags(String key, Object value) { + if (this.flags == null) + this.flags = new java.util.HashMap<>(); + this.flags.put(key, value); + return this; + } + + @JsonProperty("Modules") + public List getModules() { + return modules; + } + + public License setModules(List modules) { + this.modules = modules; + return this; + } + + public License addModules(String... modules) { + if (this.modules == null) + this.modules = new java.util.ArrayList<>(); + for (String item : modules) + this.modules.add(item); + return this; + } + + @JsonProperty("Features") + public List getFeatures() { + return features; + } + + public License setFeatures(List features) { + this.features = features; + return this; + } + + public License addFeatures(String... features) { + if (this.features == null) + this.features = new java.util.ArrayList<>(); + for (String item : features) + this.features.add(item); + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static License fromJson(String json) throws IOException { + return NomadJson.deserialize(json, License.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, License.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/LicenseReply.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/LicenseReply.java new file mode 100644 index 0000000..9367213 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/LicenseReply.java @@ -0,0 +1,40 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.util.List; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class LicenseReply extends ApiObject { + private License license; + + @JsonProperty("License") + public License getLicense() { + return license; + } + + public LicenseReply setLicense(License license) { + this.license = license; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static LicenseReply fromJson(String json) throws IOException { + return NomadJson.deserialize(json, LicenseReply.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, LicenseReply.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/Node.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/Node.java index b7445c7..b20c580 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/Node.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/Node.java @@ -37,6 +37,8 @@ public final class Node extends ApiObject { private List events; private Map drivers; private Map hostVolumes; + private Map csiControllerPlugins; + private Map csiNodePlugins; private BigInteger createIndex; private BigInteger modifyIndex; @@ -303,6 +305,40 @@ public Node addHostVolumes(String key, HostVolumeInfo value) { return this; } + @JsonProperty("CSIControllerPlugins") + public Map getCsiControllerPlugins() { + return csiControllerPlugins; + } + + public Node setCsiControllerPlugins(Map csiControllerPlugins) { + this.csiControllerPlugins = csiControllerPlugins; + return this; + } + + public Node addCsiControllerPlugins(String key, CsiInfo value) { + if (this.csiControllerPlugins == null) + this.csiControllerPlugins = new java.util.HashMap<>(); + this.csiControllerPlugins.put(key, value); + return this; + } + + @JsonProperty("CSINodePlugins") + public Map getCsiNodePlugins() { + return csiNodePlugins; + } + + public Node setCsiNodePlugins(Map csiNodePlugins) { + this.csiNodePlugins = csiNodePlugins; + return this; + } + + public Node addCsiNodePlugins(String key, CsiInfo value) { + if (this.csiNodePlugins == null) + this.csiNodePlugins = new java.util.HashMap<>(); + this.csiNodePlugins.put(key, value); + return this; + } + @JsonProperty("CreateIndex") public BigInteger getCreateIndex() { return createIndex; diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingEvent.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingEvent.java new file mode 100644 index 0000000..3b9638f --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingEvent.java @@ -0,0 +1,104 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class ScalingEvent extends ApiObject { + private boolean error; + private String message; + private Map meta; + private String evalId; + private BigInteger time; + private BigInteger createIndex; + + @JsonProperty("Error") + public boolean getError() { + return error; + } + + public ScalingEvent setError(boolean error) { + this.error = error; + return this; + } + + @JsonProperty("Message") + public String getMessage() { + return message; + } + + public ScalingEvent setMessage(String message) { + this.message = message; + return this; + } + + @JsonProperty("Meta") + public Map getMeta() { + return meta; + } + + public ScalingEvent setMeta(Map meta) { + this.meta = meta; + return this; + } + + public ScalingEvent addMeta(String key, Object value) { + if (this.meta == null) + this.meta = new java.util.HashMap<>(); + this.meta.put(key, value); + return this; + } + + @JsonProperty("EvalID") + public String getEvalId() { + return evalId; + } + + public ScalingEvent setEvalId(String evalId) { + this.evalId = evalId; + return this; + } + + @JsonProperty("Time") + public BigInteger getTime() { + return time; + } + + public ScalingEvent setTime(BigInteger time) { + this.time = time; + return this; + } + + @JsonProperty("CreateIndex") + public BigInteger getCreateIndex() { + return createIndex; + } + + public ScalingEvent setCreateIndex(BigInteger createIndex) { + this.createIndex = createIndex; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static ScalingEvent fromJson(String json) throws IOException { + return NomadJson.deserialize(json, ScalingEvent.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, ScalingEvent.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingPolicy.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingPolicy.java new file mode 100644 index 0000000..55f886f --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingPolicy.java @@ -0,0 +1,144 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class ScalingPolicy extends ApiObject { + private String id; + private String namespace; + private Map target; + private Long min; + private long max; + private Map policy; + private Boolean enabled; + private BigInteger createIndex; + private BigInteger modifyIndex; + + @JsonProperty("ID") + public String getId() { + return id; + } + + public ScalingPolicy setId(String id) { + this.id = id; + return this; + } + + @JsonProperty("Namespace") + public String getNamespace() { + return namespace; + } + + public ScalingPolicy setNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + @JsonProperty("Target") + public Map getTarget() { + return target; + } + + public ScalingPolicy setTarget(Map target) { + this.target = target; + return this; + } + + public ScalingPolicy addTarget(String key, String value) { + if (this.target == null) + this.target = new java.util.HashMap<>(); + this.target.put(key, value); + return this; + } + + @JsonProperty("Min") + public Long getMin() { + return min; + } + + public ScalingPolicy setMin(Long min) { + this.min = min; + return this; + } + + @JsonProperty("Max") + public long getMax() { + return max; + } + + public ScalingPolicy setMax(long max) { + this.max = max; + return this; + } + + @JsonProperty("Policy") + public Map getPolicy() { + return policy; + } + + public ScalingPolicy setPolicy(Map policy) { + this.policy = policy; + return this; + } + + public ScalingPolicy addPolicy(String key, Object value) { + if (this.policy == null) + this.policy = new java.util.HashMap<>(); + this.policy.put(key, value); + return this; + } + + @JsonProperty("Enabled") + public Boolean getEnabled() { + return enabled; + } + + public ScalingPolicy setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + @JsonProperty("CreateIndex") + public BigInteger getCreateIndex() { + return createIndex; + } + + public ScalingPolicy setCreateIndex(BigInteger createIndex) { + this.createIndex = createIndex; + return this; + } + + @JsonProperty("ModifyIndex") + public BigInteger getModifyIndex() { + return modifyIndex; + } + + public ScalingPolicy setModifyIndex(BigInteger modifyIndex) { + this.modifyIndex = modifyIndex; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static ScalingPolicy fromJson(String json) throws IOException { + return NomadJson.deserialize(json, ScalingPolicy.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, ScalingPolicy.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingPolicyListStub.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingPolicyListStub.java new file mode 100644 index 0000000..fbabc22 --- /dev/null +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ScalingPolicyListStub.java @@ -0,0 +1,93 @@ +package com.hashicorp.nomad.apimodel; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.hashicorp.nomad.javasdk.ApiObject; +import com.hashicorp.nomad.javasdk.NomadJson; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +/** + * This is a generated JavaBean representing a request or response structure. + * + * @see Nomad HTTP API documentation associated with the endpoint you are using. + */ +public final class ScalingPolicyListStub extends ApiObject { + private String id; + private boolean enabled; + private Map target; + private BigInteger createIndex; + private BigInteger modifyIndex; + + @JsonProperty("ID") + public String getId() { + return id; + } + + public ScalingPolicyListStub setId(String id) { + this.id = id; + return this; + } + + @JsonProperty("Enabled") + public boolean getEnabled() { + return enabled; + } + + public ScalingPolicyListStub setEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + @JsonProperty("Target") + public Map getTarget() { + return target; + } + + public ScalingPolicyListStub setTarget(Map target) { + this.target = target; + return this; + } + + public ScalingPolicyListStub addTarget(String key, String value) { + if (this.target == null) + this.target = new java.util.HashMap<>(); + this.target.put(key, value); + return this; + } + + @JsonProperty("CreateIndex") + public BigInteger getCreateIndex() { + return createIndex; + } + + public ScalingPolicyListStub setCreateIndex(BigInteger createIndex) { + this.createIndex = createIndex; + return this; + } + + @JsonProperty("ModifyIndex") + public BigInteger getModifyIndex() { + return modifyIndex; + } + + public ScalingPolicyListStub setModifyIndex(BigInteger modifyIndex) { + this.modifyIndex = modifyIndex; + return this; + } + + @Override + public String toString() { + return NomadJson.serialize(this); + } + + public static ScalingPolicyListStub fromJson(String json) throws IOException { + return NomadJson.deserialize(json, ScalingPolicyListStub.class); + } + + public static List fromJsonArray(String json) throws IOException { + return NomadJson.deserializeList(json, ScalingPolicyListStub.class); + } +} diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/SchedulerConfiguration.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/SchedulerConfiguration.java index 8d8458b..b4f5f09 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/SchedulerConfiguration.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/SchedulerConfiguration.java @@ -14,10 +14,21 @@ * @see Nomad HTTP API documentation associated with the endpoint you are using. */ public final class SchedulerConfiguration extends ApiObject { + private String schedulerAlgorithm; private PreemptionConfig preemptionConfig; private BigInteger createIndex; private BigInteger modifyIndex; + @JsonProperty("SchedulerAlgorithm") + public String getSchedulerAlgorithm() { + return schedulerAlgorithm; + } + + public SchedulerConfiguration setSchedulerAlgorithm(String schedulerAlgorithm) { + this.schedulerAlgorithm = schedulerAlgorithm; + return this; + } + @JsonProperty("PreemptionConfig") public PreemptionConfig getPreemptionConfig() { return preemptionConfig; diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ServerHealth.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ServerHealth.java index dd6d653..8087869 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ServerHealth.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ServerHealth.java @@ -21,8 +21,7 @@ public final class ServerHealth extends ApiObject { private String serfStatus; private String version; private boolean leader; - private String lastContact; // NOTE: the API generator will try to convert this to long but - // the Nomad HTTP API emits it as a string; do not change + private String lastContact; private BigInteger lastTerm; private BigInteger lastIndex; private boolean healthy; diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/Service.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/Service.java index f068d00..446a4d6 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/Service.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/Service.java @@ -18,6 +18,7 @@ public final class Service extends ApiObject { private String name; private List tags; private List canaryTags; + private boolean enableTagOverride; private String portLabel; private String addressMode; private List checks; @@ -82,6 +83,16 @@ public Service addCanaryTags(String... canaryTags) { return this; } + @JsonProperty("EnableTagOverride") + public boolean getEnableTagOverride() { + return enableTagOverride; + } + + public Service setEnableTagOverride(boolean enableTagOverride) { + this.enableTagOverride = enableTagOverride; + return this; + } + @JsonProperty("PortLabel") public String getPortLabel() { return portLabel; diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ServiceCheck.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ServiceCheck.java index dac2521..60607d0 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/ServiceCheck.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/ServiceCheck.java @@ -22,6 +22,7 @@ public final class ServiceCheck extends ApiObject { private String path; private String protocol; private String portLabel; + private boolean expose; private String addressMode; private long interval; private long timeout; @@ -122,6 +123,16 @@ public ServiceCheck setPortLabel(String portLabel) { return this; } + @JsonProperty("Expose") + public boolean getExpose() { + return expose; + } + + public ServiceCheck setExpose(boolean expose) { + this.expose = expose; + return this; + } + @JsonProperty("AddressMode") public String getAddressMode() { return addressMode; diff --git a/sdk/src/main/java/com/hashicorp/nomad/apimodel/Task.java b/sdk/src/main/java/com/hashicorp/nomad/apimodel/Task.java index 86df72a..fd10645 100644 --- a/sdk/src/main/java/com/hashicorp/nomad/apimodel/Task.java +++ b/sdk/src/main/java/com/hashicorp/nomad/apimodel/Task.java @@ -17,12 +17,14 @@ public final class Task extends ApiObject { private String name; private String driver; private String user; + private TaskLifecycle lifecycle; private Map config; private List constraints; private List affinities; private Map env; private List services; private Resources resources; + private RestartPolicy restartPolicy; private Map meta; private Long killTimeout; private LogConfig logConfig; @@ -31,6 +33,7 @@ public final class Task extends ApiObject { private List