Beispiel #1
0
    def list_loaded_applications(self, to_dictionary: bool = False,
                                 **filters) -> Union[List["Application"], List[dict]]:
        """Return list of all loaded application objects or application dicts
        if `to_dictionary=True` that the user has access to. Optionally filter
        the Applications by specifying the `filters` keyword arguments.

        Args:
            to_dictionary: If True, returns list of application dicts
            **filters: Available filter parameters: ['acg', 'id', 'name',
                'status', 'alias', 'description', 'date_created',
                'date_modified', 'owner']
        """
        return Application._list_loaded_applications(
            connection=self.connection,
            to_dictionary=to_dictionary,
            **filters,
        )
Beispiel #2
0
    def _app_id_check(connection, application_id, application_name):
        """Check if the application name exists and returns the application ID.

        Args:
            connection(object): MicroStrategy connection object
            application_id: Application ID
            application_name: Application name
        """
        if application_id is None and application_name is None:
            msg = ("Please specify either 'application_name' or 'application_id' "
                   "parameter in the constructor.")
            helper.exception_handler(msg)
        if application_id is None:
            app_loaded_list = Application._list_loaded_applications(connection, to_dictionary=True,
                                                                    name=application_name)
            try:
                application_id = app_loaded_list[0]['id']
            except IndexError:
                helper.exception_handler(
                    "There is no application with the given name: '{}'".format(application_name),
                    exception_type=ValueError)

        return application_id