diff --git a/connectors/proactive_client/pom.xml b/connectors/proactive_client/pom.xml index cccbe1c175463b9a3e5dd2da17309de35cd900d5..09c8977ed13d270f41b26cd6575da0851ef9c9ad 100644 --- a/connectors/proactive_client/pom.xml +++ b/connectors/proactive_client/pom.xml @@ -20,7 +20,7 @@ org.activeeon scheduling-abstraction-layer - 3.6-SNAPSHOT + 3.7-SNAPSHOT diff --git a/mule_esb/mule-integration/src/main/java/cloud/morphemic/mule_integration/proactive/ProactiveClientServiceForIntegrationImpl.java b/mule_esb/mule-integration/src/main/java/cloud/morphemic/mule_integration/proactive/ProactiveClientServiceForIntegrationImpl.java index 54b90b5d843cb34e80914f661a44c52eeb17f231..885f8210548b01414ee1b22a5a5ccb37b6387082 100644 --- a/mule_esb/mule-integration/src/main/java/cloud/morphemic/mule_integration/proactive/ProactiveClientServiceForIntegrationImpl.java +++ b/mule_esb/mule-integration/src/main/java/cloud/morphemic/mule_integration/proactive/ProactiveClientServiceForIntegrationImpl.java @@ -22,6 +22,12 @@ public class ProactiveClientServiceForIntegrationImpl extends ProactiveClientSer super(restUrl, login, password, encryptorPassword); } + /*Fields that are used only for openstack deployment: + -domain + -identityVersion + -scopePrefix + -scopeVariable + */ @Override public void callAddClouds(@Payload List cloudDefinitions) { log.info("ProactiveClientServiceForIntegrationImpl->callAddClouds: cloudDefinitions size= {}", cloudDefinitions.size()); @@ -32,8 +38,8 @@ public class ProactiveClientServiceForIntegrationImpl extends ProactiveClientSer for(Object cloudDefinition : cloudDefinitions) { cloudJSON = new JSONObject(); - log.debug("ProactiveClientServiceForIntegrationImpl->callAddClouds: cloudDefinition: class= {}", cloudDefinition.getClass()); - log.debug("ProactiveClientServiceForIntegrationImpl->callAddClouds: cloudDefinition: toString= {}", cloudDefinition.toString()); + log.info("ProactiveClientServiceForIntegrationImpl->callAddClouds: cloudDefinition: class= {}", cloudDefinition.getClass()); + log.info("ProactiveClientServiceForIntegrationImpl->callAddClouds: cloudDefinition: toString= {}", cloudDefinition.toString()); cloudJSON.put("cloudID", MoreObjects.firstNonNull(((LinkedHashMap) cloudDefinition).get("id"), UUID.randomUUID().toString())); cloudJSON.put("cloudType", ((LinkedHashMap) cloudDefinition).get("cloudType")); @@ -45,47 +51,47 @@ public class ProactiveClientServiceForIntegrationImpl extends ProactiveClientSer throw new RuntimeException("Got cloud definition without credentials - user and secret are required to operate with cloud service provider"); } credentialsJSON = new JSONObject(); + credentialsJSON.put("domain", credentials.get("domain")); credentialsJSON.put("user", credentials.get("user")); credentialsJSON.put("secret", credentials.get("secret")); String securityGroup = null; String nodeGroup = null; - String domain = null; - String identityVersion = null; + Integer identityVersion; String scopePrefix = null; String scopeValue = null; String defaultNetwork = null; String regionBlacklist = null; + Integer identityVersion; + String scopePrefix; + String scopeValue; JSONObject scopeJSON = new JSONObject(); LinkedHashMap cloudConfiguration = (LinkedHashMap)((LinkedHashMap) cloudDefinition).get("cloudConfiguration"); if(ObjectUtils.isNotEmpty(cloudConfiguration)) { + identityVersion = (cloudConfiguration.get("identityVersion") != null) ? Integer.parseInt((String) cloudConfiguration.get("identityVersion")) : null; + scopePrefix = (cloudConfiguration.get("scopePrefix") != null) ? (String) cloudConfiguration.get("scopePrefix") : null; + scopeValue = (cloudConfiguration.get("scopeValue") != null) ? (String) cloudConfiguration.get("scopeValue") : null; + cloudJSON.put("identityVersion", identityVersion); + scopeJSON.put("prefix", scopePrefix); + scopeJSON.put("value", scopeValue); + cloudJSON.put("scope", scopeJSON); LinkedHashMap properties = (LinkedHashMap) cloudConfiguration.get("properties"); if (ObjectUtils.isNotEmpty(properties)) { securityGroup = (String) properties.get("securityGroup"); - identityVersion = (String) properties.get("identityVersion"); - domain = (String) properties.get("credentialsDomain"); - scopePrefix = (String) properties.get("scopePrefix"); - scopeValue = (String) properties.get("scopeValue"); defaultNetwork = (String) properties.get("defaultNetwork"); regionBlacklist = (String) properties.get("regionBlacklist"); } nodeGroup = (String) cloudConfiguration.get("nodeGroup"); } cloudJSON.put("securityGroup", MoreObjects.firstNonNull(securityGroup, JSONObject.NULL)); - cloudJSON.put("defaultNetwork", MoreObjects.firstNonNull(defaultNetwork, JSONObject.NULL)); - cloudJSON.put("blacklist", MoreObjects.firstNonNull(regionBlacklist, JSONObject.NULL)); - credentialsJSON.put("domain", MoreObjects.firstNonNull(domain, JSONObject.NULL)); cloudJSON.put("credentials", credentialsJSON); - cloudJSON.put("identityVersion", MoreObjects.firstNonNull(identityVersion, JSONObject.NULL)); - scopeJSON.put("prefix", MoreObjects.firstNonNull(scopePrefix, JSONObject.NULL)); - scopeJSON.put("value", MoreObjects.firstNonNull(scopeValue, JSONObject.NULL)); - cloudJSON.put("scope", scopeJSON); cloudJSON.put("nodeGroup", MoreObjects.firstNonNull(nodeGroup, JSONObject.NULL)); cloudsJSONArray.put(cloudJSON); + log.info(cloudsJSONArray.toString()); } - log.debug("ProactiveClientServiceForIntegrationImpl->callAddClouds: addClouds->cloudsJSONArray= {}", cloudsJSONArray.toString()); + log.info("ProactiveClientServiceForIntegrationImpl->callAddClouds: addClouds->cloudsJSONArray= {}", cloudsJSONArray.toString()); log.info("ProactiveClientServiceForIntegrationImpl->callAddClouds: cloudsJSONArray length= {}", cloudsJSONArray.length()); int ret = addClouds(cloudsJSONArray); log.info("ProactiveClientServiceForIntegrationImpl->callAddClouds: addClouds returned= {}", ret);