def vfolders(access_key):
    '''
    List and manage virtual folders.
    '''
    fields = [
        ('Name', 'name'),
        ('Created At', 'created_at'),
        ('Last Used', 'last_used'),
        ('Max Files', 'max_files'),
        ('Max Size', 'max_size'),
    ]
    if access_key is None:
        q = 'query { vfolders { $fields } }'
    else:
        q = 'query($ak:String) { vfolders(access_key:$ak) { $fields } }'
    q = q.replace('$fields', ' '.join(item[1] for item in fields))
    v = {'ak': access_key}
    with Session() as session:
        try:
            resp = session.Admin.query(q, v)
        except Exception as e:
            print_error(e)
            sys.exit(1)
        print(tabulate((item.values() for item in resp['vfolders']),
                       headers=(item[0] for item in fields)))
def vfolders ( access_key ) : fields = [ ( 'Name' , 'name' ) , ( 'Created At' , 'created_at' ) , ( 'Last Used' , 'last_used' ) , ( 'Max Files' , 'max_files' ) , ( 'Max Size' , 'max_size' ) , ] if access_key is None : q = 'query { vfolders { $fields } }' else : q = 'query($ak:String) { vfolders(access_key:$ak) { $fields } }' q = q . replace ( '$fields' , ' ' . join ( item [ 1 ] for item in fields ) ) v = { 'ak' : access_key } with Session ( ) as session : try : resp = session . Admin . query ( q , v ) except Exception as e : print_error ( e ) sys . exit ( 1 ) print ( tabulate ( ( item . values ( ) for item in resp [ 'vfolders' ] ) , headers = ( item [ 0 ] for item in fields ) ) )
List and manage virtual folders.