MCPcopy Create free account
hub / github.com/aws/aws-cli / InstanceVarProvider

Class InstanceVarProvider

awscli/botocore/configprovider.py:586–609  ·  view source on GitHub ↗

This class loads config values from the session instance vars.

Source from the content-addressed store, hash-verified

584
585
586class 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
612class ScopedConfigProvider(BaseProvider):

Calls

no outgoing calls

Tested by 1

assert_provides_valueMethod · 0.72