airbyte.secrets.prompt
Secret manager that prompts the user to enter a secret.
1# Copyright (c) 2024 Airbyte, Inc., all rights reserved. 2"""Secret manager that prompts the user to enter a secret.""" 3 4from __future__ import annotations 5 6import contextlib 7from getpass import getpass 8 9from airbyte.secrets.base import SecretManager, SecretSourceEnum, SecretString 10 11 12class SecretsPrompt(SecretManager): 13 """Secret manager that prompts the user to enter a secret.""" 14 15 name = SecretSourceEnum.PROMPT.value 16 17 def get_secret( 18 self, 19 secret_name: str, 20 ) -> SecretString | None: 21 """Prompt the user to enter a secret. 22 23 As a security measure, the secret is not echoed to the terminal when typed. 24 """ 25 with contextlib.suppress(Exception): 26 return SecretString(getpass(f"Enter the value for secret '{secret_name}': ")) 27 28 return None
13class SecretsPrompt(SecretManager): 14 """Secret manager that prompts the user to enter a secret.""" 15 16 name = SecretSourceEnum.PROMPT.value 17 18 def get_secret( 19 self, 20 secret_name: str, 21 ) -> SecretString | None: 22 """Prompt the user to enter a secret. 23 24 As a security measure, the secret is not echoed to the terminal when typed. 25 """ 26 with contextlib.suppress(Exception): 27 return SecretString(getpass(f"Enter the value for secret '{secret_name}': ")) 28 29 return None
Secret manager that prompts the user to enter a secret.
18 def get_secret( 19 self, 20 secret_name: str, 21 ) -> SecretString | None: 22 """Prompt the user to enter a secret. 23 24 As a security measure, the secret is not echoed to the terminal when typed. 25 """ 26 with contextlib.suppress(Exception): 27 return SecretString(getpass(f"Enter the value for secret '{secret_name}': ")) 28 29 return None
Prompt the user to enter a secret.
As a security measure, the secret is not echoed to the terminal when typed.