#
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

from talos.thrift.Thrift import TType, TMessageType, TException, TApplicationException

from talos.thrift.transport import TTransport
from talos.thrift.protocol import TBinaryProtocol, TProtocol
try:
  from talos.thrift.protocol import fastbinary
except:
  fastbinary = None



class BaseQuota:
  """
  BaseQuota is the base struct of UserQuota and TopicQuota
  the quota service is made for three aspects:
  1. the resource number taken up by users
  2. the read/write qps quota
  3. the traffic qps quota


  Attributes:
   - spaceQuota: The max space can be used for specified developer/topic
  default 1T for developer, and 500G for topic

   - usedSpace: The used space quota

   - remainingSpace: The remaining space quota

   - putMessageQpsQuota: The max total qps of putMessage of specified developer/topic
  default 40000 for developer, and 4000 for topic

   - getMessageQpsQuota: The max total qps of getMessage of specified developer/topic
  default 40000 for developer, and 4000 for topic

   - putMessageBytesQpsQuota: The max total bytes of putMessage of specified developer/topic
  default 500MB for developer, and 50MB for topic

   - getMessageBytesQpsQuota: The max total bytes of getMessage of specified developer/topic
  default 500MB for developer, and 50MB for topic

  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'spaceQuota', None, None, ), # 1
    (2, TType.I64, 'usedSpace', None, None, ), # 2
    (3, TType.I64, 'remainingSpace', None, None, ), # 3
    (4, TType.I32, 'putMessageQpsQuota', None, None, ), # 4
    (5, TType.I32, 'getMessageQpsQuota', None, None, ), # 5
    (6, TType.I64, 'putMessageBytesQpsQuota', None, None, ), # 6
    (7, TType.I64, 'getMessageBytesQpsQuota', None, None, ), # 7
  )

  def __init__(self, spaceQuota=None, usedSpace=None, remainingSpace=None, putMessageQpsQuota=None, getMessageQpsQuota=None, putMessageBytesQpsQuota=None, getMessageBytesQpsQuota=None,):
    self.spaceQuota = spaceQuota
    self.usedSpace = usedSpace
    self.remainingSpace = remainingSpace
    self.putMessageQpsQuota = putMessageQpsQuota
    self.getMessageQpsQuota = getMessageQpsQuota
    self.putMessageBytesQpsQuota = putMessageBytesQpsQuota
    self.getMessageBytesQpsQuota = getMessageBytesQpsQuota

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.I64:
          self.spaceQuota = iprot.readI64()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.usedSpace = iprot.readI64()
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.remainingSpace = iprot.readI64()
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I32:
          self.putMessageQpsQuota = iprot.readI32()
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.I32:
          self.getMessageQpsQuota = iprot.readI32()
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.I64:
          self.putMessageBytesQpsQuota = iprot.readI64()
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.I64:
          self.getMessageBytesQpsQuota = iprot.readI64()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('BaseQuota')
    if self.spaceQuota is not None:
      oprot.writeFieldBegin('spaceQuota', TType.I64, 1)
      oprot.writeI64(self.spaceQuota)
      oprot.writeFieldEnd()
    if self.usedSpace is not None:
      oprot.writeFieldBegin('usedSpace', TType.I64, 2)
      oprot.writeI64(self.usedSpace)
      oprot.writeFieldEnd()
    if self.remainingSpace is not None:
      oprot.writeFieldBegin('remainingSpace', TType.I64, 3)
      oprot.writeI64(self.remainingSpace)
      oprot.writeFieldEnd()
    if self.putMessageQpsQuota is not None:
      oprot.writeFieldBegin('putMessageQpsQuota', TType.I32, 4)
      oprot.writeI32(self.putMessageQpsQuota)
      oprot.writeFieldEnd()
    if self.getMessageQpsQuota is not None:
      oprot.writeFieldBegin('getMessageQpsQuota', TType.I32, 5)
      oprot.writeI32(self.getMessageQpsQuota)
      oprot.writeFieldEnd()
    if self.putMessageBytesQpsQuota is not None:
      oprot.writeFieldBegin('putMessageBytesQpsQuota', TType.I64, 6)
      oprot.writeI64(self.putMessageBytesQpsQuota)
      oprot.writeFieldEnd()
    if self.getMessageBytesQpsQuota is not None:
      oprot.writeFieldBegin('getMessageBytesQpsQuota', TType.I64, 7)
      oprot.writeI64(self.getMessageBytesQpsQuota)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.spaceQuota is None:
      raise TProtocol.TProtocolException(message='Required field spaceQuota is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.spaceQuota)
    value = (value * 31) ^ hash(self.usedSpace)
    value = (value * 31) ^ hash(self.remainingSpace)
    value = (value * 31) ^ hash(self.putMessageQpsQuota)
    value = (value * 31) ^ hash(self.getMessageQpsQuota)
    value = (value * 31) ^ hash(self.putMessageBytesQpsQuota)
    value = (value * 31) ^ hash(self.getMessageBytesQpsQuota)
    return value

  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 UserQuota:
  """
  Attributes:
   - baseQuota: The base quota member

   - topicNumberQuota: The max topic number allowed to create for specified developerId,
  default 20 (1 ~ 100);

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'baseQuota', (BaseQuota, BaseQuota.thrift_spec), None, ), # 1
    (2, TType.I32, 'topicNumberQuota', None, None, ), # 2
  )

  def __init__(self, baseQuota=None, topicNumberQuota=None,):
    self.baseQuota = baseQuota
    self.topicNumberQuota = topicNumberQuota

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.baseQuota = BaseQuota()
          self.baseQuota.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.topicNumberQuota = iprot.readI32()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('UserQuota')
    if self.baseQuota is not None:
      oprot.writeFieldBegin('baseQuota', TType.STRUCT, 1)
      self.baseQuota.write(oprot)
      oprot.writeFieldEnd()
    if self.topicNumberQuota is not None:
      oprot.writeFieldBegin('topicNumberQuota', TType.I32, 2)
      oprot.writeI32(self.topicNumberQuota)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.baseQuota is None:
      raise TProtocol.TProtocolException(message='Required field baseQuota is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.baseQuota)
    value = (value * 31) ^ hash(self.topicNumberQuota)
    return value

  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 SetUserQuotaRequest:
  """
  Attributes:
   - developerId: The developerId to set quota;

   - userQuota: The user quota;

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'developerId', None, None, ), # 1
    (2, TType.STRUCT, 'userQuota', (UserQuota, UserQuota.thrift_spec), None, ), # 2
  )

  def __init__(self, developerId=None, userQuota=None,):
    self.developerId = developerId
    self.userQuota = userQuota

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.developerId = iprot.readString()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.userQuota = UserQuota()
          self.userQuota.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('SetUserQuotaRequest')
    if self.developerId is not None:
      oprot.writeFieldBegin('developerId', TType.STRING, 1)
      oprot.writeString(self.developerId)
      oprot.writeFieldEnd()
    if self.userQuota is not None:
      oprot.writeFieldBegin('userQuota', TType.STRUCT, 2)
      self.userQuota.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.developerId is None:
      raise TProtocol.TProtocolException(message='Required field developerId is unset!')
    if self.userQuota is None:
      raise TProtocol.TProtocolException(message='Required field userQuota is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.developerId)
    value = (value * 31) ^ hash(self.userQuota)
    return value

  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 QueryUserQuotaResponse:
  """
  Attributes:
   - userQuota: The user quota;

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'userQuota', (UserQuota, UserQuota.thrift_spec), None, ), # 1
  )

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

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.userQuota = UserQuota()
          self.userQuota.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('QueryUserQuotaResponse')
    if self.userQuota is not None:
      oprot.writeFieldBegin('userQuota', TType.STRUCT, 1)
      self.userQuota.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.userQuota is None:
      raise TProtocol.TProtocolException(message='Required field userQuota is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.userQuota)
    return value

  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 ListUserQuotaResponse:
  """
  Attributes:
   - userQuotaList: The developer -> UserQuota map;

  """

  thrift_spec = (
    None, # 0
    (1, TType.MAP, 'userQuotaList', (TType.STRING,None,TType.STRUCT,(UserQuota, UserQuota.thrift_spec)), None, ), # 1
  )

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

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.MAP:
          self.userQuotaList = {}
          (_ktype1, _vtype2, _size0 ) = iprot.readMapBegin()
          for _i4 in range(_size0):
            _key5 = iprot.readString()
            _val6 = UserQuota()
            _val6.read(iprot)
            self.userQuotaList[_key5] = _val6
          iprot.readMapEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('ListUserQuotaResponse')
    if self.userQuotaList is not None:
      oprot.writeFieldBegin('userQuotaList', TType.MAP, 1)
      oprot.writeMapBegin(TType.STRING, TType.STRUCT, len(self.userQuotaList))
      for kiter7,viter8 in self.userQuotaList.items():
        oprot.writeString(kiter7)
        viter8.write(oprot)
      oprot.writeMapEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.userQuotaList is None:
      raise TProtocol.TProtocolException(message='Required field userQuotaList is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.userQuotaList)
    return value

  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 DeleteUserQuotaRequest:
  """
  Attributes:
   - developerId: The developerId to delete quota;

  """

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

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

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.developerId = iprot.readString()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('DeleteUserQuotaRequest')
    if self.developerId is not None:
      oprot.writeFieldBegin('developerId', TType.STRING, 1)
      oprot.writeString(self.developerId)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.developerId is None:
      raise TProtocol.TProtocolException(message='Required field developerId is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.developerId)
    return value

  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 PartitionQuotaInfo:
  """
  Attributes:
   - orgId: The Org Id

   - totalQuota: The org apply/old total partition quota, depending on specific request

   - usedOuota: The org used partition quota, optional

   - applyReason: The reason of apply quota

   - orgName: The Org Name

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'orgId', None, None, ), # 1
    (2, TType.I32, 'totalQuota', None, None, ), # 2
    (3, TType.I32, 'usedOuota', None, None, ), # 3
    (4, TType.STRING, 'applyReason', None, None, ), # 4
    (5, TType.STRING, 'orgName', None, None, ), # 5
  )

  def __init__(self, orgId=None, totalQuota=None, usedOuota=None, applyReason=None, orgName=None,):
    self.orgId = orgId
    self.totalQuota = totalQuota
    self.usedOuota = usedOuota
    self.applyReason = applyReason
    self.orgName = orgName

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.orgId = iprot.readString()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.totalQuota = iprot.readI32()
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.usedOuota = iprot.readI32()
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRING:
          self.applyReason = iprot.readString()
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRING:
          self.orgName = iprot.readString()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PartitionQuotaInfo')
    if self.orgId is not None:
      oprot.writeFieldBegin('orgId', TType.STRING, 1)
      oprot.writeString(self.orgId)
      oprot.writeFieldEnd()
    if self.totalQuota is not None:
      oprot.writeFieldBegin('totalQuota', TType.I32, 2)
      oprot.writeI32(self.totalQuota)
      oprot.writeFieldEnd()
    if self.usedOuota is not None:
      oprot.writeFieldBegin('usedOuota', TType.I32, 3)
      oprot.writeI32(self.usedOuota)
      oprot.writeFieldEnd()
    if self.applyReason is not None:
      oprot.writeFieldBegin('applyReason', TType.STRING, 4)
      oprot.writeString(self.applyReason)
      oprot.writeFieldEnd()
    if self.orgName is not None:
      oprot.writeFieldBegin('orgName', TType.STRING, 5)
      oprot.writeString(self.orgName)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.orgId is None:
      raise TProtocol.TProtocolException(message='Required field orgId is unset!')
    if self.totalQuota is None:
      raise TProtocol.TProtocolException(message='Required field totalQuota is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.orgId)
    value = (value * 31) ^ hash(self.totalQuota)
    value = (value * 31) ^ hash(self.usedOuota)
    value = (value * 31) ^ hash(self.applyReason)
    value = (value * 31) ^ hash(self.orgName)
    return value

  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 ApplyQuotaRequest:
  """
  Attributes:
   - quotaInfo: partition quota info

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'quotaInfo', (PartitionQuotaInfo, PartitionQuotaInfo.thrift_spec), None, ), # 1
  )

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

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.quotaInfo = PartitionQuotaInfo()
          self.quotaInfo.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('ApplyQuotaRequest')
    if self.quotaInfo is not None:
      oprot.writeFieldBegin('quotaInfo', TType.STRUCT, 1)
      self.quotaInfo.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.quotaInfo is None:
      raise TProtocol.TProtocolException(message='Required field quotaInfo is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.quotaInfo)
    return value

  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 AutoApplyQuotaRequest:
  """
  Attributes:
   - quotaInfo: partition quota info

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'quotaInfo', (PartitionQuotaInfo, PartitionQuotaInfo.thrift_spec), None, ), # 1
  )

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

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.quotaInfo = PartitionQuotaInfo()
          self.quotaInfo.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('AutoApplyQuotaRequest')
    if self.quotaInfo is not None:
      oprot.writeFieldBegin('quotaInfo', TType.STRUCT, 1)
      self.quotaInfo.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.quotaInfo is None:
      raise TProtocol.TProtocolException(message='Required field quotaInfo is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.quotaInfo)
    return value

  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 ListQuotaResponse:
  """
  Attributes:
   - quotaList: user existing approved quota

   - approvedTotalQuota: approved quota total number

  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'quotaList', (TType.STRUCT,(PartitionQuotaInfo, PartitionQuotaInfo.thrift_spec)), None, ), # 1
    (2, TType.I32, 'approvedTotalQuota', None, None, ), # 2
  )

  def __init__(self, quotaList=None, approvedTotalQuota=None,):
    self.quotaList = quotaList
    self.approvedTotalQuota = approvedTotalQuota

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.LIST:
          self.quotaList = []
          (_etype12, _size9) = iprot.readListBegin()
          for _i13 in range(_size9):
            _elem14 = PartitionQuotaInfo()
            _elem14.read(iprot)
            self.quotaList.append(_elem14)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.approvedTotalQuota = iprot.readI32()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('ListQuotaResponse')
    if self.quotaList is not None:
      oprot.writeFieldBegin('quotaList', TType.LIST, 1)
      oprot.writeListBegin(TType.STRUCT, len(self.quotaList))
      for iter15 in self.quotaList:
        iter15.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.approvedTotalQuota is not None:
      oprot.writeFieldBegin('approvedTotalQuota', TType.I32, 2)
      oprot.writeI32(self.approvedTotalQuota)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.quotaList is None:
      raise TProtocol.TProtocolException(message='Required field quotaList is unset!')
    if self.approvedTotalQuota is None:
      raise TProtocol.TProtocolException(message='Required field approvedTotalQuota is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.quotaList)
    value = (value * 31) ^ hash(self.approvedTotalQuota)
    return value

  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 ListPendingQuotaResponse:
  """
  Attributes:
   - pendingQuotaList: pending quota application

   - talosAdmin: is or not Talos Admin

  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'pendingQuotaList', (TType.STRUCT,(PartitionQuotaInfo, PartitionQuotaInfo.thrift_spec)), None, ), # 1
    (2, TType.BOOL, 'talosAdmin', None, None, ), # 2
  )

  def __init__(self, pendingQuotaList=None, talosAdmin=None,):
    self.pendingQuotaList = pendingQuotaList
    self.talosAdmin = talosAdmin

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.LIST:
          self.pendingQuotaList = []
          (_etype19, _size16) = iprot.readListBegin()
          for _i20 in range(_size16):
            _elem21 = PartitionQuotaInfo()
            _elem21.read(iprot)
            self.pendingQuotaList.append(_elem21)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.BOOL:
          self.talosAdmin = iprot.readBool()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('ListPendingQuotaResponse')
    if self.pendingQuotaList is not None:
      oprot.writeFieldBegin('pendingQuotaList', TType.LIST, 1)
      oprot.writeListBegin(TType.STRUCT, len(self.pendingQuotaList))
      for iter22 in self.pendingQuotaList:
        iter22.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.talosAdmin is not None:
      oprot.writeFieldBegin('talosAdmin', TType.BOOL, 2)
      oprot.writeBool(self.talosAdmin)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.pendingQuotaList is None:
      raise TProtocol.TProtocolException(message='Required field pendingQuotaList is unset!')
    if self.talosAdmin is None:
      raise TProtocol.TProtocolException(message='Required field talosAdmin is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.pendingQuotaList)
    value = (value * 31) ^ hash(self.talosAdmin)
    return value

  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 ApproveQuotaRequest:
  """
  Attributes:
   - quotaInfo: partition quota info

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'quotaInfo', (PartitionQuotaInfo, PartitionQuotaInfo.thrift_spec), None, ), # 1
  )

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

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.quotaInfo = PartitionQuotaInfo()
          self.quotaInfo.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('ApproveQuotaRequest')
    if self.quotaInfo is not None:
      oprot.writeFieldBegin('quotaInfo', TType.STRUCT, 1)
      self.quotaInfo.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.quotaInfo is None:
      raise TProtocol.TProtocolException(message='Required field quotaInfo is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.quotaInfo)
    return value

  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 ApproveQuotaResponse:
  """
  Attributes:
   - pendingQuotaList: pending quota application

   - talosAdmin: is or not Talos Admin

  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'pendingQuotaList', (TType.STRUCT,(PartitionQuotaInfo, PartitionQuotaInfo.thrift_spec)), None, ), # 1
    (2, TType.BOOL, 'talosAdmin', None, None, ), # 2
  )

  def __init__(self, pendingQuotaList=None, talosAdmin=None,):
    self.pendingQuotaList = pendingQuotaList
    self.talosAdmin = talosAdmin

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.LIST:
          self.pendingQuotaList = []
          (_etype26, _size23) = iprot.readListBegin()
          for _i27 in range(_size23):
            _elem28 = PartitionQuotaInfo()
            _elem28.read(iprot)
            self.pendingQuotaList.append(_elem28)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.BOOL:
          self.talosAdmin = iprot.readBool()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('ApproveQuotaResponse')
    if self.pendingQuotaList is not None:
      oprot.writeFieldBegin('pendingQuotaList', TType.LIST, 1)
      oprot.writeListBegin(TType.STRUCT, len(self.pendingQuotaList))
      for iter29 in self.pendingQuotaList:
        iter29.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.talosAdmin is not None:
      oprot.writeFieldBegin('talosAdmin', TType.BOOL, 2)
      oprot.writeBool(self.talosAdmin)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.pendingQuotaList is None:
      raise TProtocol.TProtocolException(message='Required field pendingQuotaList is unset!')
    if self.talosAdmin is None:
      raise TProtocol.TProtocolException(message='Required field talosAdmin is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.pendingQuotaList)
    value = (value * 31) ^ hash(self.talosAdmin)
    return value

  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 RevokeQuotaRequest:
  """
  Attributes:
   - quotaInfo: partition quota info

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'quotaInfo', (PartitionQuotaInfo, PartitionQuotaInfo.thrift_spec), None, ), # 1
  )

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

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.quotaInfo = PartitionQuotaInfo()
          self.quotaInfo.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('RevokeQuotaRequest')
    if self.quotaInfo is not None:
      oprot.writeFieldBegin('quotaInfo', TType.STRUCT, 1)
      self.quotaInfo.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.quotaInfo is None:
      raise TProtocol.TProtocolException(message='Required field quotaInfo is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.quotaInfo)
    return value

  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 RevokeQuotaResponse:
  """
  Attributes:
   - pendingQuotaList: pending quota application

   - talosAdmin: is or not Talos Admin

  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'pendingQuotaList', (TType.STRUCT,(PartitionQuotaInfo, PartitionQuotaInfo.thrift_spec)), None, ), # 1
    (2, TType.BOOL, 'talosAdmin', None, None, ), # 2
  )

  def __init__(self, pendingQuotaList=None, talosAdmin=None,):
    self.pendingQuotaList = pendingQuotaList
    self.talosAdmin = talosAdmin

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (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.LIST:
          self.pendingQuotaList = []
          (_etype33, _size30) = iprot.readListBegin()
          for _i34 in range(_size30):
            _elem35 = PartitionQuotaInfo()
            _elem35.read(iprot)
            self.pendingQuotaList.append(_elem35)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.BOOL:
          self.talosAdmin = iprot.readBool()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('RevokeQuotaResponse')
    if self.pendingQuotaList is not None:
      oprot.writeFieldBegin('pendingQuotaList', TType.LIST, 1)
      oprot.writeListBegin(TType.STRUCT, len(self.pendingQuotaList))
      for iter36 in self.pendingQuotaList:
        iter36.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.talosAdmin is not None:
      oprot.writeFieldBegin('talosAdmin', TType.BOOL, 2)
      oprot.writeBool(self.talosAdmin)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.pendingQuotaList is None:
      raise TProtocol.TProtocolException(message='Required field pendingQuotaList is unset!')
    if self.talosAdmin is None:
      raise TProtocol.TProtocolException(message='Required field talosAdmin is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.pendingQuotaList)
    value = (value * 31) ^ hash(self.talosAdmin)
    return value

  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)
