updateFirewallRule method

Future<UpdateFirewallRuleOutput> updateFirewallRule({
  1. required String firewallRuleId,
  2. FirewallRuleAction? action,
  3. BlockOverrideDnsQueryType? blockOverrideDnsType,
  4. String? blockOverrideDomain,
  5. int? blockOverrideTtl,
  6. FirewallBlockResponse? blockResponse,
  7. String? clientToken,
  8. ConfidenceThreshold? confidenceThreshold,
  9. String? description,
  10. DnsAdvancedProtection? dnsAdvancedProtection,
  11. String? name,
  12. int? priority,
})

Updates the configuration of a DNS firewall rule.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter firewallRuleId : The ID of the DNS Firewall rule.

Parameter action : The action that DNS Firewall should take on a DNS query when it matches one of the domains in the rule's domain list, or a threat in a DNS Firewall Advanced rule.

Parameter blockOverrideDnsType : The DNS record's type. This determines the format of the record value that you provided in BlockOverrideDomain. Used for the rule action BLOCK with a BlockResponse setting of OVERRIDE.

Parameter blockOverrideDomain : The custom DNS record to send back in response to the query. Used for the rule action BLOCK with a BlockResponse setting of OVERRIDE.

Parameter blockOverrideTtl : The recommended amount of time, in seconds, for the DNS resolver or web browser to cache the provided override record. Used for the rule action BLOCK with a BlockResponse setting of OVERRIDE.

Parameter blockResponse : The way that you want DNS Firewall to block the request. Used for the rule action setting BLOCK.

Parameter clientToken : A unique, case-sensitive identifier to ensure idempotency. This means that making the same request multiple times with the same clientToken has the same result every time.

Parameter confidenceThreshold : The confidence threshold for DNS Firewall Advanced. You must provide this value when you create a DNS Firewall Advanced rule.

Parameter description : The description for the Firewall rule.

Parameter dnsAdvancedProtection : The type of the DNS Firewall Advanced rule. Valid values are DGA, DNS_TUNNELING, and DICTIONARY_DGA.

Parameter name : The name of the DNS Firewall rule.

Parameter priority : The setting that determines the processing order of the rule in the rule group. DNS Firewall processes the rules in a rule group by order of priority, starting from the lowest setting.

Implementation

Future<UpdateFirewallRuleOutput> updateFirewallRule({
  required String firewallRuleId,
  FirewallRuleAction? action,
  BlockOverrideDnsQueryType? blockOverrideDnsType,
  String? blockOverrideDomain,
  int? blockOverrideTtl,
  FirewallBlockResponse? blockResponse,
  String? clientToken,
  ConfidenceThreshold? confidenceThreshold,
  String? description,
  DnsAdvancedProtection? dnsAdvancedProtection,
  String? name,
  int? priority,
}) async {
  _s.validateNumRange(
    'blockOverrideTtl',
    blockOverrideTtl,
    0,
    604800,
  );
  _s.validateNumRange(
    'priority',
    priority,
    1,
    10000,
  );
  final $payload = <String, dynamic>{
    if (action != null) 'action': action.value,
    if (blockOverrideDnsType != null)
      'blockOverrideDnsType': blockOverrideDnsType.value,
    if (blockOverrideDomain != null)
      'blockOverrideDomain': blockOverrideDomain,
    if (blockOverrideTtl != null) 'blockOverrideTtl': blockOverrideTtl,
    if (blockResponse != null) 'blockResponse': blockResponse.value,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (confidenceThreshold != null)
      'confidenceThreshold': confidenceThreshold.value,
    if (description != null) 'description': description,
    if (dnsAdvancedProtection != null)
      'dnsAdvancedProtection': dnsAdvancedProtection.value,
    if (name != null) 'name': name,
    if (priority != null) 'priority': priority,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/firewall-rules/${Uri.encodeComponent(firewallRuleId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateFirewallRuleOutput.fromJson(response);
}