@@ -37,8 +37,9 @@ public static List<String> defaultShardKeyRegexes() {
3737 private Integer port ;
3838 private Type type ;
3939 private boolean ossCluster ;
40- private ProxyPolicy proxyPolicy ;
4140 private IPType ossClusterAPIPreferredIPType ;
41+ private ProxyPolicy proxyPolicy ;
42+ private String redisVersion ;
4243 private List <ShardKeyRegex > shardKeyRegex ;
4344 private Integer shardCount ;
4445 private ShardPlacement shardPlacement ;
@@ -56,8 +57,9 @@ private Database(Builder builder) {
5657 this .port = builder .port ;
5758 this .type = builder .type ;
5859 this .ossCluster = builder .ossCluster ;
59- this .proxyPolicy = builder .proxyPolicy ;
6060 this .ossClusterAPIPreferredIPType = builder .ossClusterAPIPreferredIPType ;
61+ this .proxyPolicy = builder .proxyPolicy ;
62+ this .redisVersion = builder .redisVersion ;
6163 this .shardKeyRegex = builder .shardKeyRegexes .stream ().map (ShardKeyRegex ::new ).collect (Collectors .toList ());
6264 this .shardCount = builder .shardCount ;
6365 this .shardPlacement = builder .shardPlacement ;
@@ -134,6 +136,15 @@ public void setOssCluster(boolean ossCluster) {
134136 this .ossCluster = ossCluster ;
135137 }
136138
139+ @ JsonProperty ("oss_cluster_api_preferred_ip_type" )
140+ public IPType getOssClusterAPIPreferredIPType () {
141+ return ossClusterAPIPreferredIPType ;
142+ }
143+
144+ public void setOssClusterAPIPreferredIPType (IPType ossClusterAPIPreferredIPType ) {
145+ this .ossClusterAPIPreferredIPType = ossClusterAPIPreferredIPType ;
146+ }
147+
137148 @ JsonProperty ("proxy_policy" )
138149 public ProxyPolicy getProxyPolicy () {
139150 return proxyPolicy ;
@@ -143,13 +154,13 @@ public void setProxyPolicy(ProxyPolicy proxyPolicy) {
143154 this .proxyPolicy = proxyPolicy ;
144155 }
145156
146- @ JsonProperty ("oss_cluster_api_preferred_ip_type " )
147- public IPType getOssClusterAPIPreferredIPType () {
148- return ossClusterAPIPreferredIPType ;
157+ @ JsonProperty ("redis_version " )
158+ public String getRedisVersion () {
159+ return redisVersion ;
149160 }
150161
151- public void setOssClusterAPIPreferredIPType ( IPType ossClusterAPIPreferredIPType ) {
152- this .ossClusterAPIPreferredIPType = ossClusterAPIPreferredIPType ;
162+ public void setRedisVersion ( String redisVersion ) {
163+ this .redisVersion = redisVersion ;
153164 }
154165
155166 @ JsonProperty ("shard_key_regex" )
@@ -191,7 +202,7 @@ public void setModules(List<ModuleConfig> modules) {
191202 @ Override
192203 public int hashCode () {
193204 return Objects .hash (memory , modules , name , ossCluster , ossClusterAPIPreferredIPType , port , proxyPolicy ,
194- replication , shardCount , shardKeyRegex , shardPlacement , sharding , type , uid );
205+ replication , redisVersion , shardCount , shardKeyRegex , shardPlacement , sharding , type , uid );
195206 }
196207
197208 @ Override
@@ -206,9 +217,10 @@ public boolean equals(Object obj) {
206217 return memory == other .memory && Objects .equals (modules , other .modules ) && Objects .equals (name , other .name )
207218 && ossCluster == other .ossCluster && ossClusterAPIPreferredIPType == other .ossClusterAPIPreferredIPType
208219 && Objects .equals (port , other .port ) && proxyPolicy == other .proxyPolicy
209- && replication == other .replication && Objects .equals (shardCount , other .shardCount )
210- && Objects .equals (shardKeyRegex , other .shardKeyRegex ) && shardPlacement == other .shardPlacement
211- && sharding == other .sharding && Objects .equals (type , other .type ) && Objects .equals (uid , other .uid );
220+ && Objects .equals (redisVersion , other .redisVersion ) && replication == other .replication
221+ && Objects .equals (shardCount , other .shardCount ) && Objects .equals (shardKeyRegex , other .shardKeyRegex )
222+ && shardPlacement == other .shardPlacement && sharding == other .sharding
223+ && Objects .equals (type , other .type ) && Objects .equals (uid , other .uid );
212224 }
213225
214226 public enum IPType {
@@ -240,9 +252,12 @@ public enum Type {
240252 @ JsonInclude (JsonInclude .Include .NON_NULL )
241253 public static class ModuleConfig {
242254
255+ public static final String DEFAULT_ARGS = "" ;
256+
243257 private String name ;
244258 private String id ;
245- private String args = "" ;
259+ private String args = DEFAULT_ARGS ;
260+ private String version ;
246261
247262 public ModuleConfig () {
248263 }
@@ -251,6 +266,13 @@ public ModuleConfig(String name) {
251266 this .name = name ;
252267 }
253268
269+ private ModuleConfig (Builder builder ) {
270+ this .name = builder .name ;
271+ this .id = builder .id ;
272+ this .args = builder .args ;
273+ this .version = builder .version ;
274+ }
275+
254276 @ JsonProperty ("module_name" )
255277 public String getName () {
256278 return name ;
@@ -278,6 +300,68 @@ public void setArgs(String args) {
278300 this .args = args ;
279301 }
280302
303+ @ JsonProperty ("semantic_version" )
304+ public String getVersion () {
305+ return version ;
306+ }
307+
308+ public void setVersion (String version ) {
309+ this .version = version ;
310+ }
311+
312+ public static Builder search () {
313+ return new Builder ().name (RedisModule .SEARCH .getModuleName ());
314+ }
315+
316+ public static Builder json () {
317+ return new Builder ().name (RedisModule .JSON .getModuleName ());
318+ }
319+
320+ public static Builder probabilistic () {
321+ return new Builder ().name (RedisModule .PROBABILISTIC .getModuleName ());
322+ }
323+
324+ public static Builder timeseries () {
325+ return new Builder ().name (RedisModule .TIMESERIES .getModuleName ());
326+ }
327+
328+ public static Builder builder () {
329+ return new Builder ();
330+ }
331+
332+ public static class Builder {
333+
334+ private String name ;
335+ private String id ;
336+ private String args = DEFAULT_ARGS ;
337+ private String version ;
338+
339+ public Builder name (String name ) {
340+ this .name = name ;
341+ return this ;
342+ }
343+
344+ public Builder id (String id ) {
345+ this .id = id ;
346+ return this ;
347+ }
348+
349+ public Builder args (String args ) {
350+ this .args = args ;
351+ return this ;
352+ }
353+
354+ public Builder version (String version ) {
355+ this .version = version ;
356+ return this ;
357+ }
358+
359+ public ModuleConfig build () {
360+ return new ModuleConfig (this );
361+ }
362+
363+ }
364+
281365 }
282366
283367 @ JsonInclude (JsonInclude .Include .NON_NULL )
@@ -318,6 +402,7 @@ public static final class Builder {
318402 private boolean ossCluster ;
319403 private ProxyPolicy proxyPolicy ;
320404 private IPType ossClusterAPIPreferredIPType ;
405+ private String redisVersion ;
321406 private List <String > shardKeyRegexes = new ArrayList <>();
322407 private Integer shardCount ;
323408 private ShardPlacement shardPlacement ;
@@ -336,6 +421,11 @@ public Builder name(String name) {
336421 return this ;
337422 }
338423
424+ public Builder redisVersion (String version ) {
425+ this .redisVersion = version ;
426+ return this ;
427+ }
428+
339429 public Builder replication (boolean replication ) {
340430 this .replication = replication ;
341431 return this ;
@@ -427,6 +517,11 @@ public Builder shardPlacement(ShardPlacement shardPlacement) {
427517 return this ;
428518 }
429519
520+ public Builder module (ModuleConfig module ) {
521+ this .moduleConfigs .add (module );
522+ return this ;
523+ }
524+
430525 public Builder module (RedisModule module ) {
431526 this .moduleConfigs .add (new ModuleConfig (module .getModuleName ()));
432527 return this ;
0 commit comments