Github user imesh commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/437#discussion_r37261949
  
    --- Diff: 
components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py ---
    @@ -0,0 +1,1530 @@
    +# Licensed to the Apache Software Foundation (ASF) under one
    +# or more contributor license agreements.  See the NOTICE file
    +# distributed with this work for additional information
    +# regarding copyright ownership.  The ASF licenses this file
    +# to you under the Apache License, Version 2.0 (the
    +# "License"); you may not use this file except in compliance
    +# with the License.  You may obtain a copy of the License at
    +#
    +# http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing,
    +# software distributed under the License is distributed on an
    +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +# KIND, either express or implied.  See the License for the
    +# specific language governing permissions and limitations
    +# under the License.
    +
    +from cmd2 import *
    +from Utils import *
    +from Stratos import *
    +import Configs
    +from cli.exceptions import BadResponseError
    +
    +
    +class CLI(Cmd):
    +    """Apache Stratos CLI"""
    +
    +    prompt = Configs.stratos_prompt
    +    # resolving the '-' issue
    +    Cmd.legalChars = '-' + Cmd.legalChars
    +
    +    def __init__(self):
    +        # resolving the '-' issue
    +        [Cmd.shortcuts.update({a[3:].replace('_', '-'): a[3:]}) for a in 
self.get_names() if a.startswith('do_')]
    +        Cmd.__init__(self)
    +
    +    def completenames(self, text, *ignored):
    +        # resolving the '-' issue
    +        return [a[3:].replace('_', '-') for a in self.get_names() if 
a.replace('_', '-').startswith('do-'+text)]
    +
    +    """
    +
    +    Stratos CLI specific methods
    +    
====================================================================================================================
    +
    +    # User
    +     * list-users
    +     * add-user
    +     * update-user
    +     * remove-user
    +
    +    """
    +
    +    @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_users(self, line , opts=None):
    +        """Retrieve details of all users."""
    +        try:
    +            users = Stratos.list_users()
    +            table = PrintableTable()
    +            rows = [["Username", "Role"]]
    +            for user in users:
    +                rows.append([user['userName'], user['role']])
    +            table.add_rows(rows)
    +            table.print_table()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-s', '--username_user', type="str", help="Username of 
the user"),
    +        make_option('-a', '--password_user', type="str", help="Password of 
the user"),
    +        make_option('-r', '--role_name', type="str", help="Role name of 
the user"),
    +        make_option('-f', '--first_name', type="str", help="First name of 
the user"),
    +        make_option('-l', '--last_name', type="str", help="Last name of 
the user"),
    +        make_option('-e', '--email', type="str", help="Email of the user"),
    +        make_option('-o', '--profile_name', type="str", help="Profile name 
of the user")
    +    ])
    +    def do_add_user(self, line , opts=None):
    +        """Add a user."""
    +        try:
    +            if not opts.username_user or not opts.password_user:
    +                print("usage: add-user [-s <username>] [-a <credential>] 
[-r <role>] [-e <email>] [-f <first name>]" +
    +                      " [-l <last name>] [-o <profile name>]")
    +                return
    +            else:
    +                user = Stratos.add_users(opts.username_user, 
opts.password_user, opts.role_name, opts.first_name, opts.last_name,
    +                                       opts.email, opts.profile_name)
    +                if user:
    +                    print("User successfully created")
    +                else:
    +                    print("Error creating the user")
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-s', '--username_user', type="str", help="Username of 
the user"),
    +        make_option('-a', '--password_user', type="str", help="Password of 
the user"),
    +        make_option('-r', '--role_name', type="str", help="Role name of 
the user"),
    +        make_option('-f', '--first_name', type="str", help="First name of 
the user"),
    +        make_option('-l', '--last_name', type="str", help="Last name of 
the user"),
    +        make_option('-e', '--email', type="str", help="Email of the user"),
    +        make_option('-o', '--profile_name', type="str", help="Profile name 
of the user")
    +    ])
    +    @auth
    +    def do_update_user(self, line , opts=None):
    +        """Update a specific user."""
    +        try:
    +            user = Stratos.update_user(opts.username_user, 
opts.password_user, opts.role_name, opts.first_name, opts.last_name,
    +                                       opts.email, opts.profile_name)
    +            if user:
    +                print("User successfully updated")
    +            else:
    +                print("Error updating the user")
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_remove_user(self, name , opts=None):
    +        """Delete a user."""
    +        try:
    +            if not name:
    +                print("usage: remove-user [username]")
    +            else:
    +                user_removed = Stratos.remove_user(name)
    +                print(user_removed)
    +                if user_removed:
    +                    print("You have successfully deleted user: "+name)
    +                else:
    +                    print("Could not delete user: "+name)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    """
    +    # Applications
    +     * list-applications
    +     * describe-application
    +     * add-application
    +     * update-application
    +     * remove-application
    +     * describe-application-runtime
    +     * deploy-application
    +
    +    """
    +
    +    @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_applications(self, line , opts=None):
    +        """Retrieve details of all the applications."""
    +        try:
    +            applications = Stratos.list_applications()
    +            if not applications:
    +                print("No applications found")
    +            else:
    +                table = PrintableTable()
    +                rows = [["Application ID", "Alias", "Status"]]
    +                for application in applications:
    +                    rows.append([application['applicationId'], 
application['alias'], application['status']])
    +                table.add_rows(rows)
    +                table.print_table()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_describe_application(self, application_id , opts=None):
    +        """Describe an application."""
    +        try:
    +            if not application_id:
    +                print("usage: describe-application [cluster-id]")
    +                return
    +            application = Stratos.describe_application(application_id)
    +            if not application:
    +                print("Application not found in : "+application_id)
    +            else:
    +                print("Application : "+application_id)
    +                PrintableJSON(application).pprint()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-f', '--json_file_path', type="str", help="Path of 
the JSON file")
    +    ])
    +    @auth
    +    def do_add_application(self, line , opts=None):
    +        """Add an application."""
    +        try:
    +            if not opts.json_file_path:
    +                print("usage: add-application [-f <resource path>]")
    +            else:
    +                add_application = 
Stratos.add_application(open(opts.json_file_path, 'r').read())
    +                if add_application:
    +                    print("Application added successfully")
    +                else:
    +                    print("Error adding application")
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-f', '--json_file_path', type="str", help="Path of 
the JSON file")
    +    ])
    +    @auth
    +    def do_update_application(self, application , opts=None):
    +        """Update an application."""
    +        try:
    +            if not opts.json_file_path:
    +                print("usage: update-application [-f <resource path>] 
[application]")
    +            else:
    +                update_application = 
Stratos.update_application(application, open(opts.json_file_path, 'r').read())
    +                if update_application:
    +                    print("Application updated successfully")
    +                else:
    +                    print("Error updating application")
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +
    +    @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_remove_application(self, application , opts=None):
    +        """Delete an application."""
    +        try:
    +            if not application:
    +                print("usage: remove-application [application]")
    +            else:
    +                application_removed = 
Stratos.remove_application(application)
    +                if application_removed:
    +                    print("You have successfully removed application: 
"+application)
    +                else:
    +                    print("Could not delete application : "+application)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-a', '--application_id', type="str", help="Unique ID 
of the application"),
    +        make_option('-o', '--application_policy_id', type="str", 
help="Unique ID of the application policy")
    +    ])
    +    @auth
    +    def do_deploy_application(self, line , opts=None):
    +        """Deploy an application."""
    +        try:
    +            if not opts.application_id or not opts.application_policy_id:
    +                print("usage: deploy-application [-a <applicationId>] [-o 
<applicationPolicyId>]")
    +            else:
    +                application_removed = 
Stratos.deploy_application(opts.application_id, opts.application_policy_id)
    +                if application_removed:
    +                    print("You have successfully deployed application: 
"+opts.application_id)
    +                else:
    +                    print("Could not deployed application : 
"+opts.application_id)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-a', '--application_id', type="str", help="Unique ID 
of the application"),
    +        make_option('-o', '--application_policy_id', type="str", 
help="Unique ID of the application policy")
    +    ])
    +    @auth
    +    def do_undeploy_application(self, line , opts=None):
    +        """Undeploy an application."""
    +        try:
    +            if not opts.application_id or not opts.application_policy_id:
    +                print("usage: undeploy-application [-a <applicationId>] 
[-o <applicationPolicyId>]")
    +            else:
    +                application_removed = 
Stratos.undeploy_application(opts.application_id, opts.application_policy_id)
    +                if application_removed:
    +                    print("You have successfully undeployed application: 
"+opts.application_id)
    +                else:
    +                    print("Could not undeployed application : 
"+opts.application_id)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_describe_application_runtime(self, application_id , opts=None):
    +        """Describe the runtime topology of an application."""
    +        try:
    +            if not application_id:
    +                print("usage: describe-application-runtime 
[application-id]")
    +                return
    +            application_runtime = 
Stratos.describe_application_runtime(application_id)
    +            if not application_runtime:
    +                print("Application runtime not found")
    +            else:
    +                print("Application : "+application_id)
    +                PrintableJSON(application_runtime).pprint()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    """
    +    # Application signup
    +     * describe-application-signup
    +     * add-application-signup
    +     * remove-application-signup
    +
    +    """
    +    @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_describe_application_signup(self, application_id , opts=None):
    +        """Retrieve details of a specific application signup."""
    +        try:
    +            if not application_id:
    +                print("usage: describe-application-signup 
[application-id]")
    +                return
    +            application_signup = 
Stratos.describe_application_signup(application_id)
    +            if not application_signup:
    +                print("Application signup not found")
    +            else:
    +                PrintableJSON(application_signup).pprint()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-f', '--json_file_path', type="str", help="Path of 
the JSON file")
    +    ])
    +    @auth
    +    def do_add_application_signup(self, application_id, opts=None):
    +        """Add a new application signup to the system"""
    +        try:
    +            if not opts.json_file_path:
    +                print("usage: add-application-signup [-f <resource path>] 
[application_id]")
    +            else:
    +                application_signup = 
Stratos.add_application_signup(application_id, open(opts.json_file_path, 
'r').read())
    +                if application_signup:
    +                    print("Application signup added successfully")
    +                else:
    +                    print("Error creating application signup")
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_remove_application_signup(self, signup , opts=None):
    +        """Delete an application sign up."""
    +        try:
    +            if not signup:
    +                print("usage: remove-application-signup [signup]")
    +            else:
    +                signup_removed = Stratos.remove_application_signup(signup)
    +                if signup_removed:
    +                    print("You have successfully remove signup: "+signup)
    +                else:
    +                    print("Could not delete application signup: "+signup)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    """
    +    # Tenants
    +     * list-tenants
    +     * list-tenants-by-partial-domain
    +     * describe-tenant
    +     * add-tenant
    +     * activate-tenant
    +     * deactivate-tenant
    +
    +    """
    +
    +    @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_tenants(self, line , opts=None):
    +        """Retrieve details of all tenants."""
    +        try:
    +            tenants = Stratos.list_tenants()
    +            table = PrintableTable()
    +            rows = [["Domain", "Tenant ID", "Email", " State", "Created 
Date"]]
    +            for tenant in tenants:
    +                rows.append([tenant['tenantDomain'], tenant['tenantId'], 
tenant['email'],
    +                             "Active" if tenant['active'] else 
"De-Active", 
datetime.datetime.fromtimestamp(tenant['createdDate']/1000).strftime('%Y-%m-%d 
%H:%M:%S')])
    +            table.add_rows(rows)
    +            table.print_table()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_tenants_by_partial_domain(self, partial_domain , 
opts=None):
    +        """Search for tenants based on the partial domain value entered."""
    +        try:
    +            tenants = 
Stratos.list_tenants_by_partial_domain(partial_domain)
    +            table = PrintableTable()
    +            rows = [["Domain", "Tenant ID", "Email", " State", "Created 
Date"]]
    +            for tenant in tenants:
    +                rows.append([tenant['tenantDomain'], tenant['tenantId'], 
tenant['email'],
    +                             "Active" if tenant['active'] else 
"De-Active", 
datetime.datetime.fromtimestamp(tenant['createdDate']/1000).strftime('%Y-%m-%d 
%H:%M:%S')])
    +            table.add_rows(rows)
    +            table.print_table()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_describe_tenant(self, tenant_domain_name, opts=None):
    +        """Retrieve details of a specific tenant."""
    +        if not tenant_domain_name:
    +            print("usage: describe-tenant [Domain-Name]")
    +        else:
    +            try:
    +                tenant = Stratos.describe_tenant(tenant_domain_name)
    +                if not tenant:
    +                    print("Tenant not found")
    +                else:
    +                    print("-------------------------------------")
    +                    print("Tenant Information:")
    +                    print("-------------------------------------")
    +                    print("Tenant domain: "+tenant['tenantDomain'])
    +                    print("ID: "+str(tenant['tenantId']))
    +                    print("Active: "+str(tenant['active']))
    +                    print("Email: "+tenant['email'])
    +                    print("Created date: 
"+datetime.datetime.fromtimestamp(tenant['createdDate']/1000).strftime('%Y-%m-%d
 %H:%M:%S'))
    +                    print("-------------------------------------")
    +            except BadResponseError as e:
    +                self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-s', '--username_user', type="str", help="Username of 
the tenant"),
    +        make_option('-a', '--password_user', type="str", help="Password of 
the tenant"),
    +        make_option('-d', '--domain_name', type="str", help="domain name 
of the tenant"),
    +        make_option('-f', '--first_name', type="str", help="First name of 
the tenant"),
    +        make_option('-l', '--last_name', type="str", help="Last name of 
the tenant"),
    +        make_option('-e', '--email', type="str", help="Email of the 
tenant")
    +    ])
    +    @auth
    +    def do_add_tenant(self, line , opts=None):
    +        """Add a tenant."""
    +        try:
    +            tenant = Stratos.add_tenant(opts.username_user, 
opts.first_name, opts.last_name, opts.password_user,
    +                                        opts.domain_name, opts.email)
    +            if tenant:
    +                print("Tenant added successfully : "+opts.domain_name)
    +            else:
    +                print("Error creating the tenant : "+opts.domain_name)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-s', '--username_user', type="str", help="Username of 
the tenant"),
    +        make_option('-a', '--password_user', type="str", help="Password of 
the tenant"),
    +        make_option('-d', '--domain_name', type="str", help="domain name 
of the tenant"),
    +        make_option('-f', '--first_name', type="str", help="First name of 
the tenant"),
    +        make_option('-l', '--last_name', type="str", help="Last name of 
the tenant"),
    +        make_option('-e', '--email', type="str", help="Email of the 
tenant"),
    +        make_option('-i', '--tenant_id', type="str", help="ID of the 
tenant")
    +    ])
    +    @auth
    +    def do_update_tenant(self, line , opts=None):
    +        """Update a specific tenant."""
    +        try:
    +            tenant = Stratos.update_tenant(opts.username_user, 
opts.first_name, opts.last_name, opts.password_user,
    +                                           opts.domain_name, opts.email, 
opts.tenant_id)
    +            if tenant:
    +                print("Tenant updated successfully : "+opts.domain_name)
    +            else:
    +                print("Error updating the tenant : "+opts.domain_name)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_activate_tenant(self, tenant_domain, opts=None):
    +        """Activate a tenant."""
    +        try:
    +            if not tenant_domain:
    +                print("usage: activate-tenant <TENANT_DOMAIN> ")
    +            else:
    +                activate_tenant = Stratos.activate_tenant(tenant_domain)
    +                if activate_tenant:
    +                    print("You have successfully activated the tenant : 
"+tenant_domain)
    +                else:
    +                    print("Could not activate tenant : "+tenant_domain)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_deactivate_tenant(self, tenant_domain, opts=None):
    +        """Deactivate a tenant."""
    +        try:
    +            if not tenant_domain:
    +                print("usage: deactivate-tenant <TENANT_DOMAIN> ")
    +            else:
    +                activate_tenant = Stratos.deactivate_tenant(tenant_domain)
    +                if activate_tenant:
    +                    print("You have successfully deactivated the tenant : 
"+tenant_domain)
    +                else:
    +                    print("Could not deactivate tenant : "+tenant_domain)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    """
    +    # Cartridges
    +     * list-cartridges
    +     * list-cartridges-by-filter
    +     * describe-cartridge
    +     * add-cartridge
    +     * remove-cartridge
    +
    +    """
    +
    +    @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_cartridges(self, line , opts=None):
    +        """Retrieve details of available cartridges."""
    +        try:
    +            cartridges = Stratos.list_cartridges()
    +            table = PrintableTable()
    +            rows = [["Type", "Category", "Name", "Description", "Version", 
"Multi-Tenant"]]
    +            for cartridge in cartridges:
    +                rows.append([cartridge['type'], cartridge['category'], 
cartridge['displayName'], cartridge['description'],
    +                             cartridge['version'], "True" if 
cartridge['multiTenant'] == 1 else "False"])
    +            table.add_rows(rows)
    +            table.print_table()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_cartridges_by_filter(self, filter_text , opts=None):
    +        """Retrieve details of available cartridges."""
    +        try:
    +            if not filter_text:
    +                print("")
    +            else:
    +                cartridges = Stratos.list_cartridges_by_filter(filter_text)
    +                table = PrintableTable()
    +                rows = [["Type", "Category", "Name", "Description", 
"Version", "Multi-Tenant"]]
    +                for cartridge in cartridges:
    +                    rows.append([cartridge['type'], cartridge['category'], 
cartridge['displayName'], cartridge['description'],
    +                                 cartridge['version'], "True" if 
cartridge['multiTenant'] == 1 else "False"])
    +                table.add_rows(rows)
    +                table.print_table()
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @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_describe_cartridge(self, cartridge_type, opts=None):
    +        """Retrieve details of a specific cartridge."""
    +        if not cartridge_type:
    +            print("usage: describe-cartridge [cartridge-type]")
    +        else:
    +            try:
    +                cartridge = Stratos.describe_cartridge(cartridge_type)
    +                if not cartridge:
    +                    print("Cartridge not found")
    +                else:
    +                    print("-------------------------------------")
    +                    print("Cartridge Information:")
    +                    print("-------------------------------------")
    +                    print("Type: "+cartridge['type'])
    +                    print("Category: "+cartridge['category'])
    +                    print("Name: "+cartridge['displayName'])
    +                    print("Description: "+cartridge['description'])
    +                    print("Version: "+str(cartridge['version']))
    +                    print("Multi-Tenant: "+str(cartridge['multiTenant']))
    +                    print("Host Name: "+cartridge['host'])
    +                    print("-------------------------------------")
    +            except requests.HTTPError as e:
    +                self.perror(str(e))
    +    
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-f', '--json_file_path', type="str", help="Path of 
the JSON file")
    +    ])
    +    @auth
    +    def do_add_cartridge(self, line , opts=None):
    +        """Add a cartridge definition."""
    +        try:
    +            if not opts.json_file_path:
    +                print("usage: add-cartridge [-f <resource path>]")
    +            else:
    +                cartridge = 
Stratos.add_cartridge(open(opts.json_file_path, 'r').read())
    +                if cartridge:
    +                    print("Cartridge added successfully")
    +                else:
    +                    print("Error adding Cartridge")
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    @options([
    +        make_option('-u', '--username', type="str", help="Username of the 
user"),
    +        make_option('-p', '--password', type="str", help="Password of the 
user"),
    +        make_option('-f', '--json_file_path', type="str", help="Path of 
the JSON file")
    +    ])
    +    @auth
    +    def do_update_cartridge(self, line , opts=None):
    +        """Update a cartridge"""
    +        try:
    +            if not opts.json_file_path:
    +                print("usage: update-cartridge [-f <resource path>]")
    +            else:
    +                cartridge = 
Stratos.update_cartridge(open(opts.json_file_path, 'r').read())
    +                if cartridge:
    +                    print("Cartridge updated successfully")
    +                else:
    +                    print("Error updating Cartridge")
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +
    +    @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_remove_cartridge(self, cartridge_type , opts=None):
    +        """Delete a cartridge"""
    +        try:
    +            if not cartridge_type:
    +                print("usage: remove-cartridge [cartridge-type]")
    +            else:
    +                cartridge_removed = 
Stratos.remove_cartridge(cartridge_type)
    +                if cartridge_removed:
    +                    print("Successfully un-deployed cartridge : 
"+cartridge_type)
    +                else:
    +                    print("Could not un-deployed cartridge : 
"+cartridge_type)
    +        except BadResponseError as e:
    +            self.perror(str(e))
    +
    +    """
    +    # Cartridge groups
    +     * list-cartridge-groups
    +     * describe-cartridge-group
    +     * add-cartridge-group
    +     * remove-cartridge-group
    +
    +    """
    +
    +    @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_cartridge_groups(self, line , opts=None):
    +        """Retrieve details of all the cartridge groups."""
    --- End diff --
    
    Same as above, shall we add parameter descriptions to the method comment?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to