Added list-deploying-policies

Signed-off-by: Imesh Gunaratne <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/b4871b33
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/b4871b33
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/b4871b33

Branch: refs/heads/stratos-4.1.x
Commit: b4871b33c5d2367a3c7f92d5765e130452d21390
Parents: 623e446
Author: Milindu Sanoj Kumarage <[email protected]>
Authored: Tue Aug 4 12:19:42 2015 +0530
Committer: Imesh Gunaratne <[email protected]>
Committed: Tue Oct 13 16:32:47 2015 +0530

----------------------------------------------------------------------
 .../src/main/python/cli/CLI.py                   | 19 +++++++++++++++++++
 .../src/main/python/cli/Stratos.py               |  4 ++++
 2 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/b4871b33/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 1715b82..346b073 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
@@ -253,3 +253,22 @@ class CLI(Cmd):
             Stratos.deploy_user()
         except ValueError as e:
             self.perror("sdc")
+
+
+    @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_deployment_policies(self, line , opts=None):
+        """Illustrate the base class method use."""
+        deployment_policies = Stratos.list_deployment_policies()
+        if not deployment_policies:
+            print("No deployment policies found")
+        else:
+            table = PrintableTable()
+            rows = [["Id", "Accessibility"]]
+            for deployment_policy in deployment_policies:
+                rows.append([deployment_policy['id'], 
len(deployment_policy['networkPartitions'])])
+            table.add_rows(rows)
+            table.print_table()

http://git-wip-us.apache.org/repos/asf/stratos/blob/b4871b33/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 e7becf9..db6ca31 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
@@ -93,6 +93,10 @@ class Stratos:
         return 
Stratos.get('kubernetesClusters/'+kubernetes_cluster_id+'/hosts',
                            errorMessage='Kubernetes cluster not found')
 
+    @staticmethod
+    def list_deployment_policies():
+        return Stratos.get('deploymentPolicies',
+                           errorMessage='Deployment policies not found')
 
     """
     # Utils

Reply via email to