Skip to content

Commit 7986872

Browse files
author
Kevin McDonald
committed
Adds notes about installation, remove doc build warnings
1 parent fe02ab9 commit 7986872

3 files changed

Lines changed: 73 additions & 60 deletions

File tree

SoftLayer/managers/hardware.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
class HardwareManager(utils.IdentifierMixin, object):
2222
"""Manage hardware devices.
2323
24-
:param SoftLayer.API.Client client: an API client instance
25-
:param SoftLayer.managers.OrderingManager ordering_manager: an optional
26-
manager to handle ordering.
27-
If none is provided, one will be
28-
auto initialized.
2924
Example::
3025
3126
# Initialize the Manager.
@@ -36,6 +31,12 @@ class HardwareManager(utils.IdentifierMixin, object):
3631
import SoftLayer
3732
client = SoftLayer.Client()
3833
mgr = SoftLayer.HardwareManager(client)
34+
35+
:param SoftLayer.API.Client client: an API client instance
36+
:param SoftLayer.managers.OrderingManager ordering_manager: an optional
37+
manager to handle ordering.
38+
If none is provided, one will be
39+
auto initialized.
3940
"""
4041
def __init__(self, client, ordering_manager=None):
4142
self.client = client
@@ -51,15 +52,16 @@ def cancel_hardware(self, hardware_id, reason='unneeded', comment='',
5152
immediate=False):
5253
"""Cancels the specified dedicated server.
5354
55+
Example::
56+
57+
# Cancels hardware id 1234
58+
result = mgr.cancel_hardware(hardware_id=1234)
59+
5460
:param int hardware_id: The ID of the hardware to be cancelled.
5561
:param string reason: The reason code for the cancellation. This should
5662
come from :func:`get_cancellation_reasons`.
5763
:param string comment: An optional comment to include with the
5864
cancellation.
59-
Example::
60-
61-
# Cancels hardware id 1234
62-
result = mgr.cancel_hardware(hardware_id=1234)
6365
"""
6466

6567
# Get cancel reason

SoftLayer/managers/vs.py

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ def list_instances(self, hourly=True, monthly=True, tags=None, cpus=None,
5353
public_ip=None, private_ip=None, **kwargs):
5454
"""Retrieve a list of all virtual servers on the account.
5555
56+
Example::
57+
58+
# Print out a list of hourly instances in the DAL05 data center.
59+
60+
for vsi in mgr.list_instances(hourly=True, datacenter='dal05'):
61+
print vsi['fullyQualifiedDomainName'], vsi['primaryIpAddress']
62+
63+
# Using a custom object-mask. Will get ONLY what is specified
64+
object_mask = "mask[hostname,monitoringRobot[robotStatus]]"
65+
for vsi in mgr.list_instances(mask=object_mask,hourly=True):
66+
print vsi
67+
5668
:param boolean hourly: include hourly instances
5769
:param boolean monthly: include monthly instances
5870
:param list tags: filter based on list of tags
@@ -68,19 +80,6 @@ def list_instances(self, hourly=True, monthly=True, tags=None, cpus=None,
6880
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.)
6981
:returns: Returns a list of dictionaries representing the matching
7082
virtual servers
71-
72-
Example::
73-
74-
# Print out a list of hourly instances in the DAL05 data center.
75-
76-
for vsi in mgr.list_instances(hourly=True, datacenter='dal05'):
77-
print vsi['fullyQualifiedDomainName'], vsi['primaryIpAddress']
78-
79-
# Using a custom object-mask. Will get ONLY what is specified
80-
object_mask = "mask[hostname,monitoringRobot[robotStatus]]"
81-
for vsi in mgr.list_instances(mask=object_mask,hourly=True):
82-
print vsi
83-
8483
"""
8584
if 'mask' not in kwargs:
8685
items = [
@@ -463,6 +462,32 @@ def verify_create_instance(self, **kwargs):
463462
def create_instance(self, **kwargs):
464463
"""Creates a new virtual server instance.
465464
465+
.. warning::
466+
467+
This will add charges to your account
468+
469+
Example::
470+
471+
new_vsi = {
472+
'domain': u'test01.labs.sftlyr.ws',
473+
'hostname': u'minion05',
474+
'datacenter': u'hkg02',
475+
'dedicated': False,
476+
'private': False,
477+
'cpus': 1,
478+
'os_code' : u'UBUNTU_LATEST',
479+
'hourly': True,
480+
'ssh_keys': [1234],
481+
'disks': ('100','25'),
482+
'local_disk': True,
483+
'memory': 1024,
484+
'tags': 'test, pleaseCancel'
485+
}
486+
487+
vsi = mgr.create_instance(**new_vsi)
488+
# vsi will have the newly created vsi details if done properly.
489+
print vsi
490+
466491
:param int cpus: The number of virtual CPUs to include in the instance.
467492
:param int memory: The amount of RAM to order.
468493
:param bool hourly: Flag to indicate if this server should be billed
@@ -492,30 +517,6 @@ def create_instance(self, **kwargs):
492517
:param list ssh_keys: The SSH keys to add to the root user
493518
:param int nic_speed: The port speed to set
494519
:param string tags: tags to set on the VS as a comma separated list
495-
496-
.. warning::
497-
This will add charges to your account
498-
499-
Example::
500-
new_vsi = {
501-
'domain': u'test01.labs.sftlyr.ws',
502-
'hostname': u'minion05',
503-
'datacenter': u'hkg02',
504-
'dedicated': False,
505-
'private': False,
506-
'cpus': 1,
507-
'os_code' : u'UBUNTU_LATEST',
508-
'hourly': True,
509-
'ssh_keys': [1234],
510-
'disks': ('100','25'),
511-
'local_disk': True,
512-
'memory': 1024,
513-
'tags': 'test, pleaseCancel'
514-
}
515-
516-
vsi = mgr.create_instance(**new_vsi)
517-
# vsi will have the newly created vsi details if done properly.
518-
print vsi
519520
"""
520521
tags = kwargs.pop('tags', None)
521522
inst = self.guest.createObject(self._generate_create_dict(**kwargs))
@@ -530,9 +531,11 @@ def create_instances(self, config_list):
530531
create_instance().
531532
532533
.. warning::
534+
533535
This will add charges to your account
534536
535537
Example::
538+
536539
# Define the instance we want to create.
537540
new_vsi = {
538541
'domain': u'test01.labs.sftlyr.ws',
@@ -576,6 +579,13 @@ def create_instances(self, config_list):
576579
def change_port_speed(self, instance_id, public, speed):
577580
"""Allows you to change the port speed of a virtual server's NICs.
578581
582+
Example::
583+
584+
#change the Public interface to 10Mbps on instance 12345
585+
result = mgr.change_port_speed(instance_id=12345,
586+
public=True, speed=10)
587+
# result will be True or an Exception
588+
579589
:param int instance_id: The ID of the VS
580590
:param bool public: Flag to indicate which interface to change.
581591
True (default) means the public interface.
@@ -584,12 +594,6 @@ def change_port_speed(self, instance_id, public, speed):
584594
585595
.. warning::
586596
A port speed of 0 will disable the interface.
587-
588-
Example::
589-
#change the Public interface to 10Mbps on instance 12345
590-
result = mgr.change_port_speed(instance_id=12345,
591-
public=True, speed=10)
592-
# result will be True or an Exception
593597
"""
594598
if public:
595599
func = self.guest.setPublicNetworkInterfaceSpeed
@@ -711,14 +715,6 @@ def upgrade(self, instance_id, cpus=None, memory=None,
711715
nic_speed=None, public=True):
712716
"""Upgrades a VS instance.
713717
714-
:param int instance_id: Instance id of the VS to be upgraded
715-
:param int cpus: The number of virtual CPUs to upgrade to
716-
of a VS instance.
717-
:param bool public: CPU will be in Private/Public Node.
718-
:param int memory: RAM of the VS to be upgraded to.
719-
:param int nic_speed: The port speed to set
720-
721-
:returns: bool
722718
Example::
723719
724720
# Upgrade instance 12345 to 4 CPUs and 4 GB of memory
@@ -727,6 +723,14 @@ def upgrade(self, instance_id, cpus=None, memory=None,
727723
mgr = SoftLayer.VSManager(client)
728724
mgr.upgrade(12345, cpus=4, memory=4)
729725
726+
:param int instance_id: Instance id of the VS to be upgraded
727+
:param int cpus: The number of virtual CPUs to upgrade to
728+
of a VS instance.
729+
:param bool public: CPU will be in Private/Public Node.
730+
:param int memory: RAM of the VS to be upgraded to.
731+
:param int nic_speed: The port speed to set
732+
733+
:returns: bool
730734
"""
731735
package_items = self._get_package_items()
732736
prices = []

docs/install.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Installation
44
============
55

6+
What's Included
7+
---------------
8+
When you install softlayer-python you you will get the following:
9+
10+
* a python package called 'SoftLayer' (casing is important) available in your python path.
11+
* a command-line client placed in your system path named 'slcli'.
12+
613
Using Pip
714
---------
815

0 commit comments

Comments
 (0)