Created
January 9, 2014 09:39
-
-
Save liouxiao/8331752 to your computer and use it in GitHub Desktop.
An sample python code to order a bare-metal server in SoftLayer.
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
#!/usr/bin/env python | |
import SoftLayer | |
client = SoftLayer.Client() | |
mgr = SoftLayer.HardwareManager(client) | |
order = { | |
'location': 'FIRST_AVAILABLE', | |
'hostname': 'myserver', | |
'domain': 'sampledomain.com', | |
'bare_metal': True, | |
'hourly': True, # to order an hourly-charged bare-metal server! | |
'server': 26219, # 2 x 2.0 GHz Core Bare Metal Instance - 2 GB Ram | |
'os': 32353, # Ubuntu 12.04 64bit | |
'disks': [29372], # with one 250GB SATA II disk | |
'port_speed': 26737 # 100 Mbps Public & Private Networks | |
} | |
print mgr.verify_order(**order) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's the output (formatted) - unfortunately the returned "useHourlyPricing" is set to "False" even I specify "hourly" to "True":
(URL: https://gist.github.com/liouxiao/8333416)
{
"preTaxSetup": "0",
"storageGroups": [],
"postTaxRecurring": "111.3",
"billingOrderItemId": "",
"presetId": "",
"hardware": [
{
"domain": "sampledomain.com",
"hostname": "myserver",
"serviceProviderId": "",
"bareMetalInstanceFlag": 1,
"hardwareStatusId": "",
"serviceProviderResourceId": "",
"account": {
"modifyDate": "",
"lateFeeProtectionFlag": "",
"createDate": "",
"accountStatusId": "",
"brandId": "",
"allowedPptpVpnQuantity": "",
"statusDate": "",
"isReseller": "",
"id": "",
"claimedTaxExemptTxFlag": ""
},
"primaryBackendNetworkComponent": {
"maxSpeed": "",
"modifyDate": "",
"networkVlanId": "",
"hardwareId": "",
"id": "",
"speed": "",
"port": ""
},
"id": "",
"primaryNetworkComponent": {
"maxSpeed": "",
"modifyDate": "",
"networkVlanId": "",
"hardwareId": "",
"id": "",
"speed": "",
"port": ""
},
"accountId": ""
}
],
"prices": [
{
"itemId": 1013,
"setupFee": "0",
"recurringFee": "111.3",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": ".35",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 26219,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"capacity": "2",
"description": "2 x 2.0 GHzCore Bare Metal Instance - 2 GB Ram",
"upgradeItemId": "",
"bundle": [
{
"category": {
"quantityLimit": 0,
"categoryCode": "ram",
"id": 3,
"name": "Ram"
},
"itemPrice": {
"itemId": 862,
"setupFee": "0",
"recurringFee": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 34690,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"capacity": "2",
"description": "2 GB",
"upgradeItemId": "",
"units": "GB",
"id": 862
},
"accountRestrictions": [],
"categories": [
{
"quantityLimit": 0,
"categoryCode": "ram",
"id": 3,
"name": "Ram"
}
],
"packageReferences": [
{
"itemPriceId": 34690,
"id": 289436,
"packageId": 50
}
],
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
"bundleItemId": 1013,
"itemPriceId": 34690,
"id": 5245
}
],
"units": "CORE",
"id": 1013
},
"categories": [
{
"quantityLimit": 20,
"categoryCode": "server_core",
"id": 110,
"name": "Bare Metal Instance"
}
],
"proratedRecurringFee": "86.167741935484",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 13,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 29372,
"sort": 99,
"item": {
"softwareDescriptionId": "",
"capacity": "250",
"description": "250GB SATA II",
"upgradeItemId": "",
"bundle": [],
"units": "GB",
"id": 13
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "disk0",
"id": 4,
"name": "First Hard Drive"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 4167,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 32353,
"sort": 9,
"item": {
"softwareDescription": {
"virtualizationPlatform": 0,
"name": "Ubuntu",
"referenceCode": "UBUNTU_12_32",
"requiredUser": "root",
"id": 1030,
"virtualLicense": 0,
"version": "12.04.0-32 LAMP for Bare Metal",
"upgradeSoftwareDescriptionId": "",
"upgradeSwDescId": "",
"attributes": [],
"longDescription": "Ubuntu / Ubuntu / 12.04.0-32 LAMP for Bare Metal",
"controlPanel": 0,
"operatingSystem": 1,
"manufacturer": "Ubuntu"
},
"softwareDescriptionId": 1030,
"capacity": "0",
"description": "Ubuntu Linux 12.04 LTS Precise Pangolin - LAMP Install (32 bit)",
"upgradeItemId": "",
"bundle": [],
"units": "N/A",
"id": 4167
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "os",
"id": 12,
"name": "Operating System"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 187,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 26737,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"capacity": "100",
"description": "100 Mbps Public & Private Networks",
"upgradeItemId": 188,
"bundle": [
{
"category": {
"quantityLimit": 0,
"categoryCode": "public_port",
"id": 8,
"name": "Public Network Port"
},
"itemPrice": {
"itemId": 26,
"setupFee": "0",
"recurringFee": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 31780,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"upgradeItemId": "",
"capacity": "100",
"description": "100 Mbps public uplink",
"id": 26
},
"accountRestrictions": [],
"packageReferences": [
{
"itemPriceId": 31780,
"id": 280072,
"packageId": 50
}
],
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
"bundleItemId": 187,
"itemPriceId": 31780,
"id": 5258
},
{
"category": {
"quantityLimit": 0,
"categoryCode": "service_port",
"id": 9,
"name": "Private Network Port"
},
"itemPrice": {
"itemId": 47,
"setupFee": "0",
"recurringFee": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 23017,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"upgradeItemId": "",
"capacity": "100",
"description": "100 Mbps private uplink",
"id": 47
},
"accountRestrictions": [],
"packageReferences": [
{
"itemPriceId": 23017,
"id": 254785,
"packageId": 50
}
],
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
"bundleItemId": 187,
"itemPriceId": 23017,
"id": 5269
}
],
"id": 187
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "port_speed",
"id": 26,
"name": "Uplink Port Speeds"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 15,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 34807,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"capacity": "1",
"description": "1 IP Address",
"upgradeItemId": "",
"bundle": [],
"id": 15
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "pri_ip_addresses",
"id": 13,
"name": "Primary IP Addresses"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 173,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"laborFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"sort": 0,
"item": {
"softwareDescriptionId": "",
"capacity": "5000",
"description": "5000 GB Bandwidth",
"upgradeItemId": 100,
"bundle": [],
"units": "GB",
"id": 173
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "bandwidth",
"id": 10,
"name": "Public Bandwidth"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"id": 27674,
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 50,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": ".007",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 34241,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"upgradeItemId": "",
"description": "Host Ping and TCP Service Monitoring",
"bundle": [],
"id": 50
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "monitoring",
"id": 20,
"name": "Monitoring"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 307,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 35310,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"upgradeItemId": "",
"description": "Nessus Vulnerability Assessment & Reporting",
"bundle": [],
"id": 307
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "vulnerability_scanner",
"id": 32,
"name": "Vulnerability Assessments & Management"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 53,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": ".007",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 34996,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"upgradeItemId": "",
"description": "Automated Reboot from Monitoring",
"bundle": [],
"id": 53
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "response",
"id": 22,
"name": "Response"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 309,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 33483,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"upgradeItemId": "",
"description": "Unlimited SSL VPN Users & 1 PPTP VPN User per account",
"bundle": [],
"id": 309
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "vpn_management",
"id": 31,
"name": "VPN Management - Private Network"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 503,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 23070,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"upgradeItemId": "",
"description": "Reboot / Remote Console",
"bundle": [],
"id": 503
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "remote_management",
"id": 46,
"name": "Remote Management"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
},
{
"itemId": 51,
"setupFee": "0",
"recurringFee": "0",
"proratedRecurringFeeTax": "0",
"recurringFeeTax": "0",
"hourlyRecurringFee": "0",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 32500,
"sort": 0,
"item": {
"softwareDescriptionId": "",
"upgradeItemId": "",
"description": "Email and Ticket",
"bundle": [],
"id": 51
},
"categories": [
{
"quantityLimit": 0,
"categoryCode": "notification",
"id": 21,
"name": "Notification"
}
],
"proratedRecurringFee": "0",
"oneTimeFeeTax": "0",
"laborFee": "0",
"onSaleFlag": "",
"quantity": ""
}
],
"sendQuoteEmailFlag": "",
"packageId": 50,
"useHourlyPricing": False,
"preTaxRecurringMonthly": "111.3",
"preTaxRecurring": "111.3",
"primaryDiskPartitionId": 1,
"locationObject": {
"activePresaleEvents": [],
"id": 168642,
"name": "sjc01",
"longName": "San Jose 1"
},
"isManagedOrder": 0,
"imageTemplateId": "",
"postTaxRecurringMonthly": "111.3",
"resourceGroupTemplateId": "",
"postTaxSetup": "0",
"location": "168642",
"stepId": "",
"proratedInitialCharge": "86.17",
"totalRecurringTax": "0",
"preTaxRecurringHourly": "0",
"sourceVirtualGuestId": "",
"bigDataOrderFlag": False,
"extendedHardwareTesting": "",
"resourceGroupId": "",
"postTaxRecurringHourly": "0",
"currencyShortName": "USD",
"containerSplHash": "0000000013e9959400007fd2136930f6",
"proratedOrderTotal": "86.17",
"serverCoreCount": 2,
"privateCloudOrderFlag": False,
"totalSetupTax": "0",
"quantity": 1
}