This class loads config values from the session instance vars.
| 584 | |
| 585 | |
| 586 | class InstanceVarProvider(BaseProvider): |
| 587 | """This class loads config values from the session instance vars.""" |
| 588 | |
| 589 | def __init__(self, instance_var, session): |
| 590 | """Initialize InstanceVarProvider. |
| 591 | |
| 592 | :type instance_var: str |
| 593 | :param instance_var: The instance variable to load from the session. |
| 594 | |
| 595 | :type session: :class:`botocore.session.Session` |
| 596 | :param session: The botocore session to get the loaded configuration |
| 597 | file variables from. |
| 598 | """ |
| 599 | self._instance_var = instance_var |
| 600 | self._session = session |
| 601 | |
| 602 | def provide(self): |
| 603 | """Provide a config value from the session instance vars.""" |
| 604 | instance_vars = self._session.instance_variables() |
| 605 | value = instance_vars.get(self._instance_var) |
| 606 | return value |
| 607 | |
| 608 | def __repr__(self): |
| 609 | return f'InstanceVarProvider(instance_var={self._instance_var}, session={self._session})' |
| 610 | |
| 611 | |
| 612 | class ScopedConfigProvider(BaseProvider): |
no outgoing calls