| OLD | NEW |
| 1 # Copyright (c) 2006-2010 Chris Moyer http://coredumped.org/ | 1 # Copyright (c) 2006-2010 Chris Moyer http://coredumped.org/ |
| 2 # | 2 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: | 9 # lowing conditions: |
| 10 # | 10 # |
| 11 # The above copyright notice and this permission notice shall be included | 11 # The above copyright notice and this permission notice shall be included |
| 12 # in all copies or substantial portions of the Software. | 12 # in all copies or substantial portions of the Software. |
| 13 # | 13 # |
| 14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |
| 16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | 16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT |
| 17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | 17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 20 # IN THE SOFTWARE. | 20 # IN THE SOFTWARE. |
| 21 | 21 |
| 22 import uuid | 22 import uuid |
| 23 import urllib | 23 import urllib |
| 24 | 24 |
| 25 class InvalidationBatch(object): | 25 class InvalidationBatch(object): |
| 26 """A simple invalidation request. | 26 """A simple invalidation request. |
| 27 :see: http://docs.amazonwebservices.com/AmazonCloudFront/2010-08-01/APIR
eference/index.html?InvalidationBatchDatatype.html | 27 :see: http://docs.amazonwebservices.com/AmazonCloudFront/2010-08-01/APIR
eference/index.html?InvalidationBatchDatatype.html |
| 28 """ | 28 """ |
| 29 | 29 |
| 30 def __init__(self, paths=[], connection=None, distribution=None, caller_refe
rence=''): | 30 def __init__(self, paths=None, connection=None, distribution=None, caller_re
ference=''): |
| 31 """Create a new invalidation request: | 31 """Create a new invalidation request: |
| 32 :paths: An array of paths to invalidate | 32 :paths: An array of paths to invalidate |
| 33 """ | 33 """ |
| 34 self.paths = paths | 34 self.paths = paths or [] |
| 35 self.distribution = distribution | 35 self.distribution = distribution |
| 36 self.caller_reference = caller_reference | 36 self.caller_reference = caller_reference |
| 37 if not self.caller_reference: | 37 if not self.caller_reference: |
| 38 self.caller_reference = str(uuid.uuid4()) | 38 self.caller_reference = str(uuid.uuid4()) |
| 39 | 39 |
| 40 # If we passed in a distribution, | 40 # If we passed in a distribution, |
| 41 # then we use that as the connection object | 41 # then we use that as the connection object |
| 42 if distribution: | 42 if distribution: |
| 43 self.connection = connection | 43 self.connection = connection |
| 44 else: | 44 else: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 self.paths.append(value) | 88 self.paths.append(value) |
| 89 elif name == "Status": | 89 elif name == "Status": |
| 90 self.status = value | 90 self.status = value |
| 91 elif name == "Id": | 91 elif name == "Id": |
| 92 self.id = value | 92 self.id = value |
| 93 elif name == "CreateTime": | 93 elif name == "CreateTime": |
| 94 self.create_time = value | 94 self.create_time = value |
| 95 elif name == "CallerReference": | 95 elif name == "CallerReference": |
| 96 self.caller_reference = value | 96 self.caller_reference = value |
| 97 return None | 97 return None |
| OLD | NEW |