alirezazamani commented on a change in pull request #647: Add java API to
create cluster with CloudConfig
URL: https://github.com/apache/helix/pull/647#discussion_r356887467
##########
File path: helix-core/src/main/java/org/apache/helix/tools/ClusterSetup.java
##########
@@ -176,6 +179,37 @@ public void close() {
}
}
+ public void addCluster(String clusterName, boolean overwritePrevious,
boolean isCloudEnabled,
+ CloudConfig cloudConfig) throws HelixException {
+ if (isCloudEnabled) {
+ if (cloudConfig != null) {
+ String cloudID = cloudConfig.getCloudID();
+ String cloudProvider = cloudConfig.getCloudProvider();
+ List<String> cloudInfoSource = cloudConfig.getCloudInfoSources();
+ String cloudProcessorName = cloudConfig.getCloudInfoProcessorName();
+
+ // Validate the cloudConfig in the builder
+ // If it is invalid, do not even create a cluster
+ CloudConfig.Builder builder = new CloudConfig.Builder(clusterName);
+ builder.setCloudEnabled(true);
+ builder.setCloudID(cloudID);
+ builder.setCloudProvider(CloudProvider.valueOf(cloudProvider));
+ builder.setCloudInfoSources(cloudInfoSource);
+ builder.setCloudInfoProcessorName(cloudProcessorName);
+
+ // The builder checks the fields and generate exception with proper
message.
Review comment:
Done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]