AWSParams

class awsparams.AWSParams(profile: str = '')

AWSParams handles all Parameter Store operations

Parameters:profile (optional) – AWS Profile to use for the session
ssm

Boto3 SSM Client object

Type:boto3.client
profile

AWS Profile to use for the session

Type:str, optional
build_param_result(param: dict, *, prefix: str = '', values: bool = True) → awsparams.ParamResult

Build a parameter result

Parameters:
  • param (dict) – Parameter to build ParamResult for
  • prefix (str, optional) – If passed prefix will be removed from parameter name
  • values (bool, optional) – Flag to toggle values defaults True
Returns:

Parameter result in a ParamResult NamedTuple.

Return type:

ParamResult

get_all_parameters(*, prefix: str = '', values: bool = True, decryption: bool = True, trim_name: bool = True) → List[awsparams.ParamResult]

Get all parameters Optionally by prefix or path

If prefix starts with a / then A Parameter path is assumed and the calls to aws will use path api’s which are more performant than traversing all parameters

Parameters:
  • prefix (str, optional) – Prefix to filter parameters on
  • values (bool, optional) – Flag toggle values defaults True
  • decryption (bool, optional) – Flag to toggle decryption defaults True
  • trim_name (bool, optional) – Flag to toggle name trimming on results defaults True
Returns:

List of Parameter Results

Return type:

List[ParamResult]

get_parameter(name: str, *, values: bool = True, decryption: bool = True) → Optional[awsparams.ParamResult]

Get a specific Parameter

Parameters:
  • name (str) – Name of parameter to get
  • values (bool, optional) – Flag to toggle values defaults True
  • decryption (bool, optional) – Flag to choose decryption. Defaults True
Returns:

The Parameter for success or else None

Return type:

ParamResult, None

get_parameter_value(name: str, *, decryption: bool = True) → str

Get a specified Parameter’s Value

Parameters:
  • name (str) – Name of parameter to get
  • decryption (bool, optional) – Flag to choose decryption. Defaults True
Returns:

Value of the Parameter as a string.

Return type:

str

new_param(name: str, value: str, *, param_type: str = 'String', key: str = '', description: str = '', overwrite: bool = False)

Create a new parameter

Parameters:
  • name (str) – Name of new parameter.
  • value (str) – Value of the new parameter
  • param_type (str, optional) – Type of New parameter default “String”
  • key (str, optional) – KMS Key to encrypt default “”
  • description (str, optional) – Description of the new parameter default “”
  • overwrite (bool, optional) – Flag to toggle overwriting existing parameter default False
put_parameter(parameter: dict, *, overwrite: bool = False, profile: str = '')

Put a Parameter

Parameters:
  • parameter (dict) – Parameter to create
  • overwrite (bool, optional) – Flag to overwrite existing parameters
  • profile (str, optional) – Optional specifiy a alternate profile to use
remove_parameter(param: str)

Remove a Parameter

Parameters:param (str) – Name of the parameter to remove
set_param(param: str, value: str) → bool

Edit an existing parameter

Parameters:
  • param (str) – Name of parameter to set.
  • value (str) – Value to set.
Returns:

True for modified False for unmodified

Return type:

bool