Added examples to hardware, ssl · JNETCOMMUNITY/softlayer-python@e2fbcd9 · GitHub
Skip to content

Commit e2fbcd9

Browse files
Added examples to hardware, ssl
1 parent 14b7f4d commit e2fbcd9

3 files changed

Lines changed: 150 additions & 11 deletions

File tree

SoftLayer/managers/hardware.py

Lines changed: 109 additions & 10 deletions

SoftLayer/managers/ssl.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ class SSLManager(object):
1111
"""Manages SSL certificates.
1212
1313
:param SoftLayer.API.Client client: an API client instance
14+
15+
Example::
16+
# Initialize the Manager.
17+
# env variables. These can also be specified in ~/.softlayer,
18+
# or passed directly to SoftLayer.Client()
19+
# SL_USERNAME = YOUR_USERNAME
20+
# SL_API_KEY = YOUR_API_KEY
21+
import SoftLayer
22+
client = SoftLayer.Client()
23+
mgr = SoftLayer.SSLManager(client)
24+
1425
"""
1526

1627
def __init__(self, client):
@@ -24,6 +35,12 @@ def list_certs(self, method='all'):
2435
'all', 'expired', and 'valid'.
2536
:returns: A list of dictionaries representing the requested SSL certs.
2637
38+
Example::
39+
40+
# Get all valid SSL certs
41+
certs = mgr.list_certs(method='valid')
42+
print certs
43+
2744
"""
2845
ssl = self.client['Account']
2946
methods = {
@@ -42,6 +59,11 @@ def add_certificate(self, certificate):
4259
:param dict certificate: A dictionary representing the parts of the
4360
certificate. See SLDN for more information.
4461
62+
Example::
63+
64+
cert = ??
65+
result = mgr.add_certificate(certificate=cert)
66+
4567
"""
4668
return self.ssl.createObject(certificate)
4769

@@ -50,6 +72,12 @@ def remove_certificate(self, cert_id):
5072
5173
:param integer cert_id: a certificate ID to remove
5274
75+
Example::
76+
77+
# Removes certificate with id 1234
78+
result = mgr.remove_certificate(cert_id = 1234)
79+
print result
80+
5381
"""
5482
return self.ssl.deleteObject(id=cert_id)
5583

@@ -61,6 +89,13 @@ def edit_certificate(self, certificate):
6189
6290
:param dict certificate: the certificate to update.
6391
92+
Example::
93+
94+
# Updates the cert id 1234
95+
cert['id'] = 1234
96+
cert['certificate'] = ??
97+
result = mgr.edit_certificate(certificate=cert)
98+
6499
"""
65100
return self.ssl.editObject(certificate, id=certificate['id'])
66101

@@ -69,5 +104,10 @@ def get_certificate(self, cert_id):
69104
70105
:param integer cert_id: the certificate ID to retrieve
71106
107+
Example::
108+
109+
cert = mgr.get_certificate(cert_id=1234)
110+
print(cert)
111+
72112
"""
73113
return self.ssl.getObject(id=cert_id)

SoftLayer/managers/vs.py

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)