Skip to content

Commit e5b41ec

Browse files
Merge pull request #920 from allmightyspiff/doc_updates
Doc updates
2 parents c76169d + ad364de commit e5b41ec

File tree

11 files changed

+169
-94
lines changed

11 files changed

+169
-94
lines changed

SoftLayer/managers/block.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,7 @@ def cancel_snapshot_space(self, volume_id,
408408
409409
:param integer volume_id: The volume ID
410410
:param string reason: The reason for cancellation
411-
:param boolean immediate_flag: Cancel immediately or
412-
on anniversary date
411+
:param boolean immediate_flag: Cancel immediately or on anniversary date
413412
"""
414413

415414
block_volume = self.get_block_volume_details(
@@ -506,8 +505,7 @@ def cancel_block_volume(self, volume_id,
506505
507506
:param integer volume_id: The volume ID
508507
:param string reason: The reason for cancellation
509-
:param boolean immediate_flag: Cancel immediately or
510-
on anniversary date
508+
:param boolean immediate_flag: Cancel immediately or on anniversary date
511509
"""
512510
block_volume = self.get_block_volume_details(
513511
volume_id,

SoftLayer/managers/dedicated_host.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
SoftLayer.dedicatedhost
3-
~~~~~~~~~~~~
3+
~~~~~~~~~~~~~~~~~~~~~~~
44
DH Manager/helpers
55
66
:license: MIT, see License for more details.
@@ -23,21 +23,10 @@ class DedicatedHostManager(utils.IdentifierMixin, object):
2323
2424
See product information here https://www.ibm.com/cloud/dedicated
2525
26-
Example::
27-
# Initialize the DedicatedHostManager.
28-
# env variables. These can also be specified in ~/.softlayer,
29-
# or passed directly to SoftLayer.Client()
30-
# SL_USERNAME = YOUR_USERNAME
31-
# SL_API_KEY = YOUR_API_KEY
32-
import SoftLayer
33-
client = SoftLayer.Client()
34-
mgr = SoftLayer.DedicatedHostManager(client)
3526
3627
:param SoftLayer.API.BaseClient client: the client instance
37-
:param SoftLayer.managers.OrderingManager ordering_manager: an optional
38-
manager to handle ordering.
39-
If none is provided, one will be
40-
auto initialized.
28+
:param SoftLayer.managers.OrderingManager ordering_manager: an optional manager to handle ordering.
29+
If none is provided, one will be auto initialized.
4130
"""
4231

4332
def __init__(self, client, ordering_manager=None):
@@ -52,19 +41,14 @@ def list_instances(self, tags=None, cpus=None, memory=None, hostname=None,
5241
disk=None, datacenter=None, **kwargs):
5342
"""Retrieve a list of all dedicated hosts on the account
5443
55-
Example::
56-
5744
:param list tags: filter based on list of tags
5845
:param integer cpus: filter based on number of CPUS
5946
:param integer memory: filter based on amount of memory
6047
:param string hostname: filter based on hostname
6148
:param string disk: filter based on disk
6249
:param string datacenter: filter based on datacenter
6350
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.)
64-
:returns: Returns a list of dictionaries representing the matching
65-
dedicated host.
66-
67-
51+
:returns: Returns a list of dictionaries representing the matching dedicated host.
6852
6953
"""
7054
if 'mask' not in kwargs:
@@ -113,8 +97,7 @@ def get_host(self, host_id, **kwargs):
11397
"""Get details about a dedicated host.
11498
11599
:param integer : the host ID
116-
:returns: A dictionary containing a large amount of information about
117-
the specified instance.
100+
:returns: A dictionary containing host information.
118101
119102
Example::
120103

SoftLayer/managers/file.py

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -357,21 +357,16 @@ def create_snapshot(self, volume_id, notes='', **kwargs):
357357
return self.client.call('Network_Storage', 'createSnapshot',
358358
notes, id=volume_id, **kwargs)
359359

360-
def enable_snapshots(self, volume_id, schedule_type, retention_count,
361-
minute, hour, day_of_week, **kwargs):
360+
def enable_snapshots(self, volume_id, schedule_type, retention_count, minute, hour, day_of_week, **kwargs):
362361
"""Enables snapshots for a specific file volume at a given schedule
363362
364363
:param integer volume_id: The id of the volume
365364
:param string schedule_type: 'HOURLY'|'DAILY'|'WEEKLY'
366-
:param integer retention_count: The number of snapshots to attempt to
367-
retain in this schedule
368-
:param integer minute: The minute of the hour at which HOURLY, DAILY,
369-
and WEEKLY snapshots should be taken
370-
:param integer hour: The hour of the day at which DAILY and WEEKLY
371-
snapshots should be taken
372-
:param string|integer day_of_week: The day of the week on which WEEKLY
373-
snapshots should be taken, either as a string ('SUNDAY') or integer
374-
('0' is Sunday)
365+
:param integer retention_count: The number of snapshots to attempt to retain in this schedule
366+
:param integer minute: The minute of the hour at which HOURLY, DAILY, and WEEKLY snapshots should be taken
367+
:param integer hour: The hour of the day at which DAILY and WEEKLY snapshots should be taken
368+
:param string|integer day_of_week: The day of the week on which WEEKLY snapshots should be taken,
369+
either as a string ('SUNDAY') or integer ('0' is Sunday)
375370
:return: Returns whether successfully scheduled or not
376371
"""
377372

@@ -392,8 +387,7 @@ def disable_snapshots(self, volume_id, schedule_type):
392387
:return: Returns whether successfully disabled or not
393388
"""
394389

395-
return self.client.call('Network_Storage', 'disableSnapshots',
396-
schedule_type, id=volume_id)
390+
return self.client.call('Network_Storage', 'disableSnapshots', schedule_type, id=volume_id)
397391

398392
def list_volume_schedules(self, volume_id):
399393
"""Lists schedules for a given volume
@@ -409,8 +403,7 @@ def list_volume_schedules(self, volume_id):
409403

410404
return utils.lookup(volume_detail, 'schedules')
411405

412-
def order_snapshot_space(self, volume_id, capacity, tier,
413-
upgrade, **kwargs):
406+
def order_snapshot_space(self, volume_id, capacity, tier, upgrade, **kwargs):
414407
"""Orders snapshot space for the given file volume.
415408
416409
:param integer volume_id: The ID of the volume
@@ -431,15 +424,12 @@ def order_snapshot_space(self, volume_id, capacity, tier,
431424

432425
return self.client.call('Product_Order', 'placeOrder', order)
433426

434-
def cancel_snapshot_space(self, volume_id,
435-
reason='No longer needed',
436-
immediate=False):
427+
def cancel_snapshot_space(self, volume_id, reason='No longer needed', immediate=False):
437428
"""Cancels snapshot space for a given volume.
438429
439430
:param integer volume_id: The volume ID
440431
:param string reason: The reason for cancellation
441-
:param boolean immediate: Cancel immediately or
442-
on anniversary date
432+
:param boolean immediate: Cancel immediately or on anniversary date
443433
"""
444434

445435
file_volume = self.get_file_volume_details(
@@ -482,15 +472,12 @@ def restore_from_snapshot(self, volume_id, snapshot_id):
482472
return self.client.call('Network_Storage', 'restoreFromSnapshot',
483473
snapshot_id, id=volume_id)
484474

485-
def cancel_file_volume(self, volume_id,
486-
reason='No longer needed',
487-
immediate=False):
475+
def cancel_file_volume(self, volume_id, reason='No longer needed', immediate=False):
488476
"""Cancels the given file storage volume.
489477
490478
:param integer volume_id: The volume ID
491479
:param string reason: The reason for cancellation
492-
:param boolean immediate: Cancel immediately or
493-
on anniversary date
480+
:param boolean immediate: Cancel immediately or on anniversary date
494481
"""
495482
file_volume = self.get_file_volume_details(
496483
volume_id,

SoftLayer/managers/ordering.py

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,14 @@
1111

1212
CATEGORY_MASK = '''id,
1313
isRequired,
14-
itemCategory[
15-
id,
16-
name,
17-
categoryCode
18-
]
14+
itemCategory[id, name, categoryCode]
1915
'''
2016

21-
ITEM_MASK = '''id,
22-
keyName,
23-
description
24-
'''
17+
ITEM_MASK = '''id, keyName, description'''
2518

26-
PACKAGE_MASK = '''id,
27-
name,
28-
keyName,
29-
isActive
30-
'''
19+
PACKAGE_MASK = '''id, name, keyName, isActive'''
3120

32-
PRESET_MASK = '''id,
33-
name,
34-
keyName,
35-
description
36-
'''
21+
PRESET_MASK = '''id, name, keyName, description'''
3722

3823

3924
class OrderingManager(object):
@@ -102,7 +87,7 @@ def get_only_active_packages(packages):
10287
If a package is active, it is eligible for ordering
10388
This will inspect the 'isActive' property on the provided packages
10489
105-
:param packages Dictionary of packages, isActive key must be present
90+
:param packages: Dictionary of packages, isActive key must be present
10691
"""
10792

10893
active_packages = []
@@ -121,8 +106,7 @@ def get_package_by_type(self, package_type, mask=None):
121106
one returned by the API.
122107
If no packages are found, returns None
123108
124-
:param package_type string representing the package type key name
125-
we are interested in
109+
:param string package_type: representing the package type key name we are interested in
126110
"""
127111
packages = self.get_packages_of_type([package_type], mask)
128112
if len(packages) == 0:
@@ -133,9 +117,8 @@ def get_package_by_type(self, package_type, mask=None):
133117
def get_package_id_by_type(self, package_type):
134118
"""Return the package ID of a Product Package with a given type.
135119
136-
:param package_type string representing the package type key name
137-
we are interested in
138-
:raises ValueError when no package of the given type is found
120+
:param string package_type: representing the package type key name we are interested in
121+
:raises ValueError: when no package of the given type is found
139122
"""
140123

141124
mask = "mask[id, name, description, isActive, type[keyName]]"
@@ -148,7 +131,7 @@ def get_package_id_by_type(self, package_type):
148131
def get_quotes(self):
149132
"""Retrieve a list of quotes.
150133
151-
:return a list of SoftLayer_Billing_Order_Quote
134+
:returns: a list of SoftLayer_Billing_Order_Quote
152135
"""
153136

154137
quotes = self.client['Account'].getActiveQuotes()
@@ -157,7 +140,7 @@ def get_quotes(self):
157140
def get_quote_details(self, quote_id):
158141
"""Retrieve quote details.
159142
160-
:param quote_id ID number of target quote
143+
:param quote_id: ID number of target quote
161144
"""
162145

163146
quote = self.client['Billing_Order_Quote'].getObject(id=quote_id)
@@ -166,7 +149,7 @@ def get_quote_details(self, quote_id):
166149
def get_order_container(self, quote_id):
167150
"""Generate an order container from a quote object.
168151
169-
:param quote_id ID number of target quote
152+
:param quote_id: ID number of target quote
170153
"""
171154

172155
quote = self.client['Billing_Order_Quote']
@@ -196,8 +179,7 @@ def generate_order_template(self, quote_id, extra, quantity=1):
196179
product_type = 'hardware'
197180

198181
if len(extra) != quantity:
199-
raise ValueError("You must specify extra for each server in the "
200-
"quote")
182+
raise ValueError("You must specify extra for each server in the quote")
201183

202184
container[product_type] = []
203185
for extra_details in extra:
@@ -236,8 +218,7 @@ def get_package_by_key(self, package_keyname, mask=None):
236218
237219
If no packages are found, returns None
238220
239-
:param package_keyname string representing the package key name
240-
we are interested in.
221+
:param package_keyname: string representing the package key name we are interested in.
241222
:param string mask: Mask to specify the properties we want to retrieve
242223
"""
243224
_filter = {
@@ -394,16 +375,15 @@ def verify_order(self, package_keyname, location, item_keynames, complex_type=No
394375
possible keynames for a package, use list_items()
395376
(or `slcli order item-list`)
396377
:param str complex_type: The complex type to send with the order. Typically begins
397-
with 'SoftLayer_Container_Product_Order_'.
378+
with `SoftLayer_Container_Product_Order_`.
398379
:param bool hourly: If true, uses hourly billing, otherwise uses monthly billing
399380
:param string preset_keyname: If needed, specifies a preset to use for that package.
400381
To see a list of possible keynames for a package, use
401382
list_preset() (or `slcli order preset-list`)
402383
:param dict extras: The extra data for the order in dictionary format.
403384
Example: A VSI order requires hostname and domain to be set, so
404385
extras will look like the following:
405-
{'virtualGuests': [{'hostname': 'test',
406-
'domain': 'softlayer.com'}]}
386+
'virtualGuests': [{'hostname': 'test', 'domain': 'softlayer.com'}]}
407387
:param int quantity: The number of resources to order
408388
409389
"""
@@ -425,16 +405,15 @@ def place_order(self, package_keyname, location, item_keynames, complex_type=Non
425405
possible keynames for a package, use list_items()
426406
(or `slcli order item-list`)
427407
:param str complex_type: The complex type to send with the order. Typically begins
428-
with 'SoftLayer_Container_Product_Order_'.
408+
with `SoftLayer_Container_Product_Order_`.
429409
:param bool hourly: If true, uses hourly billing, otherwise uses monthly billing
430410
:param string preset_keyname: If needed, specifies a preset to use for that package.
431411
To see a list of possible keynames for a package, use
432412
list_preset() (or `slcli order preset-list`)
433413
:param dict extras: The extra data for the order in dictionary format.
434414
Example: A VSI order requires hostname and domain to be set, so
435415
extras will look like the following:
436-
{'virtualGuests': [{'hostname': 'test',
437-
'domain': 'softlayer.com'}]}
416+
{'virtualGuests': [{'hostname': 'test', domain': 'softlayer.com'}]}
438417
:param int quantity: The number of resources to order
439418
440419
"""
@@ -457,16 +436,15 @@ def generate_order(self, package_keyname, location, item_keynames, complex_type=
457436
possible keynames for a package, use list_items()
458437
(or `slcli order item-list`)
459438
:param str complex_type: The complex type to send with the order. Typically begins
460-
with 'SoftLayer_Container_Product_Order_'.
439+
with `SoftLayer_Container_Product_Order_`.
461440
:param bool hourly: If true, uses hourly billing, otherwise uses monthly billing
462441
:param string preset_keyname: If needed, specifies a preset to use for that package.
463442
To see a list of possible keynames for a package, use
464443
list_preset() (or `slcli order preset-list`)
465444
:param dict extras: The extra data for the order in dictionary format.
466445
Example: A VSI order requires hostname and domain to be set, so
467446
extras will look like the following:
468-
{'virtualGuests': [{'hostname': 'test',
469-
'domain': 'softlayer.com'}]}
447+
{'virtualGuests': [{'hostname': 'test', 'domain': 'softlayer.com'}]}
470448
:param int quantity: The number of resources to order
471449
472450
"""

docs/api/managers/block.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. _block:
2+
3+
.. automodule:: SoftLayer.managers.block
4+
:members:
5+
:inherited-members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. _dedicated_host:
2+
3+
.. automodule:: SoftLayer.managers.dedicated_host
4+
:members:
5+
:inherited-members:

docs/api/managers/file.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. _file:
2+
3+
.. automodule:: SoftLayer.managers.file
4+
:members:
5+
:inherited-members:

docs/api/managers/ordering.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. _ordering:
2+
3+
.. automodule:: SoftLayer.managers.ordering
4+
:members:
5+
:inherited-members:

docs/cli.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ functionality not fully documented here.
1414

1515
cli/ipsec
1616
cli/vs
17+
cli/ordering
1718

1819

1920
.. _config_setup:

0 commit comments

Comments
 (0)