Class: VagrantPlugins::Sakura::Action::ListId
- Inherits:
-
Object
- Object
- VagrantPlugins::Sakura::Action::ListId
- Defined in:
- lib/vagrant-sakura/action/list_id.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ListId
constructor
A new instance of ListId.
Constructor Details
#initialize(app, env) ⇒ ListId
Returns a new instance of ListId.
5 6 7 |
# File 'lib/vagrant-sakura/action/list_id.rb', line 5 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vagrant-sakura/action/list_id.rb', line 9 def call(env) api = env[:sakura_api] puts "Zone: %s" % env[:machine].provider_config.zone_id puts "" puts "---- Archives ----" puts "%-14s %5s %s" % ["ID", "Size", "Name"] r = api.get("/archive") r["Archives"].sort { |a, b| a["DisplayOrder"] <=> b["DisplayOrder"] }.each { |archive| gb = archive["SizeMB"] / 1024 puts "%-14u %3uGB %s" % [archive["ID"], gb, archive["Name"]] } puts "" puts "---- Server Plans ----" puts "%-7s %-70s" % ["ID", "Name"] r = api.get("/product/server") r["ServerPlans"].each { |plan| puts "%-7u %s" % [plan["ID"], plan["Name"]] } puts "" @app.call(env) end |