MCPcopy Index your code
hub / github.com/aws/aws-cli / load

Method load

awscli/botocore/credentials.py:1157–1177  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1155 self._role_fetcher = iam_role_fetcher
1156
1157 def load(self):
1158 fetcher = self._role_fetcher
1159 # We do the first request, to see if we get useful data back.
1160 # If not, we'll pass & move on to whatever's next in the credential
1161 # chain.
1162 metadata = fetcher.retrieve_iam_role_credentials()
1163 if not metadata:
1164 return None
1165 register_feature_id('CREDENTIALS_IMDS')
1166 logger.debug(
1167 'Found credentials from IAM Role: %s', metadata['role_name']
1168 )
1169 # We manually set the data here, since we already made the request &
1170 # have it. When the expiry is hit, the credentials will auto-refresh
1171 # themselves.
1172 creds = RefreshableCredentials.create_from_metadata(
1173 metadata,
1174 method=self.METHOD,
1175 refresh_using=fetcher.retrieve_iam_role_credentials,
1176 )
1177 return creds
1178
1179
1180class EnvProvider(CredentialProvider):

Calls 3

register_feature_idFunction · 0.90
create_from_metadataMethod · 0.80

Tested by 2