s3#

S3 related resources.

This module is an example of how to enable aws_resource_search to support new resource types.

class aws_resource_search.res.s3.S3Bucket(raw_data: T_RESULT_DATA, id: str, name: str)[source]#

S3 Bucket resource data model.

classmethod from_resource(resource, bsm, boto_kwargs)[source]#

Create a document object from the boto3 API response data. Since the API response data relies on both the โ€˜bsmโ€™ object and โ€˜boto_kwargs,โ€™ we also require this information to create the document object.

For example, s3_client.list_buckets api returns:

{
    'Name': '...',
    'CreationDate': datetime.datetime(...)
}

Then, the implementation should be:

>>> @dataclasses.dataclass
... class S3BucketDocument(ResourceDocument):
...     @classmethod
...     def from_resource(
...         cls,
...         resource: "T_RESULT_DATA",
...         bsm: "BotoSesManager",
...         boto_kwargs: dict,
...     ):
...         return cls(
...             raw_data=resource,
...             id=resource["Name"],
...             name=resource["Name"],
...         )

Note

You have to implement this method for each AWS Resource Type.

property title: str#

Example: bucket_name = my-bucket

property subtitle: str#

Example: create_at = 2021-07-06T15:04:40+00:00, ๐ŸŒ Enter, ๐Ÿ“‹ Ctrl A, ๐Ÿ”— Ctrl U, ๐Ÿ‘€ Ctrl P.

property autocomplete: str#

Automatically enter the bucket name.

property arn: str#

Example: arn:aws:s3:::my-bucket

get_console_url(console: AWSConsole) str[source]#

AWS Console URL to view this AWS resource in the console. If applicable, User can tap โ€˜Enterโ€™ to open in browser.

Important

You have to implement this method for each AWS Resource Type.

classmethod get_list_resources_console_url(console: AWSConsole) str[source]#

AWS Console URL to view list all AWS resources of this type in the console. If applicable, User can tap โ€˜Enterโ€™ to open in browser.

Important

You have to implement this method for each AWS Resource Type.

get_details(ars: ARS) List[DetailItem][source]#

Include s3 uri, s3 arn, bucket location and tags in details.

class aws_resource_search.res.s3.S3BucketSearcher(service: str, method: str, is_paginator: bool, default_boto_kwargs: Optional[dict], result_path: ResultPath, doc_class: Type[T_ARS_RESOURCE_DOCUMENT], resource_type: str, fields: List[Union[StoredField, IdField, IdListField, KeywordField, TextField, NumericField, DatetimeField, BooleanField, NgramField, NgramWordsField]], cache_expire: int, more_cache_key: Optional[Callable[[Dict[str, Any]], List[str]]], bsm: Optional[BotoSesManager] = None)[source]#