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
ResourceDocumentobject to anAwsResourceItem.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().