Skip to content

Instantly share code, notes, and snippets.

@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:
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 = {
import SoftLayer.API
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
passwordClient = SoftLayer.API.Client(
'SoftLayer_Software_Component_Password', None, apiUsername, apiKey)
{
"parameters":[
"tag1, tag2, tag3",
]
}
import SoftLayer
from SoftLayer import utils
import sys
import pprint
import logging
apiUsername = ''
apiKey = ''
@underscorephil
underscorephil / gist:3790139
Created September 26, 2012 19:44
Python Upgrade CCI
# 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)
@underscorephil
underscorephil / create_account.py
Created July 10, 2015 13:36
Create sub account
# Create SoftLayer End-Customer Account on Brand Account
# Use at your own risk
import SoftLayer
from pprint import pprint as pp
import json
import SoftLayer.API
# DIST MASTER ACCOUNT API INFORMATION (NOT SUB-BRAND)
username = "CHANGE_ME" #change me
<?php
include('softlayer-api-php-client/SoftLayer/SoapClient.class.php');
$apiUser = '';
$apiKey = '';
$serverId = ;
$serverClient = SoftLayer_SoapClient::getClient('SoftLayer_Hardware_Server', $serverId, $apiUser, $apiKey);
try {
@underscorephil
underscorephil / create_notification.py
Created January 13, 2014 18:05
Create notification subscribers
#!/usr/bin/env python
import SoftLayer.API
from pprint import pprint as pp
api_username = ''
api_key = ''
client = SoftLayer.Client(
username=api_username,
<?php
include('softlayer-api-php-client/SoftLayer/SoapClient.class.php');
$apiUsername = '';
$apiKey = '';
$accountClient = SoftLayer_SoapClient::getClient('SoftLayer_Account', null, $apiUsername, $apiKey);
$mask = "mask[billingItem[recurringFee, id, orderItem[description, order[userRecord[id, username], id]]]]";