Skip to content

Instantly share code, notes, and snippets.

@ju2wheels
Last active August 29, 2015 14:08
Show Gist options
  • Save ju2wheels/7c9d5bed2542485756fe to your computer and use it in GitHub Desktop.
Save ju2wheels/7c9d5bed2542485756fe to your computer and use it in GitHub Desktop.
SoftLayer Product Package Listing
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