# # Autogenerated by Thrift # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # from thrift.Thrift import * from ttypes import * from thrift.Thrift import TProcessor from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol try: from thrift.protocol import fastbinary except: fastbinary = None class Iface: def run_command(self, cld, command, arglist): """ Parameters: - cld - command - arglist """ pass class Client(Iface): def __init__(self, iprot, oprot=None): self._iprot = self._oprot = iprot if oprot != None: self._oprot = oprot self._seqid = 0 def run_command(self, cld, command, arglist): """ Parameters: - cld - command - arglist """ self.send_run_command(cld, command, arglist) return self.recv_run_command() def send_run_command(self, cld, command, arglist): self._oprot.writeMessageBegin('run_command', TMessageType.CALL, self._seqid) args = run_command_args() args.cld = cld args.command = command args.arglist = arglist args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_run_command(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = run_command_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "run_command failed: unknown result"); class Processor(Iface, TProcessor): def __init__(self, handler): self._handler = handler self._processMap = {} self._processMap["run_command"] = Processor.process_run_command 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_run_command(self, seqid, iprot, oprot): args = run_command_args() args.read(iprot) iprot.readMessageEnd() result = run_command_result() result.success = self._handler.run_command(args.cld, args.command, args.arglist) oprot.writeMessageBegin("run_command", TMessageType.REPLY, seqid) result.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() # HELPER FUNCTIONS AND STRUCTURES class run_command_args: """ Attributes: - cld - command - arglist """ thrift_spec = ( None, # 0 (1, TType.STRUCT, 'cld', (CloudQuery, CloudQuery.thrift_spec), None, ), # 1 (2, TType.STRING, 'command', None, None, ), # 2 (3, TType.LIST, 'arglist', (TType.STRING,None), None, ), # 3 ) def __init__(self, cld=None, command=None, arglist=None,): self.cld = cld self.command = command self.arglist = arglist 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.cld = CloudQuery() self.cld.read(iprot) else: iprot.skip(ftype) elif fid == 2: if ftype == TType.STRING: self.command = iprot.readString(); else: iprot.skip(ftype) elif fid == 3: if ftype == TType.LIST: self.arglist = [] (_etype10, _size7) = iprot.readListBegin() for _i11 in xrange(_size7): _elem12 = iprot.readString(); self.arglist.append(_elem12) iprot.readListEnd() 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('run_command_args') if self.cld != None: oprot.writeFieldBegin('cld', TType.STRUCT, 1) self.cld.write(oprot) oprot.writeFieldEnd() if self.command != None: oprot.writeFieldBegin('command', TType.STRING, 2) oprot.writeString(self.command) oprot.writeFieldEnd() if self.arglist != None: oprot.writeFieldBegin('arglist', TType.LIST, 3) oprot.writeListBegin(TType.STRING, len(self.arglist)) for iter13 in self.arglist: oprot.writeString(iter13) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] 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 run_command_result: """ Attributes: - success """ thrift_spec = ( (0, TType.STRUCT, 'success', (CloudResponse, CloudResponse.thrift_spec), None, ), # 0 ) def __init__(self, success=None,): self.success = success 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 == 0: if ftype == TType.STRUCT: self.success = CloudResponse() self.success.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('run_command_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRUCT, 0) self.success.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] 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)