Updating deploy application cli command
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/1555abdd Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/1555abdd Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/1555abdd Branch: refs/heads/master Commit: 1555abddd2c7a5b132f9c6c5d9bbbe2b77886503 Parents: 1df52c4 Author: Imesh Gunaratne <[email protected]> Authored: Wed Dec 17 15:47:18 2014 +0530 Committer: Udara Liyanage <[email protected]> Committed: Thu Dec 18 12:06:59 2014 +0530 ---------------------------------------------------------------------- .../java/org/apache/stratos/cli/RestCommandLineService.java | 7 ++++--- .../apache/stratos/cli/commands/DeployApplicationCommand.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/1555abdd/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java index ea7452d..61f5e2b 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java @@ -75,7 +75,7 @@ public class RestCommandLineService { private static final String ENDPOINT_DEPLOY_KUBERNETES_CLUSTER = API_CONTEXT + "/kubernetesCluster"; private static final String ENDPOINT_DEPLOY_KUBERNETES_HOST = API_CONTEXT + "/kubernetesCluster/{kubernetesClusterId}/minion"; private static final String ENDPOINT_DEPLOY_SERVICE_GROUP = API_CONTEXT + "/groups"; - private static final String ENDPOINT_DEPLOY_APPLICATION = API_CONTEXT + "/applications"; + private static final String ENDPOINT_DEPLOY_APPLICATION = API_CONTEXT + "/applications/{applicationId}/deploy"; private static final String ENDPOINT_UNDEPLOY_KUBERNETES_CLUSTER= API_CONTEXT + "/kubernetesCluster/{id}"; private static final String ENDPOINT_UNDEPLOY_KUBERNETES_HOST = API_CONTEXT + "/kubernetesCluster/{kubernetesClusterId}/hosts/{id}"; @@ -930,8 +930,9 @@ public class RestCommandLineService { } // This method helps to deploy applications - public void deployApplication (String entityBody) { - restClient.deployEntity(ENDPOINT_DEPLOY_APPLICATION, entityBody, "application"); + public void deployApplication (String applicationId, String entityBody) { + restClient.deployEntity(ENDPOINT_DEPLOY_APPLICATION.replace("{applicationId}", applicationId), entityBody, + "application"); } // This method helps to undeploy applications http://git-wip-us.apache.org/repos/asf/stratos/blob/1555abdd/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java index 25e9567..699f803 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java @@ -59,7 +59,7 @@ public class DeployApplicationCommand implements Command<StratosCommandContext> @Override public String getArgumentSyntax() { - return null; + return "[application-id]"; } @Override @@ -77,6 +77,7 @@ public class DeployApplicationCommand implements Command<StratosCommandContext> context.getStratosApplication().printUsage(getName()); return CliConstants.COMMAND_FAILED; } + String applicationId = args[0]; try { CommandLineParser parser = new GnuParser(); @@ -88,7 +89,7 @@ public class DeployApplicationCommand implements Command<StratosCommandContext> return CliConstants.COMMAND_FAILED; } String resourceFileContent = CliUtils.readResource(resourcePath); - RestCommandLineService.getInstance().deployApplication(resourceFileContent); + RestCommandLineService.getInstance().deployApplication(applicationId, resourceFileContent); return CliConstants.COMMAND_SUCCESSFULL; } else { System.out.println("usage: " + getName() + " [-" + CliConstants.RESOURCE_PATH + " " + CliConstants.RESOURCE_PATH_LONG_OPTION + "]");
