Client SDK Version 2.0.0
Ionic Security client SDK for Python users
Public Member Functions | List of all members
ionicsdk.profilemanager.ProfileManager Class Reference

ProfileManager handles management of profiles, including interfacing with persistors to save and load, and loading json profile data, as well as active profiles. More...

Public Member Functions

def __init__ (self, profilelist=None, json=None, _cProfileManager=None)
 A ProfileManager can be initialized with an array of existing profiles, or a json string of profile data. More...
 
def hasactiveprofile (self)
 Determine if any device profile is active. More...
 
def setactiveprofile (self, deviceid)
 Set the current device profile of the agent. More...
 
def getactiveprofile (self)
 Get the current device profile of the agent. More...
 
def hasanyprofiles (self)
 Determine if any device profiles are loaded. More...
 
def getallprofiles (self)
 Get all available device profiles. More...
 
def addprofile (self, deviceprofile, makeactive=False)
 Add a device profile to the agent device profile collection. More...
 
def removeprofile (self, deviceid)
 Remove a device profile from the agent device profile list. More...
 
def getprofileforkeyid (self, keyid)
 Determine which device profile is associated with the provided key ID. More...
 
def loadprofiles (self, persistor)
 Load device profiles using the provided profile persistor. More...
 
def saveprofiles (self, persistor)
 Save device profiles using the specified profile persistor. More...
 
def loadfromjson (self, jsonstring)
 
def savetojson (self)
 

Detailed Description

ProfileManager handles management of profiles, including interfacing with persistors to save and load, and loading json profile data, as well as active profiles.

Constructor & Destructor Documentation

◆ __init__()

def ionicsdk.profilemanager.ProfileManager.__init__ (   self,
  profilelist = None,
  json = None,
  _cProfileManager = None 
)

A ProfileManager can be initialized with an array of existing profiles, or a json string of profile data.

Parameters
profilelist(DeviceProfileList, optional): A device profile list to initialize the manager with. If unspecified or None, will start with an empty list and profiles must be added later.
jsonstring(string, optional): A string containing profile data in json format. Can be read from a SEP file or downloaded from a server.

Member Function Documentation

◆ addprofile()

def ionicsdk.profilemanager.ProfileManager.addprofile (   self,
  deviceprofile,
  makeactive = False 
)

Add a device profile to the agent device profile collection.

Parameters
deviceprofile(DeviceProfile): The device profile object.
makeactive(bool, optional): If true, then this profile will be set as the active profile (default: False).
Returns
None, raises an exception on errors

◆ getactiveprofile()

def ionicsdk.profilemanager.ProfileManager.getactiveprofile (   self)

Get the current device profile of the agent.

Returns
Returns the active device profile object. If no active profile is set, then None will be returned. You can also call Agent.hasactiveprofile() to determine if there is an active profile.

◆ getallprofiles()

def ionicsdk.profilemanager.ProfileManager.getallprofiles (   self)

Get all available device profiles.

Returns
Returns a DeviceProfileList (subclass of list) of all device profile objects.

◆ getprofileforkeyid()

def ionicsdk.profilemanager.ProfileManager.getprofileforkeyid (   self,
  keyid 
)

Determine which device profile is associated with the provided key ID.

Parameters
keyid(string): The key ID for which to retrieve the associated device profile.
Returns
The DeviceProfile associated with the provided key ID, or None if not found.

◆ hasactiveprofile()

def ionicsdk.profilemanager.ProfileManager.hasactiveprofile (   self)

Determine if any device profile is active.

Returns
True if an active profile is loaded, False otherwise

◆ hasanyprofiles()

def ionicsdk.profilemanager.ProfileManager.hasanyprofiles (   self)

Determine if any device profiles are loaded.

Returns
True if an any profile is loaded, False otherwise

◆ loadprofiles()

def ionicsdk.profilemanager.ProfileManager.loadprofiles (   self,
  persistor 
)

Load device profiles using the provided profile persistor.

Attempts to load device profiles using the specified profile persistor.

If loading is successful, all existing profiles associated with the agent will be discarded in favor of the newly loaded profiles. The active profile provided by the persistor will replace the previous active profile (if any). It is also possible that the persistor does not provide an active profile, in which case the agent object will be left without an active profile.

If loading is not successful, then no changes are made to the state of the agent.

Parameters
persistor(DeviceProfilePersistorBase): The device profile persistor.
Returns
None, raises an exception on errors

◆ removeprofile()

def ionicsdk.profilemanager.ProfileManager.removeprofile (   self,
  deviceid 
)

Remove a device profile from the agent device profile list.

Parameters
deviceid(string): The device id of the profile to remove.
Returns
None, raises an exception on errors

◆ saveprofiles()

def ionicsdk.profilemanager.ProfileManager.saveprofiles (   self,
  persistor 
)

Save device profiles using the specified profile persistor.

Parameters
persistor(DeviceProfilePersistorBase): The device profile persistor.
Returns
None, raises an exception on errors

◆ setactiveprofile()

def ionicsdk.profilemanager.ProfileManager.setactiveprofile (   self,
  deviceid 
)

Set the current device profile of the agent.

Parameters
deviceid(str): A string device id of a loaded profile to set as the active profile for the agent. If a DeviceProfile object is given instead it will use the deviceid parameter of the object as the string source.
Returns
None, raises an exception on errors

The documentation for this class was generated from the following file: