Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
54f72c1
security-groups-request-ids : Add output for RequestIDs
fisherma91 Aug 23, 2017
4c0badf
security-groups-request-ids : Add output for RequestIDs
fisherma91 Aug 25, 2017
7768a83
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 6, 2017
d3650de
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 23, 2017
f4bc42f
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 23, 2017
d7a736f
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 24, 2017
d851de6
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 24, 2017
4228058
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 24, 2017
9d04a8e
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 24, 2017
a3406a1
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 24, 2017
884d117
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 25, 2017
7c25d97
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 26, 2017
265460a
security-groups-request-ids : Add output for RequestIDs
fisherma91 Oct 27, 2017
a453d6d
Merge branch 'master' into security-groups-request-ids
fisherma91 Jan 9, 2018
01ee771
security-groups-request-ids : Add output for RequestIDs
fisherma91 Jan 9, 2018
3a72d7f
security-groups-request-ids : Add output for RequestIDs
fisherma91 Feb 1, 2018
6333687
Major refactoring of audit log code
fisherma91 Feb 8, 2018
0b83362
Merge pull request #1097 from erick-sapp/dev
allmightyspiff Feb 5, 2019
6ae6814
Updated fixture.
Feb 5, 2019
495dcc2
Merge branch 'master' into finishfish
erick-sapp Feb 5, 2019
e2648c6
Fixing typos and refactoring work.
Feb 5, 2019
5a406b4
More refactoring.
Feb 5, 2019
8bbbe78
Formating changes.
Feb 5, 2019
82574e0
Updates to fixture and unit test.
Feb 5, 2019
5320df0
Refactoring. Audi-log is no more. All references has been changed to …
Feb 5, 2019
5aee15e
Merge pull request #3 from erick-sapp/master
erick-sapp Feb 5, 2019
bb1717c
Made the metadata field optional, and handles empty responses.
Feb 6, 2019
8bb2b1e
Updated unit tests.
Feb 6, 2019
004e5af
Strips out leading and trailing curly-brackets from metadata if displ…
Feb 6, 2019
d21cbd1
Added and renamed fields.
Feb 7, 2019
6a16076
Finished unit test.
Feb 10, 2019
62e66b7
Formating changes.
Feb 10, 2019
563f5da
Added limit option to 'event-log get'.
Feb 10, 2019
c822afc
Merge pull request #1099 from erick-sapp/finishfish
allmightyspiff Feb 13, 2019
ac20b16
Version 5.7.0
allmightyspiff Feb 15, 2019
c0553f4
Merge pull request #1102 from allmightyspiff/master
allmightyspiff Feb 15, 2019
9033912
Merge pull request #4 from erick-sapp/master
erick-sapp Feb 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
# Change Log


## [5.7.0] - 2018-11-16
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.6.4...master

+ #1099 Support for security group Ids
+ event-log cli command
+ #1069 Virtual Placement Group Support
```
slcli vs placementgroup --help
Commands:
create Create a placement group
create-options List options for creating Reserved Capacity
delete Delete a placement group.
detail View details of a placement group.
list List Reserved Capacity groups.
```
+ #962 Rest Transport improvements. Properly handle HTTP exceptions instead of crashing.
+ #1090 removed power_state column option from "slcli server list"
+ #676 - ipv6 support for creating virtual guests
* Refactored virtual guest creation to use Product_Order::placeOrder instead of Virtual_Guest::createObject, because createObject doesn't allow adding IPv6
+ #882 Added table which shows the status of each url in object storage
+ #1085 Update provisionedIops reading to handle float-y values
+ #1074 fixed issue with config setup
+ #1081 Fix file volume-cancel
+ #1059 Support for SoftLayer_Hardware_Server::toggleManagementInterface
* `slcli hw toggle-ipmi`


## [5.6.4] - 2018-11-16

- Changes: https://github.com/softlayer/softlayer-python/compare/v5.6.3...v5.6.4
Expand Down
1 change: 1 addition & 0 deletions SoftLayer/CLI/event_log/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Event Logs."""
77 changes: 77 additions & 0 deletions SoftLayer/CLI/event_log/get.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"""Get Event Logs."""
# :license: MIT, see LICENSE for more details.

import json

import click

import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting

COLUMNS = ['event', 'object', 'type', 'date', 'username']


@click.command()
@click.option('--date-min', '-d',
help='The earliest date we want to search for event logs in mm/dd/yyyy format.')
@click.option('--date-max', '-D',
help='The latest date we want to search for event logs in mm/dd/yyyy format.')
@click.option('--obj-event', '-e',
help="The event we want to get event logs for")
@click.option('--obj-id', '-i',
help="The id of the object we want to get event logs for")
@click.option('--obj-type', '-t',
help="The type of the object we want to get event logs for")
@click.option('--utc-offset', '-z',
help="UTC Offset for searching with dates. The default is -0000")
@click.option('--metadata/--no-metadata', default=False,
help="Display metadata if present")
@click.option('--limit', '-l', default=30,
help="How many results to get in one api call, default is 30.")
@environment.pass_env
def cli(env, date_min, date_max, obj_event, obj_id, obj_type, utc_offset, metadata, limit):
"""Get Event Logs"""

mgr = SoftLayer.EventLogManager(env.client)
usrmgr = SoftLayer.UserManager(env.client)
request_filter = mgr.build_filter(date_min, date_max, obj_event, obj_id, obj_type, utc_offset)
logs = mgr.get_event_logs(request_filter, log_limit=limit)

if logs is None:
env.fout('None available.')
return

if metadata and 'metadata' not in COLUMNS:
COLUMNS.append('metadata')

table = formatting.Table(COLUMNS)

if metadata:
table.align['metadata'] = "l"

for log in logs:
user = log['userType']
label = ''

try:
label = log['label']
except KeyError:
pass # label is already at default value.

if user == "CUSTOMER":
user = usrmgr.get_user(log['userId'], "mask[username]")['username']
if metadata:
try:
metadata_data = json.dumps(json.loads(log['metaData']), indent=4, sort_keys=True)
if env.format == "table":
metadata_data = metadata_data.strip("{}\n\t")
except ValueError:
metadata_data = log['metaData']

table.add_row([log['eventName'], label, log['objectName'],
log['eventCreateDate'], user, metadata_data])
else:
table.add_row([log['eventName'], label, log['objectName'],
log['eventCreateDate'], user])
env.fout(table)
26 changes: 26 additions & 0 deletions SoftLayer/CLI/event_log/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Get Event Log Types."""
# :license: MIT, see LICENSE for more details.

import click

import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting

COLUMNS = ['types']


@click.command()
@environment.pass_env
def cli(env):
"""Get Event Log Types"""
mgr = SoftLayer.EventLogManager(env.client)

event_log_types = mgr.get_event_log_types()

table = formatting.Table(COLUMNS)

for event_log_type in event_log_types:
table.add_row([event_log_type])

env.fout(table)
5 changes: 5 additions & 0 deletions SoftLayer/CLI/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
('block:volume-order', 'SoftLayer.CLI.block.order:cli'),
('block:volume-set-lun-id', 'SoftLayer.CLI.block.lun:cli'),

('event-log', 'SoftLayer.CLI.event_log'),
('event-log:get', 'SoftLayer.CLI.event_log.get:cli'),
('event-log:types', 'SoftLayer.CLI.event_log.types:cli'),

('file', 'SoftLayer.CLI.file'),
('file:access-authorize', 'SoftLayer.CLI.file.access.authorize:cli'),
('file:access-list', 'SoftLayer.CLI.file.access.list:cli'),
Expand Down Expand Up @@ -256,6 +260,7 @@
'SoftLayer.CLI.securitygroup.interface:add'),
('securitygroup:interface-remove',
'SoftLayer.CLI.securitygroup.interface:remove'),
('securitygroup:event-log', 'SoftLayer.CLI.securitygroup.event_log:get_by_request_id'),

('sshkey', 'SoftLayer.CLI.sshkey'),
('sshkey:add', 'SoftLayer.CLI.sshkey.add:cli'),
Expand Down
32 changes: 32 additions & 0 deletions SoftLayer/CLI/securitygroup/event_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Get event logs relating to security groups"""
# :license: MIT, see LICENSE for more details.

import json

import click

import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting

COLUMNS = ['event', 'label', 'date', 'metadata']


@click.command()
@click.argument('request_id')
@environment.pass_env
def get_by_request_id(env, request_id):
"""Search for event logs by request id"""
mgr = SoftLayer.NetworkManager(env.client)

logs = mgr.get_event_logs_by_request_id(request_id)

table = formatting.Table(COLUMNS)
table.align['metadata'] = "l"

for log in logs:
metadata = json.dumps(json.loads(log['metaData']), indent=4, sort_keys=True)

table.add_row([log['eventName'], log['label'], log['eventCreateDate'], metadata])

env.fout(table)
24 changes: 18 additions & 6 deletions SoftLayer/CLI/securitygroup/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
'interface',
'ipAddress', ]

REQUEST_COLUMNS = ['requestId']


@click.command()
@click.argument('securitygroup_id')
Expand Down Expand Up @@ -90,11 +92,16 @@ def add(env, securitygroup_id, network_component, server, interface):
mgr = SoftLayer.NetworkManager(env.client)
component_id = _get_component_id(env, network_component, server, interface)

success = mgr.attach_securitygroup_component(securitygroup_id,
component_id)
if not success:
ret = mgr.attach_securitygroup_component(securitygroup_id,
component_id)
if not ret:
raise exceptions.CLIAbort("Could not attach network component")

table = formatting.Table(REQUEST_COLUMNS)
table.add_row([ret['requestId']])

env.fout(table)


@click.command()
@click.argument('securitygroup_id')
Expand All @@ -113,11 +120,16 @@ def remove(env, securitygroup_id, network_component, server, interface):
mgr = SoftLayer.NetworkManager(env.client)
component_id = _get_component_id(env, network_component, server, interface)

success = mgr.detach_securitygroup_component(securitygroup_id,
component_id)
if not success:
ret = mgr.detach_securitygroup_component(securitygroup_id,
component_id)
if not ret:
raise exceptions.CLIAbort("Could not detach network component")

table = formatting.Table(REQUEST_COLUMNS)
table.add_row([ret['requestId']])

env.fout(table)


def _validate_args(network_component, server, interface):
use_server = bool(server and interface and not network_component)
Expand Down
27 changes: 25 additions & 2 deletions SoftLayer/CLI/securitygroup/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
'createDate',
'modifyDate']

REQUEST_BOOL_COLUMNS = ['requestId', 'response']
REQUEST_RULES_COLUMNS = ['requestId', 'rules']


@click.command()
@click.argument('securitygroup_id')
Expand Down Expand Up @@ -109,6 +112,11 @@ def add(env, securitygroup_id, remote_ip, remote_group,
if not ret:
raise exceptions.CLIAbort("Failed to add security group rule")

table = formatting.Table(REQUEST_RULES_COLUMNS)
table.add_row([ret['requestId'], str(ret['rules'])])

env.fout(table)


@click.command()
@click.argument('securitygroup_id')
Expand Down Expand Up @@ -149,9 +157,16 @@ def edit(env, securitygroup_id, rule_id, remote_ip, remote_group,
if protocol:
data['protocol'] = protocol

if not mgr.edit_securitygroup_rule(securitygroup_id, rule_id, **data):
ret = mgr.edit_securitygroup_rule(securitygroup_id, rule_id, **data)

if not ret:
raise exceptions.CLIAbort("Failed to edit security group rule")

table = formatting.Table(REQUEST_BOOL_COLUMNS)
table.add_row([ret['requestId']])

env.fout(table)


@click.command()
@click.argument('securitygroup_id')
Expand All @@ -160,5 +175,13 @@ def edit(env, securitygroup_id, rule_id, remote_ip, remote_group,
def remove(env, securitygroup_id, rule_id):
"""Remove a rule from a security group."""
mgr = SoftLayer.NetworkManager(env.client)
if not mgr.remove_securitygroup_rule(securitygroup_id, rule_id):

ret = mgr.remove_securitygroup_rule(securitygroup_id, rule_id)

if not ret:
raise exceptions.CLIAbort("Failed to remove security group rule")

table = formatting.Table(REQUEST_BOOL_COLUMNS)
table.add_row([ret['requestId']])

env.fout(table)
2 changes: 1 addition & 1 deletion SoftLayer/CLI/user/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@click.option('--logins', '-l', is_flag=True, default=False,
help="Show login history of this user for the last 30 days")
@click.option('--events', '-e', is_flag=True, default=False,
help="Show audit log for this user.")
help="Show event log for this user.")
@environment.pass_env
def cli(env, identifier, keys, permissions, hardware, virtual, logins, events):
"""User details."""
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

:license: MIT, see LICENSE for more details.
"""
VERSION = 'v5.6.4'
VERSION = 'v5.7.0'
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/'
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'
Expand Down
Loading