Skip to content

Commit 8c95cd9

Browse files
committed
changed strategy to provider
1 parent eabfc73 commit 8c95cd9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

databricks/sdk/credentials_provider.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,11 +1065,11 @@ def model_serving_auth(cfg: "Config") -> Optional[CredentialsProvider]:
10651065

10661066

10671067
class DefaultCredentials:
1068-
"""Select the first applicable credential strategy from the chain"""
1068+
"""Select the first applicable credential provider from the chain"""
10691069

10701070
def __init__(self) -> None:
10711071
self._auth_type = "default"
1072-
self._auth_strategies = [
1072+
self._auth_providers = [
10731073
pat_auth,
10741074
basic_auth,
10751075
metadata_service,
@@ -1093,26 +1093,26 @@ def auth_type(self) -> str:
10931093
return self._auth_type
10941094

10951095
def oauth_token(self, cfg: "Config") -> oauth.Token:
1096-
for strategy in self._auth_strategies:
1097-
auth_type = strategy.auth_type()
1096+
for provider in self._auth_providers:
1097+
auth_type = provider.auth_type()
10981098
if auth_type != self._auth_type:
10991099
# ignore other auth types if they don't match the selected one
11001100
continue
1101-
return strategy.oauth_token(cfg)
1101+
return provider.oauth_token(cfg)
11021102

11031103
def __call__(self, cfg: "Config") -> CredentialsProvider:
1104-
for strategy in self._auth_strategies:
1105-
auth_type = strategy.auth_type()
1104+
for provider in self._auth_providers:
1105+
auth_type = provider.auth_type()
11061106
if cfg.auth_type and auth_type != cfg.auth_type:
11071107
# ignore other auth types if one is explicitly enforced
11081108
logger.debug(f"Ignoring {auth_type} auth, because {cfg.auth_type} is preferred")
11091109
continue
11101110
logger.debug(f"Attempting to configure auth: {auth_type}")
11111111
try:
1112-
# The header factory might be None if the strategy cannot be
1112+
# The header factory might be None if the provider cannot be
11131113
# configured for the current environment. For example, if the
1114-
# strategy requires some missing environment variables.
1115-
header_factory = strategy(cfg)
1114+
# provider requires some missing environment variables.
1115+
header_factory = provider(cfg)
11161116
if not header_factory:
11171117
continue
11181118

0 commit comments

Comments
 (0)