Skip to content

Commit 67ee362

Browse files
added some more documentation around event-logs
1 parent f7e8025 commit 67ee362

File tree

7 files changed

+82
-22
lines changed

7 files changed

+82
-22
lines changed

SoftLayer/CLI/call_api.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,19 @@ def cli(env, service, method, parameters, _id, _filters, mask, limit, offset,
8787
output_python=False):
8888
"""Call arbitrary API endpoints with the given SERVICE and METHOD.
8989
90-
\b
91-
Examples:
92-
slcli call-api Account getObject
93-
slcli call-api Account getVirtualGuests --limit=10 --mask=id,hostname
94-
slcli call-api Virtual_Guest getObject --id=12345
95-
slcli call-api Metric_Tracking_Object getBandwidthData --id=1234 \\
96-
"2015-01-01 00:00:00" "2015-01-1 12:00:00" public
97-
slcli call-api Account getVirtualGuests \\
98-
-f 'virtualGuests.datacenter.name=dal05' \\
99-
-f 'virtualGuests.maxCpu=4' \\
100-
--mask=id,hostname,datacenter.name,maxCpu
101-
slcli call-api Account getVirtualGuests \\
102-
-f 'virtualGuests.datacenter.name IN dal05,sng01'
90+
Example::
91+
92+
slcli call-api Account getObject
93+
slcli call-api Account getVirtualGuests --limit=10 --mask=id,hostname
94+
slcli call-api Virtual_Guest getObject --id=12345
95+
slcli call-api Metric_Tracking_Object getBandwidthData --id=1234 \\
96+
"2015-01-01 00:00:00" "2015-01-1 12:00:00" public
97+
slcli call-api Account getVirtualGuests \\
98+
-f 'virtualGuests.datacenter.name=dal05' \\
99+
-f 'virtualGuests.maxCpu=4' \\
100+
--mask=id,hostname,datacenter.name,maxCpu
101+
slcli call-api Account getVirtualGuests \\
102+
-f 'virtualGuests.datacenter.name IN dal05,sng01'
103103
"""
104104

105105
args = [service, method] + list(parameters)

SoftLayer/CLI/event_log/get.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
help="Total number of result to return. -1 to return ALL, there may be a LOT of these.")
2828
@environment.pass_env
2929
def cli(env, date_min, date_max, obj_event, obj_id, obj_type, utc_offset, metadata, limit):
30-
"""Get Event Logs"""
30+
"""Get Event Logs
31+
32+
Example:
33+
slcli event-log get -d 01/01/2019 -D 02/01/2019 -t User -l 10
34+
"""
3135
columns = ['Event', 'Object', 'Type', 'Date', 'Username']
3236

3337
event_mgr = SoftLayer.EventLogManager(env.client)

SoftLayer/managers/event_log.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
SoftLayer.event_log
3-
~~~~~~~~~~~~~~~~~
3+
~~~~~~~~~~~~~~~~~~~
44
Network Manager/helpers
55
66
:license: MIT, see LICENSE for more details.
@@ -23,11 +23,20 @@ def __init__(self, client):
2323
def get_event_logs(self, request_filter=None, log_limit=20, iterator=True):
2424
"""Returns a list of event logs
2525
26+
Example::
27+
28+
event_mgr = SoftLayer.EventLogManager(env.client)
29+
request_filter = event_mgr.build_filter(date_min="01/01/2019", date_max="02/01/2019")
30+
logs = event_mgr.get_event_logs(request_filter)
31+
for log in logs:
32+
print("Event Name: {}".format(log['eventName']))
33+
34+
2635
:param dict request_filter: filter dict
2736
:param int log_limit: number of results to get in one API call
2837
:param bool iterator: False will only make one API call for log_limit results.
2938
True will keep making API calls until all logs have been retreived. There may be a lot of these.
30-
:returns: List of event logs
39+
:returns: List of event logs. If iterator=True, will return a python generator object instead.
3140
"""
3241
if iterator:
3342
# Call iter_call directly as this returns the actual generator

docs/api/managers/event_log.rst

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

docs/cli.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ functionality not fully documented here.
1111

1212
.. toctree::
1313
:maxdepth: 2
14+
:glob:
1415

15-
cli/account
16-
cli/vs
17-
cli/hardware
18-
cli/ordering
19-
cli/users
20-
cli/ipsec
16+
cli/*
2117

2218
.. _config_setup:
2319

@@ -179,3 +175,4 @@ Most commands will take in additional options/arguments. To see all available ac
179175
--tags TEXT Show instances that have one of these comma-
180176
separated tags
181177
--help Show this message and exit.
178+

docs/cli/call_api.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. _cli_call_api:
2+
3+
Call API
4+
========
5+
6+
7+
.. click:: SoftLayer.CLI.call_api:cli
8+
:prog: call-api
9+
:show-nested:

docs/cli/event_log.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _cli_event_log:
2+
3+
Event-Log Commands
4+
====================
5+
6+
7+
.. click:: SoftLayer.CLI.event_log.get:cli
8+
:prog: event-log get
9+
:show-nested:
10+
11+
There are usually quite a few events on an account, so be careful when using the `--limit -1` option. The command will automatically break requests out into smaller sub-requests, but this command may take a very long time to complete. It will however print out data as it comes in.
12+
13+
.. click:: SoftLayer.CLI.event_log.types:cli
14+
:prog: event-log types
15+
:show-nested:
16+
17+
18+
Currently the types are as follows, more may be added in the future.
19+
::
20+
21+
:......................:
22+
: types :
23+
:......................:
24+
: Account :
25+
: CDN :
26+
: User :
27+
: Bare Metal Instance :
28+
: API Authentication :
29+
: Server :
30+
: CCI :
31+
: Image :
32+
: Bluemix LB :
33+
: Facility :
34+
: Cloud Object Storage :
35+
: Security Group :
36+
:......................:

0 commit comments

Comments
 (0)