Skip to content

More efficient created_by #2161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion SoftLayer/CLI/dedicatedhost/list_guests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from SoftLayer import utils

COLUMNS = [
column_helper.Column('guid', ('globalIdentifier',)),
Expand All @@ -18,7 +19,8 @@
column_helper.Column('backend_ip', ('primaryBackendIpAddress',)),
column_helper.Column(
'created_by',
('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
lambda created_by: utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
column_helper.Column('power_state', ('powerState', 'name')),
column_helper.Column(
'tags',
Expand Down
4 changes: 3 additions & 1 deletion SoftLayer/CLI/hardware/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from SoftLayer import utils

# pylint: disable=unnecessary-lambda

Expand All @@ -22,7 +23,8 @@
mask='activeTransaction[id, transactionStatus[name, friendlyName]]'),
column_helper.Column(
'created_by',
('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
lambda created_by: utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
column_helper.Column(
'tags',
lambda server: formatting.tags(server.get('tagReferences')),
Expand Down
4 changes: 3 additions & 1 deletion SoftLayer/CLI/virt/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
column_helper.Column('action', lambda guest: formatting.active_txn(guest),
mask='activeTransaction[id,transactionStatus[name,friendlyName]]'),
column_helper.Column('power_state', ('powerState', 'name')),
column_helper.Column('created_by', ('billingItem', 'orderItem', 'order', 'userRecord', 'username')),
column_helper.Column('created_by', lambda created_by:
utils.lookup(created_by, 'billingItem', 'orderItem', 'order', 'userRecord', 'username'),
mask='billingItem[id,orderItem[id,order[id,userRecord[username]]]]'),
column_helper.Column('tags', lambda server: formatting.tags(server.get('tagReferences')),
mask="tagReferences.tag.name"),
column_helper.Column(
Expand Down
Loading