from __future__ import print_function
import SoftLayer
from SoftLayer.managers.vs import VSManager
def create_vsi():
#Create a client to the SoftLayer_Account API service.
#Note: currently set without the user ID and API key since
#it will by default use the values set in the CLI
#to use other values use SoftLayer.Client(sl_username, sl_api_key)
client = SoftLayer.Client()
vsi_mgr = VSManager(client)
# uncomment to display create options
# print(vsi_mgr.get_create_options())
# common values
datacenter = 'wdc07' # the data center code
domain = 'example.com' # the domain name suffix for the host
os_code = 'UBUNTU_LATEST_64' # the operating system code
local_disk = True # local disk or SAN
hourly = True # hourly or monthly billing
dedicated = False # multi-tenant or single tenant
private_vlan = '1892939' # VLAN for the server see VLAN list above
public_vlan = '1892917'
nic_speed = 1000 # speed of network device
disks = [100] # size of the disks
private = False # private networking only or include public internet networking as well
ssh_keys = [975995, 972047] # the IDs of the ssh keys to load on the server - use slcli sshkey list
post_uri = 'https://tinylab.info/apacheInstaller.sh'
hostname = 'testing'
cpus = 4
memory = 8192
tags = 'owner:ryan,project:poc,type:docker'
result = vsi_mgr.create_instance(hostname=hostname, domain=domain,
cpus=cpus, memory=memory, datacenter=datacenter,
os_code=os_code, local_disk=local_disk,
hourly=hourly, dedicated=dedicated,
private_vlan=private_vlan, disks=disks,
nic_speed=nic_speed, private=private,
ssh_keys=ssh_keys, tags=tags)
print(result)
if __name__ == '__main__':
create_vsi()