Sha256: fd434afb799a096a404cdee42ab10d117dfbe9245cc5d5836c8ca4d7dd11ded2

Contents?: true

Size: 1005 Bytes

Versions: 10

Compression:

Stored size: 1005 Bytes

Contents

module VagrantPlugins
  module Sakura
    module Action
      class ListId
        def initialize(app, env)
          @app = app
        end

        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"].to_i <=> b["DisplayOrder"].to_i
          }.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
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vagrant-sakura-0.4.2 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.4.0 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.3.2 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.3.1 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.3.0 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.2.1 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.1.0 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.0.9 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.0.8 lib/vagrant-sakura/action/list_id.rb
vagrant-sakura-0.0.7 lib/vagrant-sakura/action/list_id.rb