CloudStackAIO/CloudStack.py
async def request(self, command: str, **kwargs) -> dict:
        """
        Async co-routine to perform requests to a CloudStackAPI. The parameters needs to include the command string,
        which refers to the API to be called. In principle any available and future CloudStack API can be called. The
        `**kwargs` magic allows us to all add supported parameters to the given API call. A list of all available APIs
        can found at https://cloudstack.apache.org/api/apidocs-4.8/TOC_User.html

        :param command: Command string indicating the CloudStack API to be called.
        :type command: str
        :param kwargs: Parameters to be passed to the CloudStack API
        :return: Dictionary containing the decoded json reply of the CloudStack API
        :rtype: dict
        """
        kwargs.update(dict(apikey=self.api_key, command=command, response='json'))

        if 'list' in command.lower():  # list APIs can be paginated, therefore include max_page_size and page parameter
            kwargs.update(dict(pagesize=self.max_page_size, page=1))

        final_data = dict()
        while True:
            async with self.client_session.get(self.end_point, params=self._sign(kwargs)) as response:
                data = await self._handle_response(response=response,
                                                   await_final_result='queryasyncjobresult' not in command.lower())
                try:
                    count = data.pop('count')
                except KeyError:
                    if not data:
                        # Empty dictionary is returned in case a query does not contain any results.
                        # Can happen also if a listAPI is called with a page that does not exits. Therefore, final_data
                        # has to be returned in order to return all results from preceding pages.
                        return final_data
                    else:
                        # Only list API calls have a 'count' key inside the response,
                        # return data as it is in other cases!
                        return data
                else:
                    # update final_data using paginated results, dictionaries of the response contain the count key
                    # and one key pointing to the actual data values
                    for key, value in data.items():
                        final_data.setdefault(key, []).extend(value)
                    final_data['count'] = final_data.setdefault('count', 0) + count
                    kwargs['page'] += 1
                    if count < self.max_page_size:  # no more pages exists
                        return final_data
async def request(self, command: str, **kwargs) -> dict:
        """
        Async co-routine to perform requests to a CloudStackAPI. The parameters needs to include the command string,
        which refers to the API to be called. In principle any available and future CloudStack API can be called. The
        `**kwargs` magic allows us to all add supported parameters to the given API call. A list of all available APIs
        can found at https://cloudstack.apache.org/api/apidocs-4.8/TOC_User.html

        :param command: Command string indicating the CloudStack API to be called.
        :type command: str
        :param kwargs: Parameters to be passed to the CloudStack API
        :return: Dictionary containing the decoded json reply of the CloudStack API
        :rtype: dict
        """
        kwargs.update(dict(apikey=self.api_key, command=command, response='json'))

        if 'list' in command.lower():  # list APIs can be paginated, therefore include max_page_size and page parameter
            kwargs.update(dict(pagesize=self.max_page_size, page=1))

        final_data = dict()
        while True:
            async with self.client_session.get(self.end_point, params=self._sign(kwargs)) as response:
                data = await self._handle_response(response=response,
                                                   await_final_result='queryasyncjobresult' not in command.lower())
                try:
                    count = data.pop('count')
                except KeyError:
                    if not data:
                        # Empty dictionary is returned in case a query does not contain any results.
                        # Can happen also if a listAPI is called with a page that does not exits. Therefore, final_data
                        # has to be returned in order to return all results from preceding pages.
                        return final_data
                    else:
                        # Only list API calls have a 'count' key inside the response,
                        # return data as it is in other cases!
                        return data
                else:
                    # update final_data using paginated results, dictionaries of the response contain the count key
                    # and one key pointing to the actual data values
                    for key, value in data.items():
                        final_data.setdefault(key, []).extend(value)
                    final_data['count'] = final_data.setdefault('count', 0) + count
                    kwargs['page'] += 1
                    if count < self.max_page_size:  # no more pages exists
                        return final_data
async def request ( self , command : str , * * kwargs ) -> dict : kwargs . update ( dict ( apikey = self . api_key , command = command , response = 'json' ) ) if 'list' in command . lower ( ) : # list APIs can be paginated, therefore include max_page_size and page parameter kwargs . update ( dict ( pagesize = self . max_page_size , page = 1 ) ) final_data = dict ( ) while True : async with self . client_session . get ( self . end_point , params = self . _sign ( kwargs ) ) as response : data = await self . _handle_response ( response = response , await_final_result = 'queryasyncjobresult' not in command . lower ( ) ) try : count = data . pop ( 'count' ) except KeyError : if not data : # Empty dictionary is returned in case a query does not contain any results. # Can happen also if a listAPI is called with a page that does not exits. Therefore, final_data # has to be returned in order to return all results from preceding pages. return final_data else : # Only list API calls have a 'count' key inside the response, # return data as it is in other cases! return data else : # update final_data using paginated results, dictionaries of the response contain the count key # and one key pointing to the actual data values for key , value in data . items ( ) : final_data . setdefault ( key , [ ] ) . extend ( value ) final_data [ 'count' ] = final_data . setdefault ( 'count' , 0 ) + count kwargs [ 'page' ] += 1 if count < self . max_page_size : # no more pages exists return final_data
Async co-routine to perform requests to a CloudStackAPI. The parameters needs to include the command string,
        which refers to the API to be called. In principle any available and future CloudStack API can be called. The
        `**kwargs` magic allows us to all add supported parameters to the given API call. A list of all available APIs
        can found at https://cloudstack.apache.org/api/apidocs-4.8/TOC_User.html

        :param command: Command string indicating the CloudStack API to be called.
        :type command: str
        :param kwargs: Parameters to be passed to the CloudStack API
        :return: Dictionary containing the decoded json reply of the CloudStack API
        :rtype: dict
Async co - routine to perform requests to a CloudStackAPI . The parameters needs to include the command string which refers to the API to be called . In principle any available and future CloudStack API can be called . The ** kwargs magic allows us to all add supported parameters to the given API call . A list of all available APIs can found at https : // cloudstack . apache . org / api / apidocs - 4 . 8 / TOC_User . html