<filename>raritan/rpc/usermgmt/__init__.py<gh_stars>0
# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/Role.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.usermgmt


# interface
class Role(Interface):
    idlType = "usermgmt.Role:1.0.0"

    ERR_INVALID_VALUE = 1

    # structure
    class Privilege(Structure):
        idlType = "usermgmt.Role.Privilege:1.0.0"
        elements = ["name", "args"]

        def __init__(self, name, args):
            typecheck.is_string(name, AssertionError)
            for x0 in args:
                typecheck.is_string(x0, AssertionError)

            self.name = name
            self.args = args

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                args=[x0 for x0 in json["args"]],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["args"] = [x0 for x0 in self.args]
            return json

    # structure
    class Info(Structure):
        idlType = "usermgmt.Role.Info:1.0.0"
        elements = ["description", "locked", "privileges"]

        def __init__(self, description, locked, privileges):
            typecheck.is_string(description, AssertionError)
            typecheck.is_bool(locked, AssertionError)
            for x0 in privileges:
                typecheck.is_struct(
                    x0, raritan.rpc.usermgmt.Role.Privilege, AssertionError
                )

            self.description = description
            self.locked = locked
            self.privileges = privileges

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                description=json["description"],
                locked=json["locked"],
                privileges=[
                    raritan.rpc.usermgmt.Role.Privilege.decode(x0, agent)
                    for x0 in json["privileges"]
                ],
            )
            return obj

        def encode(self):
            json = {}
            json["description"] = self.description
            json["locked"] = self.locked
            json["privileges"] = [
                raritan.rpc.usermgmt.Role.Privilege.encode(x0) for x0 in self.privileges
            ]
            return json

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.usermgmt.Role.Info.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.usermgmt.Role.Info, DecodeException)
        return _ret_

    def updateFull(self, info):
        agent = self.agent
        typecheck.is_struct(info, raritan.rpc.usermgmt.Role.Info, AssertionError)
        args = {}
        args["info"] = raritan.rpc.usermgmt.Role.Info.encode(info)
        rsp = agent.json_rpc(self.target, "updateFull", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/RoleManager.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.event

import raritan.rpc.usermgmt


# value object
class RoleEvent(raritan.rpc.event.UserEvent):
    idlType = "usermgmt.RoleEvent:1.0.0"

    def __init__(self, rolename, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.RoleEvent, self).__init__(
            actUserName, actIpAddr, source
        )
        typecheck.is_string(rolename, AssertionError)

        self.rolename = rolename

    def encode(self):
        json = super(raritan.rpc.usermgmt.RoleEvent, self).encode()
        json["rolename"] = self.rolename
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            rolename=json["rolename"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["rolename"]
        elements = elements + super(raritan.rpc.usermgmt.RoleEvent, self).listElements()
        return elements


# value object
class RoleAdded(RoleEvent):
    idlType = "usermgmt.RoleAdded:1.0.0"

    def __init__(self, rolename, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.RoleAdded, self).__init__(
            rolename, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.RoleAdded, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.RoleEvent
            rolename=json["rolename"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = elements + super(raritan.rpc.usermgmt.RoleAdded, self).listElements()
        return elements


# value object
class RoleRemoved(RoleEvent):
    idlType = "usermgmt.RoleRemoved:1.0.0"

    def __init__(self, rolename, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.RoleRemoved, self).__init__(
            rolename, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.RoleRemoved, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.RoleEvent
            rolename=json["rolename"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.usermgmt.RoleRemoved, self).listElements()
        )
        return elements


# value object
class RoleChanged(RoleEvent):
    idlType = "usermgmt.RoleChanged:1.0.0"

    def __init__(
        self, oldSettings, newSettings, rolename, actUserName, actIpAddr, source
    ):
        super(raritan.rpc.usermgmt.RoleChanged, self).__init__(
            rolename, actUserName, actIpAddr, source
        )
        typecheck.is_struct(oldSettings, raritan.rpc.usermgmt.Role.Info, AssertionError)
        typecheck.is_struct(newSettings, raritan.rpc.usermgmt.Role.Info, AssertionError)

        self.oldSettings = oldSettings
        self.newSettings = newSettings

    def encode(self):
        json = super(raritan.rpc.usermgmt.RoleChanged, self).encode()
        json["oldSettings"] = raritan.rpc.usermgmt.Role.Info.encode(self.oldSettings)
        json["newSettings"] = raritan.rpc.usermgmt.Role.Info.encode(self.newSettings)
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            oldSettings=raritan.rpc.usermgmt.Role.Info.decode(
                json["oldSettings"], agent
            ),
            newSettings=raritan.rpc.usermgmt.Role.Info.decode(
                json["newSettings"], agent
            ),
            # for usermgmt.RoleEvent
            rolename=json["rolename"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["oldSettings", "newSettings"]
        elements = (
            elements + super(raritan.rpc.usermgmt.RoleChanged, self).listElements()
        )
        return elements


# interface
class RoleManager(Interface):
    idlType = "usermgmt.RoleManager:1.0.0"

    ERR_ROLE_ALREADY_EXISTS = 1

    ERR_MAX_ROLES_REACHED = 2

    ERR_INVALID_VALUE = 3

    ERR_ROLE_DOESNT_EXIST = 1

    ERR_ROLE_NOT_DELETABLE = 2

    # structure
    class ArgumentDesc(Structure):
        idlType = "usermgmt.RoleManager.ArgumentDesc:1.0.0"
        elements = ["name", "desc"]

        def __init__(self, name, desc):
            typecheck.is_string(name, AssertionError)
            typecheck.is_string(desc, AssertionError)

            self.name = name
            self.desc = desc

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                desc=json["desc"],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["desc"] = self.desc
            return json

    # structure
    class PrivilegeDesc(Structure):
        idlType = "usermgmt.RoleManager.PrivilegeDesc:1.0.0"
        elements = ["name", "desc", "args"]

        def __init__(self, name, desc, args):
            typecheck.is_string(name, AssertionError)
            typecheck.is_string(desc, AssertionError)
            for x0 in args:
                typecheck.is_struct(
                    x0, raritan.rpc.usermgmt.RoleManager.ArgumentDesc, AssertionError
                )

            self.name = name
            self.desc = desc
            self.args = args

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                desc=json["desc"],
                args=[
                    raritan.rpc.usermgmt.RoleManager.ArgumentDesc.decode(x0, agent)
                    for x0 in json["args"]
                ],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["desc"] = self.desc
            json["args"] = [
                raritan.rpc.usermgmt.RoleManager.ArgumentDesc.encode(x0)
                for x0 in self.args
            ]
            return json

    # structure
    class RoleAccount(Structure):
        idlType = "usermgmt.RoleManager.RoleAccount:1.0.0"
        elements = ["id", "name", "info"]

        def __init__(self, id, name, info):
            typecheck.is_int(id, AssertionError)
            typecheck.is_string(name, AssertionError)
            typecheck.is_struct(info, raritan.rpc.usermgmt.Role.Info, AssertionError)

            self.id = id
            self.name = name
            self.info = info

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                id=json["id"],
                name=json["name"],
                info=raritan.rpc.usermgmt.Role.Info.decode(json["info"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["id"] = self.id
            json["name"] = self.name
            json["info"] = raritan.rpc.usermgmt.Role.Info.encode(self.info)
            return json

    # structure
    class Info(Structure):
        idlType = "usermgmt.RoleManager.Info:1.0.0"
        elements = ["privileges", "roles"]

        def __init__(self, privileges, roles):
            for x0 in privileges:
                typecheck.is_struct(
                    x0, raritan.rpc.usermgmt.RoleManager.PrivilegeDesc, AssertionError
                )
            for x0 in roles:
                typecheck.is_struct(
                    x0, raritan.rpc.usermgmt.RoleManager.RoleAccount, AssertionError
                )

            self.privileges = privileges
            self.roles = roles

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                privileges=[
                    raritan.rpc.usermgmt.RoleManager.PrivilegeDesc.decode(x0, agent)
                    for x0 in json["privileges"]
                ],
                roles=[
                    raritan.rpc.usermgmt.RoleManager.RoleAccount.decode(x0, agent)
                    for x0 in json["roles"]
                ],
            )
            return obj

        def encode(self):
            json = {}
            json["privileges"] = [
                raritan.rpc.usermgmt.RoleManager.PrivilegeDesc.encode(x0)
                for x0 in self.privileges
            ]
            json["roles"] = [
                raritan.rpc.usermgmt.RoleManager.RoleAccount.encode(x0)
                for x0 in self.roles
            ]
            return json

    def createRoleFull(self, name, info):
        agent = self.agent
        typecheck.is_string(name, AssertionError)
        typecheck.is_struct(info, raritan.rpc.usermgmt.Role.Info, AssertionError)
        args = {}
        args["name"] = name
        args["info"] = raritan.rpc.usermgmt.Role.Info.encode(info)
        rsp = agent.json_rpc(self.target, "createRoleFull", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def deleteRole(self, name):
        agent = self.agent
        typecheck.is_string(name, AssertionError)
        args = {}
        args["name"] = name
        rsp = agent.json_rpc(self.target, "deleteRole", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getAllRoleNames(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAllRoleNames", args)
        _ret_ = [x0 for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_string(x0, DecodeException)
        return _ret_

    def getAllRoles(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAllRoles", args)
        _ret_ = [
            raritan.rpc.usermgmt.RoleManager.RoleAccount.decode(x0, agent)
            for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(
                x0, raritan.rpc.usermgmt.RoleManager.RoleAccount, DecodeException
            )
        return _ret_

    def getAllPrivileges(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAllPrivileges", args)
        _ret_ = [
            raritan.rpc.usermgmt.RoleManager.PrivilegeDesc.decode(x0, agent)
            for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(
                x0, raritan.rpc.usermgmt.RoleManager.PrivilegeDesc, DecodeException
            )
        return _ret_

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.usermgmt.RoleManager.Info.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.usermgmt.RoleManager.Info, DecodeException
        )
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/User.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.um

import raritan.rpc.usermgmt


# structure
class SnmpV3Settings(Structure):
    idlType = "usermgmt.SnmpV3Settings:1.0.0"
    elements = [
        "enabled",
        "secLevel",
        "authProtocol",
        "usePasswordAsAuthPassphrase",
        "haveAuthPassphrase",
        "authPassphrase",
        "privProtocol",
        "useAuthPassphraseAsPrivPassphrase",
        "havePrivPassphrase",
        "privPassphrase",
    ]

    def __init__(
        self,
        enabled,
        secLevel,
        authProtocol,
        usePasswordAsAuthPassphrase,
        haveAuthPassphrase,
        authPassphrase,
        privProtocol,
        useAuthPassphraseAsPrivPassphrase,
        havePrivPassphrase,
        privPassphrase,
    ):
        typecheck.is_bool(enabled, AssertionError)
        typecheck.is_enum(secLevel, raritan.rpc.um.SnmpV3.SecurityLevel, AssertionError)
        typecheck.is_enum(
            authProtocol, raritan.rpc.um.SnmpV3.AuthProtocol, AssertionError
        )
        typecheck.is_bool(usePasswordAsAuthPassphrase, AssertionError)
        typecheck.is_bool(haveAuthPassphrase, AssertionError)
        typecheck.is_string(authPassphrase, AssertionError)
        typecheck.is_enum(
            privProtocol, raritan.rpc.um.SnmpV3.PrivProtocol, AssertionError
        )
        typecheck.is_bool(useAuthPassphraseAsPrivPassphrase, AssertionError)
        typecheck.is_bool(havePrivPassphrase, AssertionError)
        typecheck.is_string(privPassphrase, AssertionError)

        self.enabled = enabled
        self.secLevel = secLevel
        self.authProtocol = authProtocol
        self.usePasswordAsAuthPassphrase = usePasswordAsAuthPassphrase
        self.haveAuthPassphrase = haveAuthPassphrase
        self.authPassphrase = authPassphrase
        self.privProtocol = privProtocol
        self.useAuthPassphraseAsPrivPassphrase = useAuthPassphraseAsPrivPassphrase
        self.havePrivPassphrase = havePrivPassphrase
        self.privPassphrase = privPassphrase

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            enabled=json["enabled"],
            secLevel=raritan.rpc.um.SnmpV3.SecurityLevel.decode(json["secLevel"]),
            authProtocol=raritan.rpc.um.SnmpV3.AuthProtocol.decode(
                json["authProtocol"]
            ),
            usePasswordAsAuthPassphrase=json["usePasswordAsAuthPassphrase"],
            haveAuthPassphrase=json["haveAuthPassphrase"],
            authPassphrase=json["authPassphrase"],
            privProtocol=raritan.rpc.um.SnmpV3.PrivProtocol.decode(
                json["privProtocol"]
            ),
            useAuthPassphraseAsPrivPassphrase=json["useAuthPassphraseAsPrivPassphrase"],
            havePrivPassphrase=json["havePrivPassphrase"],
            privPassphrase=json["privPassphrase"],
        )
        return obj

    def encode(self):
        json = {}
        json["enabled"] = self.enabled
        json["secLevel"] = raritan.rpc.um.SnmpV3.SecurityLevel.encode(self.secLevel)
        json["authProtocol"] = raritan.rpc.um.SnmpV3.AuthProtocol.encode(
            self.authProtocol
        )
        json["usePasswordAsAuthPassphrase"] = self.usePasswordAsAuthPassphrase
        json["haveAuthPassphrase"] = self.haveAuthPassphrase
        json["authPassphrase"] = self.authPassphrase
        json["privProtocol"] = raritan.rpc.um.SnmpV3.PrivProtocol.encode(
            self.privProtocol
        )
        json[
            "useAuthPassphraseAsPrivPassphrase"
        ] = self.useAuthPassphraseAsPrivPassphrase
        json["havePrivPassphrase"] = self.havePrivPassphrase
        json["privPassphrase"] = self.privPassphrase
        return json


# structure
class AuxInfo(Structure):
    idlType = "usermgmt.AuxInfo:1.0.0"
    elements = ["fullname", "telephone", "eMail"]

    def __init__(self, fullname, telephone, eMail):
        typecheck.is_string(fullname, AssertionError)
        typecheck.is_string(telephone, AssertionError)
        typecheck.is_string(eMail, AssertionError)

        self.fullname = fullname
        self.telephone = telephone
        self.eMail = eMail

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            fullname=json["fullname"],
            telephone=json["telephone"],
            eMail=json["eMail"],
        )
        return obj

    def encode(self):
        json = {}
        json["fullname"] = self.fullname
        json["telephone"] = self.telephone
        json["eMail"] = self.eMail
        return json


# enumeration
class TemperatureEnum(Enumeration):
    idlType = "usermgmt.TemperatureEnum:1.0.0"
    values = ["DEG_C", "DEG_F"]


TemperatureEnum.DEG_C = TemperatureEnum(0)
TemperatureEnum.DEG_F = TemperatureEnum(1)

# enumeration
class LengthEnum(Enumeration):
    idlType = "usermgmt.LengthEnum:1.0.0"
    values = ["METER", "FEET"]


LengthEnum.METER = LengthEnum(0)
LengthEnum.FEET = LengthEnum(1)

# enumeration
class PressureEnum(Enumeration):
    idlType = "usermgmt.PressureEnum:1.0.0"
    values = ["PASCAL", "PSI"]


PressureEnum.PASCAL = PressureEnum(0)
PressureEnum.PSI = PressureEnum(1)

# structure
class Preferences(Structure):
    idlType = "usermgmt.Preferences:1.0.0"
    elements = ["temperatureUnit", "lengthUnit", "pressureUnit"]

    def __init__(self, temperatureUnit, lengthUnit, pressureUnit):
        typecheck.is_enum(
            temperatureUnit, raritan.rpc.usermgmt.TemperatureEnum, AssertionError
        )
        typecheck.is_enum(lengthUnit, raritan.rpc.usermgmt.LengthEnum, AssertionError)
        typecheck.is_enum(
            pressureUnit, raritan.rpc.usermgmt.PressureEnum, AssertionError
        )

        self.temperatureUnit = temperatureUnit
        self.lengthUnit = lengthUnit
        self.pressureUnit = pressureUnit

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            temperatureUnit=raritan.rpc.usermgmt.TemperatureEnum.decode(
                json["temperatureUnit"]
            ),
            lengthUnit=raritan.rpc.usermgmt.LengthEnum.decode(json["lengthUnit"]),
            pressureUnit=raritan.rpc.usermgmt.PressureEnum.decode(json["pressureUnit"]),
        )
        return obj

    def encode(self):
        json = {}
        json["temperatureUnit"] = raritan.rpc.usermgmt.TemperatureEnum.encode(
            self.temperatureUnit
        )
        json["lengthUnit"] = raritan.rpc.usermgmt.LengthEnum.encode(self.lengthUnit)
        json["pressureUnit"] = raritan.rpc.usermgmt.PressureEnum.encode(
            self.pressureUnit
        )
        return json


# structure
class UserInfo(Structure):
    idlType = "usermgmt.UserInfo:1.0.0"
    elements = [
        "enabled",
        "locked",
        "blocked",
        "needPasswordChange",
        "auxInfo",
        "snmpV3Settings",
        "sshPublicKey",
        "preferences",
        "roleIds",
    ]

    def __init__(
        self,
        enabled,
        locked,
        blocked,
        needPasswordChange,
        auxInfo,
        snmpV3Settings,
        sshPublicKey,
        preferences,
        roleIds,
    ):
        typecheck.is_bool(enabled, AssertionError)
        typecheck.is_bool(locked, AssertionError)
        typecheck.is_bool(blocked, AssertionError)
        typecheck.is_bool(needPasswordChange, AssertionError)
        typecheck.is_struct(auxInfo, raritan.rpc.usermgmt.AuxInfo, AssertionError)
        typecheck.is_struct(
            snmpV3Settings, raritan.rpc.usermgmt.SnmpV3Settings, AssertionError
        )
        typecheck.is_string(sshPublicKey, AssertionError)
        typecheck.is_struct(
            preferences, raritan.rpc.usermgmt.Preferences, AssertionError
        )
        for x0 in roleIds:
            typecheck.is_int(x0, AssertionError)

        self.enabled = enabled
        self.locked = locked
        self.blocked = blocked
        self.needPasswordChange = needPasswordChange
        self.auxInfo = auxInfo
        self.snmpV3Settings = snmpV3Settings
        self.sshPublicKey = sshPublicKey
        self.preferences = preferences
        self.roleIds = roleIds

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            enabled=json["enabled"],
            locked=json["locked"],
            blocked=json["blocked"],
            needPasswordChange=json["needPasswordChange"],
            auxInfo=raritan.rpc.usermgmt.AuxInfo.decode(json["auxInfo"], agent),
            snmpV3Settings=raritan.rpc.usermgmt.SnmpV3Settings.decode(
                json["snmpV3Settings"], agent
            ),
            sshPublicKey=json["sshPublicKey"],
            preferences=raritan.rpc.usermgmt.Preferences.decode(
                json["preferences"], agent
            ),
            roleIds=[x0 for x0 in json["roleIds"]],
        )
        return obj

    def encode(self):
        json = {}
        json["enabled"] = self.enabled
        json["locked"] = self.locked
        json["blocked"] = self.blocked
        json["needPasswordChange"] = self.needPasswordChange
        json["auxInfo"] = raritan.rpc.usermgmt.AuxInfo.encode(self.auxInfo)
        json["snmpV3Settings"] = raritan.rpc.usermgmt.SnmpV3Settings.encode(
            self.snmpV3Settings
        )
        json["sshPublicKey"] = self.sshPublicKey
        json["preferences"] = raritan.rpc.usermgmt.Preferences.encode(self.preferences)
        json["roleIds"] = [x0 for x0 in self.roleIds]
        return json


# structure
class UserCapabilities(Structure):
    idlType = "usermgmt.UserCapabilities:1.0.0"
    elements = ["canSetPassword", "canSetPreferences"]

    def __init__(self, canSetPassword, canSetPreferences):
        typecheck.is_bool(canSetPassword, AssertionError)
        typecheck.is_bool(canSetPreferences, AssertionError)

        self.canSetPassword = canSetPassword
        self.canSetPreferences = canSetPreferences

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            canSetPassword=json["canSetPassword"],
            canSetPreferences=json["canSetPreferences"],
        )
        return obj

    def encode(self):
        json = {}
        json["canSetPassword"] = self.canSetPassword
        json["canSetPreferences"] = self.canSetPreferences
        return json


# interface
class User(Interface):
    idlType = "usermgmt.User:1.0.1"

    ERR_PASSWORD_UNCHANGED = 1

    ERR_PASSWORD_EMPTY = 2

    ERR_PASSWORD_TOO_SHORT = 3

    ERR_PASSWORD_TOO_LONG = 4

    ERR_PASSWORD_CTRL_CHARS = 5

    ERR_PASSWORD_NEED_LOWER = 6

    ERR_PASSWORD_NEED_UPPER = 7

    ERR_PASSWORD_NEED_NUMERIC = 8

    ERR_PASSWORD_NEED_SPECIAL = 9

    ERR_PASSWORD_IN_HISTORY = 10

    ERR_PASSWORD_TOO_SHORT_FOR_SNMP = 11

    ERR_INVALID_ARGUMENT = 12

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.usermgmt.UserInfo.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.usermgmt.UserInfo, DecodeException)
        return _ret_

    def setAccountPassword(self, password):
        agent = self.agent
        typecheck.is_string(password, AssertionError)
        args = {}
        args["password"] = password
        rsp = agent.json_rpc(self.target, "setAccountPassword", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def updateAccountFull(self, password, info):
        agent = self.agent
        typecheck.is_string(password, AssertionError)
        typecheck.is_struct(info, raritan.rpc.usermgmt.UserInfo, AssertionError)
        args = {}
        args["password"] = password
        args["info"] = raritan.rpc.usermgmt.UserInfo.encode(info)
        rsp = agent.json_rpc(self.target, "updateAccountFull", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getInfoAndPrivileges(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfoAndPrivileges", args)
        info = raritan.rpc.usermgmt.UserInfo.decode(rsp["info"], agent)
        privileges = [
            raritan.rpc.usermgmt.Role.Privilege.decode(x0, agent)
            for x0 in rsp["privileges"]
        ]
        typecheck.is_struct(info, raritan.rpc.usermgmt.UserInfo, DecodeException)
        for x0 in privileges:
            typecheck.is_struct(
                x0, raritan.rpc.usermgmt.Role.Privilege, DecodeException
            )
        return (info, privileges)

    def setPreferences(self, prefs):
        agent = self.agent
        typecheck.is_struct(prefs, raritan.rpc.usermgmt.Preferences, AssertionError)
        args = {}
        args["prefs"] = raritan.rpc.usermgmt.Preferences.encode(prefs)
        rsp = agent.json_rpc(self.target, "setPreferences", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getCapabilities(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getCapabilities", args)
        _ret_ = raritan.rpc.usermgmt.UserCapabilities.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.usermgmt.UserCapabilities, DecodeException
        )
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/UserManager.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.event

import raritan.rpc.usermgmt


# structure
class Account(Structure):
    idlType = "usermgmt.Account:1.0.0"
    elements = ["name", "info"]

    def __init__(self, name, info):
        typecheck.is_string(name, AssertionError)
        typecheck.is_struct(info, raritan.rpc.usermgmt.UserInfo, AssertionError)

        self.name = name
        self.info = info

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            name=json["name"],
            info=raritan.rpc.usermgmt.UserInfo.decode(json["info"], agent),
        )
        return obj

    def encode(self):
        json = {}
        json["name"] = self.name
        json["info"] = raritan.rpc.usermgmt.UserInfo.encode(self.info)
        return json


# value object
class AccountEvent(raritan.rpc.event.UserEvent):
    idlType = "usermgmt.AccountEvent:1.0.0"

    def __init__(self, username, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.AccountEvent, self).__init__(
            actUserName, actIpAddr, source
        )
        typecheck.is_string(username, AssertionError)

        self.username = username

    def encode(self):
        json = super(raritan.rpc.usermgmt.AccountEvent, self).encode()
        json["username"] = self.username
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["username"]
        elements = (
            elements + super(raritan.rpc.usermgmt.AccountEvent, self).listElements()
        )
        return elements


# value object
class AccountAdded(AccountEvent):
    idlType = "usermgmt.AccountAdded:1.0.0"

    def __init__(self, username, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.AccountAdded, self).__init__(
            username, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.AccountAdded, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.AccountEvent
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.usermgmt.AccountAdded, self).listElements()
        )
        return elements


# value object
class AccountRemoved(AccountEvent):
    idlType = "usermgmt.AccountRemoved:1.0.0"

    def __init__(self, username, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.AccountRemoved, self).__init__(
            username, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.AccountRemoved, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.AccountEvent
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.usermgmt.AccountRemoved, self).listElements()
        )
        return elements


# value object
class PasswordChanged(AccountEvent):
    idlType = "usermgmt.PasswordChanged:1.0.0"

    def __init__(self, username, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.PasswordChanged, self).__init__(
            username, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.PasswordChanged, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.AccountEvent
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.usermgmt.PasswordChanged, self).listElements()
        )
        return elements


# value object
class AccountChanged(AccountEvent):
    idlType = "usermgmt.AccountChanged:1.0.0"

    def __init__(
        self, oldSettings, newSettings, username, actUserName, actIpAddr, source
    ):
        super(raritan.rpc.usermgmt.AccountChanged, self).__init__(
            username, actUserName, actIpAddr, source
        )
        typecheck.is_struct(oldSettings, raritan.rpc.usermgmt.UserInfo, AssertionError)
        typecheck.is_struct(newSettings, raritan.rpc.usermgmt.UserInfo, AssertionError)

        self.oldSettings = oldSettings
        self.newSettings = newSettings

    def encode(self):
        json = super(raritan.rpc.usermgmt.AccountChanged, self).encode()
        json["oldSettings"] = raritan.rpc.usermgmt.UserInfo.encode(self.oldSettings)
        json["newSettings"] = raritan.rpc.usermgmt.UserInfo.encode(self.newSettings)
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            oldSettings=raritan.rpc.usermgmt.UserInfo.decode(
                json["oldSettings"], agent
            ),
            newSettings=raritan.rpc.usermgmt.UserInfo.decode(
                json["newSettings"], agent
            ),
            # for usermgmt.AccountEvent
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["oldSettings", "newSettings"]
        elements = (
            elements + super(raritan.rpc.usermgmt.AccountChanged, self).listElements()
        )
        return elements


# interface
class UserManager(Interface):
    idlType = "usermgmt.UserManager:1.0.2"

    ERR_USER_DOESNT_EXIST = 1

    ERR_USER_NOT_DELETABLE = 2

    ERR_USER_ALREADY_EXISTS = 1

    ERR_MAX_USERS_REACHED = 2

    ERR_PASSWORD_TOO_SHORT_FOR_SNMP = 3

    ERR_INVALID_VALUE = 4

    ERR_PASSWORD_EMPTY = 5

    ERR_PASSWORD_TOO_SHORT = 6

    ERR_PASSWORD_TOO_LONG = 7

    ERR_PASSWORD_CTRL_CHARS = 8

    ERR_PASSWORD_NEED_LOWER = 9

    ERR_PASSWORD_NEED_UPPER = 10

    ERR_PASSWORD_NEED_NUMERIC = 11

    ERR_PASSWORD_NEED_SPECIAL = 12

    def getAccountNames(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAccountNames", args)
        _ret_ = [x0 for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_string(x0, DecodeException)
        return _ret_

    def createAccount(self, username, password):
        agent = self.agent
        typecheck.is_string(username, AssertionError)
        typecheck.is_string(password, AssertionError)
        args = {}
        args["username"] = username
        args["password"] = password
        rsp = agent.json_rpc(self.target, "createAccount", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def deleteAccount(self, username):
        agent = self.agent
        typecheck.is_string(username, AssertionError)
        args = {}
        args["username"] = username
        rsp = agent.json_rpc(self.target, "deleteAccount", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getAllAccounts(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAllAccounts", args)
        _ret_ = [raritan.rpc.usermgmt.Account.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_struct(x0, raritan.rpc.usermgmt.Account, DecodeException)
        return _ret_

    def createAccountFull(self, username, password, info):
        agent = self.agent
        typecheck.is_string(username, AssertionError)
        typecheck.is_string(password, AssertionError)
        typecheck.is_struct(info, raritan.rpc.usermgmt.UserInfo, AssertionError)
        args = {}
        args["username"] = username
        args["password"] = password
        args["info"] = raritan.rpc.usermgmt.UserInfo.encode(info)
        rsp = agent.json_rpc(self.target, "createAccountFull", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getAccountsByRole(self, roleName):
        agent = self.agent
        typecheck.is_string(roleName, AssertionError)
        args = {}
        args["roleName"] = roleName
        rsp = agent.json_rpc(self.target, "getAccountsByRole", args)
        _ret_ = [raritan.rpc.usermgmt.Account.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_struct(x0, raritan.rpc.usermgmt.Account, DecodeException)
        return _ret_

    def getDefaultPreferences(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getDefaultPreferences", args)
        _ret_ = raritan.rpc.usermgmt.Preferences.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.usermgmt.Preferences, DecodeException)
        return _ret_

    def setDefaultPreferences(self, prefs):
        agent = self.agent
        typecheck.is_struct(prefs, raritan.rpc.usermgmt.Preferences, AssertionError)
        args = {}
        args["prefs"] = raritan.rpc.usermgmt.Preferences.encode(prefs)
        rsp = agent.json_rpc(self.target, "setDefaultPreferences", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

<filename>raritan/rpc/usermgmt/__init__.py<gh_stars>0
# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/Role.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.usermgmt


# interface
class Role(Interface):
    idlType = "usermgmt.Role:1.0.0"

    ERR_INVALID_VALUE = 1

    # structure
    class Privilege(Structure):
        idlType = "usermgmt.Role.Privilege:1.0.0"
        elements = ["name", "args"]

        def __init__(self, name, args):
            typecheck.is_string(name, AssertionError)
            for x0 in args:
                typecheck.is_string(x0, AssertionError)

            self.name = name
            self.args = args

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                args=[x0 for x0 in json["args"]],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["args"] = [x0 for x0 in self.args]
            return json

    # structure
    class Info(Structure):
        idlType = "usermgmt.Role.Info:1.0.0"
        elements = ["description", "locked", "privileges"]

        def __init__(self, description, locked, privileges):
            typecheck.is_string(description, AssertionError)
            typecheck.is_bool(locked, AssertionError)
            for x0 in privileges:
                typecheck.is_struct(
                    x0, raritan.rpc.usermgmt.Role.Privilege, AssertionError
                )

            self.description = description
            self.locked = locked
            self.privileges = privileges

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                description=json["description"],
                locked=json["locked"],
                privileges=[
                    raritan.rpc.usermgmt.Role.Privilege.decode(x0, agent)
                    for x0 in json["privileges"]
                ],
            )
            return obj

        def encode(self):
            json = {}
            json["description"] = self.description
            json["locked"] = self.locked
            json["privileges"] = [
                raritan.rpc.usermgmt.Role.Privilege.encode(x0) for x0 in self.privileges
            ]
            return json

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.usermgmt.Role.Info.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.usermgmt.Role.Info, DecodeException)
        return _ret_

    def updateFull(self, info):
        agent = self.agent
        typecheck.is_struct(info, raritan.rpc.usermgmt.Role.Info, AssertionError)
        args = {}
        args["info"] = raritan.rpc.usermgmt.Role.Info.encode(info)
        rsp = agent.json_rpc(self.target, "updateFull", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/RoleManager.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.event

import raritan.rpc.usermgmt


# value object
class RoleEvent(raritan.rpc.event.UserEvent):
    idlType = "usermgmt.RoleEvent:1.0.0"

    def __init__(self, rolename, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.RoleEvent, self).__init__(
            actUserName, actIpAddr, source
        )
        typecheck.is_string(rolename, AssertionError)

        self.rolename = rolename

    def encode(self):
        json = super(raritan.rpc.usermgmt.RoleEvent, self).encode()
        json["rolename"] = self.rolename
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            rolename=json["rolename"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["rolename"]
        elements = elements + super(raritan.rpc.usermgmt.RoleEvent, self).listElements()
        return elements


# value object
class RoleAdded(RoleEvent):
    idlType = "usermgmt.RoleAdded:1.0.0"

    def __init__(self, rolename, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.RoleAdded, self).__init__(
            rolename, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.RoleAdded, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.RoleEvent
            rolename=json["rolename"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = elements + super(raritan.rpc.usermgmt.RoleAdded, self).listElements()
        return elements


# value object
class RoleRemoved(RoleEvent):
    idlType = "usermgmt.RoleRemoved:1.0.0"

    def __init__(self, rolename, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.RoleRemoved, self).__init__(
            rolename, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.RoleRemoved, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.RoleEvent
            rolename=json["rolename"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.usermgmt.RoleRemoved, self).listElements()
        )
        return elements


# value object
class RoleChanged(RoleEvent):
    idlType = "usermgmt.RoleChanged:1.0.0"

    def __init__(
        self, oldSettings, newSettings, rolename, actUserName, actIpAddr, source
    ):
        super(raritan.rpc.usermgmt.RoleChanged, self).__init__(
            rolename, actUserName, actIpAddr, source
        )
        typecheck.is_struct(oldSettings, raritan.rpc.usermgmt.Role.Info, AssertionError)
        typecheck.is_struct(newSettings, raritan.rpc.usermgmt.Role.Info, AssertionError)

        self.oldSettings = oldSettings
        self.newSettings = newSettings

    def encode(self):
        json = super(raritan.rpc.usermgmt.RoleChanged, self).encode()
        json["oldSettings"] = raritan.rpc.usermgmt.Role.Info.encode(self.oldSettings)
        json["newSettings"] = raritan.rpc.usermgmt.Role.Info.encode(self.newSettings)
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            oldSettings=raritan.rpc.usermgmt.Role.Info.decode(
                json["oldSettings"], agent
            ),
            newSettings=raritan.rpc.usermgmt.Role.Info.decode(
                json["newSettings"], agent
            ),
            # for usermgmt.RoleEvent
            rolename=json["rolename"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["oldSettings", "newSettings"]
        elements = (
            elements + super(raritan.rpc.usermgmt.RoleChanged, self).listElements()
        )
        return elements


# interface
class RoleManager(Interface):
    idlType = "usermgmt.RoleManager:1.0.0"

    ERR_ROLE_ALREADY_EXISTS = 1

    ERR_MAX_ROLES_REACHED = 2

    ERR_INVALID_VALUE = 3

    ERR_ROLE_DOESNT_EXIST = 1

    ERR_ROLE_NOT_DELETABLE = 2

    # structure
    class ArgumentDesc(Structure):
        idlType = "usermgmt.RoleManager.ArgumentDesc:1.0.0"
        elements = ["name", "desc"]

        def __init__(self, name, desc):
            typecheck.is_string(name, AssertionError)
            typecheck.is_string(desc, AssertionError)

            self.name = name
            self.desc = desc

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                desc=json["desc"],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["desc"] = self.desc
            return json

    # structure
    class PrivilegeDesc(Structure):
        idlType = "usermgmt.RoleManager.PrivilegeDesc:1.0.0"
        elements = ["name", "desc", "args"]

        def __init__(self, name, desc, args):
            typecheck.is_string(name, AssertionError)
            typecheck.is_string(desc, AssertionError)
            for x0 in args:
                typecheck.is_struct(
                    x0, raritan.rpc.usermgmt.RoleManager.ArgumentDesc, AssertionError
                )

            self.name = name
            self.desc = desc
            self.args = args

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                desc=json["desc"],
                args=[
                    raritan.rpc.usermgmt.RoleManager.ArgumentDesc.decode(x0, agent)
                    for x0 in json["args"]
                ],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["desc"] = self.desc
            json["args"] = [
                raritan.rpc.usermgmt.RoleManager.ArgumentDesc.encode(x0)
                for x0 in self.args
            ]
            return json

    # structure
    class RoleAccount(Structure):
        idlType = "usermgmt.RoleManager.RoleAccount:1.0.0"
        elements = ["id", "name", "info"]

        def __init__(self, id, name, info):
            typecheck.is_int(id, AssertionError)
            typecheck.is_string(name, AssertionError)
            typecheck.is_struct(info, raritan.rpc.usermgmt.Role.Info, AssertionError)

            self.id = id
            self.name = name
            self.info = info

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                id=json["id"],
                name=json["name"],
                info=raritan.rpc.usermgmt.Role.Info.decode(json["info"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["id"] = self.id
            json["name"] = self.name
            json["info"] = raritan.rpc.usermgmt.Role.Info.encode(self.info)
            return json

    # structure
    class Info(Structure):
        idlType = "usermgmt.RoleManager.Info:1.0.0"
        elements = ["privileges", "roles"]

        def __init__(self, privileges, roles):
            for x0 in privileges:
                typecheck.is_struct(
                    x0, raritan.rpc.usermgmt.RoleManager.PrivilegeDesc, AssertionError
                )
            for x0 in roles:
                typecheck.is_struct(
                    x0, raritan.rpc.usermgmt.RoleManager.RoleAccount, AssertionError
                )

            self.privileges = privileges
            self.roles = roles

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                privileges=[
                    raritan.rpc.usermgmt.RoleManager.PrivilegeDesc.decode(x0, agent)
                    for x0 in json["privileges"]
                ],
                roles=[
                    raritan.rpc.usermgmt.RoleManager.RoleAccount.decode(x0, agent)
                    for x0 in json["roles"]
                ],
            )
            return obj

        def encode(self):
            json = {}
            json["privileges"] = [
                raritan.rpc.usermgmt.RoleManager.PrivilegeDesc.encode(x0)
                for x0 in self.privileges
            ]
            json["roles"] = [
                raritan.rpc.usermgmt.RoleManager.RoleAccount.encode(x0)
                for x0 in self.roles
            ]
            return json

    def createRoleFull(self, name, info):
        agent = self.agent
        typecheck.is_string(name, AssertionError)
        typecheck.is_struct(info, raritan.rpc.usermgmt.Role.Info, AssertionError)
        args = {}
        args["name"] = name
        args["info"] = raritan.rpc.usermgmt.Role.Info.encode(info)
        rsp = agent.json_rpc(self.target, "createRoleFull", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def deleteRole(self, name):
        agent = self.agent
        typecheck.is_string(name, AssertionError)
        args = {}
        args["name"] = name
        rsp = agent.json_rpc(self.target, "deleteRole", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getAllRoleNames(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAllRoleNames", args)
        _ret_ = [x0 for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_string(x0, DecodeException)
        return _ret_

    def getAllRoles(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAllRoles", args)
        _ret_ = [
            raritan.rpc.usermgmt.RoleManager.RoleAccount.decode(x0, agent)
            for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(
                x0, raritan.rpc.usermgmt.RoleManager.RoleAccount, DecodeException
            )
        return _ret_

    def getAllPrivileges(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAllPrivileges", args)
        _ret_ = [
            raritan.rpc.usermgmt.RoleManager.PrivilegeDesc.decode(x0, agent)
            for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(
                x0, raritan.rpc.usermgmt.RoleManager.PrivilegeDesc, DecodeException
            )
        return _ret_

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.usermgmt.RoleManager.Info.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.usermgmt.RoleManager.Info, DecodeException
        )
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/User.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.um

import raritan.rpc.usermgmt


# structure
class SnmpV3Settings(Structure):
    idlType = "usermgmt.SnmpV3Settings:1.0.0"
    elements = [
        "enabled",
        "secLevel",
        "authProtocol",
        "usePasswordAsAuthPassphrase",
        "haveAuthPassphrase",
        "authPassphrase",
        "privProtocol",
        "useAuthPassphraseAsPrivPassphrase",
        "havePrivPassphrase",
        "privPassphrase",
    ]

    def __init__(
        self,
        enabled,
        secLevel,
        authProtocol,
        usePasswordAsAuthPassphrase,
        haveAuthPassphrase,
        authPassphrase,
        privProtocol,
        useAuthPassphraseAsPrivPassphrase,
        havePrivPassphrase,
        privPassphrase,
    ):
        typecheck.is_bool(enabled, AssertionError)
        typecheck.is_enum(secLevel, raritan.rpc.um.SnmpV3.SecurityLevel, AssertionError)
        typecheck.is_enum(
            authProtocol, raritan.rpc.um.SnmpV3.AuthProtocol, AssertionError
        )
        typecheck.is_bool(usePasswordAsAuthPassphrase, AssertionError)
        typecheck.is_bool(haveAuthPassphrase, AssertionError)
        typecheck.is_string(authPassphrase, AssertionError)
        typecheck.is_enum(
            privProtocol, raritan.rpc.um.SnmpV3.PrivProtocol, AssertionError
        )
        typecheck.is_bool(useAuthPassphraseAsPrivPassphrase, AssertionError)
        typecheck.is_bool(havePrivPassphrase, AssertionError)
        typecheck.is_string(privPassphrase, AssertionError)

        self.enabled = enabled
        self.secLevel = secLevel
        self.authProtocol = authProtocol
        self.usePasswordAsAuthPassphrase = usePasswordAsAuthPassphrase
        self.haveAuthPassphrase = haveAuthPassphrase
        self.authPassphrase = authPassphrase
        self.privProtocol = privProtocol
        self.useAuthPassphraseAsPrivPassphrase = useAuthPassphraseAsPrivPassphrase
        self.havePrivPassphrase = havePrivPassphrase
        self.privPassphrase = privPassphrase

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            enabled=json["enabled"],
            secLevel=raritan.rpc.um.SnmpV3.SecurityLevel.decode(json["secLevel"]),
            authProtocol=raritan.rpc.um.SnmpV3.AuthProtocol.decode(
                json["authProtocol"]
            ),
            usePasswordAsAuthPassphrase=json["usePasswordAsAuthPassphrase"],
            haveAuthPassphrase=json["haveAuthPassphrase"],
            authPassphrase=json["authPassphrase"],
            privProtocol=raritan.rpc.um.SnmpV3.PrivProtocol.decode(
                json["privProtocol"]
            ),
            useAuthPassphraseAsPrivPassphrase=json["useAuthPassphraseAsPrivPassphrase"],
            havePrivPassphrase=json["havePrivPassphrase"],
            privPassphrase=json["privPassphrase"],
        )
        return obj

    def encode(self):
        json = {}
        json["enabled"] = self.enabled
        json["secLevel"] = raritan.rpc.um.SnmpV3.SecurityLevel.encode(self.secLevel)
        json["authProtocol"] = raritan.rpc.um.SnmpV3.AuthProtocol.encode(
            self.authProtocol
        )
        json["usePasswordAsAuthPassphrase"] = self.usePasswordAsAuthPassphrase
        json["haveAuthPassphrase"] = self.haveAuthPassphrase
        json["authPassphrase"] = self.authPassphrase
        json["privProtocol"] = raritan.rpc.um.SnmpV3.PrivProtocol.encode(
            self.privProtocol
        )
        json[
            "useAuthPassphraseAsPrivPassphrase"
        ] = self.useAuthPassphraseAsPrivPassphrase
        json["havePrivPassphrase"] = self.havePrivPassphrase
        json["privPassphrase"] = self.privPassphrase
        return json


# structure
class AuxInfo(Structure):
    idlType = "usermgmt.AuxInfo:1.0.0"
    elements = ["fullname", "telephone", "eMail"]

    def __init__(self, fullname, telephone, eMail):
        typecheck.is_string(fullname, AssertionError)
        typecheck.is_string(telephone, AssertionError)
        typecheck.is_string(eMail, AssertionError)

        self.fullname = fullname
        self.telephone = telephone
        self.eMail = eMail

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            fullname=json["fullname"],
            telephone=json["telephone"],
            eMail=json["eMail"],
        )
        return obj

    def encode(self):
        json = {}
        json["fullname"] = self.fullname
        json["telephone"] = self.telephone
        json["eMail"] = self.eMail
        return json


# enumeration
class TemperatureEnum(Enumeration):
    idlType = "usermgmt.TemperatureEnum:1.0.0"
    values = ["DEG_C", "DEG_F"]


TemperatureEnum.DEG_C = TemperatureEnum(0)
TemperatureEnum.DEG_F = TemperatureEnum(1)

# enumeration
class LengthEnum(Enumeration):
    idlType = "usermgmt.LengthEnum:1.0.0"
    values = ["METER", "FEET"]


LengthEnum.METER = LengthEnum(0)
LengthEnum.FEET = LengthEnum(1)

# enumeration
class PressureEnum(Enumeration):
    idlType = "usermgmt.PressureEnum:1.0.0"
    values = ["PASCAL", "PSI"]


PressureEnum.PASCAL = PressureEnum(0)
PressureEnum.PSI = PressureEnum(1)

# structure
class Preferences(Structure):
    idlType = "usermgmt.Preferences:1.0.0"
    elements = ["temperatureUnit", "lengthUnit", "pressureUnit"]

    def __init__(self, temperatureUnit, lengthUnit, pressureUnit):
        typecheck.is_enum(
            temperatureUnit, raritan.rpc.usermgmt.TemperatureEnum, AssertionError
        )
        typecheck.is_enum(lengthUnit, raritan.rpc.usermgmt.LengthEnum, AssertionError)
        typecheck.is_enum(
            pressureUnit, raritan.rpc.usermgmt.PressureEnum, AssertionError
        )

        self.temperatureUnit = temperatureUnit
        self.lengthUnit = lengthUnit
        self.pressureUnit = pressureUnit

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            temperatureUnit=raritan.rpc.usermgmt.TemperatureEnum.decode(
                json["temperatureUnit"]
            ),
            lengthUnit=raritan.rpc.usermgmt.LengthEnum.decode(json["lengthUnit"]),
            pressureUnit=raritan.rpc.usermgmt.PressureEnum.decode(json["pressureUnit"]),
        )
        return obj

    def encode(self):
        json = {}
        json["temperatureUnit"] = raritan.rpc.usermgmt.TemperatureEnum.encode(
            self.temperatureUnit
        )
        json["lengthUnit"] = raritan.rpc.usermgmt.LengthEnum.encode(self.lengthUnit)
        json["pressureUnit"] = raritan.rpc.usermgmt.PressureEnum.encode(
            self.pressureUnit
        )
        return json


# structure
class UserInfo(Structure):
    idlType = "usermgmt.UserInfo:1.0.0"
    elements = [
        "enabled",
        "locked",
        "blocked",
        "needPasswordChange",
        "auxInfo",
        "snmpV3Settings",
        "sshPublicKey",
        "preferences",
        "roleIds",
    ]

    def __init__(
        self,
        enabled,
        locked,
        blocked,
        needPasswordChange,
        auxInfo,
        snmpV3Settings,
        sshPublicKey,
        preferences,
        roleIds,
    ):
        typecheck.is_bool(enabled, AssertionError)
        typecheck.is_bool(locked, AssertionError)
        typecheck.is_bool(blocked, AssertionError)
        typecheck.is_bool(needPasswordChange, AssertionError)
        typecheck.is_struct(auxInfo, raritan.rpc.usermgmt.AuxInfo, AssertionError)
        typecheck.is_struct(
            snmpV3Settings, raritan.rpc.usermgmt.SnmpV3Settings, AssertionError
        )
        typecheck.is_string(sshPublicKey, AssertionError)
        typecheck.is_struct(
            preferences, raritan.rpc.usermgmt.Preferences, AssertionError
        )
        for x0 in roleIds:
            typecheck.is_int(x0, AssertionError)

        self.enabled = enabled
        self.locked = locked
        self.blocked = blocked
        self.needPasswordChange = needPasswordChange
        self.auxInfo = auxInfo
        self.snmpV3Settings = snmpV3Settings
        self.sshPublicKey = sshPublicKey
        self.preferences = preferences
        self.roleIds = roleIds

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            enabled=json["enabled"],
            locked=json["locked"],
            blocked=json["blocked"],
            needPasswordChange=json["needPasswordChange"],
            auxInfo=raritan.rpc.usermgmt.AuxInfo.decode(json["auxInfo"], agent),
            snmpV3Settings=raritan.rpc.usermgmt.SnmpV3Settings.decode(
                json["snmpV3Settings"], agent
            ),
            sshPublicKey=json["sshPublicKey"],
            preferences=raritan.rpc.usermgmt.Preferences.decode(
                json["preferences"], agent
            ),
            roleIds=[x0 for x0 in json["roleIds"]],
        )
        return obj

    def encode(self):
        json = {}
        json["enabled"] = self.enabled
        json["locked"] = self.locked
        json["blocked"] = self.blocked
        json["needPasswordChange"] = self.needPasswordChange
        json["auxInfo"] = raritan.rpc.usermgmt.AuxInfo.encode(self.auxInfo)
        json["snmpV3Settings"] = raritan.rpc.usermgmt.SnmpV3Settings.encode(
            self.snmpV3Settings
        )
        json["sshPublicKey"] = self.sshPublicKey
        json["preferences"] = raritan.rpc.usermgmt.Preferences.encode(self.preferences)
        json["roleIds"] = [x0 for x0 in self.roleIds]
        return json


# structure
class UserCapabilities(Structure):
    idlType = "usermgmt.UserCapabilities:1.0.0"
    elements = ["canSetPassword", "canSetPreferences"]

    def __init__(self, canSetPassword, canSetPreferences):
        typecheck.is_bool(canSetPassword, AssertionError)
        typecheck.is_bool(canSetPreferences, AssertionError)

        self.canSetPassword = canSetPassword
        self.canSetPreferences = canSetPreferences

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            canSetPassword=json["canSetPassword"],
            canSetPreferences=json["canSetPreferences"],
        )
        return obj

    def encode(self):
        json = {}
        json["canSetPassword"] = self.canSetPassword
        json["canSetPreferences"] = self.canSetPreferences
        return json


# interface
class User(Interface):
    idlType = "usermgmt.User:1.0.1"

    ERR_PASSWORD_UNCHANGED = 1

    ERR_PASSWORD_EMPTY = 2

    ERR_PASSWORD_TOO_SHORT = 3

    ERR_PASSWORD_TOO_LONG = 4

    ERR_PASSWORD_CTRL_CHARS = 5

    ERR_PASSWORD_NEED_LOWER = 6

    ERR_PASSWORD_NEED_UPPER = 7

    ERR_PASSWORD_NEED_NUMERIC = 8

    ERR_PASSWORD_NEED_SPECIAL = 9

    ERR_PASSWORD_IN_HISTORY = 10

    ERR_PASSWORD_TOO_SHORT_FOR_SNMP = 11

    ERR_INVALID_ARGUMENT = 12

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.usermgmt.UserInfo.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.usermgmt.UserInfo, DecodeException)
        return _ret_

    def setAccountPassword(self, password):
        agent = self.agent
        typecheck.is_string(password, AssertionError)
        args = {}
        args["password"] = password
        rsp = agent.json_rpc(self.target, "setAccountPassword", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def updateAccountFull(self, password, info):
        agent = self.agent
        typecheck.is_string(password, AssertionError)
        typecheck.is_struct(info, raritan.rpc.usermgmt.UserInfo, AssertionError)
        args = {}
        args["password"] = password
        args["info"] = raritan.rpc.usermgmt.UserInfo.encode(info)
        rsp = agent.json_rpc(self.target, "updateAccountFull", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getInfoAndPrivileges(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfoAndPrivileges", args)
        info = raritan.rpc.usermgmt.UserInfo.decode(rsp["info"], agent)
        privileges = [
            raritan.rpc.usermgmt.Role.Privilege.decode(x0, agent)
            for x0 in rsp["privileges"]
        ]
        typecheck.is_struct(info, raritan.rpc.usermgmt.UserInfo, DecodeException)
        for x0 in privileges:
            typecheck.is_struct(
                x0, raritan.rpc.usermgmt.Role.Privilege, DecodeException
            )
        return (info, privileges)

    def setPreferences(self, prefs):
        agent = self.agent
        typecheck.is_struct(prefs, raritan.rpc.usermgmt.Preferences, AssertionError)
        args = {}
        args["prefs"] = raritan.rpc.usermgmt.Preferences.encode(prefs)
        rsp = agent.json_rpc(self.target, "setPreferences", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getCapabilities(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getCapabilities", args)
        _ret_ = raritan.rpc.usermgmt.UserCapabilities.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.usermgmt.UserCapabilities, DecodeException
        )
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/UserManager.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.event

import raritan.rpc.usermgmt


# structure
class Account(Structure):
    idlType = "usermgmt.Account:1.0.0"
    elements = ["name", "info"]

    def __init__(self, name, info):
        typecheck.is_string(name, AssertionError)
        typecheck.is_struct(info, raritan.rpc.usermgmt.UserInfo, AssertionError)

        self.name = name
        self.info = info

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            name=json["name"],
            info=raritan.rpc.usermgmt.UserInfo.decode(json["info"], agent),
        )
        return obj

    def encode(self):
        json = {}
        json["name"] = self.name
        json["info"] = raritan.rpc.usermgmt.UserInfo.encode(self.info)
        return json


# value object
class AccountEvent(raritan.rpc.event.UserEvent):
    idlType = "usermgmt.AccountEvent:1.0.0"

    def __init__(self, username, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.AccountEvent, self).__init__(
            actUserName, actIpAddr, source
        )
        typecheck.is_string(username, AssertionError)

        self.username = username

    def encode(self):
        json = super(raritan.rpc.usermgmt.AccountEvent, self).encode()
        json["username"] = self.username
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["username"]
        elements = (
            elements + super(raritan.rpc.usermgmt.AccountEvent, self).listElements()
        )
        return elements


# value object
class AccountAdded(AccountEvent):
    idlType = "usermgmt.AccountAdded:1.0.0"

    def __init__(self, username, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.AccountAdded, self).__init__(
            username, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.AccountAdded, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.AccountEvent
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.usermgmt.AccountAdded, self).listElements()
        )
        return elements


# value object
class AccountRemoved(AccountEvent):
    idlType = "usermgmt.AccountRemoved:1.0.0"

    def __init__(self, username, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.AccountRemoved, self).__init__(
            username, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.AccountRemoved, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.AccountEvent
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.usermgmt.AccountRemoved, self).listElements()
        )
        return elements


# value object
class PasswordChanged(AccountEvent):
    idlType = "usermgmt.PasswordChanged:1.0.0"

    def __init__(self, username, actUserName, actIpAddr, source):
        super(raritan.rpc.usermgmt.PasswordChanged, self).__init__(
            username, actUserName, actIpAddr, source
        )

    def encode(self):
        json = super(raritan.rpc.usermgmt.PasswordChanged, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for usermgmt.AccountEvent
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.usermgmt.PasswordChanged, self).listElements()
        )
        return elements


# value object
class AccountChanged(AccountEvent):
    idlType = "usermgmt.AccountChanged:1.0.0"

    def __init__(
        self, oldSettings, newSettings, username, actUserName, actIpAddr, source
    ):
        super(raritan.rpc.usermgmt.AccountChanged, self).__init__(
            username, actUserName, actIpAddr, source
        )
        typecheck.is_struct(oldSettings, raritan.rpc.usermgmt.UserInfo, AssertionError)
        typecheck.is_struct(newSettings, raritan.rpc.usermgmt.UserInfo, AssertionError)

        self.oldSettings = oldSettings
        self.newSettings = newSettings

    def encode(self):
        json = super(raritan.rpc.usermgmt.AccountChanged, self).encode()
        json["oldSettings"] = raritan.rpc.usermgmt.UserInfo.encode(self.oldSettings)
        json["newSettings"] = raritan.rpc.usermgmt.UserInfo.encode(self.newSettings)
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            oldSettings=raritan.rpc.usermgmt.UserInfo.decode(
                json["oldSettings"], agent
            ),
            newSettings=raritan.rpc.usermgmt.UserInfo.decode(
                json["newSettings"], agent
            ),
            # for usermgmt.AccountEvent
            username=json["username"],
            # for event.UserEvent
            actUserName=json["actUserName"],
            actIpAddr=json["actIpAddr"],
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["oldSettings", "newSettings"]
        elements = (
            elements + super(raritan.rpc.usermgmt.AccountChanged, self).listElements()
        )
        return elements


# interface
class UserManager(Interface):
    idlType = "usermgmt.UserManager:1.0.2"

    ERR_USER_DOESNT_EXIST = 1

    ERR_USER_NOT_DELETABLE = 2

    ERR_USER_ALREADY_EXISTS = 1

    ERR_MAX_USERS_REACHED = 2

    ERR_PASSWORD_TOO_SHORT_FOR_SNMP = 3

    ERR_INVALID_VALUE = 4

    ERR_PASSWORD_EMPTY = 5

    ERR_PASSWORD_TOO_SHORT = 6

    ERR_PASSWORD_TOO_LONG = 7

    ERR_PASSWORD_CTRL_CHARS = 8

    ERR_PASSWORD_NEED_LOWER = 9

    ERR_PASSWORD_NEED_UPPER = 10

    ERR_PASSWORD_NEED_NUMERIC = 11

    ERR_PASSWORD_NEED_SPECIAL = 12

    def getAccountNames(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAccountNames", args)
        _ret_ = [x0 for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_string(x0, DecodeException)
        return _ret_

    def createAccount(self, username, password):
        agent = self.agent
        typecheck.is_string(username, AssertionError)
        typecheck.is_string(password, AssertionError)
        args = {}
        args["username"] = username
        args["password"] = password
        rsp = agent.json_rpc(self.target, "createAccount", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def deleteAccount(self, username):
        agent = self.agent
        typecheck.is_string(username, AssertionError)
        args = {}
        args["username"] = username
        rsp = agent.json_rpc(self.target, "deleteAccount", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getAllAccounts(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getAllAccounts", args)
        _ret_ = [raritan.rpc.usermgmt.Account.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_struct(x0, raritan.rpc.usermgmt.Account, DecodeException)
        return _ret_

    def createAccountFull(self, username, password, info):
        agent = self.agent
        typecheck.is_string(username, AssertionError)
        typecheck.is_string(password, AssertionError)
        typecheck.is_struct(info, raritan.rpc.usermgmt.UserInfo, AssertionError)
        args = {}
        args["username"] = username
        args["password"] = password
        args["info"] = raritan.rpc.usermgmt.UserInfo.encode(info)
        rsp = agent.json_rpc(self.target, "createAccountFull", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getAccountsByRole(self, roleName):
        agent = self.agent
        typecheck.is_string(roleName, AssertionError)
        args = {}
        args["roleName"] = roleName
        rsp = agent.json_rpc(self.target, "getAccountsByRole", args)
        _ret_ = [raritan.rpc.usermgmt.Account.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_struct(x0, raritan.rpc.usermgmt.Account, DecodeException)
        return _ret_

    def getDefaultPreferences(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getDefaultPreferences", args)
        _ret_ = raritan.rpc.usermgmt.Preferences.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.usermgmt.Preferences, DecodeException)
        return _ret_

    def setDefaultPreferences(self, prefs):
        agent = self.agent
        typecheck.is_struct(prefs, raritan.rpc.usermgmt.Preferences, AssertionError)
        args = {}
        args["prefs"] = raritan.rpc.usermgmt.Preferences.encode(prefs)
        rsp = agent.json_rpc(self.target, "setDefaultPreferences", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

# Do NOT edit this file! # It was generated by IdlC class idl.json.python.ProxyAsnVisitor. # # Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/Role.idl" # # interface # structure # structure # Do NOT edit this file! # It was generated by IdlC class idl.json.python.ProxyAsnVisitor. # # Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/RoleManager.idl" # # value object # for event.UserEvent # for idl.Event # value object # for usermgmt.RoleEvent # for event.UserEvent # for idl.Event # value object # for usermgmt.RoleEvent # for event.UserEvent # for idl.Event # value object # for usermgmt.RoleEvent # for event.UserEvent # for idl.Event # interface # structure # structure # structure # structure # Do NOT edit this file! # It was generated by IdlC class idl.json.python.ProxyAsnVisitor. # # Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/User.idl" # # structure # structure # enumeration # enumeration # enumeration # structure # structure # structure # interface # Do NOT edit this file! # It was generated by IdlC class idl.json.python.ProxyAsnVisitor. # # Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/UserManager.idl" # # structure # value object # for event.UserEvent # for idl.Event # value object # for usermgmt.AccountEvent # for event.UserEvent # for idl.Event # value object # for usermgmt.AccountEvent # for event.UserEvent # for idl.Event # value object # for usermgmt.AccountEvent # for event.UserEvent # for idl.Event # value object # for usermgmt.AccountEvent # for event.UserEvent # for idl.Event # interface