Class: Chef::Knife::SceAddressOfferings
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::SceAddressOfferings
- Includes:
- SceBase
- Defined in:
- lib/chef/knife/sce_address_offerings.rb
Instance Method Summary collapse
Methods included from SceBase
#connection, #connection_storage, #datacenter_id, included, #locate_config_value, #msg_pair, #validate!
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/chef/knife/sce_address_offerings.rb', line 33 def run $stdout.sync = true validate! offer_list = [ ui.color('Offering ID', :bold), ui.color("Location", :bold), ui.color('Price', :bold) ].flatten.compact output_column_count = offer_list.length address_offerings = connection.list_address_offerings[:body]["addresses"] address_offerings.each do |offer| did = datacenter_id if did.nil? or did.eql?( offer["location"] ) offer_list << offer["id"].to_s offer_list << connection.locations.get(offer["location"]).name offer_list << "#{offer['price']['rate']}#{offer['price']['currencyCode']}/#{offer['price']['pricePerQuantity']}#{offer['price']['unitOfMeasure']}" end end puts "\n" puts ui.list(offer_list, :uneven_columns_across, output_column_count) end |