def describe_groups()

in footmark/ess/connection.py [0:0]


    def describe_groups(self, scaling_group_ids=None, scaling_group_names=None, pagenumber=None, pagesize=50):
        """
        Query the information of a scaling group. Scaling groups have the following life cycle states:

            Active: In this state, the scaling group can receive scaling rule execution requests and trigger scaling activities.
            Inactive: In this state, the scaling group does not receive scaling rule execution requests.
            Deleting: The scaling group is being deleted and does not receive scaling rule execution requests. 
        
        :type list
        :param scaling_group_ids: List ID of a scaling groups.
            At most 20 IDs can be entered.
            Invalid scaling group IDs are not displayed in query results, and no error is reported.
        :type list
        :param scaling_group_names: List name of a scaling groups.
            At most 20 IDs can be entered.
            Invalid scaling group IDs are not displayed in query results, and no error is reported.
        :type int
        :param pagenumber: Page number of the scaling group list. The initial value and default value are both 1.
        :type int
        :param pagesize: When querying by page, this parameter indicates the number of lines per page. Maximum value: 50; default value: 10.
        
        :rtype: list
        :return: A list of :class:`footmark.ess.group`

        """

        cfgs = []
        params = {}
        if scaling_group_ids:
            for i in range(len(scaling_group_ids)):
                if i < 20 and scaling_group_ids[i]:
                    self.build_list_params(params, scaling_group_ids[i], 'ScalingGroupId' + bytes(i + 1))
        if scaling_group_names:
            for i in range(len(scaling_group_names)):
                if i < 20 and scaling_group_names[i]:
                    self.build_list_params(params, scaling_group_names[i], 'ScalingGroupName' + bytes(i + 1))

        self.build_list_params(params, pagesize, 'PageSize')

        pNum = pagenumber
        if not pNum:
            pNum = 1
        while True:
            self.build_list_params(params, pNum, 'PageNumber')
            cfg_list = self.get_list('DescribeScalingGroups', params, ['ScalingGroups', ScalingGroup])
            for cfg in cfg_list:
                cfgs.append(cfg)
            if pagenumber or len(cfg_list) < pagesize:
                break
            pNum += 1

        return cfgs