コード例 #1
0
def list_policies(groupid):
    '''List out current scaling policies.'''
    resp = utils.get(endpoint % (auth_data['id'], 'groups/%s/policies' % groupid), token=auth_data['token'])
    data = []
    for i in resp.json['policies']:
        if 'changePercent' in i:
            chng = '%s%%' % i['changePercent']
        else:
            chng = '%s server(s)' % i['change']
        utils.printvtable([('ID', i['id']), ('Name', i['name']),
                ('Change', chng), ('Cooldown', i['cooldown']),
                ('Type', i['type']),
                ('Link', utils.string_a_list([l['href'] for l in i['links']]))])
コード例 #2
0
def get_groups():
    '''List out current scaling groups.'''
    resp = utils.get(endpoint % (auth_data['id'], 'groups'),
            auth_data['token']).json
    groups = resp['groups']
    for group in groups:
        utils.printvtable([('Group ID', group['id']),
            ('Desired Capacity', group['desiredCapacity']),
            ('Pending Capacity', group['pendingCapacity']),
            ('Active Capacity', group['activeCapacity']),
            ('Active Nodes',
            utils.string_a_list(
                                [findservers(i) for i in
                                 [i['id'] for i in group['active']]]))])