Merge from trunk
[plcapi.git] / trunk / PLC / Methods / GetNetworkMethods.py
diff --git a/trunk/PLC/Methods/GetNetworkMethods.py b/trunk/PLC/Methods/GetNetworkMethods.py
new file mode 100644 (file)
index 0000000..cee914a
--- /dev/null
@@ -0,0 +1,22 @@
+from PLC.Faults import *
+from PLC.Method import Method
+from PLC.Parameter import Parameter, Mixed
+from PLC.NetworkMethods import NetworkMethod, NetworkMethods
+from PLC.Auth import Auth
+
+class GetNetworkMethods(Method):
+    """
+    Returns a list of all valid network methods.
+    """
+
+    roles = ['admin', 'pi', 'user', 'tech', 'node']
+
+    accepts = [
+        Auth()
+        ]
+
+    returns = [NetworkMethod.fields['method']]
+
+
+    def call(self, auth):
+        return [network_method['method'] for network_method in NetworkMethods(self.api)]