Class: VagrantPlugins::NiftyCloud::Action::TerminateInstance
- Inherits:
-
Object
- Object
- VagrantPlugins::NiftyCloud::Action::TerminateInstance
- Defined in:
- lib/vagrant-niftycloud/action/terminate_instance.rb
Overview
This terminates the running instance.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ TerminateInstance
constructor
A new instance of TerminateInstance.
Constructor Details
#initialize(app, env) ⇒ TerminateInstance
Returns a new instance of TerminateInstance.
9 10 11 12 |
# File 'lib/vagrant-niftycloud/action/terminate_instance.rb', line 9 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_niftycloud::action::terminate_instance") end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vagrant-niftycloud/action/terminate_instance.rb', line 14 def call(env) # 例外の定義は以下参照 # http://cloud.nifty.com/api/sdk/rdoc/ begin # terminate処理 response = env[:niftycloud_compute].delete(env) env[:machine].id = nil @app.call(env) rescue NIFTY::ConfigurationError => e raise Errors::NiftyCloudConfigurationError, :message => e. rescue NIFTY::ArgumentError => e raise Errors::NiftyCloudArgumentError, :message => e. rescue NIFTY::ResponseFormatError => e raise Errors::NiftyCloudResponseFormatError, :message => e. rescue NIFTY::ResponseError => e raise Errors::NiftyCloudResponseError, :code => e.error_code, :message => e. end end |