Last active
August 29, 2015 14:08
-
-
Save ju2wheels/7c9d5bed2542485756fe to your computer and use it in GitHub Desktop.
SoftLayer Product Package Listing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'softlayer_api' | |
sl_client = SoftLayer::Client.new(:api_key => ENV["SL_API_KEY"], :username => ENV["SL_API_USERNAME"], :timeout => 240) | |
pkgs = [SoftLayer::ProductPackage.bare_metal_instance_package(sl_client),SoftLayer::ProductPackage.virtual_server_package(sl_client),SoftLayer::ProductPackage.additional_products_package(sl_client)].concat(SoftLayer::ProductPackage.bare_metal_server_packages(sl_client)) | |
File.open("/tmp/sl_product_package_catagories.txt", "w") do |fout| | |
pkgs.each do |pkg| | |
fout.write "================#{pkg.name}===================\n" | |
pkg.categories.each do |item_cat| | |
fout.write "#{item_cat.categoryCode}\n" | |
item_cat.configuration_options.each do |cat_opt| | |
fout.write "\t#{Hash[cat_opt.each_pair.to_a].inspect}\n" | |
end | |
fout.puts | |
fout.puts | |
end | |
fout.puts | |
fout.puts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment