SecurityPolicyRuleRateLimitOptions.fromJson constructor

SecurityPolicyRuleRateLimitOptions.fromJson(
  1. Object? j
)

Implementation

factory SecurityPolicyRuleRateLimitOptions.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return SecurityPolicyRuleRateLimitOptions(
    banDurationSec: switch (json['banDurationSec']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    banThreshold: switch (json['banThreshold']) {
      null => null,
      Object $1 => SecurityPolicyRuleRateLimitOptionsThreshold.fromJson($1),
    },
    conformAction: switch (json['conformAction']) {
      null => null,
      Object $1 => decodeString($1),
    },
    enforceOnKey: switch (json['enforceOnKey']) {
      null => null,
      Object $1 => decodeString($1),
    },
    enforceOnKeyConfigs: switch (json['enforceOnKeyConfigs']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          SecurityPolicyRuleRateLimitOptionsEnforceOnKeyConfig.fromJson(i),
      ],
      _ => throw const FormatException('"enforceOnKeyConfigs" is not a list'),
    },
    enforceOnKeyName: switch (json['enforceOnKeyName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    exceedAction: switch (json['exceedAction']) {
      null => null,
      Object $1 => decodeString($1),
    },
    exceedRedirectOptions: switch (json['exceedRedirectOptions']) {
      null => null,
      Object $1 => SecurityPolicyRuleRedirectOptions.fromJson($1),
    },
    rateLimitThreshold: switch (json['rateLimitThreshold']) {
      null => null,
      Object $1 => SecurityPolicyRuleRateLimitOptionsThreshold.fromJson($1),
    },
  );
}