Skip to content

Commit 81fca4c

Browse files
author
Nathan Beittenmiller
committed
Adding a few minor examples
1 parent 99ca128 commit 81fca4c

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

SoftLayer/managers/vs.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,19 @@ def get_instance(self, instance_id, **kwargs):
133133
:returns: A dictionary containing a large amount of information about
134134
the specified instance.
135135
136+
::
137+
138+
# Print out the FQDN and IP address for instance ID 12345.
139+
# env variables
140+
# SL_USERNAME = YOUR_USERNAME
141+
# SL_API_KEY = YOUR_API_KEY
142+
import SoftLayer
143+
client = SoftLayer.Client()
144+
145+
mgr = SoftLayer.VSManager(client)
146+
vsi = mgr.get_instance(12345)
147+
print vsi['fullyQualifiedDomainName'], vs['primaryIpAddress']
148+
136149
"""
137150

138151
if 'mask' not in kwargs:
@@ -189,6 +202,18 @@ def cancel_instance(self, instance_id):
189202
190203
:param integer instance_id: the instance ID to cancel
191204
205+
::
206+
207+
# Cancel for instance ID 12345.
208+
# env variables
209+
# SL_USERNAME = YOUR_USERNAME
210+
# SL_API_KEY = YOUR_API_KEY
211+
import SoftLayer
212+
client = SoftLayer.Client()
213+
214+
mgr = SoftLayer.VSManager(client)
215+
mgr.cancel_instance(12345)
216+
192217
"""
193218
return self.guest.deleteObject(id=instance_id)
194219

@@ -199,6 +224,20 @@ def reload_instance(self, instance_id, post_uri=None, ssh_keys=None):
199224
:param string post_url: The URI of the post-install script to run
200225
after reload
201226
:param list ssh_keys: The SSH keys to add to the root user
227+
228+
::
229+
230+
# Reload instance ID 12345 then run a custom post-provision script.
231+
# env variables
232+
# SL_USERNAME = YOUR_USERNAME
233+
# SL_API_KEY = YOUR_API_KEY
234+
import SoftLayer
235+
client = SoftLayer.Client()
236+
237+
post_uri = 'https://somehost.com/bootstrap.sh'
238+
mgr = SoftLayer.VSManager(client)
239+
vsi = mgr.reload_instance(12345, post_uri=post_url)
240+
202241
"""
203242
config = {}
204243

@@ -497,12 +536,23 @@ def upgrade(self, instance_id, cpus=None, memory=None,
497536
nic_speed=None, public=True):
498537
"""
499538
Upgrades a VS instance
539+
500540
:param int instance_id: Instance id of the VS to be upgraded
501541
:param int cpus: The number of virtual CPUs to upgrade to
502542
of a VS instance.
503543
:param bool public: CPU will be in Private/Public Node.
504544
:param int memory: RAM of the VS to be upgraded to.
505545
:param int nic_speed: The port speed to set
546+
547+
::
548+
549+
# Upgrade instance 12345 to 4 CPUs and 4 GB of memory
550+
import SoftLayer
551+
client = SoftLayer.Client(config="~/.softlayer")
552+
553+
mgr = SoftLayer.VSManager(client)
554+
mgr.upgrade(12345, cpus=4, memory=4)
555+
506556
"""
507557
package_items = self._get_package_items()
508558
item_id = []

docs/api/managers/cci.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.. _cci:
22

3+
.. warning:: This module is now deprecated. It has been replaced with the VSIManager.
4+
35
.. automodule:: SoftLayer.managers.cci
46
:members:
57
:inherited-members:

0 commit comments

Comments
 (0)