softlayer / softlayer-ruby

http://softlayer.github.io/softlayer-ruby/
MIT License
54 stars 35 forks source link

Product Package Database Category Item Descriptions Too Vague #59

Closed ju2wheels closed 9 years ago

ju2wheels commented 9 years ago

When looking at item selections, the descriptions should be as unique as possible so as to clearly differentiate them. Most of the items look fine except for the ones returned by database as shown below.

Running:

sl_client = SoftLayer::Client.new(:api_key => ENV["SL_API_KEY"], :username => ENV["SL_API_USERNAME"])
vs_pkg = SoftLayer::ProductPackage.virtual_server_package(sl_client)
vs_pkg.categories.each{|item_cat| next unless item_cat.categoryCode == 'database'; puts item_cat.categoryCode; item_cat.configuration_options.each {|cat_opt| puts "\t#{cat_opt['price_id']} #{cat_opt['description']}: #{cat_opt['capacity']} #{cat_opt['units']}"} }

Gives this:

database
    40258 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    39738 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    40590 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40462 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40458 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40472 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40490 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40492 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40256 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40260 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40510 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40512 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40530 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40532 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40550 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40552 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40576 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40574 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40270 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40592 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40440 Microsoft SQL Server 2014 Express Edition: 0 N/A
    40600 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40290 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40288 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40610 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40308 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40310 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40620 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40330 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40332 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40630 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40356 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40354 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40376 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40374 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40392 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40390 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40410 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40420 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40430 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    27998 Riak Enterprise 1.3.0: 0 N/A
    27223 Riak 1.x: 0 N/A
    34960 MySQL for Linux:  
    36492 MySQL 5.7 for Windows: 0 
    36588 MySQL 5.0.51 for Windows: 0 N/A
    34923 MySQL 5.0 for Windows:  
    31648 MongoDB: 0 N/A
    23172 Microsoft SQL Server 2005 Express:  
    32367 Microsoft SQL Server 2005 Workgroup:  
    25297 Microsoft SQL Server 2005 Standard:  
    23079 Microsoft SQL Server 2005 Enterprise:  
    29504 Microsoft SQL Server 2008 Express:  
    33972 Microsoft SQL Server 2008 Web:  
    25417 Microsoft SQL Server 2008 Workgroup:  
    34065 Microsoft SQL Server 2008 Standard:  
    27150 Microsoft SQL Server 2008 Enterprise:  
    32718 Microsoft SQL Server 2008 Express R2:  
    31972 Microsoft SQL Server 2008 Web R2:  
    25600 Microsoft SQL Server 2008 Workgroup R2:  
    22515 Microsoft SQL Server 2008 Standard R2:  
    30560 Microsoft SQL Server 2008 Enterprise R2:  
    26800 Microsoft SQL Server 2012 Express Edition: 0 N/A
    30389 Microsoft SQL Server 2012 Web Edition: 0 N/A
    26337 Microsoft SQL Server 2012 Web Edition: 0 N/A
    26913 Microsoft SQL Server 2012 Web Edition: 0 N/A
    23557 Microsoft SQL Server 2012 Web Edition: 0 N/A
    33287 Microsoft SQL Server 2012 Web Edition: 0 N/A
    27436 Microsoft SQL Server 2012 Web Edition: 0 N/A
    28622 Microsoft SQL Server 2012 Web Edition: 0 N/A
    33101 Microsoft SQL Server 2012 Web Edition: 0 N/A
    33671 Microsoft SQL Server 2012 Web Edition: 0 N/A
    24891 Microsoft SQL Server 2012 Web Edition: 0 N/A
    31979 Microsoft SQL Server 2012 Web Edition: 0 N/A
    24309 Microsoft SQL Server 2012 Web Edition: 0 N/A
    32888 Microsoft SQL Server 2012 Web Edition: 0 N/A
    31131 Microsoft SQL Server 2012 Web Edition: 0 N/A
    27600 Microsoft SQL Server 2012 Web Edition: 0 N/A
    39818 Microsoft SQL Server 2012 Web Edition: 0 N/A
    33061 Microsoft SQL Server 2012 Web Edition: 0 N/A
    32312 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    28705 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    25816 Microsoft SQL Server 2012 Web Edition: 0 N/A
    32962 Microsoft SQL Server 2012 Web Edition: 0 N/A
    31420 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    34146 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    29826 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    23981 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    30054 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    26699 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    25337 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    24095 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    34425 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    30776 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    34592 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    23658 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    29441 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    22574 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    26076 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    30096 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    39798 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    31990 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    24810 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    28175 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    31655 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    26100 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32831 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    31680 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    30856 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    34652 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    29431 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32114 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    24504 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32487 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32822 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    30404 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    28079 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32135 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32990 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A

Whats the difference beyond potentially pricing? Is it arch/seat count/etc... Choosing the right id is useless here unless we know what we are ordering ;-) .

ju2wheels commented 9 years ago

Closing this, I cant reproduce it anymore, I think it may be a weird artifact of my having been using softlayer_api v3 in an irb instance and moved to 1.0.8 for testing while still leaving the same irb instance open with v3 stuff loaded and forgot.

sergiocarlosmorales commented 9 years ago

If you inspect the capacityRestrictionType, capacityRestrictionMinimum and capacityRestrictionMaximum properties of a price (http://sldn.softlayer.com/reference/datatypes/SoftLayer_Product_Item_Price), you'll be able to see which price ID is valid for the # of cores you are ordering with.

Example: Price ID 40458 has a capacityRestrictionType of CORE (which refers to the number of cores the VSI being ordered with), and both the capacityRestrictionMinimum and capacityRestrictionMaximum properties of the price have a value of 4. That means this price must be used if you want to order SQL Server 2014 STD version with a 4 core VSI.

Price ID 40458 has capacityRestrictionMinimum & Maximum of 1, so that price may be sent in a 1 core VSI order.

If you send-in the wrong price, say the MS SQL 4 core price as part of a 1 core VSI order, the order will fail verification. This is due to some products licensing scheme which is per-socket or per-core.

ju2wheels commented 9 years ago

Reopened, and updated my original post, messed up the provided example compared to what I was actually running thats why I couldnt reproduce.

ju2wheels commented 9 years ago

@sergiocarlosmorales makes sense, thank you. Is there a list of capacityRestrictionType potential values anywhere?

Will leave this open, would be nice to have had some sort of filter method as part of ProductPackage or include these fields in the results, seem pretty important to making an accurate selection.

ju2wheels commented 9 years ago

Considering adding sl_dynamic_attr of itemPriceReferences to ProductPackage and either merging with categories or pass it on to the item category initialization. If that change is ok with you guys I can take care of adding it.

@sergiocarlosmorales pls ignore previous question, will assume capacityRestrictionType must be of type product category item units unless told otherwise.

SLsthompson commented 9 years ago

You should probably include it in the object mask of the call to getConfiguration then extract it from the price items in the ProductItemCategory class. If you want to make a full-blown product item price class (instead of the "ProductConfigurationOption" object) that would be fine too. ProductConfigurationOption was created to match some behavior on the Python side and as a... er... conservation of effort measure.

ju2wheels commented 9 years ago

Works for me, I dont think going down a product item class route just to get the capacity restrictions is really necessary yet (it would be ignoring most of the item price data and retrieving only whats necessary to make an accurate category item selection).

Currently getting this (it works fine using a tweaked mask with getItemPriceReferences as a separate call though):

data = sl_client[:Product_Package].object_with_id(46).object_mask("mask[package.itemPriceReferences.itemPrice.capacityRestrictionMaximum,package.itemPriceReferences.itemPrice.capacityRestrictionMinimum,package.itemPriceReferences.itemPrice.capacityRestrictionType,package.itemPriceReferences.itemPrice.requiredCoreCount]").getConfiguration()
RuntimeError: HTTP-Error: 500 Internal Server Error
    from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:549:in `do_rpc'
    from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:420:in `call2'
    from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:410:in `call'
    from /var/lib/gems/1.9.1/gems/softlayer_api-3.0.0/lib/softlayer/Service.rb:281:in `call_softlayer_api_with_params'
    from /var/lib/gems/1.9.1/gems/softlayer_api-3.0.0/lib/softlayer/APIParameterFilter.rb:194:in `method_missing'
    from (irb):16
    from /usr/bin/irb:12:in `<main>'

Adding it to getCategories instead...