CloudWanderer-io / CloudWanderer

A Python package which wanders across your AWS account and records your resources in a variety of Storage Connectors
http://cloudwanderer.io
MIT License
24 stars 1 forks source link

Allow passing Config object to cloudwanderer session #267

Open 0bart opened 2 years ago

0bart commented 2 years ago

Is your feature request related to a problem? Please describe. Currently when I want to change boto3 client's config I have to pass the botocore.config.Config object to the CloudWandererBoto3Session's resource method. If I use CloudWandererAWSInterface to get resources the only way to pass config object to boto3 client is to include it as client_args in CloudWandererAWSInterface's get_resources method what causes unnecessary chain. It makes impossible to inject ready-to-use CloudWandererAWSInterface object to high level code repositories or fetchers, since we have to pass client_args and handle passing client_args there.

Describe the solution you'd like IMO good idea would be to allow passing Config object to CloudWandererBoto3Session's __init__ as an optional parameter:

class CloudWandererBoto3Session(boto3.session.Session):
    def __init__(
            self,
            ...,
            config: Optional[botocore.client.Config] = None,
        ) -> None:
        ...

then invoke super().resource() method with config=config or self.config

Describe alternatives you've considered N/A

Additional context N/A