create_automation_rule
async
¶
create_automation_rule(
*,
config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
tags: Optional[TagMap] = None,
rule_status: Optional[RuleStatus] = None,
rule_order: Optional[RuleOrderValue] = None,
rule_name: Optional[NonEmptyString] = None,
description: Optional[NonEmptyString] = None,
is_terminal: Optional[Boolean] = None,
criteria: Optional[AutomationRulesFindingFilters] = None,
actions: Optional[ActionList] = None,
) -> CreateAutomationRuleResponse
Creates an automation rule based on input parameters.
Parameters:
-
tags(Optional[TagMap], default:None) –User-defined tags associated with an automation rule.
-
rule_status(Optional[RuleStatus], default:None) –Whether the rule is active after it is created. If this parameter is equal to
ENABLED, Security Hub CSPM starts applying the rule to findings and finding updates after the rule is created. To change the value of this parameter after creating a rule, useBatchUpdateAutomationRules. -
rule_order(Optional[RuleOrderValue], default:None) –An integer ranging from 1 to 1000 that represents the order in which the rule action is applied to findings. Security Hub CSPM applies rules with lower values for this parameter first.
-
rule_name(Optional[NonEmptyString], default:None) –The name of the rule.
-
description(Optional[NonEmptyString], default:None) –A description of the rule.
-
is_terminal(Optional[Boolean], default:None) –Specifies whether a rule is the last to be applied with respect to a finding that matches the rule criteria. This is useful when a finding matches the criteria for multiple rules, and each rule has different actions. If a rule is terminal, Security Hub CSPM applies the rule action to a finding that matches the rule criteria and doesn't evaluate other rules for the finding. By default, a rule isn't terminal.
-
criteria(Optional[AutomationRulesFindingFilters], default:None) –A set of ASFF finding field attributes and corresponding expected values that Security Hub CSPM uses to filter findings. If a rule is enabled and a finding matches the conditions specified in this parameter, Security Hub CSPM applies the rule action to the finding.
-
actions(Optional[ActionList], default:None) –One or more actions to update finding fields if a finding matches the conditions specified in
Criteria.
Raises:
-
AccessDeniedException–You don't have permission to perform the action specified in the request.
-
InternalException–Internal server error.
-
InvalidAccessException–The account doesn't have permission to perform this action.
-
InvalidInputException–The request was rejected because you supplied an invalid or out-of-range value for an input parameter.
-
LimitExceededException–The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create an automation rule The following example creates an automation rule.
>>> await client.create_automation_rule(tags={'important-resources-rule': 's3-bucket'}, rule_status='ENABLED', rule_order=1, rule_name='Elevate severity for important resources', description='Elevate finding severity to Critical for important resources', is_terminal=False, criteria={'ProductName': [{'Value': 'Security Hub', 'Comparison': 'EQUALS'}], 'ComplianceStatus': [{'Value': 'FAILED', 'Comparison': 'EQUALS'}], 'RecordState': [{'Value': 'ACTIVE', 'Comparison': 'EQUALS'}], 'WorkflowStatus': [{'Value': 'NEW', 'Comparison': 'EQUALS'}], 'ResourceId': [{'Value': 'arn:aws:s3:::examplebucket/developers/design_info.doc', 'Comparison': 'EQUALS'}]}, actions=[{'Type': 'FINDING_FIELDS_UPDATE', 'FindingFieldsUpdate': {'Severity': {'Label': 'CRITICAL'}, 'Note': {'Text': 'This is a critical S3 bucket, please look into this ASAP', 'UpdatedBy': 'test-user'}}}])
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 | |