#NEWLINE# def ex_list_keypairs( self , ssh = False , password = False , key_group = None ) : #NEWLINE# #INDENT# '\n        List available console and server keys\n        There are two types of keys for NephoScale, ssh and password keys.\n        If run without arguments, lists all keys. Otherwise list only\n        ssh keys, or only password keys.\n        Password keys with key_group 4 are console keys. When a server\n        is created, it has two keys, one password or ssh key, and\n        one password console key.\n\n        :keyword ssh: if specified, show ssh keys only (optional)\n        :type    ssh: ``bool``\n\n        :keyword password: if specified, show password keys only (optional)\n        :type    password: ``bool``\n\n        :keyword key_group: if specified, show keys with this key_group only\n                            eg key_group=4 for console password keys (optional)\n        :type    key_group: ``int``\n\n        :rtype: ``list`` of :class:`NodeKey`\n        ' #NEWLINE# if ( ssh and password ) : #NEWLINE# #INDENT# raise LibcloudError ( 'You can only supply ssh or password. To get all keys call with no arguments' ) #NEWLINE# #UNINDENT# if ssh : #NEWLINE# #INDENT# result = self . connection . request ( '/key/sshrsa/' ) . object #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if password : #NEWLINE# #INDENT# result = self . connection . request ( '/key/password/' ) . object #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = self . connection . request ( '/key/' ) . object #NEWLINE# #UNINDENT# #UNINDENT# keys = [ self . _to_key ( value ) for value in result . get ( 'data' , [ ] ) ] #NEWLINE# if key_group : #NEWLINE# #INDENT# keys = [ key for key in keys if ( key . key_group == key_group ) ] #NEWLINE# #UNINDENT# return keys