Last active
February 2, 2017 17:57
-
-
Save underscorephil/4067388 to your computer and use it in GitHub Desktop.
Retrieve imageTemplateId by name
This file contains hidden or 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 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