Secrets Manager
Botree Secrets Manager utilities.
Classes
botree.secrets_manager.SecretsManager(session: Session, client_kwargs: dict = dict())
AWS Secrets Manager wrapper.
Source code in botree/secrets_manager.py
Functions
create_secret(name: str, secret: Dict[str, Any], description: str, *args: str, **kwargs: str) -> Dict[str, Union[str, Dict[str, str], List[str], int, datetime]]
Create a new secret.
Parameters:
-
name
(
str
) –Secret name.
-
secret
(
Dict[str, Any]
) –Secret content.
-
description
(
str
) –Secret AWS description.
Returns:
-
Dict[str, Union[str, Dict[str, str], List[str], int, datetime]]
–Chosen secret.
Source code in botree/secrets_manager.py
delete_secret(name: str, recovery_window: int = 30, force_delete: bool = False) -> dict
Delete an existing secret.
Parameters:
-
name
(
str
) –Secret name.
-
recovery_window
(
int
) –The number of days that Secrets Manager waits before permanently deleting the secret, by default 30.
-
force_delete
(
bool
) –Specifies whether to delete the secret without any recovery window. You can't use both this parameter and RecoveryWindowInDays in the same call. If you don't use either, then Secrets Manager defaults to a 30 day recovery window, by default False.
Returns:
-
Dict[str, Union[str, datetime, models.ResponseMetadata]]
–Metadata.
Source code in botree/secrets_manager.py
generate_password(length: int = 32, exclude_characters: str = '', exclude_numbers: bool = False, exclude_punctuation: bool = False, exclude_uppercase: bool = False, exclude_lowercase: bool = False, exclude_space: bool = True, include_each_type: bool = True) -> dict
Generates a strong random password.
Parameters:
-
length
(
int
) –The length of the password. If you don't include this parameter, by default 32
-
exclude_characters
(
str
) –A string of the characters that you don't want in the password, by default ""
-
exclude_numbers
(
bool
) –Specifies whether to exclude numbers from the password, by default False. If false, numbers will be included.
-
exclude_punctuation
(
bool
) –Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ . If False, the password can contain punctuation.
-
exclude_uppercase
(
bool
) –Specifies whether to exclude uppercase letters from the password, by default False. If False, the password can contain uppercase letters.
-
exclude_lowercase
(
bool
) –Specifies whether to exclude lowercase letters from the password, by default False. If False, the password can contain lowercase letters.
-
exclude_space
(
bool
) –Specifies whether to include the space character, by default True. If False, the password can contain space characters.
-
include_each_type
(
bool
) –Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation, by default True. If True, the password contains at least one of every character type.
Returns:
-
Mapping[Dict[str, str], Dict[str, models.ResponseMetadata]]
–Random password and, optionally, metadata.
Source code in botree/secrets_manager.py
get_secret(name: str, *args: str, **kwargs: str) -> Dict[str, Union[str, Dict[str, str], List[str], int, datetime]]
Get a secret from AWS Secrets Manager by name.
Parameters:
-
name
(
str
) –Secret name as in AWS Secrets Manager.
Returns:
-
Dict[str, Union[str, Dict[str, str], List[str], int, datetime]]
–Chosen secret.
Source code in botree/secrets_manager.py
list_secrets(*args, **kwargs) -> dict
Returns a list of all stored secrets.
Actually, this returns a list of all secrets within the Boto3 limit of 100.
Returns:
-
dict
–List of secrets and, optionally, metadata.