Warning
This module is now deprecated. It has been replaced with the VSIManager.
SoftLayer.cci¶
CCIManager to provide backwards compatibility.
license: | MIT, see LICENSE for more details. |
---|
- class SoftLayer.managers.cci.CCIManager(client)[source]¶
Wrapper for the VSManager class to provide backwards compatibility with the old CCIManager class.
- cancel_instance(instance_id)¶
Cancel an instance immediately, deleting all its data.
Parameters: instance_id (integer) – the instance ID to cancel # Cancel for instance ID 12345. # env variables # SL_USERNAME = YOUR_USERNAME # SL_API_KEY = YOUR_API_KEY import SoftLayer client = SoftLayer.Client() mgr = SoftLayer.VSManager(client) mgr.cancel_instance(12345)
- capture(instance_id, name, additional_disks=False, notes=None)¶
Capture one or all disks from a VS to a SoftLayer image.
Parameters set to None will be ignored and not attempted to be updated.
Parameters: - instance_id (integer) – the instance ID to edit
- name (string) – name assigned to the image
- additional_disks (string) – set to true to include all additional attached storage devices
- notes (string) – notes about this particular image
- change_port_speed(instance_id, public, speed)¶
Allows you to change the port speed of a virtual server’s NICs.
Parameters: - instance_id (int) – The ID of the VS
- public (bool) – Flag to indicate which interface to change. True (default) means the public interface. False indicates the private interface.
- speed (int) – The port speed to set.
- create_instance(**kwargs)¶
Creates a new virtual server instance
Parameters: - cpus (int) – The number of virtual CPUs to include in the instance.
- memory (int) – The amount of RAM to order.
- hourly (bool) – Flag to indicate if this server should be billed hourly (default) or monthly.
- hostname (string) – The hostname to use for the new server.
- domain (string) – The domain to use for the new server.
- local_disk (bool) – Flag to indicate if this should be a local disk (default) or a SAN disk.
- datacenter (string) – The short name of the data center in which the VS should reside.
- os_code (string) – The operating system to use. Cannot be specified if image_id is specified.
- image_id (int) – The ID of the image to load onto the server. Cannot be specified if os_code is specified.
- dedicated (bool) – Flag to indicate if this should be housed on a dedicated or shared host (default). This will incur a fee on your account.
- public_vlan (int) – The ID of the public VLAN on which you want this VS placed.
- private_vlan (int) – The ID of the public VLAN on which you want this VS placed.
- disks (list) – A list of disk capacities for this server.
- post_uri (string) – The URI of the post-install script to run after reload
- private (bool) – If true, the VS will be provisioned only with access to the private network. Defaults to false
- ssh_keys (list) – The SSH keys to add to the root user
- nic_speed (int) – The port speed to set
- tag (string) – tags to set on the VS as a comma separated list
- create_instances(config_list)¶
Creates multiple virtual server instances
This takes a list of dictionaries using the same arguments as create_instance().
- edit(instance_id, userdata=None, hostname=None, domain=None, notes=None, tag=None)¶
Edit hostname, domain name, notes, and/or the user data of a VS
Parameters set to None will be ignored and not attempted to be updated.
Parameters: - instance_id (integer) – the instance ID to edit
- userdata (string) – user data on VS to edit. If none exist it will be created
- hostname (string) – valid hostname
- domain (string) – valid domain namem
- notes (string) – notes about this particular VS
- tag (string) – tags to set on the VS as a comma separated list. Use the empty string to remove all tags.
- get_create_options()¶
Retrieves the available options for creating a VS.
Returns: A dictionary of creation options.
- get_instance(instance_id, **kwargs)¶
Get details about a virtual server instance
Parameters: instance_id (integer) – the instance ID Returns: A dictionary containing a large amount of information about the specified instance. # Print out the FQDN and IP address for instance ID 12345. # env variables # SL_USERNAME = YOUR_USERNAME # SL_API_KEY = YOUR_API_KEY import SoftLayer client = SoftLayer.Client() mgr = SoftLayer.VSManager(client) vsi = mgr.get_instance(12345) print vsi['fullyQualifiedDomainName'], vs['primaryIpAddress']
- list_instances(hourly=True, monthly=True, tags=None, cpus=None, memory=None, hostname=None, domain=None, local_disk=None, datacenter=None, nic_speed=None, public_ip=None, private_ip=None, **kwargs)¶
Retrieve a list of all virtual servers on the account.
Parameters: - hourly (boolean) – include hourly instances
- monthly (boolean) – include monthly instances
- tags (list) – filter based on tags
- cpus (integer) – filter based on number of CPUS
- memory (integer) – filter based on amount of memory
- hostname (string) – filter based on hostname
- domain (string) – filter based on domain
- local_disk (string) – filter based on local_disk
- datacenter (string) – filter based on datacenter
- nic_speed (integer) – filter based on network speed (in MBPS)
- public_ip (string) – filter based on public ip address
- private_ip (string) – filter based on private ip address
- **kwargs (dict) – response-level options (mask, limit, etc.)
Returns: Returns a list of dictionaries representing the matching virtual servers
# Print out a list of all hourly instances in the DAL05 data center. # env variables # SL_USERNAME = YOUR_USERNAME # SL_API_KEY = YOUR_API_KEY import SoftLayer client = SoftLayer.Client() mgr = SoftLayer.VSManager(client) for vsi in mgr.list_instances(hourly=True, datacenter='dal05'): print vsi['fullyQualifiedDomainName'], vs['primaryIpAddress']
- reload_instance(instance_id, post_uri=None, ssh_keys=None)¶
Perform an OS reload of an instance with its current configuration.
Parameters: - instance_id (integer) – the instance ID to reload
- post_url (string) – The URI of the post-install script to run after reload
- ssh_keys (list) – The SSH keys to add to the root user
# Reload instance ID 12345 then run a custom post-provision script. # env variables # SL_USERNAME = YOUR_USERNAME # SL_API_KEY = YOUR_API_KEY import SoftLayer client = SoftLayer.Client() post_uri = 'https://somehost.com/bootstrap.sh' mgr = SoftLayer.VSManager(client) vsi = mgr.reload_instance(12345, post_uri=post_url)
- rescue(instance_id)¶
Reboot a VSI into the Xen recsue kernel
Parameters: instance_id (integer) – the instance ID to rescue
- resolve_ids(identifier)¶
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters: identifier (string) – identifying string Returns list:
- upgrade(instance_id, cpus=None, memory=None, nic_speed=None, public=True)¶
Upgrades a VS instance
Parameters: - instance_id (int) – Instance id of the VS to be upgraded
- cpus (int) – The number of virtual CPUs to upgrade to of a VS instance.
- public (bool) – CPU will be in Private/Public Node.
- memory (int) – RAM of the VS to be upgraded to.
- nic_speed (int) – The port speed to set
# Upgrade instance 12345 to 4 CPUs and 4 GB of memory import SoftLayer client = SoftLayer.Client(config="~/.softlayer") mgr = SoftLayer.VSManager(client) mgr.upgrade(12345, cpus=4, memory=4)
- verify_create_instance(**kwargs)¶
Verifies an instance creation command without actually placing an order. See create_instance() for a list of available options.
- wait_for_ready(instance_id, limit, delay=1, pending=False)¶
Determine if a VS is ready and available. In some cases though, that can mean that no transactions are running. The default arguments imply a VS is operational and ready for use by having network connectivity and remote access is available. Setting pending=True will ensure future API calls against this instance will not error due to pending transactions such as OS Reloads and cancellations.
Parameters: - instance_id (int) – The instance ID with the pending transaction
- limit (int) – The maximum amount of time to wait.
- delay (int) – The number of seconds to sleep before checks. Defaults to 1.
- pending (bool) – Wait for pending transactions not related to provisioning or reloads such as monitoring.
- wait_for_transaction(instance_id, limit, delay=1)¶
Waits on a VS transaction for the specified amount of time. is really just a wrapper for wait_for_ready(pending=True). Provided for backwards compatibility.
Parameters: - instance_id (int) – The instance ID with the pending transaction
- limit (int) – The maximum amount of time to wait.
- delay (int) – The number of seconds to sleep before checks. Defaults to 1.