Created
March 14, 2014 17:48
-
-
Save ryanrhanson/9552967 to your computer and use it in GitHub Desktop.
Flex image capture - Python
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 | |
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