| OLD | NEW |
| 1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ |
| 2 # Copyright (c) 2010, Eucalyptus Systems, Inc. | 2 # Copyright (c) 2010, Eucalyptus Systems, Inc. |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Permission is hereby granted, free of charge, to any person obtaining a | 5 # Permission is hereby granted, free of charge, to any person obtaining a |
| 6 # copy of this software and associated documentation files (the | 6 # copy of this software and associated documentation files (the |
| 7 # "Software"), to deal in the Software without restriction, including | 7 # "Software"), to deal in the Software without restriction, including |
| 8 # without limitation the rights to use, copy, modify, merge, publish, dis- | 8 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 9 # tribute, sublicense, and/or sell copies of the Software, and to permit | 9 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 10 # persons to whom the Software is furnished to do so, subject to the fol- | 10 # persons to whom the Software is furnished to do so, subject to the fol- |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 src_bucket = self | 552 src_bucket = self |
| 553 else: | 553 else: |
| 554 src_bucket = self.connection.get_bucket(src_bucket_name) | 554 src_bucket = self.connection.get_bucket(src_bucket_name) |
| 555 acl = src_bucket.get_xml_acl(src_key_name) | 555 acl = src_bucket.get_xml_acl(src_key_name) |
| 556 if encrypt_key: | 556 if encrypt_key: |
| 557 headers[provider.server_side_encryption_header] = 'AES256' | 557 headers[provider.server_side_encryption_header] = 'AES256' |
| 558 src = '%s/%s' % (src_bucket_name, urllib.quote(src_key_name)) | 558 src = '%s/%s' % (src_bucket_name, urllib.quote(src_key_name)) |
| 559 if src_version_id: | 559 if src_version_id: |
| 560 src += '?version_id=%s' % src_version_id | 560 src += '?version_id=%s' % src_version_id |
| 561 headers = {provider.copy_source_header : str(src)} | 561 headers = {provider.copy_source_header : str(src)} |
| 562 headers[provider.storage_class_header] = storage_class | 562 # make sure storage_class_header key exists before accessing it |
| 563 if provider.storage_class_header: |
| 564 headers[provider.storage_class_header] = storage_class |
| 563 if metadata: | 565 if metadata: |
| 564 headers[provider.metadata_directive_header] = 'REPLACE' | 566 headers[provider.metadata_directive_header] = 'REPLACE' |
| 565 headers = boto.utils.merge_meta(headers, metadata, provider) | 567 headers = boto.utils.merge_meta(headers, metadata, provider) |
| 566 else: | 568 else: |
| 567 headers[provider.metadata_directive_header] = 'COPY' | 569 headers[provider.metadata_directive_header] = 'COPY' |
| 568 response = self.connection.make_request('PUT', self.name, new_key_name, | 570 response = self.connection.make_request('PUT', self.name, new_key_name, |
| 569 headers=headers) | 571 headers=headers) |
| 570 body = response.read() | 572 body = response.read() |
| 571 if response.status == 200: | 573 if response.status == 200: |
| 572 key = self.new_key(new_key_name) | 574 key = self.new_key(new_key_name) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 query_args += '&versionId=%s' % version_id | 609 query_args += '&versionId=%s' % version_id |
| 608 response = self.connection.make_request('GET', self.name, key_name, | 610 response = self.connection.make_request('GET', self.name, key_name, |
| 609 query_args=query_args, | 611 query_args=query_args, |
| 610 headers=headers) | 612 headers=headers) |
| 611 body = response.read() | 613 body = response.read() |
| 612 if response.status != 200: | 614 if response.status != 200: |
| 613 raise self.connection.provider.storage_response_error( | 615 raise self.connection.provider.storage_response_error( |
| 614 response.status, response.reason, body) | 616 response.status, response.reason, body) |
| 615 return body | 617 return body |
| 616 | 618 |
| 617 def set_xml_acl(self, acl_str, key_name='', headers=None, version_id=None): | 619 def set_xml_acl(self, acl_str, key_name='', headers=None, version_id=None, |
| 618 query_args = 'acl' | 620 query_args='acl'): |
| 619 if version_id: | 621 if version_id: |
| 620 query_args += '&versionId=%s' % version_id | 622 query_args += '&versionId=%s' % version_id |
| 621 response = self.connection.make_request('PUT', self.name, key_name, | 623 response = self.connection.make_request('PUT', self.name, key_name, |
| 622 data=acl_str.encode('ISO-8859-1'
), | 624 data=acl_str.encode('ISO-8859-1'
), |
| 623 query_args=query_args, | 625 query_args=query_args, |
| 624 headers=headers) | 626 headers=headers) |
| 625 body = response.read() | 627 body = response.read() |
| 626 if response.status != 200: | 628 if response.status != 200: |
| 627 raise self.connection.provider.storage_response_error( | 629 raise self.connection.provider.storage_response_error( |
| 628 response.status, response.reason, body) | 630 response.status, response.reason, body) |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 query_args=query_args, | 1201 query_args=query_args, |
| 1200 headers=headers) | 1202 headers=headers) |
| 1201 body = response.read() | 1203 body = response.read() |
| 1202 boto.log.debug(body) | 1204 boto.log.debug(body) |
| 1203 if response.status != 204: | 1205 if response.status != 204: |
| 1204 raise self.connection.provider.storage_response_error( | 1206 raise self.connection.provider.storage_response_error( |
| 1205 response.status, response.reason, body) | 1207 response.status, response.reason, body) |
| 1206 | 1208 |
| 1207 def delete(self, headers=None): | 1209 def delete(self, headers=None): |
| 1208 return self.connection.delete_bucket(self.name, headers=headers) | 1210 return self.connection.delete_bucket(self.name, headers=headers) |
| OLD | NEW |