November 23, 2017
Get the storage space prices to order an endurance space.

The script retrieves all the storage spaces prices which
meet an IOPS requirement and these prices are valid to
an arbitrary location.

Important manual pages:

Author: SoftLayer Technologies, Inc. <>

import SoftLayer
import json

USERNAME = 'set me'
API_KEY = 'set me'

# The package id to order endurance object storage.
packageId = 240

# value = 200 is for 2 IOPS per GB.
# value = 100 is for 0.25 IOPS per GB.
# value = 300 is for 4 IOPS per GB.
iops = 100

# The list of location group ids
# from where we wish to get the prices.
locationGroupIds = [505]

# Declares the API client.
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
productPackage = client['SoftLayer_Product_Package']

# Declares an object filter in order to get only the standard prices
# which are for storage spaces and meet the requirements for
# the configured IOPS.
objectFilter = {"items": {"prices": {"capacityRestrictionMaximum": {"operation": iops}, "categories": {"categoryCode": {"operation": "performance_storage_space"}}, "locationGroupId": {"operation": "in", "options": [{"name": "data", "value": [505]}]}}}}

    items = productPackage.getItems(id=packageId, filter=objectFilter)
    print(json.dumps(items, sort_keys=True, indent=2, separators=(',', ': ')))
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to get the prices. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))