NetworkSecurityManagerCustomerAPI / Client / create_rule

create_rule

NetworkSecurityManagerCustomerAPI.Client.create_rule(**kwargs)

Creates a rule. A rule defines a network security configuration to enforce, such as an AWS WAF rule group or configuration data. Use isPublished to create the rule in published ( ACTIVE) or draft ( DRAFT) state.

See also: AWS API Documentation

Request Syntax

response = client.create_rule(
    clientToken='string',
    ruleName='string',
    firewallType='WAF',
    ruleType='CONFIGURATION'|'INSPECTION',
    ruleDescription='string',
    configuration={...}|[...]|123|123.4|'string'|True|None,
    isPublished=True|False,
    tags={
        'string': 'string'
    }
)
Parameters:
  • clientToken (string) –

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    This field is autopopulated if not provided.

  • ruleName (string) –

    [REQUIRED]

    The name of the rule.

  • firewallType (string) –

    [REQUIRED]

    The firewall type associated with the resource.

  • ruleType (string) –

    [REQUIRED]

    The type of the rule. CONFIGURATION rules contain firewall settings, and INSPECTION rules contain rule groups.

  • ruleDescription (string) – A description of the rule.

  • configuration (document) –

    [REQUIRED]

    The firewall configuration for the rule, as a JSON document. The structure depends on the rule’s firewall type and rule type. For an AWS WAF INSPECTION rule, provide an AWS WAF rule group. For an AWS WAF CONFIGURATION rule, provide a single web ACL setting, such as DefaultAction or VisibilityConfig; use wafConfigDataType to declare which setting the document contains. For the schema of each setting and complete examples, see Writing rule configurations in the AWS Network Security Manager Developer Guide.

  • isPublished (boolean) – Specifies whether to publish the resource. When true, the resource is saved in published ( ACTIVE) state. When false, it is saved as a draft ( DRAFT). Default: true.

  • tags (dict) –

    The tags to add to the resource when it is created.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'ruleId': 'string',
    'ruleArn': 'string',
    'ruleName': 'string',
    'firewallType': 'WAF',
    'ruleType': 'CONFIGURATION'|'INSPECTION',
    'ruleDescription': 'string',
    'configuration': {...}|[...]|123|123.4|'string'|True|None,
    'status': 'DRAFT'|'ACTIVE'|'DISABLED',
    'version': 'string',
    'updateToken': 'string',
    'isSnapshot': True|False,
    'hasPublishedVersion': True|False,
    'updatedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • ruleId (string) –

      The service-generated id of the rule.

    • ruleArn (string) –

      The Amazon Resource Name (ARN) of the rule.

    • ruleName (string) –

      The name of the rule.

    • firewallType (string) –

      The firewall type associated with the resource.

    • ruleType (string) –

      The type of the rule. CONFIGURATION rules contain firewall settings, and INSPECTION rules contain rule groups.

    • ruleDescription (string) –

      A description of the rule.

    • configuration (document) –

      The firewall configuration for the rule, as a JSON document. The structure depends on the rule’s firewall type and rule type.

    • status (string) –

      The current status of the resource: DRAFT (unpublished, editable) or ACTIVE (published, in use).

    • version (string) –

      The version of the resource.

    • updateToken (string) –

      A token used for optimistic concurrency control. Each read and write returns an updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications.

    • isSnapshot (boolean) –

      Specifies whether the resource is a snapshot of a published version.

    • hasPublishedVersion (boolean) –

      Specifies whether a published version of the resource exists.

    • updatedAt (datetime) –

      The time when the resource was last updated.

Exceptions