svn keywords
[plcapi.git] / PLC / Methods / DeleteConfFile.py
1 # $Id$
2 # $URL$
3 from PLC.Faults import *
4 from PLC.Method import Method
5 from PLC.Parameter import Parameter, Mixed
6 from PLC.ConfFiles import ConfFile, ConfFiles
7 from PLC.Auth import Auth
8
9 class DeleteConfFile(Method):
10     """
11     Returns an array of structs containing details about node
12     configuration files. If conf_file_ids is specified, only the
13     specified configuration files will be queried.
14     """
15
16     roles = ['admin']
17
18     accepts = [
19         Auth(),
20         ConfFile.fields['conf_file_id']
21         ]
22
23     returns = Parameter(int, '1 if successful')
24     
25
26     def call(self, auth, conf_file_id):
27         conf_files = ConfFiles(self.api, [conf_file_id])
28         if not conf_files:
29             raise PLCInvalidArgument, "No such configuration file"
30
31         conf_file = conf_files[0]
32         conf_file.delete()
33         self.event_objects = {'ConfFile': [conf_file['conf_file_id']]}
34
35         return 1