Skip to content

Instantly share code, notes, and snippets.

import SoftLayer
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
client = SoftLayer.Client(username=apiUsername, api_key=apiKey)
records = [
{
require 'rubygems'
require 'softlayer_api'
$SL_API_USERNAME = "" # enter your username here
$SL_API_KEY = ""
virtual_guest_service = SoftLayer::Service.new("SoftLayer_Virtual_Guest")
begin
templateObject = {
@underscorephil
underscorephil / gist:4271461
Last active October 13, 2015 23:18
SoftLayer_Virtual_Guest::createObject - PHP
<?php
require_once('softlayer-api-php-client/SoftLayer/SoapClient.class.php');
$apiUsername = '';
$apiKey = '';
$client = Softlayer_SoapClient::getClient('SoftLayer_Virtual_Guest', null, $apiUsername, $apiKey);
try {
$templateObject = new stdClass();
$templateObject->hostname = 'test1';
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
@underscorephil
underscorephil / order_dedicated_flex_image.py
Last active October 13, 2015 16:48
Order dedicated server from a Flex Image
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
@underscorephil
underscorephil / gist:4125357
Created November 21, 2012 15:14
Get required price options for package
<?php
require_once('softlayer-api-php-client/SoftLayer/SoapClient.class.php');
/**
* Set your SoftLayer API username and key.
*/
$apiUsername = '';
$apiKey = '';
$packageId = 46;
@underscorephil
underscorephil / template_id_by_name.py
Last active February 2, 2017 17:57
Retrieve imageTemplateId by name
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:
@underscorephil
underscorephil / gist:4067364
Last active October 12, 2015 18:18
Retrieve required price options
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(
@underscorephil
underscorephil / gist:4067337
Last active October 12, 2015 18:18
Order a monthly billed virtual server in Python based on an existing image template
import SoftLayer.API
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
templateId =
client = SoftLayer.API.Client('SoftLayer_Product_Order', None, apiUsername, apiKey)
mask[
id;
uplinkComponent[
id;
hardware[
fullyQualifiedDomainName;
id;
hardwareChassis[
id;
hardwareFunction.code