Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/boto/sqs/batchresults.py @ 0:d30785e31577 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
| author | guerler |
|---|---|
| date | Fri, 31 Jul 2020 00:18:57 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d30785e31577 |
|---|---|
| 1 # Copyright (c) 2011 Mitch Garnaat http://garnaat.org/ | |
| 2 # Copyright (c) 2011 Eucalyptus Systems, Inc. | |
| 3 # | |
| 4 # Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 # copy of this software and associated documentation files (the | |
| 6 # "Software"), to deal in the Software without restriction, including | |
| 7 # without limitation the rights to use, copy, modify, merge, publish, dis- | |
| 8 # tribute, sublicense, and/or sell copies of the Software, and to permit | |
| 9 # persons to whom the Software is furnished to do so, subject to the fol- | |
| 10 # lowing conditions: | |
| 11 # | |
| 12 # The above copyright notice and this permission notice shall be included | |
| 13 # in all copies or substantial portions of the Software. | |
| 14 # | |
| 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
| 16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | |
| 17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | |
| 18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
| 19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
| 21 # IN THE SOFTWARE. | |
| 22 | |
| 23 """ | |
| 24 A set of results returned by SendMessageBatch. | |
| 25 """ | |
| 26 | |
| 27 class ResultEntry(dict): | |
| 28 """ | |
| 29 The result (successful or unsuccessful) of a single | |
| 30 message within a send_message_batch request. | |
| 31 | |
| 32 In the case of a successful result, this dict-like | |
| 33 object will contain the following items: | |
| 34 | |
| 35 :ivar id: A string containing the user-supplied ID of the message. | |
| 36 :ivar message_id: A string containing the SQS ID of the new message. | |
| 37 :ivar message_md5: A string containing the MD5 hash of the message body. | |
| 38 | |
| 39 In the case of an error, this object will contain the following | |
| 40 items: | |
| 41 | |
| 42 :ivar id: A string containing the user-supplied ID of the message. | |
| 43 :ivar sender_fault: A boolean value. | |
| 44 :ivar error_code: A string containing a short description of the error. | |
| 45 :ivar error_message: A string containing a description of the error. | |
| 46 """ | |
| 47 | |
| 48 def startElement(self, name, attrs, connection): | |
| 49 return None | |
| 50 | |
| 51 def endElement(self, name, value, connection): | |
| 52 if name == 'Id': | |
| 53 self['id'] = value | |
| 54 elif name == 'MessageId': | |
| 55 self['message_id'] = value | |
| 56 elif name == 'MD5OfMessageBody': | |
| 57 self['message_md5'] = value | |
| 58 elif name == 'SenderFault': | |
| 59 self['sender_fault'] = value | |
| 60 elif name == 'Code': | |
| 61 self['error_code'] = value | |
| 62 elif name == 'Message': | |
| 63 self['error_message'] = value | |
| 64 | |
| 65 class BatchResults(object): | |
| 66 """ | |
| 67 A container for the results of a send_message_batch request. | |
| 68 | |
| 69 :ivar results: A list of successful results. Each item in the | |
| 70 list will be an instance of :class:`ResultEntry`. | |
| 71 | |
| 72 :ivar errors: A list of unsuccessful results. Each item in the | |
| 73 list will be an instance of :class:`ResultEntry`. | |
| 74 """ | |
| 75 | |
| 76 def __init__(self, parent): | |
| 77 self.parent = parent | |
| 78 self.results = [] | |
| 79 self.errors = [] | |
| 80 | |
| 81 def startElement(self, name, attrs, connection): | |
| 82 if name.endswith('MessageBatchResultEntry'): | |
| 83 entry = ResultEntry() | |
| 84 self.results.append(entry) | |
| 85 return entry | |
| 86 if name == 'BatchResultErrorEntry': | |
| 87 entry = ResultEntry() | |
| 88 self.errors.append(entry) | |
| 89 return entry | |
| 90 return None | |
| 91 | |
| 92 def endElement(self, name, value, connection): | |
| 93 setattr(self, name, value) | |
| 94 | |
| 95 |
