if site['site_id'] not in self.caller['site_ids']:
raise PLCPermissionDenied, "Not allowed to view the PCUs at that site"
- pcus = PCUs(self.api, site['pcu_ids']).values()
-
- # turn each pcu into a real dict
- pcus = [dict(pcu) for pcu in pcus]
-
- return pcus
+ return PCUs(self.api, site['pcu_ids']).values()
returns = [Address.fields]
def call(self, auth, address_id_list = None):
- addresses = Addresses(self.api, address_id_list).values()
-
- # Turn each address into a real dict
- addresses = [dict(address) for address in addresses]
-
- return addresses
+ return Addresses(self.api, address_id_list).values()
returns = [ConfFile.fields]
def call(self, auth, conf_file_ids = None):
- conf_files = ConfFiles(self.api, conf_file_ids).values()
- conf_files = [dict(conf_file) for conf_file in conf_files]
- return conf_files
+ return ConfFiles(self.api, conf_file_ids).values()
raise PLCInvalidArgument, "Cannot specify multiple object types when object_ids are specified"
# Get node information
- events = Events(self.api, event_id_list, person_id_list, event_type_list, \
+ return Events(self.api, event_id_list, person_id_list, event_type_list, \
object_type_list, object_id_list, fault_code_list).values()
-
- # turn each node into a real dict.
- events = [dict(event) for event in events]
-
- return events
if not key_ids:
return []
- keys = Keys(self.api, key_ids).values()
-
- # Turn each key into a real dict
- keys = [dict(key) for key in keys]
-
- return keys
+ return Keys(self.api, key_ids).values()
returns = [NodeGroup.fields]
def call(self, auth, nodegroup_id_or_name_list = None):
- # Get node group details
- nodegroups = NodeGroups(self.api, nodegroup_id_or_name_list).values()
-
- # Turn each nodegroup into a real dict.
- nodegroups = [dict(nodegroup) for nodegroup in nodegroups]
-
- return nodegroups
+ return NodeGroups(self.api, nodegroup_id_or_name_list).values()
returns = [NodeNetwork.fields]
def call(self, auth, nodenetwork_id_or_ip_list = None):
- nodenetworks = NodeNetworks(self.api, nodenetwork_id_or_ip_list).values()
-
- # Cast from NodeNetwork to real dict
- nodenetworks = [dict(nodenetwork) for nodenetwork in nodenetworks]
-
- return nodenetworks
+ return NodeNetworks(self.api, nodenetwork_id_or_ip_list).values()
returns = [Node.fields]
def call(self, auth, node_id_or_hostname_list = None):
- # Authenticated function
- assert self.caller is not None
-
- valid_fields = Node.fields.keys()
+ # Get node information
+ nodes = Nodes(self.api, node_id_or_hostname_list).values()
# Remove admin only fields
if 'admin' not in self.caller['roles']:
- for key in ['boot_nonce', 'key', 'session', 'root_person_ids']:
- if key in valid_fields:
- valid_fields.remove(key)
-
- # Get node information
- nodes = Nodes(self.api, node_id_or_hostname_list).values()
+ for node in nodes:
+ for field in ['boot_nonce', 'key', 'session', 'root_person_ids']:
+ if field in node:
+ del node[field]
- # Turn each node into a real dict
- nodes = [dict(node) for node in nodes]
-
return nodes
if not pcu_ids:
return []
- pcus = PCUs(self.api, pcu_ids).values()
-
- # Turn each PCU into a real dict
- pcus = [dict(pcu) for pcu in pcus]
-
- return pcus
+ return PCUs(self.api, pcu_ids).values()
if 'admin' not in self.caller['roles']:
persons = filter(self.caller.can_view, persons)
- # Turn each account into a real dict
- persons = [dict(person) for person in persons]
-
return persons
returns = [Role.fields]
def call(self, auth):
-
- roles = Roles(self.api).values()
-
- #turn each role into a real dict
- roles = [dict(role) for role in roles]
-
- return roles
+ return Roles(self.api).values()
-import os
-
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Auth import PasswordAuth
Return an array of structs containing details about all sites. If
site_id_list is specified, only the specified sites will be
queried.
-
"""
roles = ['admin', 'pi', 'user', 'tech']
object_type = 'Site'
object_ids = []
- def __init__(self, *args, **kwds):
- Method.__init__(self, *args, **kwds)
- # Update documentation with list of default fields returned
- self.__doc__ += os.linesep.join(Site.fields.keys())
-
def call(self, auth, site_id_or_login_base_list = None):
-
- # Get site information
- sites = Sites(self.api, site_id_or_login_base_list)
-
- # get id of objects affected by this call
- self.object_ids = sites.keys()
-
- # turn each site into a real dict.
- sites = [dict(site) for site in sites.values()]
-
- return sites
+ return Sites(self.api, site_id_or_login_base_list).values()
returns = [SliceAttributeType.fields]
def call(self, auth, attribute_type_id_or_name_list = None):
- # Get slice attribute type information
- attribute_types = SliceAttributeTypes(self.api, attribute_type_id_or_name_list).values()
-
- # Turn each attribute into a real dict.
- attribute_types = [dict(attribute_type) for attribute_type in attribute_types]
-
- return attribute_types
+ return SliceAttributeTypes(self.api, attribute_type_id_or_name_list).values()
if not slice_attribute_ids:
return []
- slice_attributes = SliceAttributes(self.api, slice_attribute_ids).values()
-
- slice_attributes = [dict(slice_attribute) for slice_attribute in slice_attributes]
-
- return slice_attributes
+ return SliceAttributes(self.api, slice_attribute_ids).values()
can_view = lambda slice: slice['slice_id'] in valid_slice_ids
slices = filter(can_view, slices)
- # Turn each slice into a real dict
- slices = [dict(slice) for slice in slices]
-
return slices
+import time
+
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
-methods = 'AddAddressType AddAddressTypeToAddress AddBootState AddConfFile AddConfFileToNode AddKeyType AddNetworkMethod AddNetworkType AddNodeGroup AddNodeNetwork AddNode AddNodeToNodeGroup AddNodeToPCU AddPCU AddPersonKey AddPerson AddPersonToSite AddPersonToSlice AddRole AddRoleToPerson AddSiteAddress AddSite AddSliceAttribute AddSliceAttributeType AddSlice AddSliceToNodes AdmAddAddressType AdmAddNodeGroup AdmAddNodeNetwork AdmAddNode AdmAddNodeToNodeGroup AdmAddPersonKey AdmAddPerson AdmAddPersonToSite AdmAddSitePowerControlUnit AdmAddSite AdmAssociateNodeToPowerControlUnitPort AdmAuthCheck AdmDeleteAddressType AdmDeleteAllPersonKeys AdmDeleteNodeGroup AdmDeleteNodeNetwork AdmDeleteNode AdmDeletePersonKeys AdmDeletePerson AdmDeleteSitePowerControlUnit AdmDeleteSite AdmDisassociatePowerControlUnitPort AdmGenerateNodeConfFile AdmGetAllAddressTypes AdmGetAllKeyTypes AdmGetAllNodeNetworks AdmGetAllRoles AdmGetNodeGroupNodes AdmGetNodeGroups AdmGetNodes AdmGetPersonKeys AdmGetPersonRoles AdmGetPersonSites AdmGetPersons AdmGetPowerControlUnitNodes AdmGetPowerControlUnits AdmGetSiteNodes AdmGetSitePersons AdmGetSitePIs AdmGetSitePowerControlUnits AdmGetSites AdmGetSiteTechContacts AdmGrantRoleToPerson AdmIsPersonInRole AdmQueryConfFile AdmQueryNode AdmQueryPerson AdmQueryPowerControlUnit AdmQuerySite AdmRebootNode AdmRemoveNodeFromNodeGroup AdmRemovePersonFromSite AdmRevokeRoleFromPerson AdmSetPersonEnabled AdmSetPersonPrimarySite AdmUpdateNodeGroup AdmUpdateNodeNetwork AdmUpdateNode AdmUpdatePerson AdmUpdateSitePowerControlUnit AdmUpdateSite AuthCheck BlacklistKey DeleteAddress DeleteAddressTypeFromAddress DeleteAddressType DeleteBootState DeleteConfFile DeleteKey DeleteKeyType DeleteNetworkMethod DeleteNetworkType DeleteNodeFromNodeGroup DeleteNodeFromPCU DeleteNodeGroup DeleteNodeNetwork DeleteNode DeletePCU DeletePersonFromSite DeletePersonFromSlice DeletePerson DeleteRoleFromPerson DeleteRole DeleteSite DeleteSliceAttribute DeleteSliceAttributeType DeleteSliceFromNodes DeleteSlice GetAddresses GetAddressTypes GetBootStates GetConfFiles GetEvents GetKeys GetKeyTypes GetNetworkMethods GetNetworkTypes GetNodeGroups GetNodeNetworks GetNodes GetPCUs GetPersons GetRoles GetSites GetSliceAttributes GetSliceAttributeTypes GetSlices GetSlivers RebootNode SetPersonPrimarySite SliceCreate SliceDelete UpdateAddress UpdateAddressType UpdateConfFile UpdateKey UpdateNodeGroup UpdateNodeNetwork UpdateNode UpdatePCU UpdatePerson UpdateSite UpdateSliceAttribute UpdateSliceAttributeType UpdateSlice system.listMethods system.methodHelp system.methodSignature system.multicall'.split()
+methods = 'AddAddressType AddAddressTypeToAddress AddBootState AddConfFile AddConfFileToNodeGroup AddConfFileToNode AddKeyType AddNetworkMethod AddNetworkType AddNodeGroup AddNodeNetwork AddNode AddNodeToNodeGroup AddNodeToPCU AddPCU AddPersonKey AddPerson AddPersonToSite AddPersonToSlice AddRole AddRoleToPerson AddSiteAddress AddSite AddSliceAttribute AddSliceAttributeType AddSlice AddSliceToNodes AdmAddAddressType AdmAddNodeGroup AdmAddNodeNetwork AdmAddNode AdmAddNodeToNodeGroup AdmAddPersonKey AdmAddPerson AdmAddPersonToSite AdmAddSitePowerControlUnit AdmAddSite AdmAssociateNodeToPowerControlUnitPort AdmAuthCheck AdmDeleteAddressType AdmDeleteAllPersonKeys AdmDeleteNodeGroup AdmDeleteNodeNetwork AdmDeleteNode AdmDeletePersonKeys AdmDeletePerson AdmDeleteSitePowerControlUnit AdmDeleteSite AdmDisassociatePowerControlUnitPort AdmGenerateNodeConfFile AdmGetAllAddressTypes AdmGetAllKeyTypes AdmGetAllNodeNetworks AdmGetAllRoles AdmGetNodeGroupNodes AdmGetNodeGroups AdmGetNodes AdmGetPersonKeys AdmGetPersonRoles AdmGetPersonSites AdmGetPersons AdmGetPowerControlUnitNodes AdmGetPowerControlUnits AdmGetSiteNodes AdmGetSitePersons AdmGetSitePIs AdmGetSitePowerControlUnits AdmGetSites AdmGetSiteTechContacts AdmGrantRoleToPerson AdmIsPersonInRole AdmQueryConfFile AdmQueryNode AdmQueryPerson AdmQueryPowerControlUnit AdmQuerySite AdmRebootNode AdmRemoveNodeFromNodeGroup AdmRemovePersonFromSite AdmRevokeRoleFromPerson AdmSetPersonEnabled AdmSetPersonPrimarySite AdmUpdateNodeGroup AdmUpdateNodeNetwork AdmUpdateNode AdmUpdatePerson AdmUpdateSitePowerControlUnit AdmUpdateSite AuthCheck BlacklistKey DeleteAddress DeleteAddressTypeFromAddress DeleteAddressType DeleteBootState DeleteConfFile DeleteKey DeleteKeyType DeleteNetworkMethod DeleteNetworkType DeleteNodeFromNodeGroup DeleteNodeFromPCU DeleteNodeGroup DeleteNodeNetwork DeleteNode DeletePCU DeletePersonFromSite DeletePersonFromSlice DeletePerson DeleteRoleFromPerson DeleteRole DeleteSite DeleteSliceAttribute DeleteSliceAttributeType DeleteSliceFromNodes DeleteSlice GetAddresses GetAddressTypes GetBootStates GetConfFiles GetEvents GetKeys GetKeyTypes GetNetworkMethods GetNetworkTypes GetNodeGroups GetNodeNetworks GetNodes GetPCUs GetPersons GetRoles GetSites GetSliceAttributes GetSliceAttributeTypes GetSlices GetSlivers RebootNode SetPersonPrimarySite SliceCreate SliceDelete UpdateAddress UpdateAddressType UpdateConfFile UpdateKey UpdateNodeGroup UpdateNodeNetwork UpdateNode UpdatePCU UpdatePerson UpdateSite UpdateSliceAttribute UpdateSliceAttributeType UpdateSlice system.listMethods system.methodHelp system.methodSignature system.multicall'.split()