You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/10/13 13:06:55 UTC
[32/50] stratos git commit: Added list-autoscaling-policies
Added list-autoscaling-policies
Signed-off-by: Imesh Gunaratne <im...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/a0c8f355
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/a0c8f355
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/a0c8f355
Branch: refs/heads/stratos-4.1.x
Commit: a0c8f355572e361c5ae68c82a16d4f94b123753b
Parents: ce2bf7c
Author: Milindu Sanoj Kumarage <ag...@gmail.com>
Authored: Tue Aug 4 12:21:08 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue Oct 13 16:32:48 2015 +0530
----------------------------------------------------------------------
.../src/main/python/cli/CLI.py | 18 ++++++++++++++++++
.../src/main/python/cli/Stratos.py | 5 +++++
2 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/a0c8f355/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py b/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py
index 346b073..83374c7 100755
--- a/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py
+++ b/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py
@@ -272,3 +272,21 @@ class CLI(Cmd):
rows.append([deployment_policy['id'], len(deployment_policy['networkPartitions'])])
table.add_rows(rows)
table.print_table()
+
+ @options([
+ make_option('-u', '--username', type="str", help="Username of the user"),
+ make_option('-p', '--password', type="str", help="Password of the user")
+ ])
+ @auth
+ def do_list_autoscaling_policies(self, line , opts=None):
+ """Retrieve details of all the cartridge groups that have been added."""
+ autoscaling_policies = Stratos.list_autoscaling_policies()
+ if not autoscaling_policies:
+ print("No autoscaling policies found")
+ else:
+ table = PrintableTable()
+ rows = [["Id", "Accessibility"]]
+ for autoscaling_policy in autoscaling_policies:
+ rows.append([autoscaling_policy['id'], "Public" if autoscaling_policy['isPublic'] else "Private"])
+ table.add_rows(rows)
+ table.print_table()
http://git-wip-us.apache.org/repos/asf/stratos/blob/a0c8f355/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py b/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py
index 809c4fa..04ff674 100755
--- a/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py
+++ b/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py
@@ -102,6 +102,11 @@ class Stratos:
def list_cartridge_groups():
return Stratos.get('cartridgeGroups',
errorMessage='cartridge groups not found')
+ @staticmethod
+ def list_autoscaling_policies():
+ return Stratos.get('autoscalingPolicies',
+ errorMessage='No Autoscaling policies found')
+
"""
# Utils