awsc.base_control.ResourceLister

class awsc.base_control.ResourceLister(*args, selector_cb=None, **kwargs)

The meaty ResourceLister is the object that handles all of the resource listing from AWS. Most basic resource listers will be direct subclasses with minor configuration.

Attributes:
command_palettelist(str)

A list of commands for opening this particular resource lister. This may be any proper name for the AWS resource, such as queue, a shorthand, such as sqs, or any commonly known alternative name.

resource_typestr

The human-readable name of the resource type.

main_providerstr

The provider the list_method uses in boto3.

categorystr

A human-readable name of the category of AWS resources this lister belongs to, for logging purposes.

subcategorystr

A human-readable name of the subcategory of AWS resources this lister belongs to, for logging purposes.

list_methodstr

The method to call to list the resources.

list_kwargsdict

The kwargs to pass to the list method. May be modified in the initializer for dynamic parameters.

item_pathstr

The path where an item can be retrieved.

columnsdict

A map of column specification. Each column’s key is the name of the column, while the value is a dict with the following fields: - path (required): The jq path for the column within the item. - size (required if not hidden): The size of the column. - weight (int, default 0): The weight of the column for sorting the columns in order. - hidden (bool, default false): Whether the column is hidden. - sort_weight (int, optional): If present, the weight of the column for sorting rows. Columns without a sort weight are not used

for sorting.

primary_keystr

The field which contains the unique identifier of the resource. For most resources, this is the same field every time. Not always, unfortunately.

describe_commandcallable or str

The command to run for the describe autogenerated action. If str, this is a reference to another, existing hotkey. If callable, the function is called and the return value is pushed as a new frame (so ideally, use an opener classmethod as the thing to pass to this). The describe command will be assigned the d hotkey, as well as the ENTER hotkey is no open command is present.

describe_kwargsdict

Additional keyword arguments to pass to the describe command.

describe_selection_argstr, default=”entry”

The name of the keyword argument where the selection of this list control should be passed on describe.

open_commandcallable or str

The command to run for the open autogenerated action. If str, this is a reference to another, existing hotkey. If callable, the function is called and the return value is pushed as a new frame (so ideally, use an opener classmethod as the thing to pass to this). The open command will be assigned the ENTER hotkey. If not present, the describe_command is instead assigned to the ENTER key.

open_kwargsdict

Additional keyword arguments to pass to the open command.

open_selection_argstr, default=”entry”

The name of the keyword argument where the selection of this list control should be passed on open.

Methods

Autocommand(command_class, key[, tooltip, ...])

Class decorator that automatically assigns a hotkey to a function upon instantiation of the target class.

Autohotkey(key[, tooltip, is_validated, ...])

Decorator that automatically assigns a hotkey to a function upon instantiation.

add_block(block)

Adds a new child block to this block.

add_column(column[, min_size, index])

Adds a new column to the ListControl.

add_entry(entry)

Adds a new entry to the ListControl.

add_hotkey(hotkey, action[, tooltip, ...])

Adds a new hotkey to the control.

async_inner(*args, fn[, clear])

Inner section of asynch.

asynch(fn, *args[, clear])

Async wrapper.

auto_refresh()

Automatic refresh function stub for implementation in subclasses.

autohotkey_condition(hotkey)

Autohotkey condition callback.

before_paint()

Hook function for acting on the block before any blocks are painted for the current frame.

before_paint_critical()

Critical section for the pre-paint hook.

bottomright()

Returns the coordinates of the bottom right corner of the block.

clear_blocks([tag])

Removes all blocks with the matching tag from the child blocks of this block.

command(cmd, **kwargs)

Inner section of a command hotkey callback.

command_wrapper(cmd, selection_arg, **kwargs)

Wraps a command as a hotkey callback.

confirm_template(*args[, hotkey, hotkey_tooltip])

Creates a confirmation sequence.

copy_arn(*args)

Copies the ARN of the selection to the clipboard if available.

describe(*args)

Describe is a special command automatically assigned to 'd' if describe_command is set.

empty(_)

Callback used to generate an empty string.

end(*args)

Hotkey callback for KEY_END.

get_data(*args, **kwargs)

Data streaming function.

get_data_generic(resource_key, list_method, ...)

Generic data retrieval function designed to interact with the AWS API.

handle_finalization_critical()

Finalization hook.

handle_new_entries_critical(entries)

Critical section for the new entry hook.

home(*args)

Hotkey callback for KEY_HOME.

input(key)

Input handler hook function.

list_down(*args)

Hotkey callback for KEY_DOWN.

list_up(*args)

Hotkey callback for KEY_UP.

matches(list_entry, *args)

For pre-filtering resource listers, this function decides whether a list entry being generated matches the criteria for being displayed on the control.

on_close()

Cleanup hook.

open(*args)

Describe is a special command automatically assigned to ENTER if open_command is set.

opener(**kwargs)

Session-aware initializer for this class.

pagedown(*args)

Hotkey callback for KEY_PAGEDOWN.

pageup(*args)

Hotkey callback for KEY_PAGEUP.

paint()

Hook function for painting the block.

refresh_data(*args, **kwargs)

Performs a full refresh asynchronously, fetching all data again and updating all entries as required.

register()

Classmethod to register this class and all of its subclasses with the commander control.

remove_block(block)

Removes a specific block from this block.

reparent()

Shorthand function for removing a Block from its parent and re-adding it.

select_and_close(*args)

Hotkey callback for KEY_ENTER in selector mode.

selector(callback, **kwargs)

Session-aware initializer for this class for opening it in selector mode.

selector_template(method, template, title, ...)

Templates a SingleSelectionDialog flow, which calls an AWS API method with the provided template at the end of the flow.

sort()

Sorts the list of entries.

title_info()

Title info callback for this class.

topleft()

Returns the coordinates of the top left corner of the block.

validate_hotkey(key)

Validates whether a hotkey can be used based on the state of the control.

on_become_frame

__init__(*args, selector_cb=None, **kwargs)

Initializes a ListControl object.

Methods

__init__(*args[, selector_cb])

Initializes a ListControl object.

add_block(block)

Adds a new child block to this block.

add_column(column[, min_size, index])

Adds a new column to the ListControl.

add_entry(entry)

Adds a new entry to the ListControl.

add_hotkey(hotkey, action[, tooltip, ...])

Adds a new hotkey to the control.

async_inner(*args, fn[, clear])

Inner section of asynch.

asynch(fn, *args[, clear])

Async wrapper.

auto_refresh()

Automatic refresh function stub for implementation in subclasses.

autohotkey_condition(hotkey)

Autohotkey condition callback.

before_paint()

Hook function for acting on the block before any blocks are painted for the current frame.

before_paint_critical()

Critical section for the pre-paint hook.

bottomright()

Returns the coordinates of the bottom right corner of the block.

clear_blocks([tag])

Removes all blocks with the matching tag from the child blocks of this block.

command(cmd, **kwargs)

Inner section of a command hotkey callback.

command_wrapper(cmd, selection_arg, **kwargs)

Wraps a command as a hotkey callback.

confirm_template(*args[, hotkey, hotkey_tooltip])

Creates a confirmation sequence.

copy_arn(*args)

Copies the ARN of the selection to the clipboard if available.

describe(*args)

Describe is a special command automatically assigned to 'd' if describe_command is set.

empty(_)

Callback used to generate an empty string.

end(*args)

Hotkey callback for KEY_END.

get_data(*args, **kwargs)

Data streaming function.

get_data_generic(resource_key, list_method, ...)

Generic data retrieval function designed to interact with the AWS API.

handle_finalization_critical()

Finalization hook.

handle_new_entries_critical(entries)

Critical section for the new entry hook.

home(*args)

Hotkey callback for KEY_HOME.

input(key)

Input handler hook function.

list_down(*args)

Hotkey callback for KEY_DOWN.

list_up(*args)

Hotkey callback for KEY_UP.

matches(list_entry, *args)

For pre-filtering resource listers, this function decides whether a list entry being generated matches the criteria for being displayed on the control.

on_become_frame()

on_close()

Cleanup hook.

open(*args)

Describe is a special command automatically assigned to ENTER if open_command is set.

opener(**kwargs)

Session-aware initializer for this class.

pagedown(*args)

Hotkey callback for KEY_PAGEDOWN.

pageup(*args)

Hotkey callback for KEY_PAGEUP.

paint()

Hook function for painting the block.

refresh_data(*args, **kwargs)

Performs a full refresh asynchronously, fetching all data again and updating all entries as required.

register()

Classmethod to register this class and all of its subclasses with the commander control.

remove_block(block)

Removes a specific block from this block.

reparent()

Shorthand function for removing a Block from its parent and re-adding it.

select_and_close(*args)

Hotkey callback for KEY_ENTER in selector mode.

selector(callback, **kwargs)

Session-aware initializer for this class for opening it in selector mode.

selector_template(method, template, title, ...)

Templates a SingleSelectionDialog flow, which calls an AWS API method with the provided template at the end of the flow.

sort()

Sorts the list of entries.

title_info()

Title info callback for this class.

topleft()

Returns the coordinates of the top left corner of the block.

validate_hotkey(key)

Validates whether a hotkey can be used based on the state of the control.

Attributes

additional_commands

border

Returns the border of the control.

category

columns

command_palette

corners

Read-only property for calculating the four corners of the block.

describe_command

describe_kwargs

describe_selection_arg

filter

Allows for filtering the list entries without removing them.

filtered

Read-only property that returns the list of filtered entris.

height

Read-only property for the height of the block.

inner

Read-only property for calculating the four inner corners of the block.

item_path

list_kwargs

list_method

main_provider

open_command

open_kwargs

open_selection_arg

prefix

primary_key

resource_type

rows

Read-only property which contains the number of visible rows in the control.

selection

Read-only property which contains the currently selected list entry.

subcategory

title

w_in

Read-only property for the inner width of the block.

width

Read-only property for the width of the block.