Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Get the recurring cost of a single server or all servers on your account.
*
* Perform two operations:
* 1) Get a list of servers on a SoftLayer account along with their recurring
* monthly costs. We can get that by calling getHardware() in the
* SoftLayer_Account API service with an object mask to retrieve cost.
* 2) Get the cost for a single server by calling getCost() in the
* SoftLayer_Hardware_Server service.
"""
Order a Cloud Computing Instance based on an existing CCI
Build a SoftLayer_Container_Product_Order_Virtaul_Guest object for a new
CloudLayer Computing Instance based on an existing CCI and disk template image
on your account and pass it to the SoftLayer_Product_Order API service to order
it. See below for more details.
This assumes you're using the SoftLayer API Python client
<http://github.com/softlayer/softlayer-api-python-client>. It's been written
#!/usr/bin/perl
# Order a Cloud Computing Instance based on an existing CCI
#
# Build a SoftLayer_Container_Product_Order_Virtaul_Guest object for a new
# CloudLayer Computing Instance based on an existing CCI and disk template image
# on your account and pass it to the SoftLayer_Product_Order API service to
# order it. See below for more details.
#
# This assumes you're using the SoftLayer API Perl client
# <http://github.com/softlayer/softlayer-api-perl-client>.
#!/usr/bin/perl
# Retrieve and analyze a single invoice record
#
# Print a simple report containing information about a single SoftLayer invoice:
# * The invoice's id number and creation date
# * The amount billed in the invoice
# * A list of all items billed for in the invoice, their child items, and their
# prices.
# * Note whether or not the item billed is for an existing server on your
# SoftLauer account.
#!/usr/bin/perl
# Order a new CDN account
#
# Build a SoftLayer_Container_Product_Order_Network_ContentDelivery_Account
# object for a new CDN account order and pass it to the SoftLayer_Product_Order
# API service to order it. In this carsre we'll order a pay as you go bandwidth
# and storage CDN accopunt. See below for more details.
#
# This assumes you're using the SoftLayer API Perl client
# <http://github.com/softlayer/softlayer-api-perl-client>.
#!/usr/bin/perl
# Reboot a SoftLayer server
#
# Given a server id call the rebootDefault() method in the
# SoftLayer_Hardware_Server service to attempt to reboot the server via IPMI
# or its power strip if remote management is unavailable. See
# <http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/rebootDefault>
# for more information.
#
# This script assumes you're using the SoftLayer API Perl client
"""
Reboot a SoftLayer server
Given a server id call the rebootDefault() method in the
SoftLayer_Hardware_Server service to attempt to reboot the server via IPMI or
its power strip if remote management is unavailable. See
<http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/rebootDefault>
for more information.
This script assumes you're using the SoftLayer API Python client
#!/usr/bin/perl
# Retrieve a list of switchport statistics for a server's network interfaces.
#
# This script makes a single call to the getPortStatistics() method in the
# SoftLayer_Network_Component API service
# (http://sldn.softlayer.com/reference/services/SoftLayer_NetworkComponent/getPortStatistics)
# for each of a server's network components to query port statistics for that
# interface from SoftLayer's switches. Port statistics are modeled by the
# SoftLayer__Container_Network_Port_Statistic data type
# (http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Network_Port_Statistic).
"""
Perform a server OS reload with a new operating system.
Reload a server with a new operating system, software, and a custom drive
partition scheme. In this case we're loading a server with Windows 2008 R2
Standard Edition, 64-bit with a 50G C: partition and a D: partition that fills
up the rest of the disk's free space. SoftLayer's standard
reloadOperatingSystem() method in the SoftLayer_Hardware_Server API service
<http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/reloadOperatingSystem>
takes care of the heavy lifting after you've defined your new software options
"""
Perform a server OS reload with custom partitions.
Reload a server with its current operating system, software, but with custom
drive partitions. SoftLayer's standard reloadOperatingSystem() method in the
SoftLayer_Hardware_Server API service
<http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/reloadOperatingSystem>
takes care of the heavy lifting after you've defined your new drive partitions.
Please perform server backups as necessary before reloading your operating
system.