Skip to content

Instantly share code, notes, and snippets.

@sudorandom
Forked from underscorephil/order_quote_ips.py
Last active December 21, 2015 04:59
Show Gist options
  • Save sudorandom/6253703 to your computer and use it in GitHub Desktop.
Save sudorandom/6253703 to your computer and use it in GitHub Desktop.
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
apiUsername = ''
apiKey = ''
quoteId = '12345'
client = SoftLayer.Client(username=apiUsername, api_key=apiKey)
def getOrderContainer(quoteId):
quoteContainer = \
client['Billing_Order_Quote'].getRecalculatedOrderContainer(id=quoteId)
return quoteContainer['orderContainers'][0]
orderContainer = getOrderContainer(quoteId)
orderContainer['itemCategoryQuestionAnswers'] = [{
# How many of these new IPs will be in use within the next 30 days
'categoryId': 14,
'categoryCode': 'sec_ip_addresses',
'questionId': 14,
'answer': 2
}, {
# How many of these new IPs will be in use within the next 6 months
'categoryId': 14,
'categoryCode': 'sec_ip_addresses',
'questionId': 15,
'answer': 4
}, {
# Description of your need for additional IPs
'categoryId': 14,
'categoryCode': 'sec_ip_addresses',
'questionId': 16,
'answer': 'Brief description/explanation of the need for additional IPs.'
}, {
# Contact Name
'categoryId': 14,
'categoryCode': 'sec_ip_addresses',
'questionId': 9,
'answer': 'Jon Doe'
}, {
# Contact Job Title
'categoryId': 14,
'categoryCode': 'sec_ip_addresses',
'questionId': 10,
'answer': 'Network.'
}, {
# Contact Email
'categoryId': 14,
'categoryCode': 'sec_ip_addresses',
'questionId': 11,
'answer': '[email protected]'
}, {
# Contact Phone Number
'categoryId': 14,
'categoryCode': 'sec_ip_addresses',
'questionId': 12,
'answer': '555-555-5555'
}, {
# I agree that the contact information is valid
'categoryId': 14,
'categoryCode': 'sec_ip_addresses',
'questionId': 13,
'answer': '1'
}]
orderContainer['complexType'] = 'Container_Product_Order_Hardware_Server'
orderContainer['hardware'] = [
{'hostname': 'server01', 'domain': 'example.com'}
]
result = client['SoftLayer_Billing_Order_Quote'].verifyOrder(orderContainer)
pp(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment