tagging¶
This module implements the AWS CloudFormation resource tags handling logics.
Due to the historical reason, the AWS CloudFormation resource tags type definition is not consistent, we have to add more logic to handle both old tag type and new tag type.
- cottonformation.core.tagging.get_tags_if_tags(res: Resource) Dict[str, str] [source]¶
The aws cft definition is wrong, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-insightrule-tags.html
- cottonformation.core.tagging.put_tags_if_tags(res: Resource, tags: Dict[str, str])[source]¶
The aws cft definition is wrong, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-insightrule-tags.html
- cottonformation.core.tagging.update_tags(res: Resource, tags: Dict[str, str], mode_skip: bool = False, mode_overwrite: bool = False, mode_raise: bool = False) Tuple[Dict[str, str], Dict[str, str]] [source]¶
Update CloudFormation resource tags.
- Parameters
res – the
Resource
objecttags – key value tags in python dictionary
mode_skip – if the key already exists, then skip it
mode_overwrite – if the key already exists, then overwrite it with new value
mode_raise – if the key already exists, then raise error
- Returns
the before and after tags in python dictionary.