Skip to content

Instantly share code, notes, and snippets.

@underscorephil
Last active February 2, 2017 17:57
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Retrieve imageTemplateId by name
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