This file contains 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
<?php | |
require_once('SoftLayer/SoapClient.class.php'); | |
/** | |
* Set your SoftLayer API username and key. | |
*/ | |
$apiUsername = ''; | |
$apiKey = ''; |
This file contains 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
function _getFtpCredentials() { | |
$accountClient = SoftLayer_SoapClient::getClient('SoftLayer_Account', null, API_USER, API_KEY); | |
$transcodeAccount = array_shift($accountClient->getTranscodeAccounts()); | |
$transcodeAccountClient = SoftLayer_SoapClient::getClient('SoftLayer_Network_Media_Transcode_Account', $transcodeAccount->id, API_USER, API_KEY); | |
return($transcodeAccountClient->getFtpAttributes()); | |
} |
This file contains 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
function _getObjectStorageClient() { | |
$options = array('adapter' => ObjectStorage_Http_Client::SOCKET, 'timeout' => 10); | |
$host = 'https://dal05.objectstorage.softlayer.net'; // the SoftLayer Object Storage API host | |
$username = OBJSTOR_USER; // user name and password is display at https://manage.softlayer.com/ObjectStorage/index | |
$password = API_KEY; | |
return new ObjectStorage($host, $username, $password, $options); | |
} |
This file contains 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.API | |
import pprint | |
def table_print(data, title_row): | |
max_widths = {} | |
data_copy = [dict(title_row)] + list(data) | |
for col in data_copy[0].keys(): | |
max_widths[col] = max([len(str(row[col])) for row in data_copy]) | |
cols_order = [tup[0] for tup in title_row] |
This file contains 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
# So we can talk to the SoftLayer API, grab the current date | |
# and structured list/dict output | |
import SoftLayer.API | |
import datetime | |
from pprint import pprint as pp | |
# Find the priceId for the RAM item matching our defined memory allotment | |
def getMemoryPrice(memoryCapacity): | |
packageClient = SoftLayer.API.Client('SoftLayer_Product_Package', 46, apiUsername, apiKey) |
This file contains 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
mask[ | |
id; | |
uplinkComponent[ | |
id; | |
hardware[ | |
fullyQualifiedDomainName; | |
id; | |
hardwareChassis[ | |
id; | |
hardwareFunction.code |
This file contains 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.API | |
from pprint import pprint as pp | |
apiUsername = '' | |
apiKey = '' | |
templateId = | |
client = SoftLayer.API.Client('SoftLayer_Product_Order', None, apiUsername, apiKey) |
This file contains 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 | |
apiUsername = '' | |
apiKey = '' | |
package = 46 | |
client = SoftLayer.Client(username=apiUsername, api_key=apiKey) | |
categoryObjectMask = "mask[isRequired, itemCategory[id, name]]" | |
configurations = client['Product_Package'].getConfiguration( |
This file contains 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: |
This file contains 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
<?php | |
require_once('softlayer-api-php-client/SoftLayer/SoapClient.class.php'); | |
/** | |
* Set your SoftLayer API username and key. | |
*/ | |
$apiUsername = ''; | |
$apiKey = ''; | |
$packageId = 46; |
OlderNewer