Skip to content

Instantly share code, notes, and snippets.

// Order a monthly billed Bare Metal Computing instance.
//
// Build a SoftLayer_Container_Product_Order_Hardware_Server object for a new
// Bare Metal Cloud (BMC) order and pass it to the SoftLayer_Product_Order API
// service to order it. In this care we'll order a 4 core instance with 16G
// RAM, 1000mbit NICs, 2000GB bandwidth, a 250G SATA drive, Windows 2008 R2
// Datacenter edition (64-bit) with Hyper-V, and default server order options.
// See below for more details.
//
// Backend code to call the SoftLayer API was generated with the wsdl.exe
// Retrieve account VLAN and subnet information.
//
// Retrieve a list of all VLANs associated with a SoftLayer customer account
// and print a simple report detailing these VLANs and the subnets assigned to
// them. We do this with a call to the getNetworkVlans() method in the
// SoftLayer_Account API service using an object mask to retrieve the VLANs'
// associated subnets and primary router records. See below for more details.
//
// Backend code to call the SoftLayer API was generated with the wsdl.exe
// utility:
// Order a new SoftLayer IP subnet
//
// Build a SoftLayer_Container_Product_Order_Network_Subnet object for a new IP
// subnet order and pass it to the SoftLayer_Product_Order API service to order
// it. See below for more details.
//
// Backend code to call the SoftLayer API was generated with the wsdl.exe
// utility:
//
// wsdl.exe /language:CS /out:"C:\path\to\project\SoftLayer_API.cs" /sharetypes http://api.service.softlayer.com/soap/v3/SoftLayer_Product_Order?wsdl
<?php
/**
* Order a control panel license for a virtual private server (VPS).
*
* Build a SoftLayer_Container_Product_Order_Software_Component_Virtual object
* for a new control panel license order and pass it to the
* SoftLayer_Product_Order API service to order it. See below for more details.
*
* This assumes the SoftLayer API PHP client
* <http://github.com/softlayer/softlayer-api-php-client> is installed in the
// Retrieve account VLAN and subnet information per server.
//
// Retrieve a list of all servers associated with a SoftLayer customer account
// and print a simple report detailing their VLANs and the subnets assigned to
// them. We do this with a call to the getHardare() method in the
// SoftLayer_Account API service using an object mask to retrieve the hardware,
// VLANs, VLANs' associated subnets and primary router records. See below for
// more details.
//
// Backend code to call the SoftLayer API was generated with the wsdl.exe
@softlayer
softlayer / getServerBandwidthImage.php
Created November 6, 2010 18:24
Retrieve a bandwidth graph for a single server.
<?php
/**
* Retrieve a bandwidth graph for a single server.
*
* Retrieve a bandwidth graph for a single server for an arbitrary start and
* end date, specifying graph size and other graphing options. We can do this
* with two calls to the SoftLayer API.
*
* Counter data such as bandwidth counters and CCI resource use are stored in
* a server's metric tracking object. Our first call retrieves that server's
@softlayer
softlayer / gist:815182
Created February 7, 2011 20:53
getReverseRecords
<?php
/**
* Recieve an indexed array of IPs and their associated reverse DNS hostnames
* when providing an IP address. This reuiqres two api calls to accomplish,
* one to retrieve the privded IP address's subnet ID, then to get all of the
* reverse DNS records for that subnet.
*
* This assumes the SoftLayer API PHP client
* <http://github.com/softlayer/softlayer-api-php-client> is installed in the
* directory '/SoftLayer' in this script's path and that you wish to use the
@softlayer
softlayer / gist:815278
Created February 7, 2011 21:39
setReverseDns
<?php
/**
* Add/update a reverse DNS record by providing an IP and FQDN.
*
* This assumes the SoftLayer API PHP client
* <http://github.com/softlayer/softlayer-api-php-client> is installed in the
* directory '/SoftLayer' in this script's path and that you wish to use the
* SOAP client instead of our XML-RPC client.
*
* @see http://sldn.softlayer.com/wiki/index.php/SoftLayer_Network_Subnet
<?php
/**
* Retrieve graphs for specific metrics for a single server.
*
* This example shows how to use the SoftLayer API to retrieve graphs for the
* specific Advanced Monitoring metrics for a single hardware or virtual guest
* server instance.
*
* We will call the SoftLayer API to retrieve the monitoring agents,
* configuration template, and configuration values for a server instance.
@softlayer
softlayer / gist:1006343
Created June 3, 2011 13:30
CCI order with IP questionnaire
<?php
require_once dirname(__FILE__) . '/SoftLayer/SoapClient.class.php';
/**
* Your SoftLayer API username.
*
* @var string
*/
$apiUsername = 'API_USERNAME';