X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FDeleteNetworkType.py;h=a02f6e0c876572a58b9cd470776f0be52a0f38bb;hb=34e1a55391f712d24f3932b98c7f26fcbd84baea;hp=f96d2a5548fd5b81cf549dcc15a9d0078a3f07e6;hpb=aa5f09efe1aaeb31820c30e7258ef8d09008ba94;p=plcapi.git diff --git a/PLC/Methods/DeleteNetworkType.py b/PLC/Methods/DeleteNetworkType.py index f96d2a5..a02f6e0 100644 --- a/PLC/Methods/DeleteNetworkType.py +++ b/PLC/Methods/DeleteNetworkType.py @@ -2,29 +2,33 @@ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.NetworkTypes import NetworkType, NetworkTypes -from PLC.Auth import PasswordAuth +from PLC.Auth import Auth class DeleteNetworkType(Method): """ Deletes a network type. + WARNING: This will cause the deletion of all network interfaces + that use this type. + Returns 1 if successful, faults otherwise. """ roles = ['admin'] accepts = [ - PasswordAuth(), + Auth(), NetworkType.fields['type'] ] returns = Parameter(int, '1 if successful') + def call(self, auth, name): network_types = NetworkTypes(self.api, [name]) if not network_types: raise PLCInvalidArgument, "No such network type" - network_type = network_types.values()[0] + network_type = network_types[0] network_type.delete()