You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/09/21 06:55:17 UTC

[GitHub] [inlong] haifxu commented on a diff in pull request #5958: [INLONG-5102][Manager] Command tools add CRUD for inlong cluster

haifxu commented on code in PR #5958:
URL: https://github.com/apache/inlong/pull/5958#discussion_r976108753


##########
inlong-manager/manager-client-tools/src/main/java/org/apache/inlong/manager/client/cli/CreateCommand.java:
##########
@@ -90,4 +94,30 @@ void run() {
             }
         }
     }
+
+    @Parameters(commandDescription = "Create cluster by json file")
+    private static class CreateCluster extends AbstractCommandRunner {
+
+        @Parameter()
+        private List<String> params;
+
+        @Parameter(names = {"-f", "--file"}, description = "json file", converter = FileConverter.class)
+        private File file;
+
+        @Override
+        void run() throws Exception {
+            String content = ClientUtils.readFile(file);
+            if (StringUtils.isBlank(content)) {
+                System.out.println("Create cluster failed: file was empty!");
+                return;
+            }
+            ClusterRequest request = objectMapper.readValue(content, ClusterRequest.class);
+            ClientUtils.initClientFactory();
+            InlongClusterClient clusterClient = ClientUtils.clientFactory.getClusterClient();
+            Integer isSave = clusterClient.saveCluster(request);

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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org