Skip to content

Commit 87a8ded

Browse files
doc updates
1 parent 0ac4de3 commit 87a8ded

File tree

6 files changed

+88
-64
lines changed

6 files changed

+88
-64
lines changed

docs/api/client.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ SoftLayer's XML-RPC API also allows for pagination.
144144
client.call('Account', 'getVirtualGuests', limit=10, offset=0) # Page 1
145145
client.call('Account', 'getVirtualGuests', limit=10, offset=10) # Page 2
146146

147+
#Automatic Pagination (v5.5.3+)
148+
client.call('Account', 'getVirtualGuests', iter=True) # Page 2
149+
147150
Here's how to create a new Cloud Compute Instance using
148151
`SoftLayer_Virtual_Guest.createObject <http://developer.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createObject>`_.
149152
Be warned, this call actually creates an hourly virtual server so this will
@@ -161,6 +164,27 @@ have billing implications.
161164
})
162165

163166

167+
Debugging
168+
-------------
169+
If you ever need to figure out what exact API call the client is making, you can do the following:
170+
171+
*NOTE* the `print_reproduceable` method produces different output for REST and XML-RPC endpoints. If you are using REST, this will produce a CURL call. IF you are using XML-RPC, it will produce some pure python code you can use outside of the SoftLayer library.
172+
173+
::
174+
# Setup the client as usual
175+
client = SoftLayer.Client()
176+
# Create an instance of the DebugTransport, which logs API calls
177+
debugger = SoftLayer.DebugTransport(client.transport)
178+
# Set that as the default client transport
179+
client.transport = debugger
180+
# Make your API call
181+
client.call('Account', 'getObject')
182+
183+
# Print out the reproduceable call
184+
for call in client.transport.get_last_calls():
185+
print(client.transport.print_reproduceable(call))
186+
187+
164188
API Reference
165189
-------------
166190

tests/CLI/modules/dedicatedhost_tests.py

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,23 @@ def test_create(self):
161161
'--billing=hourly'])
162162
self.assert_no_fail(result)
163163
args = ({
164-
'hardware': [{
165-
'domain': 'test.com',
166-
'primaryBackendNetworkComponent': {
167-
'router': {
168-
'id': 12345
169-
}
170-
},
171-
'hostname': 'test-dedicated'
172-
}],
173-
'useHourlyPricing': True,
174-
'location': 'DALLAS05',
175-
'packageId': 813,
176-
'complexType': 'SoftLayer_Container_Product_Order_Virtual_DedicatedHost',
177-
'prices': [{
164+
'hardware': [{
165+
'domain': 'test.com',
166+
'primaryBackendNetworkComponent': {
167+
'router': {
168+
'id': 12345
169+
}
170+
},
171+
'hostname': 'test-dedicated'
172+
}],
173+
'useHourlyPricing': True,
174+
'location': 'DALLAS05',
175+
'packageId': 813,
176+
'complexType': 'SoftLayer_Container_Product_Order_Virtual_DedicatedHost',
177+
'prices': [{
178178
'id': 200269
179-
}],
180-
'quantity': 1},)
179+
}],
180+
'quantity': 1},)
181181

182182
self.assert_called_with('SoftLayer_Product_Order', 'placeOrder',
183183
args=args)
@@ -197,23 +197,23 @@ def test_create_with_gpu(self):
197197
'--billing=hourly'])
198198
self.assert_no_fail(result)
199199
args = ({
200-
'hardware': [{
201-
'domain': 'test.com',
202-
'primaryBackendNetworkComponent': {
203-
'router': {
204-
'id': 12345
205-
}
206-
},
207-
'hostname': 'test-dedicated'
208-
}],
209-
'prices': [{
210-
'id': 200269
211-
}],
212-
'location': 'DALLAS05',
213-
'packageId': 813,
214-
'complexType': 'SoftLayer_Container_Product_Order_Virtual_DedicatedHost',
215-
'useHourlyPricing': True,
216-
'quantity': 1},)
200+
'hardware': [{
201+
'domain': 'test.com',
202+
'primaryBackendNetworkComponent': {
203+
'router': {
204+
'id': 12345
205+
}
206+
},
207+
'hostname': 'test-dedicated'
208+
}],
209+
'prices': [{
210+
'id': 200269
211+
}],
212+
'location': 'DALLAS05',
213+
'packageId': 813,
214+
'complexType': 'SoftLayer_Container_Product_Order_Virtual_DedicatedHost',
215+
'useHourlyPricing': True,
216+
'quantity': 1},)
217217

218218
self.assert_called_with('SoftLayer_Product_Order', 'placeOrder',
219219
args=args)
@@ -239,13 +239,13 @@ def test_create_verify(self):
239239
'useHourlyPricing': True,
240240
'hardware': [{
241241

242-
'hostname': 'test-dedicated',
243-
'domain': 'test.com',
242+
'hostname': 'test-dedicated',
243+
'domain': 'test.com',
244244

245245
'primaryBackendNetworkComponent': {
246-
'router': {
247-
'id': 12345
248-
}
246+
'router': {
247+
'id': 12345
248+
}
249249
}
250250
}],
251251
'packageId': 813, 'prices': [{'id': 200269}],
@@ -266,11 +266,11 @@ def test_create_verify(self):
266266
self.assert_no_fail(result)
267267

268268
args = ({
269-
'useHourlyPricing': True,
270-
'hardware': [{
271-
'hostname': 'test-dedicated',
272-
'domain': 'test.com',
273-
'primaryBackendNetworkComponent': {
269+
'useHourlyPricing': True,
270+
'hardware': [{
271+
'hostname': 'test-dedicated',
272+
'domain': 'test.com',
273+
'primaryBackendNetworkComponent': {
274274
'router': {
275275
'id': 12345
276276
}
@@ -318,22 +318,22 @@ def test_create_verify_no_price_or_more_than_one(self):
318318

319319
self.assertIsInstance(result.exception, exceptions.ArgumentError)
320320
args = ({
321-
'hardware': [{
322-
'domain': 'test.com',
323-
'primaryBackendNetworkComponent': {
324-
'router': {
325-
'id': 12345
326-
}
327-
},
328-
'hostname': 'test-dedicated'
329-
}],
330-
'prices': [{
331-
'id': 200269
332-
}],
333-
'location': 'DALLAS05',
334-
'packageId': 813,
335-
'complexType': 'SoftLayer_Container_Product_Order_Virtual_DedicatedHost',
336-
'useHourlyPricing': True,
337-
'quantity': 1},)
321+
'hardware': [{
322+
'domain': 'test.com',
323+
'primaryBackendNetworkComponent': {
324+
'router': {
325+
'id': 12345
326+
}
327+
},
328+
'hostname': 'test-dedicated'
329+
}],
330+
'prices': [{
331+
'id': 200269
332+
}],
333+
'location': 'DALLAS05',
334+
'packageId': 813,
335+
'complexType': 'SoftLayer_Container_Product_Order_Virtual_DedicatedHost',
336+
'useHourlyPricing': True,
337+
'quantity': 1},)
338338

339339
self.assert_called_with('SoftLayer_Product_Order', 'verifyOrder', args=args)

tests/CLI/modules/user_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_print_hardware_access(self):
9494
'fullyQualifiedDomainName': 'test.test.test',
9595
'provisionDate': '2018-05-08T15:28:32-06:00',
9696
'primaryBackendIpAddress': '175.125.126.118',
97-
'primaryIpAddress': '175.125.126.118'}
97+
'primaryIpAddress': '175.125.126.118'}
9898
],
9999
'dedicatedHosts': [
100100
{'id': 1234,

tests/managers/hardware_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def test_cancel_hardware_no_billing_item(self):
288288
ex = self.assertRaises(SoftLayer.SoftLayerError,
289289
self.hardware.cancel_hardware,
290290
6327)
291-
self.assertEqual("Ticket #1234 already exists for this server", str(ex))
291+
self.assertEqual("Ticket #1234 already exists for this server", str(ex))
292292

293293
def test_cancel_hardware_monthly_now(self):
294294
mock = self.set_mock('SoftLayer_Hardware_Server', 'getObject')

tests/managers/ordering_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def test_get_location_id_keyname(self):
508508
def test_get_location_id_exception(self):
509509
locations = self.set_mock('SoftLayer_Location', 'getDatacenters')
510510
locations.return_value = []
511-
self.assertRaises(exceptions.SoftLayerError, self.ordering.get_location_id, "BURMUDA")
511+
self.assertRaises(exceptions.SoftLayerError, self.ordering.get_location_id, "BURMUDA")
512512

513513
def test_get_location_id_int(self):
514514
dc_id = self.ordering.get_location_id(1234)

tests/managers/sshkey_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_add_key(self):
1919
notes='My notes')
2020

2121
args = ({
22-
'key': 'pretend this is a public SSH key',
22+
'key': 'pretend this is a public SSH key',
2323
'label': 'Test label',
2424
'notes': 'My notes',
2525
},)

0 commit comments

Comments
 (0)