Skip to content

Instantly share code, notes, and snippets.

@sudorandom
Forked from underscorephil/template_id_by_name.py
Created August 17, 2013 15:52
Show Gist options
  • Save sudorandom/6257555 to your computer and use it in GitHub Desktop.
Save sudorandom/6257555 to your computer and use it in GitHub Desktop.
import SoftLayer
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
def getImageTemplateId(templateName):
client = SoftLayer.Client(username=apiUsername, api_key=apiKey)
templates = client['Account'].getBlockDeviceTemplateGroups()
for template in templates:
if template['name'] == templateName:
return template['id']
pp(getImageTemplateId('Image Name Here'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment