Skip to content

Instantly share code, notes, and snippets.

@underscorephil
Created February 27, 2015 15:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save underscorephil/377bd50e71ac02377008 to your computer and use it in GitHub Desktop.
Save underscorephil/377bd50e71ac02377008 to your computer and use it in GitHub Desktop.
import SoftLayer
import json
import SoftLayer.API
from pprint import pprint as pp
# DIST MASTER ACCOUNT API INFORMATION
username = "CHANGE_ME" #change me
apiKey = "CHANGE_ME" #change me
# New Sub-brand
# Short and to the point, such as "COMPANY_NA_PARTNER"
# Must be unique, so spaces, alpha and underscores only
keyName = "" #change me
# Name of the VAR/Sub-Account
# Example "Distributor Company - Corporate" or "DistCo - ACME Partner"
longName = "" #change me
name = longName # leave as-is
# New Account paired to the new sub-brand -- this is not an end-user account, but "is" the sub-brand
companyname = longName + ' - Master Account' # default good practice left as-is, but can be changed
firstname = "" #change me
lastname = "" #change me
address = "" #change me
city = "" #change me
state = "" #change me
country = "" #change me -- two letter ISO code
zipcode = "" #change me
phone = "" #change me
email = "" #change me
# BUILD THE DATA
cust_account = {
"companyName": companyname,
"firstName": firstname,
"lastName": lastname,
"address1": address,
"postalCode": zipcode,
"city": city,
"state": state,
"country": country,
"officePhone": phone,
"email": email,
"lateFeeProtectionFlag": True,
"claimedTaxExemptTxFlag": False,
"allowedPptpVpnQuantity": 1,
"isReseller": 0,
"accountStatusId": 1001 # 1001 = Active Account
}
cust_brand = {
"keyName": keyName,
"longName": longName,
"name": name,
"account": cust_account
}
# EXECUTE IT
print("\n")
pp(cust_brand)
print("\n")
null = raw_input("Press Enter to create this brand in production... This cannot be undone.")
print("\n")
client = SoftLayer.Client(
username= username,
api_key = apiKey,
)
try:
result = client['Brand'].createObject(cust_brand)
print ()
print ("Result = ", json.dumps(result, indent=2))
except SoftLayer.SoftLayerAPIError as e:
print("Error: %s, %s" % (e.faultCode, e.faultString))
exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment