Skip to content

Instantly share code, notes, and snippets.

@ryanrhanson
Created March 14, 2014 17:48
Show Gist options
  • Save ryanrhanson/9552967 to your computer and use it in GitHub Desktop.
Save ryanrhanson/9552967 to your computer and use it in GitHub Desktop.
Flex image capture - Python
import SoftLayer
apiUser = <api user>
apiKey = <api key>
client = SoftLayer.Client(username=apiUser,api_key=apiKey)
serverId = <server id>
try:
flexImage = client['Hardware_Server'].captureImage(id=serverId)
print("Created Flex Image '%s' at %s" % (flexImage['name'],flexImage['createDate']))
print("GUID: %s" % (flexImage['globalIdentifier']))
except SoftLayer.SoftLayerAPIError as e:
print("Exception: faultCode %s, faultString %s" % (e.faultCode, e.faultString))
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment