def copy_object(self, kwargs): """ This operation copies one s3 object to another location in s3. If either the bucket of the source or the destination does not exist, an error message will be sent stating that the bucket does not exist. """ bucket = kwargs['bucket'] key = kwargs['key'] copy_source = kwargs['copy_source'] src_bucket, src_key = find_bucket_key(copy_source) response_data = {} etag = '' if bucket in self.session.s3 or src_bucket in self.session.s3: src = self.session.s3[src_bucket][src_key] self.session.s3[bucket][key] = src else: response_data['Errors'] = [{'Message': 'Bucket does not exist'}] return FakeHttp(etag), response_data
def copy_object(self, kwargs): """ This operation copies one s3 object to another location in s3. If either the bucket of the source or the destination does not exist, an error message will be sent stating that the bucket does not exist. """ bucket = kwargs['bucket'] key = kwargs['key'] copy_source = kwargs['copy_source'] src_bucket, src_key = find_bucket_key(copy_source) if not isinstance(src_key, text_type) and hasattr(src_key, 'decode'): src_key = src_key.decode('utf-8') response_data = {} etag = '' if bucket in self.session.s3 or src_bucket in self.session.s3: src = self.session.s3[src_bucket][src_key] self.session.s3[bucket][key] = src else: response_data['Errors'] = [{'Message': 'Bucket does not exist'}] response_data['ETag'] = '"%s"' % etag return FakeHttp(), response_data
def copy_object(self, kwargs): """ This operation copies one s3 object to another location in s3. If either the bucket of the source or the destination does not exist, an error message will be sent stating that the bucket does not exist. """ bucket = kwargs["bucket"] key = kwargs["key"] copy_source = kwargs["copy_source"] src_bucket, src_key = find_bucket_key(copy_source) if not isinstance(src_key, text_type) and hasattr(src_key, "decode"): src_key = src_key.decode("utf-8") response_data = {} etag = "" if bucket in self.session.s3 or src_bucket in self.session.s3: src = self.session.s3[src_bucket][src_key] self.session.s3[bucket][key] = src else: response_data["Errors"] = [{"Message": "Bucket does not exist"}] response_data["ETag"] = '"%s"' % etag return FakeHttp(), response_data