Class: Visor::Image::DeleteAllImages
- Inherits:
-
Goliath::API
- Object
- Goliath::API
- Visor::Image::DeleteAllImages
- Includes:
- Common::Exception
- Defined in:
- lib/image/routes/delete_all_images.rb
Overview
Delete all images metadata
Instance Method Summary collapse
- #exit_error(code, message) ⇒ Object
-
#on_headers(env, headers) ⇒ Object
Pre-process headers as they arrive and load them into a environment variable.
- #response(env) ⇒ Object
Instance Method Details
#exit_error(code, message) ⇒ Object
35 36 37 38 |
# File 'lib/image/routes/delete_all_images.rb', line 35 def exit_error(code, ) logger.error [code, {}, {code: code, message: }] end |
#on_headers(env, headers) ⇒ Object
Pre-process headers as they arrive and load them into a environment variable.
17 18 19 20 |
# File 'lib/image/routes/delete_all_images.rb', line 17 def on_headers(env, headers) logger.debug "Received headers: #{headers.inspect}" env['headers'] = headers end |
#response(env) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/image/routes/delete_all_images.rb', line 22 def response(env) (env, vas) images = vms.get_images images.each { |image| vms.delete_image(image[:_id]) } [200, {}, nil] rescue Forbidden => e exit_error(403, e.) rescue NotFound => e exit_error(404, e.) rescue InternalError => e exit_error(503, e.) end |