plntr-fakes3 1.0.0.pre.10alpha46 → 1.0.0.pre.10alpha47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fakes3/server.rb +12 -16
- data/lib/fakes3/version.rb +1 -1
- data/lib/fakes3/xml_adapter.rb +26 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6199fe28260288a5dd88de8f495388a37d2032527eacf177dded63ecc984d8e5
|
4
|
+
data.tar.gz: 02116b1ce0d287335a2e6d88f81fc9e73f7f2cff3bad48c33e22b0ba1ec1f111
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9de3d9bc2699a6014c4f8278b6fb810a0a13a2d033fd963b1bfb617e273557ebafeccb8552bb02c9fbc4158156b0e0c82aa88e2c377682d3331256a626d8b3ee
|
7
|
+
data.tar.gz: b28af92f0a0737a61e9703462316ed5008e4ec042c1edd65f139d8f00718fe8b51a2082479058cd3533f9c3097031482be0d5f4062f51d470d1dda8d415f75b9
|
data/lib/fakes3/server.rb
CHANGED
@@ -340,28 +340,24 @@ module FakeS3
|
|
340
340
|
warn "bucket: #{s_req.bucket}"
|
341
341
|
objects = parse_delete_objects s_req.webrick_request
|
342
342
|
bucket_obj = @store.get_bucket(s_req.bucket)
|
343
|
-
|
344
|
-
response.body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
345
|
-
response.body << "<DeleteResult>\n"
|
346
|
-
objects.each do |obj|
|
343
|
+
results = objects.collect do |obj|
|
347
344
|
warn "process key=#{obj[:key]} version_id=#{obj[:version_id]}"
|
348
345
|
if not obj[:version_id].nil?
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
</Error>
|
355
|
-
eos
|
346
|
+
{
|
347
|
+
key: obj[:key],
|
348
|
+
code: 'XXX_Unimplmented_XXX',
|
349
|
+
message: 'Deletion of object verions is not implemented',
|
350
|
+
}
|
356
351
|
else
|
357
352
|
@store.delete_object(bucket_obj, obj[:key])
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
</Deleted>
|
362
|
-
eos
|
353
|
+
{
|
354
|
+
key: obj[:key],
|
355
|
+
}
|
363
356
|
end
|
364
357
|
end
|
358
|
+
|
359
|
+
response.status = 200
|
360
|
+
response.body = XmlAdapter.delete_objects_result(results)
|
365
361
|
response.body << "</DeleteResult>"
|
366
362
|
warn '--- RESPONSE ---'
|
367
363
|
warn response.body
|
data/lib/fakes3/version.rb
CHANGED
data/lib/fakes3/xml_adapter.rb
CHANGED
@@ -218,5 +218,31 @@ module FakeS3
|
|
218
218
|
}
|
219
219
|
output
|
220
220
|
end
|
221
|
+
|
222
|
+
# <CompleteMultipartUploadResult>
|
223
|
+
# <Location>http://Example-Bucket.s3.amazonaws.com/Example-Object</Location>
|
224
|
+
# <Bucket>Example-Bucket</Bucket>
|
225
|
+
# <Key>Example-Object</Key>
|
226
|
+
# <ETag>"3858f62230ac3c915f300c664312c11f-9"</ETag>
|
227
|
+
# </CompleteMultipartUploadResult>
|
228
|
+
def self.delete_objects_result(results)
|
229
|
+
output = ""
|
230
|
+
xml = Builder::XmlMarkup.new(:target => output)
|
231
|
+
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
232
|
+
xml.DeleteResult { |lst|
|
233
|
+
results.each do |res|
|
234
|
+
if res[:error]
|
235
|
+
lst.Error { |err|
|
236
|
+
err.Key(res[:key])
|
237
|
+
err.Code(res[:code])
|
238
|
+
err.Code(res[:message])
|
239
|
+
}
|
240
|
+
else
|
241
|
+
lst.Deleted { |del| del.Key(res[:key]) }
|
242
|
+
end
|
243
|
+
end
|
244
|
+
}
|
245
|
+
output
|
246
|
+
end
|
221
247
|
end
|
222
248
|
end
|