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