manheim_c7n_tools.notifyonly module¶
- class manheim_c7n_tools.notifyonly.NotifyOnlyPolicy(policy: dict)[source]¶
Bases:
object
This class converts a c7n policy to a “notify only” policy. See Notify-Only Option for Policies for details.
IMPORTANT: When making changes to this class, be SURE to update Notify-Only Option for Policies in the documentation.
- _fix_actions(original: List) List [source]¶
Given a list of actions from a policy, return a new list of notify-only actions.
notify
actions will be included unmodifiedmark
/tag
actions will be passed through_fix_tag_action()
and the result includedmark-for-op
actions will be passed through_fix_mark_for_op_action()
and the result includedremove-tag
/unmark
/untag
actions will be passed through_fix_untag_action()
and the result includedall other actions will be REMOVED
- _fix_comment(comment: str) str [source]¶
Convert a policy comment/comments/description to a notify only version, by prefixing it with the string “NOTIFY ONLY: “.
- _fix_filters(filters: List) List [source]¶
Given a list of filters from a policy, update them for any tagging changes.
- _fix_mark_for_op_action(item: dict) dict [source]¶
Fix a
mark-for-op
action for notify-only operation.The string
notify-only
will be appended to the tag name used.
- _fix_notify_action(item: dict) dict [source]¶
Fix a
notify
action for notify-only operation.If the
violation_desc
key is present, its value will be prefixed withNOTIFY ONLY: ``. If the ``action_desc
key is present, its value will be prefixed with the stringin the future (currently notify-only)
.
- _fix_tag_action(item: dict) dict [source]¶
Fix a
tag
/mark
action for notify-only operation.The string
-notify-only
will be appended to thetag
item,key
item, and/or every item in thetags
list.If none of these values are set, the
tag
item will be set to the custodianDEFAULT_TAG
, suffixed with-notify-only
.
- _fix_tags(tags: List[str]) List[str] [source]¶
Convert a policy tags list to a notify only version, by appending a
notify-only
tag to the list.
- _fix_untag_action(item: dict) dict [source]¶
Fix a
remove-tag
/unmark
/untag
action for notify-only operation.All tag names in the
tags
list will have-notify-only
appended.