Skip to content

Commit

Permalink
Update to SQL client pool API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Sep 23, 2023
1 parent a26a85b commit e8355d0
Show file tree
Hide file tree
Showing 16 changed files with 416 additions and 416 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,41 @@ public class JWTOptionsConverter {
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, JWTOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "leeway":
if (member.getValue() instanceof Number) {
obj.setLeeway(((Number)member.getValue()).intValue());
}
break;
case "ignoreExpiration":
if (member.getValue() instanceof Boolean) {
obj.setIgnoreExpiration((Boolean)member.getValue());
}
break;
case "algorithm":
if (member.getValue() instanceof String) {
obj.setAlgorithm((String)member.getValue());
}
break;
case "header":
if (member.getValue() instanceof JsonObject) {
obj.setHeader(((JsonObject)member.getValue()).copy());
}
break;
case "noTimestamp":
if (member.getValue() instanceof Boolean) {
obj.setNoTimestamp((Boolean)member.getValue());
}
break;
case "expiresInSeconds":
if (member.getValue() instanceof Number) {
obj.setExpiresInSeconds(((Number)member.getValue()).intValue());
}
break;
case "expiresInMinutes":
if (member.getValue() instanceof Number) {
obj.setExpiresInMinutes(((Number)member.getValue()).intValue());
}
break;
case "audience":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
Expand All @@ -43,51 +73,21 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
});
}
break;
case "expiresInMinutes":
if (member.getValue() instanceof Number) {
obj.setExpiresInMinutes(((Number)member.getValue()).intValue());
}
break;
case "expiresInSeconds":
if (member.getValue() instanceof Number) {
obj.setExpiresInSeconds(((Number)member.getValue()).intValue());
}
break;
case "header":
if (member.getValue() instanceof JsonObject) {
obj.setHeader(((JsonObject)member.getValue()).copy());
}
break;
case "ignoreExpiration":
if (member.getValue() instanceof Boolean) {
obj.setIgnoreExpiration((Boolean)member.getValue());
}
break;
case "issuer":
if (member.getValue() instanceof String) {
obj.setIssuer((String)member.getValue());
}
break;
case "leeway":
if (member.getValue() instanceof Number) {
obj.setLeeway(((Number)member.getValue()).intValue());
}
break;
case "noTimestamp":
if (member.getValue() instanceof Boolean) {
obj.setNoTimestamp((Boolean)member.getValue());
case "subject":
if (member.getValue() instanceof String) {
obj.setSubject((String)member.getValue());
}
break;
case "nonceAlgorithm":
if (member.getValue() instanceof String) {
obj.setNonceAlgorithm((String)member.getValue());
}
break;
case "subject":
if (member.getValue() instanceof String) {
obj.setSubject((String)member.getValue());
}
break;
}
}
}
Expand All @@ -97,29 +97,29 @@ public static void toJson(JWTOptions obj, JsonObject json) {
}

public static void toJson(JWTOptions obj, java.util.Map<String, Object> json) {
json.put("leeway", obj.getLeeway());
json.put("ignoreExpiration", obj.isIgnoreExpiration());
if (obj.getAlgorithm() != null) {
json.put("algorithm", obj.getAlgorithm());
}
if (obj.getHeader() != null) {
json.put("header", obj.getHeader());
}
json.put("noTimestamp", obj.isNoTimestamp());
json.put("expiresInSeconds", obj.getExpiresInSeconds());
if (obj.getAudience() != null) {
JsonArray array = new JsonArray();
obj.getAudience().forEach(item -> array.add(item));
json.put("audience", array);
}
json.put("expiresInSeconds", obj.getExpiresInSeconds());
if (obj.getHeader() != null) {
json.put("header", obj.getHeader());
}
json.put("ignoreExpiration", obj.isIgnoreExpiration());
if (obj.getIssuer() != null) {
json.put("issuer", obj.getIssuer());
}
json.put("leeway", obj.getLeeway());
json.put("noTimestamp", obj.isNoTimestamp());
if (obj.getNonceAlgorithm() != null) {
json.put("nonceAlgorithm", obj.getNonceAlgorithm());
}
if (obj.getSubject() != null) {
json.put("subject", obj.getSubject());
}
if (obj.getNonceAlgorithm() != null) {
json.put("nonceAlgorithm", obj.getNonceAlgorithm());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,26 @@ public class KeyStoreOptionsConverter {
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, KeyStoreOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "type":
if (member.getValue() instanceof String) {
obj.setType((String)member.getValue());
}
break;
case "provider":
if (member.getValue() instanceof String) {
obj.setProvider((String)member.getValue());
}
break;
case "password":
if (member.getValue() instanceof String) {
obj.setPassword((String)member.getValue());
}
break;
case "path":
if (member.getValue() instanceof String) {
obj.setPath((String)member.getValue());
}
break;
case "passwordProtection":
if (member.getValue() instanceof JsonObject) {
java.util.Map<String, java.lang.String> map = new java.util.LinkedHashMap<>();
Expand All @@ -35,21 +50,6 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
obj.setPasswordProtection(map);
}
break;
case "path":
if (member.getValue() instanceof String) {
obj.setPath((String)member.getValue());
}
break;
case "provider":
if (member.getValue() instanceof String) {
obj.setProvider((String)member.getValue());
}
break;
case "type":
if (member.getValue() instanceof String) {
obj.setType((String)member.getValue());
}
break;
}
}
}
Expand All @@ -59,22 +59,22 @@ public static void toJson(KeyStoreOptions obj, JsonObject json) {
}

public static void toJson(KeyStoreOptions obj, java.util.Map<String, Object> json) {
if (obj.getType() != null) {
json.put("type", obj.getType());
}
if (obj.getProvider() != null) {
json.put("provider", obj.getProvider());
}
if (obj.getPassword() != null) {
json.put("password", obj.getPassword());
}
if (obj.getPath() != null) {
json.put("path", obj.getPath());
}
if (obj.getPasswordProtection() != null) {
JsonObject map = new JsonObject();
obj.getPasswordProtection().forEach((key, value) -> map.put(key, value));
json.put("passwordProtection", map);
}
if (obj.getPath() != null) {
json.put("path", obj.getPath());
}
if (obj.getProvider() != null) {
json.put("provider", obj.getProvider());
}
if (obj.getType() != null) {
json.put("type", obj.getType());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public class TokenCredentialsConverter {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, TokenCredentials obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "token":
if (member.getValue() instanceof String) {
obj.setToken((String)member.getValue());
}
break;
case "scopes":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
Expand All @@ -30,11 +35,6 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, TokenCr
obj.setScopes(list);
}
break;
case "token":
if (member.getValue() instanceof String) {
obj.setToken((String)member.getValue());
}
break;
}
}
}
Expand All @@ -44,13 +44,13 @@ static void toJson(TokenCredentials obj, JsonObject json) {
}

static void toJson(TokenCredentials obj, java.util.Map<String, Object> json) {
if (obj.getToken() != null) {
json.put("token", obj.getToken());
}
if (obj.getScopes() != null) {
JsonArray array = new JsonArray();
obj.getScopes().forEach(item -> array.add(item));
json.put("scopes", array);
}
if (obj.getToken() != null) {
json.put("token", obj.getToken());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ public class HtpasswdAuthOptionsConverter {
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, HtpasswdAuthOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "htpasswdFile":
if (member.getValue() instanceof String) {
obj.setHtpasswdFile((String)member.getValue());
}
break;
case "plainTextEnabled":
if (member.getValue() instanceof Boolean) {
obj.setPlainTextEnabled((Boolean)member.getValue());
}
break;
case "htpasswdFile":
if (member.getValue() instanceof String) {
obj.setHtpasswdFile((String)member.getValue());
}
break;
}
}
}
Expand All @@ -39,9 +39,9 @@ public static void toJson(HtpasswdAuthOptions obj, JsonObject json) {
}

public static void toJson(HtpasswdAuthOptions obj, java.util.Map<String, Object> json) {
json.put("plainTextEnabled", obj.isPlainTextEnabled());
if (obj.getHtpasswdFile() != null) {
json.put("htpasswdFile", obj.getHtpasswdFile());
}
json.put("plainTextEnabled", obj.isPlainTextEnabled());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,34 @@ public class JWTAuthOptionsConverter {
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, JWTAuthOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "jwks":
case "keyStore":
if (member.getValue() instanceof JsonObject) {
obj.setKeyStore(new io.vertx.ext.auth.KeyStoreOptions((io.vertx.core.json.JsonObject)member.getValue()));
}
break;
case "pubSecKeys":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<io.vertx.core.json.JsonObject> list = new java.util.ArrayList<>();
java.util.ArrayList<io.vertx.ext.auth.PubSecKeyOptions> list = new java.util.ArrayList<>();
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof JsonObject)
list.add(((JsonObject)item).copy());
list.add(new io.vertx.ext.auth.PubSecKeyOptions((io.vertx.core.json.JsonObject)item));
});
obj.setJwks(list);
obj.setPubSecKeys(list);
}
break;
case "jwtOptions":
if (member.getValue() instanceof JsonObject) {
obj.setJWTOptions(new io.vertx.ext.auth.JWTOptions((io.vertx.core.json.JsonObject)member.getValue()));
}
break;
case "keyStore":
if (member.getValue() instanceof JsonObject) {
obj.setKeyStore(new io.vertx.ext.auth.KeyStoreOptions((io.vertx.core.json.JsonObject)member.getValue()));
}
break;
case "pubSecKeys":
case "jwks":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<io.vertx.ext.auth.PubSecKeyOptions> list = new java.util.ArrayList<>();
java.util.ArrayList<io.vertx.core.json.JsonObject> list = new java.util.ArrayList<>();
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof JsonObject)
list.add(new io.vertx.ext.auth.PubSecKeyOptions((io.vertx.core.json.JsonObject)item));
list.add(((JsonObject)item).copy());
});
obj.setPubSecKeys(list);
obj.setJwks(list);
}
break;
}
Expand All @@ -59,18 +59,18 @@ public static void toJson(JWTAuthOptions obj, JsonObject json) {
}

public static void toJson(JWTAuthOptions obj, java.util.Map<String, Object> json) {
if (obj.getJwks() != null) {
if (obj.getPubSecKeys() != null) {
JsonArray array = new JsonArray();
obj.getJwks().forEach(item -> array.add(item));
json.put("jwks", array);
obj.getPubSecKeys().forEach(item -> array.add(item.toJson()));
json.put("pubSecKeys", array);
}
if (obj.getJWTOptions() != null) {
json.put("jwtOptions", obj.getJWTOptions().toJson());
}
if (obj.getPubSecKeys() != null) {
if (obj.getJwks() != null) {
JsonArray array = new JsonArray();
obj.getPubSecKeys().forEach(item -> array.add(item.toJson()));
json.put("pubSecKeys", array);
obj.getJwks().forEach(item -> array.add(item));
json.put("jwks", array);
}
}
}
Loading

0 comments on commit e8355d0

Please sign in to comment.