# -*- coding: utf-8 -*-
#
# Autogenerated by Thrift Compiler (0.10.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py:coding=utf-8
#

from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys
import logging
from .ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport


class Iface(object):
    """
    AdminAuth 서비스
    """
    def hasHashAuth(self, hash, checkUrl, adminId):
        """
        Parameters:
         - hash
         - checkUrl
         - adminId
        """
        pass

    def getCurrentHashArray(self, checkUrl, adminId):
        """
        Parameters:
         - checkUrl
         - adminId
        """
        pass

    def getAdminMenu(self, adminId):
        """
        Parameters:
         - adminId
        """
        pass

    def authorize(self, token, methods, check_url):
        """
        Parameters:
         - token
         - methods
         - check_url
        """
        pass

    def authorizeByTag(self, token, tags):
        """
        Parameters:
         - token
         - tags
        """
        pass

    def authorizeAdminByTag(self, admin_id, tags):
        """
        Parameters:
         - admin_id
         - tags
        """
        pass

    def authorizeAdminByUrl(self, admin_id, check_url):
        """
        Parameters:
         - admin_id
         - check_url
        """
        pass

    def introspectToken(self, token):
        """
        Parameters:
         - token
        """
        pass


class Client(Iface):
    """
    AdminAuth 서비스
    """
    def __init__(self, iprot, oprot=None):
        self._iprot = self._oprot = iprot
        if oprot is not None:
            self._oprot = oprot
        self._seqid = 0

    def hasHashAuth(self, hash, checkUrl, adminId):
        """
        Parameters:
         - hash
         - checkUrl
         - adminId
        """
        self.send_hasHashAuth(hash, checkUrl, adminId)
        return self.recv_hasHashAuth()

    def send_hasHashAuth(self, hash, checkUrl, adminId):
        self._oprot.writeMessageBegin('hasHashAuth', TMessageType.CALL, self._seqid)
        args = hasHashAuth_args()
        args.hash = hash
        args.checkUrl = checkUrl
        args.adminId = adminId
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_hasHashAuth(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = hasHashAuth_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.systemException is not None:
            raise result.systemException
        if result.unauthorizedException is not None:
            raise result.unauthorizedException
        raise TApplicationException(TApplicationException.MISSING_RESULT, "hasHashAuth failed: unknown result")

    def getCurrentHashArray(self, checkUrl, adminId):
        """
        Parameters:
         - checkUrl
         - adminId
        """
        self.send_getCurrentHashArray(checkUrl, adminId)
        return self.recv_getCurrentHashArray()

    def send_getCurrentHashArray(self, checkUrl, adminId):
        self._oprot.writeMessageBegin('getCurrentHashArray', TMessageType.CALL, self._seqid)
        args = getCurrentHashArray_args()
        args.checkUrl = checkUrl
        args.adminId = adminId
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_getCurrentHashArray(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = getCurrentHashArray_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.systemException is not None:
            raise result.systemException
        raise TApplicationException(TApplicationException.MISSING_RESULT, "getCurrentHashArray failed: unknown result")

    def getAdminMenu(self, adminId):
        """
        Parameters:
         - adminId
        """
        self.send_getAdminMenu(adminId)
        return self.recv_getAdminMenu()

    def send_getAdminMenu(self, adminId):
        self._oprot.writeMessageBegin('getAdminMenu', TMessageType.CALL, self._seqid)
        args = getAdminMenu_args()
        args.adminId = adminId
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_getAdminMenu(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = getAdminMenu_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.systemException is not None:
            raise result.systemException
        raise TApplicationException(TApplicationException.MISSING_RESULT, "getAdminMenu failed: unknown result")

    def authorize(self, token, methods, check_url):
        """
        Parameters:
         - token
         - methods
         - check_url
        """
        self.send_authorize(token, methods, check_url)
        self.recv_authorize()

    def send_authorize(self, token, methods, check_url):
        self._oprot.writeMessageBegin('authorize', TMessageType.CALL, self._seqid)
        args = authorize_args()
        args.token = token
        args.methods = methods
        args.check_url = check_url
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_authorize(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = authorize_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.systemException is not None:
            raise result.systemException
        if result.noTokenException is not None:
            raise result.noTokenException
        if result.malformedTokenException is not None:
            raise result.malformedTokenException
        if result.expiredTokenException is not None:
            raise result.expiredTokenException
        if result.unauthorizedException is not None:
            raise result.unauthorizedException
        return

    def authorizeByTag(self, token, tags):
        """
        Parameters:
         - token
         - tags
        """
        self.send_authorizeByTag(token, tags)
        self.recv_authorizeByTag()

    def send_authorizeByTag(self, token, tags):
        self._oprot.writeMessageBegin('authorizeByTag', TMessageType.CALL, self._seqid)
        args = authorizeByTag_args()
        args.token = token
        args.tags = tags
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_authorizeByTag(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = authorizeByTag_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.systemException is not None:
            raise result.systemException
        if result.noTokenException is not None:
            raise result.noTokenException
        if result.malformedTokenException is not None:
            raise result.malformedTokenException
        if result.expiredTokenException is not None:
            raise result.expiredTokenException
        if result.unauthorizedException is not None:
            raise result.unauthorizedException
        return

    def authorizeAdminByTag(self, admin_id, tags):
        """
        Parameters:
         - admin_id
         - tags
        """
        self.send_authorizeAdminByTag(admin_id, tags)
        self.recv_authorizeAdminByTag()

    def send_authorizeAdminByTag(self, admin_id, tags):
        self._oprot.writeMessageBegin('authorizeAdminByTag', TMessageType.CALL, self._seqid)
        args = authorizeAdminByTag_args()
        args.admin_id = admin_id
        args.tags = tags
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_authorizeAdminByTag(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = authorizeAdminByTag_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.systemException is not None:
            raise result.systemException
        if result.unauthorizedException is not None:
            raise result.unauthorizedException
        return

    def authorizeAdminByUrl(self, admin_id, check_url):
        """
        Parameters:
         - admin_id
         - check_url
        """
        self.send_authorizeAdminByUrl(admin_id, check_url)
        self.recv_authorizeAdminByUrl()

    def send_authorizeAdminByUrl(self, admin_id, check_url):
        self._oprot.writeMessageBegin('authorizeAdminByUrl', TMessageType.CALL, self._seqid)
        args = authorizeAdminByUrl_args()
        args.admin_id = admin_id
        args.check_url = check_url
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_authorizeAdminByUrl(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = authorizeAdminByUrl_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.systemException is not None:
            raise result.systemException
        if result.unauthorizedException is not None:
            raise result.unauthorizedException
        return

    def introspectToken(self, token):
        """
        Parameters:
         - token
        """
        self.send_introspectToken(token)
        return self.recv_introspectToken()

    def send_introspectToken(self, token):
        self._oprot.writeMessageBegin('introspectToken', TMessageType.CALL, self._seqid)
        args = introspectToken_args()
        args.token = token
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_introspectToken(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = introspectToken_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.systemException is not None:
            raise result.systemException
        if result.noTokenException is not None:
            raise result.noTokenException
        if result.malformedTokenException is not None:
            raise result.malformedTokenException
        if result.expiredTokenException is not None:
            raise result.expiredTokenException
        raise TApplicationException(TApplicationException.MISSING_RESULT, "introspectToken failed: unknown result")


class Processor(Iface, TProcessor):
    def __init__(self, handler):
        self._handler = handler
        self._processMap = {}
        self._processMap["hasHashAuth"] = Processor.process_hasHashAuth
        self._processMap["getCurrentHashArray"] = Processor.process_getCurrentHashArray
        self._processMap["getAdminMenu"] = Processor.process_getAdminMenu
        self._processMap["authorize"] = Processor.process_authorize
        self._processMap["authorizeByTag"] = Processor.process_authorizeByTag
        self._processMap["authorizeAdminByTag"] = Processor.process_authorizeAdminByTag
        self._processMap["authorizeAdminByUrl"] = Processor.process_authorizeAdminByUrl
        self._processMap["introspectToken"] = Processor.process_introspectToken

    def process(self, iprot, oprot):
        (name, type, seqid) = iprot.readMessageBegin()
        if name not in self._processMap:
            iprot.skip(TType.STRUCT)
            iprot.readMessageEnd()
            x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
            oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
            x.write(oprot)
            oprot.writeMessageEnd()
            oprot.trans.flush()
            return
        else:
            self._processMap[name](self, seqid, iprot, oprot)
        return True

    def process_hasHashAuth(self, seqid, iprot, oprot):
        args = hasHashAuth_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = hasHashAuth_result()
        try:
            result.success = self._handler.hasHashAuth(args.hash, args.checkUrl, args.adminId)
            msg_type = TMessageType.REPLY
        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
            raise
        except ridi.cms.thrift.Errors.ttypes.SystemException as systemException:
            msg_type = TMessageType.REPLY
            result.systemException = systemException
        except ridi.cms.thrift.Errors.ttypes.UnauthorizedException as unauthorizedException:
            msg_type = TMessageType.REPLY
            result.unauthorizedException = unauthorizedException
        except Exception as ex:
            msg_type = TMessageType.EXCEPTION
            logging.exception(ex)
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("hasHashAuth", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_getCurrentHashArray(self, seqid, iprot, oprot):
        args = getCurrentHashArray_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = getCurrentHashArray_result()
        try:
            result.success = self._handler.getCurrentHashArray(args.checkUrl, args.adminId)
            msg_type = TMessageType.REPLY
        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
            raise
        except ridi.cms.thrift.Errors.ttypes.SystemException as systemException:
            msg_type = TMessageType.REPLY
            result.systemException = systemException
        except Exception as ex:
            msg_type = TMessageType.EXCEPTION
            logging.exception(ex)
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("getCurrentHashArray", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_getAdminMenu(self, seqid, iprot, oprot):
        args = getAdminMenu_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = getAdminMenu_result()
        try:
            result.success = self._handler.getAdminMenu(args.adminId)
            msg_type = TMessageType.REPLY
        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
            raise
        except ridi.cms.thrift.Errors.ttypes.SystemException as systemException:
            msg_type = TMessageType.REPLY
            result.systemException = systemException
        except Exception as ex:
            msg_type = TMessageType.EXCEPTION
            logging.exception(ex)
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("getAdminMenu", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_authorize(self, seqid, iprot, oprot):
        args = authorize_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = authorize_result()
        try:
            self._handler.authorize(args.token, args.methods, args.check_url)
            msg_type = TMessageType.REPLY
        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
            raise
        except ridi.cms.thrift.Errors.ttypes.SystemException as systemException:
            msg_type = TMessageType.REPLY
            result.systemException = systemException
        except ridi.cms.thrift.Errors.ttypes.NoTokenException as noTokenException:
            msg_type = TMessageType.REPLY
            result.noTokenException = noTokenException
        except ridi.cms.thrift.Errors.ttypes.MalformedTokenException as malformedTokenException:
            msg_type = TMessageType.REPLY
            result.malformedTokenException = malformedTokenException
        except ridi.cms.thrift.Errors.ttypes.ExpiredTokenException as expiredTokenException:
            msg_type = TMessageType.REPLY
            result.expiredTokenException = expiredTokenException
        except ridi.cms.thrift.Errors.ttypes.UnauthorizedException as unauthorizedException:
            msg_type = TMessageType.REPLY
            result.unauthorizedException = unauthorizedException
        except Exception as ex:
            msg_type = TMessageType.EXCEPTION
            logging.exception(ex)
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("authorize", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_authorizeByTag(self, seqid, iprot, oprot):
        args = authorizeByTag_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = authorizeByTag_result()
        try:
            self._handler.authorizeByTag(args.token, args.tags)
            msg_type = TMessageType.REPLY
        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
            raise
        except ridi.cms.thrift.Errors.ttypes.SystemException as systemException:
            msg_type = TMessageType.REPLY
            result.systemException = systemException
        except ridi.cms.thrift.Errors.ttypes.NoTokenException as noTokenException:
            msg_type = TMessageType.REPLY
            result.noTokenException = noTokenException
        except ridi.cms.thrift.Errors.ttypes.MalformedTokenException as malformedTokenException:
            msg_type = TMessageType.REPLY
            result.malformedTokenException = malformedTokenException
        except ridi.cms.thrift.Errors.ttypes.ExpiredTokenException as expiredTokenException:
            msg_type = TMessageType.REPLY
            result.expiredTokenException = expiredTokenException
        except ridi.cms.thrift.Errors.ttypes.UnauthorizedException as unauthorizedException:
            msg_type = TMessageType.REPLY
            result.unauthorizedException = unauthorizedException
        except Exception as ex:
            msg_type = TMessageType.EXCEPTION
            logging.exception(ex)
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("authorizeByTag", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_authorizeAdminByTag(self, seqid, iprot, oprot):
        args = authorizeAdminByTag_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = authorizeAdminByTag_result()
        try:
            self._handler.authorizeAdminByTag(args.admin_id, args.tags)
            msg_type = TMessageType.REPLY
        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
            raise
        except ridi.cms.thrift.Errors.ttypes.SystemException as systemException:
            msg_type = TMessageType.REPLY
            result.systemException = systemException
        except ridi.cms.thrift.Errors.ttypes.UnauthorizedException as unauthorizedException:
            msg_type = TMessageType.REPLY
            result.unauthorizedException = unauthorizedException
        except Exception as ex:
            msg_type = TMessageType.EXCEPTION
            logging.exception(ex)
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("authorizeAdminByTag", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_authorizeAdminByUrl(self, seqid, iprot, oprot):
        args = authorizeAdminByUrl_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = authorizeAdminByUrl_result()
        try:
            self._handler.authorizeAdminByUrl(args.admin_id, args.check_url)
            msg_type = TMessageType.REPLY
        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
            raise
        except ridi.cms.thrift.Errors.ttypes.SystemException as systemException:
            msg_type = TMessageType.REPLY
            result.systemException = systemException
        except ridi.cms.thrift.Errors.ttypes.UnauthorizedException as unauthorizedException:
            msg_type = TMessageType.REPLY
            result.unauthorizedException = unauthorizedException
        except Exception as ex:
            msg_type = TMessageType.EXCEPTION
            logging.exception(ex)
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("authorizeAdminByUrl", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_introspectToken(self, seqid, iprot, oprot):
        args = introspectToken_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = introspectToken_result()
        try:
            result.success = self._handler.introspectToken(args.token)
            msg_type = TMessageType.REPLY
        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
            raise
        except ridi.cms.thrift.Errors.ttypes.SystemException as systemException:
            msg_type = TMessageType.REPLY
            result.systemException = systemException
        except ridi.cms.thrift.Errors.ttypes.NoTokenException as noTokenException:
            msg_type = TMessageType.REPLY
            result.noTokenException = noTokenException
        except ridi.cms.thrift.Errors.ttypes.MalformedTokenException as malformedTokenException:
            msg_type = TMessageType.REPLY
            result.malformedTokenException = malformedTokenException
        except ridi.cms.thrift.Errors.ttypes.ExpiredTokenException as expiredTokenException:
            msg_type = TMessageType.REPLY
            result.expiredTokenException = expiredTokenException
        except Exception as ex:
            msg_type = TMessageType.EXCEPTION
            logging.exception(ex)
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("introspectToken", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

# HELPER FUNCTIONS AND STRUCTURES


class hasHashAuth_args(object):
    """
    Attributes:
     - hash
     - checkUrl
     - adminId
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'hash', 'UTF8', None, ),  # 1
        (2, TType.STRING, 'checkUrl', 'UTF8', None, ),  # 2
        (3, TType.STRING, 'adminId', 'UTF8', None, ),  # 3
    )

    def __init__(self, hash=None, checkUrl=None, adminId=None,):
        self.hash = hash
        self.checkUrl = checkUrl
        self.adminId = adminId

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.hash = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.checkUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.adminId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('hasHashAuth_args')
        if self.hash is not None:
            oprot.writeFieldBegin('hash', TType.STRING, 1)
            oprot.writeString(self.hash.encode('utf-8') if sys.version_info[0] == 2 else self.hash)
            oprot.writeFieldEnd()
        if self.checkUrl is not None:
            oprot.writeFieldBegin('checkUrl', TType.STRING, 2)
            oprot.writeString(self.checkUrl.encode('utf-8') if sys.version_info[0] == 2 else self.checkUrl)
            oprot.writeFieldEnd()
        if self.adminId is not None:
            oprot.writeFieldBegin('adminId', TType.STRING, 3)
            oprot.writeString(self.adminId.encode('utf-8') if sys.version_info[0] == 2 else self.adminId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class hasHashAuth_result(object):
    """
    Attributes:
     - success
     - systemException
     - unauthorizedException
    """

    thrift_spec = (
        (0, TType.BOOL, 'success', None, None, ),  # 0
        (1, TType.STRUCT, 'systemException', (ridi.cms.thrift.Errors.ttypes.SystemException, ridi.cms.thrift.Errors.ttypes.SystemException.thrift_spec), None, ),  # 1
        (2, TType.STRUCT, 'unauthorizedException', (ridi.cms.thrift.Errors.ttypes.UnauthorizedException, ridi.cms.thrift.Errors.ttypes.UnauthorizedException.thrift_spec), None, ),  # 2
    )

    def __init__(self, success=None, systemException=None, unauthorizedException=None,):
        self.success = success
        self.systemException = systemException
        self.unauthorizedException = unauthorizedException

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.BOOL:
                    self.success = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.systemException = ridi.cms.thrift.Errors.ttypes.SystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.unauthorizedException = ridi.cms.thrift.Errors.ttypes.UnauthorizedException()
                    self.unauthorizedException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('hasHashAuth_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.BOOL, 0)
            oprot.writeBool(self.success)
            oprot.writeFieldEnd()
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 1)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        if self.unauthorizedException is not None:
            oprot.writeFieldBegin('unauthorizedException', TType.STRUCT, 2)
            self.unauthorizedException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class getCurrentHashArray_args(object):
    """
    Attributes:
     - checkUrl
     - adminId
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'checkUrl', 'UTF8', None, ),  # 1
        (2, TType.STRING, 'adminId', 'UTF8', None, ),  # 2
    )

    def __init__(self, checkUrl=None, adminId=None,):
        self.checkUrl = checkUrl
        self.adminId = adminId

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.checkUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.adminId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('getCurrentHashArray_args')
        if self.checkUrl is not None:
            oprot.writeFieldBegin('checkUrl', TType.STRING, 1)
            oprot.writeString(self.checkUrl.encode('utf-8') if sys.version_info[0] == 2 else self.checkUrl)
            oprot.writeFieldEnd()
        if self.adminId is not None:
            oprot.writeFieldBegin('adminId', TType.STRING, 2)
            oprot.writeString(self.adminId.encode('utf-8') if sys.version_info[0] == 2 else self.adminId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class getCurrentHashArray_result(object):
    """
    Attributes:
     - success
     - systemException
    """

    thrift_spec = (
        (0, TType.LIST, 'success', (TType.STRING, 'UTF8', False), None, ),  # 0
        (1, TType.STRUCT, 'systemException', (ridi.cms.thrift.Errors.ttypes.SystemException, ridi.cms.thrift.Errors.ttypes.SystemException.thrift_spec), None, ),  # 1
    )

    def __init__(self, success=None, systemException=None,):
        self.success = success
        self.systemException = systemException

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.LIST:
                    self.success = []
                    (_etype3, _size0) = iprot.readListBegin()
                    for _i4 in range(_size0):
                        _elem5 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.success.append(_elem5)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.systemException = ridi.cms.thrift.Errors.ttypes.SystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('getCurrentHashArray_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.LIST, 0)
            oprot.writeListBegin(TType.STRING, len(self.success))
            for iter6 in self.success:
                oprot.writeString(iter6.encode('utf-8') if sys.version_info[0] == 2 else iter6)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 1)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class getAdminMenu_args(object):
    """
    Attributes:
     - adminId
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'adminId', 'UTF8', None, ),  # 1
    )

    def __init__(self, adminId=None,):
        self.adminId = adminId

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.adminId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('getAdminMenu_args')
        if self.adminId is not None:
            oprot.writeFieldBegin('adminId', TType.STRING, 1)
            oprot.writeString(self.adminId.encode('utf-8') if sys.version_info[0] == 2 else self.adminId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class getAdminMenu_result(object):
    """
    Attributes:
     - success
     - systemException
    """

    thrift_spec = (
        (0, TType.LIST, 'success', (TType.STRUCT, (AdminMenu, AdminMenu.thrift_spec), False), None, ),  # 0
        (1, TType.STRUCT, 'systemException', (ridi.cms.thrift.Errors.ttypes.SystemException, ridi.cms.thrift.Errors.ttypes.SystemException.thrift_spec), None, ),  # 1
    )

    def __init__(self, success=None, systemException=None,):
        self.success = success
        self.systemException = systemException

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.LIST:
                    self.success = []
                    (_etype10, _size7) = iprot.readListBegin()
                    for _i11 in range(_size7):
                        _elem12 = AdminMenu()
                        _elem12.read(iprot)
                        self.success.append(_elem12)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.systemException = ridi.cms.thrift.Errors.ttypes.SystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('getAdminMenu_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.LIST, 0)
            oprot.writeListBegin(TType.STRUCT, len(self.success))
            for iter13 in self.success:
                iter13.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 1)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class authorize_args(object):
    """
    Attributes:
     - token
     - methods
     - check_url
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'token', 'UTF8', None, ),  # 1
        (2, TType.LIST, 'methods', (TType.STRING, 'UTF8', False), None, ),  # 2
        (3, TType.STRING, 'check_url', 'UTF8', None, ),  # 3
    )

    def __init__(self, token=None, methods=None, check_url=None,):
        self.token = token
        self.methods = methods
        self.check_url = check_url

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.token = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.methods = []
                    (_etype17, _size14) = iprot.readListBegin()
                    for _i18 in range(_size14):
                        _elem19 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.methods.append(_elem19)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.check_url = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('authorize_args')
        if self.token is not None:
            oprot.writeFieldBegin('token', TType.STRING, 1)
            oprot.writeString(self.token.encode('utf-8') if sys.version_info[0] == 2 else self.token)
            oprot.writeFieldEnd()
        if self.methods is not None:
            oprot.writeFieldBegin('methods', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.methods))
            for iter20 in self.methods:
                oprot.writeString(iter20.encode('utf-8') if sys.version_info[0] == 2 else iter20)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.check_url is not None:
            oprot.writeFieldBegin('check_url', TType.STRING, 3)
            oprot.writeString(self.check_url.encode('utf-8') if sys.version_info[0] == 2 else self.check_url)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class authorize_result(object):
    """
    Attributes:
     - systemException
     - noTokenException
     - malformedTokenException
     - expiredTokenException
     - unauthorizedException
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRUCT, 'systemException', (ridi.cms.thrift.Errors.ttypes.SystemException, ridi.cms.thrift.Errors.ttypes.SystemException.thrift_spec), None, ),  # 1
        (2, TType.STRUCT, 'noTokenException', (ridi.cms.thrift.Errors.ttypes.NoTokenException, ridi.cms.thrift.Errors.ttypes.NoTokenException.thrift_spec), None, ),  # 2
        (3, TType.STRUCT, 'malformedTokenException', (ridi.cms.thrift.Errors.ttypes.MalformedTokenException, ridi.cms.thrift.Errors.ttypes.MalformedTokenException.thrift_spec), None, ),  # 3
        (4, TType.STRUCT, 'expiredTokenException', (ridi.cms.thrift.Errors.ttypes.ExpiredTokenException, ridi.cms.thrift.Errors.ttypes.ExpiredTokenException.thrift_spec), None, ),  # 4
        (5, TType.STRUCT, 'unauthorizedException', (ridi.cms.thrift.Errors.ttypes.UnauthorizedException, ridi.cms.thrift.Errors.ttypes.UnauthorizedException.thrift_spec), None, ),  # 5
    )

    def __init__(self, systemException=None, noTokenException=None, malformedTokenException=None, expiredTokenException=None, unauthorizedException=None,):
        self.systemException = systemException
        self.noTokenException = noTokenException
        self.malformedTokenException = malformedTokenException
        self.expiredTokenException = expiredTokenException
        self.unauthorizedException = unauthorizedException

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRUCT:
                    self.systemException = ridi.cms.thrift.Errors.ttypes.SystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.noTokenException = ridi.cms.thrift.Errors.ttypes.NoTokenException()
                    self.noTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.malformedTokenException = ridi.cms.thrift.Errors.ttypes.MalformedTokenException()
                    self.malformedTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRUCT:
                    self.expiredTokenException = ridi.cms.thrift.Errors.ttypes.ExpiredTokenException()
                    self.expiredTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRUCT:
                    self.unauthorizedException = ridi.cms.thrift.Errors.ttypes.UnauthorizedException()
                    self.unauthorizedException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('authorize_result')
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 1)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        if self.noTokenException is not None:
            oprot.writeFieldBegin('noTokenException', TType.STRUCT, 2)
            self.noTokenException.write(oprot)
            oprot.writeFieldEnd()
        if self.malformedTokenException is not None:
            oprot.writeFieldBegin('malformedTokenException', TType.STRUCT, 3)
            self.malformedTokenException.write(oprot)
            oprot.writeFieldEnd()
        if self.expiredTokenException is not None:
            oprot.writeFieldBegin('expiredTokenException', TType.STRUCT, 4)
            self.expiredTokenException.write(oprot)
            oprot.writeFieldEnd()
        if self.unauthorizedException is not None:
            oprot.writeFieldBegin('unauthorizedException', TType.STRUCT, 5)
            self.unauthorizedException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class authorizeByTag_args(object):
    """
    Attributes:
     - token
     - tags
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'token', 'UTF8', None, ),  # 1
        (2, TType.LIST, 'tags', (TType.STRING, 'UTF8', False), None, ),  # 2
    )

    def __init__(self, token=None, tags=None,):
        self.token = token
        self.tags = tags

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.token = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.tags = []
                    (_etype24, _size21) = iprot.readListBegin()
                    for _i25 in range(_size21):
                        _elem26 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.tags.append(_elem26)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('authorizeByTag_args')
        if self.token is not None:
            oprot.writeFieldBegin('token', TType.STRING, 1)
            oprot.writeString(self.token.encode('utf-8') if sys.version_info[0] == 2 else self.token)
            oprot.writeFieldEnd()
        if self.tags is not None:
            oprot.writeFieldBegin('tags', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.tags))
            for iter27 in self.tags:
                oprot.writeString(iter27.encode('utf-8') if sys.version_info[0] == 2 else iter27)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class authorizeByTag_result(object):
    """
    Attributes:
     - systemException
     - noTokenException
     - malformedTokenException
     - expiredTokenException
     - unauthorizedException
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRUCT, 'systemException', (ridi.cms.thrift.Errors.ttypes.SystemException, ridi.cms.thrift.Errors.ttypes.SystemException.thrift_spec), None, ),  # 1
        (2, TType.STRUCT, 'noTokenException', (ridi.cms.thrift.Errors.ttypes.NoTokenException, ridi.cms.thrift.Errors.ttypes.NoTokenException.thrift_spec), None, ),  # 2
        (3, TType.STRUCT, 'malformedTokenException', (ridi.cms.thrift.Errors.ttypes.MalformedTokenException, ridi.cms.thrift.Errors.ttypes.MalformedTokenException.thrift_spec), None, ),  # 3
        (4, TType.STRUCT, 'expiredTokenException', (ridi.cms.thrift.Errors.ttypes.ExpiredTokenException, ridi.cms.thrift.Errors.ttypes.ExpiredTokenException.thrift_spec), None, ),  # 4
        (5, TType.STRUCT, 'unauthorizedException', (ridi.cms.thrift.Errors.ttypes.UnauthorizedException, ridi.cms.thrift.Errors.ttypes.UnauthorizedException.thrift_spec), None, ),  # 5
    )

    def __init__(self, systemException=None, noTokenException=None, malformedTokenException=None, expiredTokenException=None, unauthorizedException=None,):
        self.systemException = systemException
        self.noTokenException = noTokenException
        self.malformedTokenException = malformedTokenException
        self.expiredTokenException = expiredTokenException
        self.unauthorizedException = unauthorizedException

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRUCT:
                    self.systemException = ridi.cms.thrift.Errors.ttypes.SystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.noTokenException = ridi.cms.thrift.Errors.ttypes.NoTokenException()
                    self.noTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.malformedTokenException = ridi.cms.thrift.Errors.ttypes.MalformedTokenException()
                    self.malformedTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRUCT:
                    self.expiredTokenException = ridi.cms.thrift.Errors.ttypes.ExpiredTokenException()
                    self.expiredTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRUCT:
                    self.unauthorizedException = ridi.cms.thrift.Errors.ttypes.UnauthorizedException()
                    self.unauthorizedException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('authorizeByTag_result')
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 1)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        if self.noTokenException is not None:
            oprot.writeFieldBegin('noTokenException', TType.STRUCT, 2)
            self.noTokenException.write(oprot)
            oprot.writeFieldEnd()
        if self.malformedTokenException is not None:
            oprot.writeFieldBegin('malformedTokenException', TType.STRUCT, 3)
            self.malformedTokenException.write(oprot)
            oprot.writeFieldEnd()
        if self.expiredTokenException is not None:
            oprot.writeFieldBegin('expiredTokenException', TType.STRUCT, 4)
            self.expiredTokenException.write(oprot)
            oprot.writeFieldEnd()
        if self.unauthorizedException is not None:
            oprot.writeFieldBegin('unauthorizedException', TType.STRUCT, 5)
            self.unauthorizedException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class authorizeAdminByTag_args(object):
    """
    Attributes:
     - admin_id
     - tags
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'admin_id', 'UTF8', None, ),  # 1
        (2, TType.LIST, 'tags', (TType.STRING, 'UTF8', False), None, ),  # 2
    )

    def __init__(self, admin_id=None, tags=None,):
        self.admin_id = admin_id
        self.tags = tags

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.admin_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.tags = []
                    (_etype31, _size28) = iprot.readListBegin()
                    for _i32 in range(_size28):
                        _elem33 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.tags.append(_elem33)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('authorizeAdminByTag_args')
        if self.admin_id is not None:
            oprot.writeFieldBegin('admin_id', TType.STRING, 1)
            oprot.writeString(self.admin_id.encode('utf-8') if sys.version_info[0] == 2 else self.admin_id)
            oprot.writeFieldEnd()
        if self.tags is not None:
            oprot.writeFieldBegin('tags', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.tags))
            for iter34 in self.tags:
                oprot.writeString(iter34.encode('utf-8') if sys.version_info[0] == 2 else iter34)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class authorizeAdminByTag_result(object):
    """
    Attributes:
     - systemException
     - unauthorizedException
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRUCT, 'systemException', (ridi.cms.thrift.Errors.ttypes.SystemException, ridi.cms.thrift.Errors.ttypes.SystemException.thrift_spec), None, ),  # 1
        (2, TType.STRUCT, 'unauthorizedException', (ridi.cms.thrift.Errors.ttypes.UnauthorizedException, ridi.cms.thrift.Errors.ttypes.UnauthorizedException.thrift_spec), None, ),  # 2
    )

    def __init__(self, systemException=None, unauthorizedException=None,):
        self.systemException = systemException
        self.unauthorizedException = unauthorizedException

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRUCT:
                    self.systemException = ridi.cms.thrift.Errors.ttypes.SystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.unauthorizedException = ridi.cms.thrift.Errors.ttypes.UnauthorizedException()
                    self.unauthorizedException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('authorizeAdminByTag_result')
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 1)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        if self.unauthorizedException is not None:
            oprot.writeFieldBegin('unauthorizedException', TType.STRUCT, 2)
            self.unauthorizedException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class authorizeAdminByUrl_args(object):
    """
    Attributes:
     - admin_id
     - check_url
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'admin_id', 'UTF8', None, ),  # 1
        (2, TType.STRING, 'check_url', 'UTF8', None, ),  # 2
    )

    def __init__(self, admin_id=None, check_url=None,):
        self.admin_id = admin_id
        self.check_url = check_url

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.admin_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.check_url = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('authorizeAdminByUrl_args')
        if self.admin_id is not None:
            oprot.writeFieldBegin('admin_id', TType.STRING, 1)
            oprot.writeString(self.admin_id.encode('utf-8') if sys.version_info[0] == 2 else self.admin_id)
            oprot.writeFieldEnd()
        if self.check_url is not None:
            oprot.writeFieldBegin('check_url', TType.STRING, 2)
            oprot.writeString(self.check_url.encode('utf-8') if sys.version_info[0] == 2 else self.check_url)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class authorizeAdminByUrl_result(object):
    """
    Attributes:
     - systemException
     - unauthorizedException
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRUCT, 'systemException', (ridi.cms.thrift.Errors.ttypes.SystemException, ridi.cms.thrift.Errors.ttypes.SystemException.thrift_spec), None, ),  # 1
        (2, TType.STRUCT, 'unauthorizedException', (ridi.cms.thrift.Errors.ttypes.UnauthorizedException, ridi.cms.thrift.Errors.ttypes.UnauthorizedException.thrift_spec), None, ),  # 2
    )

    def __init__(self, systemException=None, unauthorizedException=None,):
        self.systemException = systemException
        self.unauthorizedException = unauthorizedException

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRUCT:
                    self.systemException = ridi.cms.thrift.Errors.ttypes.SystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.unauthorizedException = ridi.cms.thrift.Errors.ttypes.UnauthorizedException()
                    self.unauthorizedException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('authorizeAdminByUrl_result')
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 1)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        if self.unauthorizedException is not None:
            oprot.writeFieldBegin('unauthorizedException', TType.STRUCT, 2)
            self.unauthorizedException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class introspectToken_args(object):
    """
    Attributes:
     - token
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'token', 'UTF8', None, ),  # 1
    )

    def __init__(self, token=None,):
        self.token = token

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.token = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('introspectToken_args')
        if self.token is not None:
            oprot.writeFieldBegin('token', TType.STRING, 1)
            oprot.writeString(self.token.encode('utf-8') if sys.version_info[0] == 2 else self.token)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class introspectToken_result(object):
    """
    Attributes:
     - success
     - systemException
     - noTokenException
     - malformedTokenException
     - expiredTokenException
    """

    thrift_spec = (
        (0, TType.STRUCT, 'success', (TokenClaim, TokenClaim.thrift_spec), None, ),  # 0
        (1, TType.STRUCT, 'systemException', (ridi.cms.thrift.Errors.ttypes.SystemException, ridi.cms.thrift.Errors.ttypes.SystemException.thrift_spec), None, ),  # 1
        (2, TType.STRUCT, 'noTokenException', (ridi.cms.thrift.Errors.ttypes.NoTokenException, ridi.cms.thrift.Errors.ttypes.NoTokenException.thrift_spec), None, ),  # 2
        (3, TType.STRUCT, 'malformedTokenException', (ridi.cms.thrift.Errors.ttypes.MalformedTokenException, ridi.cms.thrift.Errors.ttypes.MalformedTokenException.thrift_spec), None, ),  # 3
        (4, TType.STRUCT, 'expiredTokenException', (ridi.cms.thrift.Errors.ttypes.ExpiredTokenException, ridi.cms.thrift.Errors.ttypes.ExpiredTokenException.thrift_spec), None, ),  # 4
    )

    def __init__(self, success=None, systemException=None, noTokenException=None, malformedTokenException=None, expiredTokenException=None,):
        self.success = success
        self.systemException = systemException
        self.noTokenException = noTokenException
        self.malformedTokenException = malformedTokenException
        self.expiredTokenException = expiredTokenException

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = TokenClaim()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.systemException = ridi.cms.thrift.Errors.ttypes.SystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.noTokenException = ridi.cms.thrift.Errors.ttypes.NoTokenException()
                    self.noTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.malformedTokenException = ridi.cms.thrift.Errors.ttypes.MalformedTokenException()
                    self.malformedTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRUCT:
                    self.expiredTokenException = ridi.cms.thrift.Errors.ttypes.ExpiredTokenException()
                    self.expiredTokenException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('introspectToken_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 1)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        if self.noTokenException is not None:
            oprot.writeFieldBegin('noTokenException', TType.STRUCT, 2)
            self.noTokenException.write(oprot)
            oprot.writeFieldEnd()
        if self.malformedTokenException is not None:
            oprot.writeFieldBegin('malformedTokenException', TType.STRUCT, 3)
            self.malformedTokenException.write(oprot)
            oprot.writeFieldEnd()
        if self.expiredTokenException is not None:
            oprot.writeFieldBegin('expiredTokenException', TType.STRUCT, 4)
            self.expiredTokenException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
