Auto Generated INFO.yaml file
[domino.git] / dominoCLI / DominoClientCLI.py
1 #
2 # Autogenerated by Thrift Compiler (0.9.3)
3 #
4 # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 #
6 #  options string: py
7 #
8
9 from thrift.Thrift import TType, TMessageType, TException, TApplicationException
10 import logging
11 from ttypes import *
12 from thrift.Thrift import TProcessor
13 from thrift.transport import TTransport
14 from thrift.protocol import TBinaryProtocol, TProtocol
15 try:
16   from thrift.protocol import fastbinary
17 except:
18   fastbinary = None
19
20
21 class Iface:
22   def d_CLI(self, msg):
23     """
24     Parameters:
25      - msg
26     """
27     pass
28
29
30 class Client(Iface):
31   def __init__(self, iprot, oprot=None):
32     self._iprot = self._oprot = iprot
33     if oprot is not None:
34       self._oprot = oprot
35     self._seqid = 0
36
37   def d_CLI(self, msg):
38     """
39     Parameters:
40      - msg
41     """
42     self.send_d_CLI(msg)
43     return self.recv_d_CLI()
44
45   def send_d_CLI(self, msg):
46     self._oprot.writeMessageBegin('d_CLI', TMessageType.CALL, self._seqid)
47     args = d_CLI_args()
48     args.msg = msg
49     args.write(self._oprot)
50     self._oprot.writeMessageEnd()
51     self._oprot.trans.flush()
52
53   def recv_d_CLI(self):
54     iprot = self._iprot
55     (fname, mtype, rseqid) = iprot.readMessageBegin()
56     if mtype == TMessageType.EXCEPTION:
57       x = TApplicationException()
58       x.read(iprot)
59       iprot.readMessageEnd()
60       raise x
61     result = d_CLI_result()
62     result.read(iprot)
63     iprot.readMessageEnd()
64     if result.success is not None:
65       return result.success
66     raise TApplicationException(TApplicationException.MISSING_RESULT, "d_CLI failed: unknown result")
67
68
69 class Processor(Iface, TProcessor):
70   def __init__(self, handler):
71     self._handler = handler
72     self._processMap = {}
73     self._processMap["d_CLI"] = Processor.process_d_CLI
74
75   def process(self, iprot, oprot):
76     (name, type, seqid) = iprot.readMessageBegin()
77     if name not in self._processMap:
78       iprot.skip(TType.STRUCT)
79       iprot.readMessageEnd()
80       x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
81       oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
82       x.write(oprot)
83       oprot.writeMessageEnd()
84       oprot.trans.flush()
85       return
86     else:
87       self._processMap[name](self, seqid, iprot, oprot)
88     return True
89
90   def process_d_CLI(self, seqid, iprot, oprot):
91     args = d_CLI_args()
92     args.read(iprot)
93     iprot.readMessageEnd()
94     result = d_CLI_result()
95     try:
96       result.success = self._handler.d_CLI(args.msg)
97       msg_type = TMessageType.REPLY
98     except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
99       raise
100     except Exception as ex:
101       msg_type = TMessageType.EXCEPTION
102       logging.exception(ex)
103       result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
104     oprot.writeMessageBegin("d_CLI", msg_type, seqid)
105     result.write(oprot)
106     oprot.writeMessageEnd()
107     oprot.trans.flush()
108
109
110 # HELPER FUNCTIONS AND STRUCTURES
111
112 class d_CLI_args:
113   """
114   Attributes:
115    - msg
116   """
117
118   thrift_spec = (
119     None, # 0
120     (1, TType.STRUCT, 'msg', (CLIMessage, CLIMessage.thrift_spec), None, ), # 1
121   )
122
123   def __init__(self, msg=None,):
124     self.msg = msg
125
126   def read(self, iprot):
127     if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
128       fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
129       return
130     iprot.readStructBegin()
131     while True:
132       (fname, ftype, fid) = iprot.readFieldBegin()
133       if ftype == TType.STOP:
134         break
135       if fid == 1:
136         if ftype == TType.STRUCT:
137           self.msg = CLIMessage()
138           self.msg.read(iprot)
139         else:
140           iprot.skip(ftype)
141       else:
142         iprot.skip(ftype)
143       iprot.readFieldEnd()
144     iprot.readStructEnd()
145
146   def write(self, oprot):
147     if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
148       oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
149       return
150     oprot.writeStructBegin('d_CLI_args')
151     if self.msg is not None:
152       oprot.writeFieldBegin('msg', TType.STRUCT, 1)
153       self.msg.write(oprot)
154       oprot.writeFieldEnd()
155     oprot.writeFieldStop()
156     oprot.writeStructEnd()
157
158   def validate(self):
159     return
160
161
162   def __hash__(self):
163     value = 17
164     value = (value * 31) ^ hash(self.msg)
165     return value
166
167   def __repr__(self):
168     L = ['%s=%r' % (key, value)
169       for key, value in self.__dict__.iteritems()]
170     return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
171
172   def __eq__(self, other):
173     return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
174
175   def __ne__(self, other):
176     return not (self == other)
177
178 class d_CLI_result:
179   """
180   Attributes:
181    - success
182   """
183
184   thrift_spec = (
185     (0, TType.STRUCT, 'success', (CLIResponse, CLIResponse.thrift_spec), None, ), # 0
186   )
187
188   def __init__(self, success=None,):
189     self.success = success
190
191   def read(self, iprot):
192     if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
193       fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
194       return
195     iprot.readStructBegin()
196     while True:
197       (fname, ftype, fid) = iprot.readFieldBegin()
198       if ftype == TType.STOP:
199         break
200       if fid == 0:
201         if ftype == TType.STRUCT:
202           self.success = CLIResponse()
203           self.success.read(iprot)
204         else:
205           iprot.skip(ftype)
206       else:
207         iprot.skip(ftype)
208       iprot.readFieldEnd()
209     iprot.readStructEnd()
210
211   def write(self, oprot):
212     if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
213       oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
214       return
215     oprot.writeStructBegin('d_CLI_result')
216     if self.success is not None:
217       oprot.writeFieldBegin('success', TType.STRUCT, 0)
218       self.success.write(oprot)
219       oprot.writeFieldEnd()
220     oprot.writeFieldStop()
221     oprot.writeStructEnd()
222
223   def validate(self):
224     return
225
226
227   def __hash__(self):
228     value = 17
229     value = (value * 31) ^ hash(self.success)
230     return value
231
232   def __repr__(self):
233     L = ['%s=%r' % (key, value)
234       for key, value in self.__dict__.iteritems()]
235     return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
236
237   def __eq__(self, other):
238     return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
239
240   def __ne__(self, other):
241     return not (self == other)