1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Keys import Key, Keys
5 from PLC.Auth import Auth
7 class BlacklistKey(Method):
9 Blacklists a key, disassociating it and all others identical to it
10 from all accounts and preventing it from ever being added again.
12 WARNING: Identical keys associated with other accounts with also
15 Returns 1 if successful, faults otherwise.
25 returns = Parameter(int, '1 if successful')
27 def call(self, auth, key_id):
28 # Get associated key details
29 keys = Keys(self.api, [key_id])
31 raise PLCInvalidArgument, "No such key"
34 # N.B.: Can blacklist any key, even foreign ones
39 self.event_objects = {'Key': [key['key_id']]}
40 self.message = 'Key %d blacklisted' % key['key_id']