November 23, 2017

Share image template.

The script shares an image template to another account, it makes
a single call to SoftLayer_Virtual_Guest_Block_Device_Template_Group::permitSharingAccess
For more information please see below.

Important manual pages

Author: SoftLayer Technologies, Inc. <>
import SoftLayer
from pprint import pprint as pp

# Your SoftLayer API username and key.
API_USERNAME = 'set me'

# Generate one at
API_KEY = 'set me'

The image template which you wish to share
To get the list of images templates in your account 
call the Softlayer_Account::getPrivateBlockDeviceTemplateGroups method
imageTemplateId = 1796623

# the account you wish to share the image template
accountToShare = 207819

# Declare the API client
client = SoftLayer.create_client_from_env(username=API_USERNAME, api_key=API_KEY)
blockDeviceTemplateGroupService = client['SoftLayer_Virtual_Guest_Block_Device_Template_Group']

    # Calling the permitSharingAccess method to share the image template
    result = blockDeviceTemplateGroupService.permitSharingAccess(accountToShare, id=imageTemplateId)
except SoftLayer.SoftLayerAPIError as e:
    # If there was an error returned from the SoftLayer API then bomb out with the
    # error message.
    print("Unable to share the image template. \nfaultCode= %s, \nfaultString= %s"
          % (e.faultCode, e.faultString))


We would love to hear it
Open an issue