Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Example of ordering an hourly pre-set configuration bare metal server
import os
import pprint
import SoftLayer
client = SoftLayer.Client(username=os.environ['SLUSERNAME'], api_key=os.environ['SLAPIKEY'], endpoint_url=SoftLayer.API_PUBLIC_ENDPOINT)
hw = {
'datacenter': {'name': 'tor01'},
'hostname': 'simplebmi',
'domain': 'test.com',
'hourlyBillingFlag': True,
'fixedConfigurationPreset': {'keyName': 'S1270_8GB_2X1TBSATA_NORAID'},
'networkComponents': [{
'maxSpeed': 1000,
# 'redundancyEnabledFlag': True,
}],
'operatingSystemReferenceCode': 'UBUNTU_14_64',
}
# this just verifies the order
productOrder = client['Hardware'].generateOrderTemplate(hw)
order = client['Product_Order'].verifyOrder(productOrder)
# to really order:
# order = client['Hardware'].createObject(productOrder)
pprint.pprint(order)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment