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[T]) → List[T][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 included- all other actions will be REMOVED
Parameters: original (list) – original policy actions list Returns: new list of actions Return type: list
-
_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: “.
Parameters: comment (str) – the original policy comment Returns: the modified comment Return type: str
-
_fix_filters
(filters: List[T]) → List[T][source]¶ Given a list of filters from a policy, update them for any tagging changes.
Parameters: filters (list) – filters from policy, or a subset thereof Returns: fixed filters Return type: list
-
_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.Parameters: item (dict) – the original action Returns: the modified action Return type: dict
-
_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)
.Parameters: item (dict) – the original action Returns: the modified action Return type: dict
-
_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
.Parameters: item (dict) – the original action Returns: the modified action Return type: dict
Convert a policy tags list to a notify only version, by appending a
notify-only
tag to the list.Parameters: tags (list) – the original tags list Returns: the modified list, with a notify-only tag appended Return type: 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.Parameters: item (dict) – the original action Returns: the modified action Return type: dict
-