aws_resource_item#

See AwsResourceItem.

class aws_resource_search.items.aws_resource_item.T_AWS_RESOURCE_ITEM_VARIABLES(*args, **kwargs)[source]#

Type hint for the “variables” field in AwsResourceItem.

class aws_resource_search.items.aws_resource_item.AwsResourceItem(title: str, subtitle: ~typing.Optional[str] = None, uid: str = <factory>, arg: ~typing.Optional[str] = None, autocomplete: ~typing.Optional[str] = None, variables: ~aws_resource_search.items.aws_resource_item.T_AWS_RESOURCE_ITEM_VARIABLES = <factory>)[source]#

Represent an item in the resource search result.

Parameters:

variables – in AwsResourceItem, the variable is a dictionary including the original document object (not dict).

classmethod from_document(resource_type: str, doc: T_ARS_RESOURCE_DOCUMENT)[source]#

A factory method that convert a dictionary view of a ResourceDocument object to an AwsResourceItem.

For example: if the doc is:

>>> doc = dataclasses.asdict(
...     S3Bucket(
...         title="my-bucket",
...         subtitle="bucket creation date",
...         uid="my-bucket",
...         autocomplete="my-bucket",
...     )
... )

Then the item will be:

>>> dataclasses.asdict(AwsResourceItem.from_document(doc))
{
    "title": "my-bucket",
    "subtitle": "bucket creation date",
    "uid": "s3-bucket",
    "autocomplete": "s3-bucket: my-bucket",
    "variables": {"doc": S3Bucket(...)},
}

We also have an array version AwsResourceItem.from_many_document().

classmethod from_many_document(resource_type: str, docs: Iterable[T_ARS_RESOURCE_DOCUMENT])[source]#

An array version of AwsResourceItem.from_document().

get_id() str[source]#

Get the resource id.

get_name() str[source]#

Get the resource name.

get_console_url(console: acu.AWSConsole) str[source]#

Get AWS console url of the resource.

get_arn() str[source]#

Get ARN of the resource.

enter_handler(ui: UI)[source]#

Default behavior:

Open AWS console url in browser.

ctrl_a_handler(ui: UI)[source]#

Default behavior:

Copy ARN to clipboard.

ctrl_u_handler(ui: UI)[source]#

Default behavior:

Copy AWS console url to clipboard.

ctrl_p_handler(ui: UI)[source]#

View details in a sub session. You can tap ‘F1’ to exit the sub session.