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
import os | |
import pprint | |
import SoftLayer | |
# !!!!! To run this you must also get getOrderItemsDict() and supporting functions | |
# from: https://gist.github.com/bmpotter/db0c5feda536f2d502cd | |
# Main - Order a bare metal svr using the more involved, but more flexible, product package method. |
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
import os | |
import sys | |
from pprint import pprint as pp | |
import SoftLayer | |
# !!!!! To run this you must also get getOrderItemsDict() and supporting functions | |
# from: https://gist.github.com/bmpotter/db0c5feda536f2d502cd | |
def getPresetsDict(client, pkgId=200): |
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
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, |
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
import os | |
import sys | |
from pprint import pprint as pp | |
import SoftLayer | |
def getOrderItemsDict(client, pkgId, location=None, displayFiltered=False): | |
'''Get all of the item price objects for the given pkg, keyed by the keyName, with the id as the value, | |
and organize these keyName/id pairs by category. The issue here is that keyName is the same between accounts, | |
the id is not. But it is the id that we need to pass into the order. | |
If location==None, return only the location independent price objects. |
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
{'av_spyware_protection': {'catName': 'Anti-Virus & Spyware Protection', | |
'isRequired': False, | |
'items': {'MCAFEE_VIRUSSCAN_ANTIVIRUS_WINDOWS': {'description': 'McAfee VirusScan Enterprise', | |
'fee': '0', | |
'hourlyFee': '0', | |
'id': 397, | |
'locationGroupId': '', | |
'priceId': 594}}}, | |
'bandwidth': {'catName': 'Public Bandwidth', | |
'isRequired': True, |
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
import os | |
import pprint | |
import SoftLayer | |
client = SoftLayer.Client(username=os.environ['SLUSERNAME'], api_key=os.environ['SLAPIKEY'], endpoint_url=SoftLayer.API_PUBLIC_ENDPOINT) | |
mask = 'id, name, description, type.keyName, items.id, items.description, items.categories.categoryCode' | |
# We only want pkgs that include a server category because there are some older packages without a server category | |
# that can not be used any more. | |
filterStr = { | |
"items": {"categories": {"categoryCode": {"operation":"server"} } }, |
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
[{'id': 56, | |
'name': 'Quad Processor Multi Core Nehalem EX', | |
'server': ['Quad Intel Xeon E7-4850 (10 Cores, 2.00 GHz)'], | |
'type': {'keyName': 'BARE_METAL_CPU'}}, | |
{'id': 126, | |
'name': 'Single Xeon 1200 Series (Sandy Bridge / Haswell)', | |
'server': ['Single Intel Xeon E3-1270 v3 (4 Cores, 3.50 GHz)', | |
'Single Intel Xeon E3-1270 (4 Cores, 3.40 GHz)'], | |
'type': {'keyName': 'BARE_METAL_CPU'}}, | |
{'id': 142, |
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
import os | |
import pprint | |
import SoftLayer | |
client = SoftLayer.Client(username=os.environ['SLUSERNAME'], api_key=os.environ['SLAPIKEY'], endpoint_url=SoftLayer.API_PUBLIC_ENDPOINT) | |
# Call this repeatedly while the bare metal server is being provisioned, until provisionDate is filled in. | |
mask = 'mask[id,fullyQualifiedDomainName,provisionDate,hardwareStatus,lastTransaction[elapsedSeconds,transactionStatus[friendlyName]],operatingSystem[id,passwords[password,username]]]' | |
hostname = 'simplebmi' | |
domain = 'test.com' | |
filterStr = {"hardware":{"hostname":{"operation":hostname},"domain":{"operation":domain}}} |
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
import os | |
import pprint | |
import SoftLayer | |
client = SoftLayer.Client(username=os.environ['SLUSERNAME'], api_key=os.environ['SLAPIKEY'], endpoint_url=SoftLayer.API_PUBLIC_ENDPOINT) | |
pkgId = 200 | |
mask = 'id, description, keyName, totalMinimumRecurringFee, configuration, configuration.price.hourlyRecurringFee, configuration.price.item.keyName' | |
# http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getActivePresets | |
presets = client['Product_Package'].getActivePresets(id=pkgId, mask=mask) |
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
{'datacenters': [{'template': {'datacenter': {'name': 'ams01'}}}, | |
{'template': {'datacenter': {'name': 'ams03'}}}, | |
{'template': {'datacenter': {'name': 'dal01'}}}, | |
{'template': {'datacenter': {'name': 'dal05'}}}, | |
{'template': {'datacenter': {'name': 'dal06'}}}, | |
{'template': {'datacenter': {'name': 'dal09'}}}, | |
{'template': {'datacenter': {'name': 'fra02'}}}, | |
{'template': {'datacenter': {'name': 'hkg02'}}}, | |
{'template': {'datacenter': {'name': 'hou02'}}}, | |
{'template': {'datacenter': {'name': 'lon02'}}}, |