View a markdown version of this page

GenerateRuleConfiguration - AWS Network Security Manager

GenerateRuleConfiguration

Generates a rule configuration from a natural-language description. Provide a prompt along with the rule's firewall type and rule type. The service returns a configuration that you can use when you create or update a rule. If you also provide an existing configuration, the service edits that configuration instead of generating a new one.

Request Syntax

POST /GenerateRuleConfiguration HTTP/1.1 Content-type: application/json { "clientToken": "string", "currentConfiguration": "string", "prompt": "string", "ruleFirewallType": "string", "ruleType": "string", "wafConfigDataType": "string" }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

clientToken

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.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: [\x21-\x7E]+

Required: No

currentConfiguration

An existing configuration to edit, as a JSON string. When you provide this value, the operation edits the configuration. When you omit it, the operation generates a new configuration.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 32768.

Required: No

prompt

A natural-language description of the configuration that you want to generate.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2000.

Pattern: [A-Za-z0-9.,?!@&:;()'"\s\-\/\n_=<>+*\#\[\]{}]*

Required: Yes

ruleFirewallType

The firewall type of the rule.

Type: String

Valid Values: WAF

Required: Yes

ruleType

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

Type: String

Valid Values: CONFIGURATION | INSPECTION

Required: Yes

wafConfigDataType

For AWS WAF configuration rules, the specific AWS WAF configuration variant to generate. This is optional; if you omit it, the service selects the variant.

Type: String

Valid Values: DefaultAction | VisibilityConfig | CaptchaConfig | ChallengeConfig | CustomResponseBodies | LoggingConfiguration | DataProtectionConfig | AssociationConfig | OnSourceDDoSProtectionConfig | TokenDomains

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "configuration": "string", "description": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

configuration

The generated configuration, as a JSON string. You can use this value in the configuration field of a rule.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 32768.

description

Reserved for a future human-readable description of the generated configuration. This field is currently not populated.

Type: String

Errors

For information about the errors that are common to all actions, see Common Error Types.

AccessDeniedException

You do not have sufficient permissions to perform this action.

HTTP Status Code: 403

InternalServerException

The request processing failed because of an internal error in the service. This is a retryable error.

HTTP Status Code: 500

ThrottlingException

The request was denied because of request throttling. Reduce your request rate and try again.

retryAfterSeconds

The number of seconds to wait before retrying the request.

HTTP Status Code: 429

ValidationException

The request failed validation. For details, see the reason and fieldList members of the response.

fieldList

The list of request fields that failed validation, if any.

reason

The reason that the request failed validation.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: