generate_rule_configuration
async
¶
generate_rule_configuration(
prompt: SensitiveString,
rule_firewall_type: RuleFirewallType,
rule_type: RuleType,
*,
config_overrides: Optional[AsyncNetworkSecurityManagerClientConfig] = None,
waf_config_data_type: Optional[WAFConfigDataType] = None,
current_configuration: Optional[str] = None,
client_token: Optional[IdempotencyToken] = None,
) -> GenerateRuleConfigurationResponse
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.
Parameters:
-
prompt(SensitiveString) –A natural-language description of the configuration that you want to generate.
-
rule_firewall_type(RuleFirewallType) –The firewall type of the rule.
-
rule_type(RuleType) –The type of the rule.
CONFIGURATIONrules contain firewall settings, andINSPECTIONrules contain rule groups. -
waf_config_data_type(Optional[WAFConfigDataType], default:None) –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.
-
current_configuration(Optional[str], default:None) –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.
-
client_token(Optional[IdempotencyToken], default:None) –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.
Raises:
-
AccessDeniedException–You do not have sufficient permissions to perform this action.
-
InternalServerException–The request processing failed because of an internal error in the service. This is a retryable error.
-
ThrottlingException–The request was denied because of request throttling. Reduce your request rate and try again.
-
ValidationException–The request failed validation. For details, see the
reasonandfieldListmembers of the response. -
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Generate a rule configuration from a description Generates a firewall rule configuration from a natural language description. The response contains the generated configuration as a JSON string, ready to use as the configuration of a rule.
>>> await client.generate_rule_configuration(prompt='Create a rate limiting rule that blocks IP addresses sending more than 2000 requests in 5 minutes', rule_firewall_type='WAF', rule_type='INSPECTION', client_token='550e8400-e29b-41d4-a716-446655440015')
Source code in docs_src/capo_network_security_manager/_services/async_network_security_manager.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |